[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260125130910.GB13967@unreal>
Date: Sun, 25 Jan 2026 15:09:10 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Pavan Chebbi <pavan.chebbi@...adcom.com>
Cc: jgg@...pe.ca, michael.chan@...adcom.com, linux-kernel@...r.kernel.org,
dave.jiang@...el.com, saeedm@...dia.com,
Jonathan.Cameron@...wei.com, gospo@...adcom.com,
selvin.xavier@...adcom.com, kalesh-anakkur.purayil@...adcom.com
Subject: Re: [PATCH fwctl 2/5] fwctl/bnxt_en: Refactor aux bus functions to
be more generic
On Sun, Jan 18, 2026 at 04:33:58AM -0800, Pavan Chebbi wrote:
> Up until now there was only one auxiliary device that bnxt
> created and that was for RoCE driver. bnxt fwctl is also
> going to use an aux bus device that bnxt should create.
> This requires some nomenclature changes and refactoring of
> the existing bnxt aux dev functions.
>
> Convert 'aux_priv' and 'edev' members of struct bnxt into
> arrays where each element contains supported auxbus device's
> data. Move struct bnxt_aux_priv from bnxt.h to ulp.h because
> that is where it belongs. Make aux bus init/uninit/add/del
> functions more generic which will loop through all the aux
> device types. Make bnxt_ulp_start/stop functions (the only
> other common functions applicable to any aux device) loop
> through the aux devices to update their config and states.
>
> Also, as an improvement in code, bnxt_register_dev() can skip
> unnecessary dereferencing of edev from bp, instead use the
> edev pointer from the function parameter.
>
> Future patches will reuse these functions to add an aux bus
> device for fwctl.
>
> Reviewed-by: Andy Gospodarek <gospo@...adcom.com>
> Signed-off-by: Pavan Chebbi <pavan.chebbi@...adcom.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 29 +-
> drivers/net/ethernet/broadcom/bnxt/bnxt.h | 17 +-
> .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
> drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 319 +++++++++++-------
> include/linux/bnxt/ulp.h | 23 +-
> 5 files changed, 239 insertions(+), 151 deletions(-)
<...>
> enum board_idx {
> BCM57301,
> BCM57302,
> @@ -2341,8 +2335,8 @@ struct bnxt {
> #define BNXT_CHIP_P5_AND_MINUS(bp) \
> (BNXT_CHIP_P3(bp) || BNXT_CHIP_P4(bp) || BNXT_CHIP_P5(bp))
>
> - struct bnxt_aux_priv *aux_priv;
> - struct bnxt_en_dev *edev;
> + struct bnxt_aux_priv *aux_priv[__BNXT_AUXDEV_MAX];
> + struct bnxt_en_dev *edev[__BNXT_AUXDEV_MAX];
>
> struct bnxt_napi **bnapi;
>
> @@ -2751,6 +2745,11 @@ struct bnxt {
> struct bnxt_ctx_pg_info *fw_crash_mem;
> u32 fw_crash_len;
> struct bnxt_bs_trace_info bs_trace[BNXT_TRACE_MAX];
> + int auxdev_id;
> + atomic_t auxdev_state[__BNXT_AUXDEV_MAX];
> +#define BNXT_ADEV_STATE_NONE 0
> +#define BNXT_ADEV_STATE_INIT 1
> +#define BNXT_ADEV_STATE_ADD 2
This is indeed an incorrect use of atomic_t. This type only ensures that
individual arithmetic operations are performed atomically. It does not
eliminate the need for the locks that were removed.
> };
>
> #define BNXT_NUM_RX_RING_STATS 8
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> index 8cad7b982664..064d7bc4ce8d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> @@ -5100,7 +5100,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
<...>
>
> void bnxt_ulp_start(struct bnxt *bp, int err)
> {
> - struct bnxt_aux_priv *aux_priv = bp->aux_priv;
> - struct bnxt_en_dev *edev = bp->edev;
> + int i;
>
> - if (!edev || err)
err is no longer used, and keeping it would alter the behavior of
bnxt_resume() and related paths. In any case, callers should not invoke
bnxt_ulp_start() when an error has already occurred.
Thanks
> - return;
> + for (i = 0; i < __BNXT_AUXDEV_MAX; i++) {
> + struct bnxt_aux_priv *aux_priv;
> + struct auxiliary_device *adev;
> + struct bnxt_en_dev *edev;
Powered by blists - more mailing lists