From: Danielle Ratson <danieller@nvidia.com>
To: Simon Horman <horms@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"yuehaibing@huawei.com" <yuehaibing@huawei.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Petr Machata <petrm@nvidia.com>
Subject: RE: [PATCH net-next 2/2] net: ethtool: Add support for writing firmware blocks using EPL payload
Date: Tue, 10 Sep 2024 08:53:35 +0000 [thread overview]
Message-ID: <DM6PR12MB451663AD549DA6D3407B92C4D89A2@DM6PR12MB4516.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240907141042.GR2097826@kernel.org>
> -----Original Message-----
> From: Simon Horman <horms@kernel.org>
> Sent: Saturday, 7 September 2024 17:11
> To: Danielle Ratson <danieller@nvidia.com>
> Cc: netdev@vger.kernel.org; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; yuehaibing@huawei.com; linux-
> kernel@vger.kernel.org; Petr Machata <petrm@nvidia.com>
> Subject: Re: [PATCH net-next 2/2] net: ethtool: Add support for writing
> firmware blocks using EPL payload
>
> On Fri, Sep 06, 2024 at 08:57:00AM +0300, Danielle Ratson wrote:
> > In the CMIS specification for pluggable modules, LPL (Low-Priority
> > Payload) and EPL (Extended Payload Length) are two types of data
> > payloads used for managing various functions and features of the module.
> >
> > EPL payloads are used for more complex and extensive management
> > functions that require a larger amount of data, so writing firmware
> > blocks using EPL is much more efficient.
> >
> > Currently, only LPL payload is supported for writing firmware blocks
> > to the module.
> >
> > Add support for writing firmware block using EPL payload, both to
> > support modules that supports only EPL write mechanism, and to
> > optimize the flashing process of modules that support LPL and EPL.
> >
> > Signed-off-by: Danielle Ratson <danieller@nvidia.com>
> > Reviewed-by: Petr Machata <petrm@nvidia.com>
>
> ...
>
> > diff --git a/net/ethtool/cmis_cdb.c b/net/ethtool/cmis_cdb.c
>
> ...
>
> > @@ -548,6 +555,49 @@ __ethtool_cmis_cdb_execute_cmd(struct
> net_device *dev,
> > return err;
> > }
> >
> > +#define CMIS_CDB_EPL_PAGE_START 0xA0
> > +#define CMIS_CDB_EPL_PAGE_END 0xAF
> > +#define CMIS_CDB_EPL_FW_BLOCK_OFFSET_START 128
> > +#define CMIS_CDB_EPL_FW_BLOCK_OFFSET_END 255
> > +
> > +static int
> > +ethtool_cmis_cdb_execute_epl_cmd(struct net_device *dev,
> > + struct ethtool_cmis_cdb_cmd_args *args,
> > + struct ethtool_module_eeprom *page_data) {
> > + u16 epl_len = be16_to_cpu(args->req.epl_len);
> > + u32 bytes_written;
> > + u8 page;
> > + int err;
>
> Hi Danielle,
>
> A minor issue from my side:
> In the first iteration of the loop below bytes_written is used uninitialised.
>
> Flagged by W=1 builds using clang-18 and gcc-14.
Hi,
Will fix thanks!
Danielle
>
> > +
> > + for (page = CMIS_CDB_EPL_PAGE_START;
> > + page <= CMIS_CDB_EPL_PAGE_END && bytes_written < epl_len;
> page++) {
> > + u16 offset = CMIS_CDB_EPL_FW_BLOCK_OFFSET_START;
> > +
> > + while (offset <= CMIS_CDB_EPL_FW_BLOCK_OFFSET_END &&
> > + bytes_written < epl_len) {
> > + u32 bytes_left = epl_len - bytes_written;
> > + u16 space_left, bytes_to_write;
> > +
> > + space_left = CMIS_CDB_EPL_FW_BLOCK_OFFSET_END
> - offset + 1;
> > + bytes_to_write = min_t(u16, bytes_left,
> > + min_t(u16, space_left,
> > + args->read_write_len_ext));
> > +
> > + err = __ethtool_cmis_cdb_execute_cmd(dev,
> page_data,
> > + page, offset,
> > + bytes_to_write,
> > + args->req.epl +
> bytes_written);
> > + if (err < 0)
> > + return err;
> > +
> > + offset += bytes_to_write;
> > + bytes_written += bytes_to_write;
> > + }
> > + }
> > + return 0;
> > +}
> > +
> > static u8 cmis_cdb_calc_checksum(const void *data, size_t size) {
> > const u8 *bytes = (const u8 *)data;
>
> --
> pw-bot: cr
prev parent reply other threads:[~2024-09-10 8:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 5:56 [PATCH net-next 0/2] ethtool: Add support for writing firmware Danielle Ratson
2024-09-06 5:56 ` [PATCH net-next 1/2] net: ethtool: Add new parameters and a function to support EPL Danielle Ratson
2024-09-06 15:36 ` Andrew Lunn
2024-09-08 12:33 ` Danielle Ratson
2024-09-06 5:57 ` [PATCH net-next 2/2] net: ethtool: Add support for writing firmware blocks using EPL payload Danielle Ratson
2024-09-07 14:10 ` Simon Horman
2024-09-10 8:53 ` Danielle Ratson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR12MB451663AD549DA6D3407B92C4D89A2@DM6PR12MB4516.namprd12.prod.outlook.com \
--to=danieller@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®