From: Simon Horman <horms@kernel.org>
To: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: Lee Trager <lee@trager.us>,
Alexander Duyck <alexanderduyck@fb.com>,
Jakub Kicinski <kuba@kernel.org>,
kernel-team@meta.com, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Jonathan Corbet <corbet@lwn.net>,
Mohsin Bashir <mohsin.bashr@gmail.com>,
Sanman Pradhan <sanmanpradhan@meta.com>,
Al Viro <viro@zeniv.linux.org.uk>,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] eth: fbnic: Add devlink dev flash support
Date: Tue, 15 Oct 2024 11:43:53 +0100 [thread overview]
Message-ID: <20241015104353.GC569285@kernel.org> (raw)
In-Reply-To: <8502a496-f83d-470c-a84d-081a7c7e2cae@linux.dev>
On Mon, Oct 14, 2024 at 12:18:36PM +0100, Vadim Fedorenko wrote:
> On 12/10/2024 03:34, Lee Trager wrote:
> > fbnic supports updating firmware using a PLDM image signed and distributed
> > by Meta. PLDM images are written into stored flashed. Flashing does not
> > interrupt operation.
> >
> > On host reboot the newly flashed UEFI driver will be used. To run new
> > control or cmrt firmware the NIC must be power cycled.
> >
> > Signed-off-by: Lee Trager <lee@trager.us>
...
> > diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c
...
> > +/**
> > + * fbnic_send_component_table - Send PLDM component table to the firmware
> > + * @context: PLDM FW update structure
> > + * @component: The component to send
> > + * @transfer_flag: Flag indication location in component tables
> > + *
> > + * Read relevant data from component table and forward it to the firmware.
> > + * Check response to verify if the firmware indicates that it wishes to
> > + * proceed with the update.
> > + *
> > + * Return: zero on success
> > + * negative error code on failure
> > + */
> > +static int fbnic_send_component_table(struct pldmfw *context,
> > + struct pldmfw_component *component,
> > + u8 transfer_flag)
> > +{
> > + struct device *dev = context->dev;
> > + u16 id = component->identifier;
> > + u8 test_string[80];
> > +
> > + switch (id) {
> > + case QSPI_SECTION_CMRT:
> > + case QSPI_SECTION_CONTROL_FW:
> > + case QSPI_SECTION_OPTION_ROM:
> > + break;
> > + default:
> > + dev_err(dev, "Unknown component ID %u\n", id);
> > + return -EINVAL;
> > + }
> > +
> > + dev_dbg(dev, "Sending PLDM component table to firmware\n");
> > +
> > + /* Temp placeholder */
> > + memcpy(test_string, component->version_string,
> > + min_t(u8, component->version_len, 79));
> > + test_string[min_t(u8, component->version_len, 79)] = 0;
>
> Looks like this construction can be replaced with strscpy().
> There were several patchsets in the tree to use strscpy(), let's follow
> the pattern.
While looking at these lines, I'm unsure why min_t() is being used
instead of min() here. As version_len is unsigned and 79 is a positive
constant, I believe min() should be fine here.
>
> > + dev_info(dev, "PLDMFW: Component ID: %u version %s\n",
> > + id, test_string);
> > +
> > + return 0;
> > +}
next prev parent reply other threads:[~2024-10-15 10:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 2:34 [PATCH net-next 0/2] eth: fbnic: Add devlink dev flash support Lee Trager
2024-10-12 2:34 ` [PATCH net-next 1/2] eth: fbnic: Add mailbox support for PLDM updates Lee Trager
2024-10-14 11:05 ` Vadim Fedorenko
2024-10-12 2:34 ` [PATCH net-next 2/2] eth: fbnic: Add devlink dev flash support Lee Trager
2024-10-14 11:18 ` Vadim Fedorenko
2024-10-15 10:43 ` Simon Horman [this message]
2024-10-18 22:48 ` Lee Trager
2024-10-19 9:34 ` Simon Horman
2024-10-22 1:37 ` [PATCH net-next v2 0/2] " Lee Trager
2024-10-22 1:37 ` [PATCH net-next v2 1/2] eth: fbnic: Add mailbox support for PLDM updates Lee Trager
2024-10-26 15:12 ` Simon Horman
2024-10-22 1:42 ` [PATCH net-next v2 2/2] eth: fbnic: Add devlink dev flash support Lee Trager
2024-10-24 9:10 ` Simon Horman
2024-10-25 22:32 ` Lee Trager
2024-10-26 15:12 ` Simon Horman
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=20241015104353.GC569285@kernel.org \
--to=horms@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sanmanpradhan@meta.com \
--cc=vadim.fedorenko@linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.