From: Simon Horman <horms@kernel.org>
To: vikas.gupta@broadcom.com
Cc: 'Simon Horman' <horms@kernel.org>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, vsrama-krishna.nemani@broadcom.com,
bhargava.marreddy@broadcom.com, rajashekar.hudumula@broadcom.com,
ajit.khaparde@broadcom.com, dharmender.garg@broadcom.com,
rahul-rg.gupta@broadcom.com
Subject: Re: [PATCH net v3 1/2] bnge: fix initial HWRM sequence
Date: Wed, 22 Apr 2026 18:06:41 +0100 [thread overview]
Message-ID: <20260422170641.846322-1-horms@kernel.org> (raw)
In-Reply-To: <20260418023438.1597876-2-vikas.gupta@broadcom.com>
From: 'Simon Horman' <horms@kernel.org>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
bnge: fix initial HWRM sequence
Firmware may not advertize correct resources if backing store is not
enabled before resource information is queried.
Fix the initial sequence of HWRMs so that driver gets capabilities
and resource information correctly.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_core.c b/drivers/net/ethernet/broadcom/bnge/bnge_core.c
> index 1c14c5fe8d613..68b74eb2c3a29 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_core.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_core.c
[ ... ]
> @@ -133,23 +140,28 @@ static int bnge_fw_register_dev(struct bnge_dev *bd)
>
> bnge_hwrm_fw_set_time(bd);
>
> - rc = bnge_hwrm_func_drv_rgtr(bd);
> + /* Get the resources and configuration from firmware */
> + rc = bnge_func_qcaps(bd);
> if (rc) {
> - dev_err(bd->dev, "Failed to rgtr with firmware rc: %d\n", rc);
> + dev_err(bd->dev, "Failed querying caps rc: %d\n", rc);
> return rc;
> }
>
> rc = bnge_alloc_ctx_mem(bd);
> if (rc) {
> dev_err(bd->dev, "Failed to allocate ctx mem rc: %d\n", rc);
> - goto err_func_unrgtr;
> + goto err_free_ctx_mem;
> }
>
> - /* Get the resources and configuration from firmware */
> - rc = bnge_func_qcaps(bd);
> + rc = bnge_hwrm_func_drv_rgtr(bd);
> if (rc) {
> - dev_err(bd->dev, "Failed initial configuration rc: %d\n", rc);
> - rc = -ENODEV;
> + dev_err(bd->dev, "Failed to rgtr with firmware rc: %d\n", rc);
> + goto err_free_ctx_mem;
Does this regression leave the hardware with active DMA pointers to freed
memory?
If bnge_alloc_ctx_mem() allocates host DMA memory and passes the addresses
to the firmware via bnge_hwrm_func_backing_store(), and then
bnge_hwrm_func_drv_rgtr() fails, the code jumps directly to err_free_ctx_mem.
> + }
> +
> + rc = bnge_func_qrcaps_qcfg(bd);
> + if (rc) {
> + dev_err(bd->dev, "Failed querying resources rc: %d\n", rc);
> goto err_func_unrgtr;
> }
>
> @@ -158,7 +170,9 @@ static int bnge_fw_register_dev(struct bnge_dev *bd)
> return 0;
>
> err_func_unrgtr:
> - bnge_fw_unregister_dev(bd);
> + bnge_hwrm_func_drv_unrgtr(bd);
> +err_free_ctx_mem:
> + bnge_free_ctx_mem(bd);
Since the err_func_unrgtr label is bypassed, is the firmware ever told to
drop the backing store configuration before the host frees the memory in
bnge_free_ctx_mem()?
In the pre-patch sequence, the driver was registered first, so any failure
subsequently triggered a driver unregister, which implicitly told the
firmware to drop the backing store configuration. With the new order, does
the firmware maintain active DMA pointers to the freed host memory?
next prev parent reply other threads:[~2026-04-22 17:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 2:34 [PATCH net v3 0/2] bnge fixes Vikas Gupta
2026-04-18 2:34 ` [PATCH net v3 1/2] bnge: fix initial HWRM sequence Vikas Gupta
2026-04-22 17:06 ` Simon Horman [this message]
2026-04-22 18:11 ` Vikas Gupta
2026-04-18 2:34 ` [PATCH net v3 2/2] bnge: remove unsupported backing store type Vikas Gupta
2026-04-23 4:10 ` [PATCH net v3 0/2] bnge fixes patchwork-bot+netdevbpf
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=20260422170641.846322-1-horms@kernel.org \
--to=horms@kernel.org \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=dharmender.garg@broadcom.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rahul-rg.gupta@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vikas.gupta@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.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