All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Lee Trager <lee@trager.us>
Cc: 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>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Mohsin Bashir <mohsin.bashr@gmail.com>,
	Sanman Pradhan <sanman.p211993@gmail.com>,
	Su Hui <suhui@nfschina.com>, Al Viro <viro@zeniv.linux.org.uk>,
	Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	Andrew Lunn <andrew@lunn.ch>,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 5/5] eth: fbnic: Add devlink dev flash support
Date: Mon, 12 May 2025 15:31:07 +0100	[thread overview]
Message-ID: <20250512143107.GJ3339421@horms.kernel.org> (raw)
In-Reply-To: <20250510002851.3247880-6-lee@trager.us>

On Fri, May 09, 2025 at 05:21:17PM -0700, Lee Trager wrote:
> Add support to update the CMRT and control firmware as well as the UEFI
> driver on fbnic using devlink dev flash.
> 
> Make sure the shutdown / quiescence paths like suspend take the devlink
> lock to prevent them from interrupting the FW flashing process.
> 
> Signed-off-by: Lee Trager <lee@trager.us>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

...

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c b/drivers/net/ethernet/meta/fbnic/fbnic_devlink.c

...

> @@ -109,8 +111,264 @@ static int fbnic_devlink_info_get(struct devlink *devlink,
>  	return 0;
>  }
> 
> +static bool
> +fbnic_pldm_match_record(struct pldmfw *context, struct pldmfw_record *record)
> +{
> +	struct pldmfw_desc_tlv *desc;
> +	u32 anti_rollback_ver = 0;
> +	struct devlink *devlink;
> +	struct fbnic_dev *fbd;
> +	struct pci_dev *pdev;
> +
> +	/* First, use the standard PCI matching function */
> +	if (!pldmfw_op_pci_match_record(context, record))
> +		return -ENODEV;

Hi Lee,

The return type of this function is bool, but here a negative integer is
being returned. Perhaps this should be:

		return false;

Flagged by Smatch

> +
> +	pdev = to_pci_dev(context->dev);
> +	fbd = pci_get_drvdata(pdev);
> +	devlink = priv_to_devlink(fbd);
> +
> +	/* If PCI match is successful, check for vendor-specific descriptors */
> +	list_for_each_entry(desc, &record->descs, entry) {
> +		if (desc->type != PLDM_DESC_ID_VENDOR_DEFINED)
> +			continue;
> +
> +		if (desc->size < 21 || desc->data[0] != 1 ||
> +		    desc->data[1] != 15)
> +			continue;
> +
> +		if (memcmp(desc->data + 2, "AntiRollbackVer", 15) != 0)
> +			continue;
> +
> +		anti_rollback_ver = get_unaligned_le32(desc->data + 17);
> +		break;
> +	}
> +
> +	/* Compare versions and return error if they do not match */
> +	if (anti_rollback_ver < fbd->fw_cap.anti_rollback_version) {
> +		char buf[128];
> +
> +		snprintf(buf, sizeof(buf),
> +			 "New firmware anti-rollback version (0x%x) is older than device version (0x%x)!",
> +			 anti_rollback_ver, fbd->fw_cap.anti_rollback_version);
> +		devlink_flash_update_status_notify(devlink, buf,
> +						   "Anti-Rollback", 0, 0);
> +
> +		return false;
> +	}
> +
> +	return true;
> +}

...

  reply	other threads:[~2025-05-12 14:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-10  0:21 [PATCH net-next v4 0/5] eth: fbnic: Add devlink dev flash support Lee Trager
2025-05-10  0:21 ` [PATCH net-next v4 1/5] pldmfw: Don't require send_package_data or send_component_table to be defined Lee Trager
2025-05-12 14:32   ` Simon Horman
2025-05-12 18:42   ` Jacob Keller
2025-05-10  0:21 ` [PATCH net-next v4 2/5] eth: fbnic: Accept minimum anti-rollback version from firmware Lee Trager
2025-05-12 14:33   ` Simon Horman
2025-05-12 18:47   ` Jacob Keller
2025-05-13  0:59     ` Lee Trager
2025-05-10  0:21 ` [PATCH net-next v4 3/5] eth: fbnic: Add support for multiple concurrent completion messages Lee Trager
2025-05-12 14:33   ` Simon Horman
2025-05-10  0:21 ` [PATCH net-next v4 4/5] eth: fbnic: Add mailbox support for PLDM updates Lee Trager
2025-05-12 14:34   ` Simon Horman
2025-05-10  0:21 ` [PATCH net-next v4 5/5] eth: fbnic: Add devlink dev flash support Lee Trager
2025-05-12 14:31   ` Simon Horman [this message]
2025-05-12 18:48   ` Jacob Keller

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=20250512143107.GJ3339421@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.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=michal.swiatkowski@linux.intel.com \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sanman.p211993@gmail.com \
    --cc=suhui@nfschina.com \
    --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.