From: Leon Romanovsky <leon@kernel.org>
To: Pavan Chebbi <pavan.chebbi@broadcom.com>
Cc: jgg@ziepe.ca, michael.chan@broadcom.com, dave.jiang@intel.com,
saeedm@nvidia.com, Jonathan.Cameron@huawei.com,
davem@davemloft.net, corbet@lwn.net, edumazet@google.com,
gospo@broadcom.com, kuba@kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch,
selvin.xavier@broadcom.com, kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH net-next v5 2/5] bnxt_en: Refactor aux bus functions to be more generic
Date: Thu, 15 Jan 2026 13:00:39 +0200 [thread overview]
Message-ID: <20260115110039.GE14359@unreal> (raw)
In-Reply-To: <CALs4sv3GenPwPXJxON8wkhRW1F-KB7DT3DkPbzm4BY620aTEvA@mail.gmail.com>
On Thu, Jan 15, 2026 at 02:58:55PM +0530, Pavan Chebbi wrote:
> On Sun, Oct 19, 2025 at 6:22 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Tue, Oct 14, 2025 at 01:10:30AM -0700, 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 accept aux device type as
> > > a parameter. 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@broadcom.com>
> > > Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
> > > ---
> > > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 29 ++-
> > > drivers/net/ethernet/broadcom/bnxt/bnxt.h | 13 +-
> > > .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
> > > drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 238 ++++++++++--------
> > > include/linux/bnxt/ulp.h | 23 +-
> > > 5 files changed, 181 insertions(+), 124 deletions(-)
> >
> > <...>
> >
> > > -void bnxt_rdma_aux_device_uninit(struct bnxt *bp)
> > > +void bnxt_aux_device_uninit(struct bnxt *bp, enum bnxt_auxdev_type idx)
> > > {
> > > struct bnxt_aux_priv *aux_priv;
> > > struct auxiliary_device *adev;
> > >
> > > /* Skip if no auxiliary device init was done. */
> > > - if (!bp->aux_priv)
> > > + if (!bp->aux_priv[idx])
> > > return;
> >
> > <...>
> >
> > > -void bnxt_rdma_aux_device_del(struct bnxt *bp)
> > > +void bnxt_aux_device_del(struct bnxt *bp, enum bnxt_auxdev_type idx)
> > > {
> > > - if (!bp->edev)
> > > + if (!bp->edev[idx])
> > > return;
> >
> > You are not supposed to call these functions if you didn't initialize
> > auxdev for this idx first. Please don't use defensive programming style
> > for in-kernel API.
>
> Sorry for late response, I started reworking the patches and wanted to
> address this comment.
> Without a map/list of active aux devs, we will have to check the
> validity of the aux_priv or edev somewhere before. That won't change
> much for the defensive programming concern.
> To do away completely with these checks, I wish to handle this change
> separately where we maintain bnxt's active auxdev by idx, in the newly
> introduced struct bnxt_aux_device.
> I hope that is fine.
I don't know. My preference is that you get things right from the
beginning. For reasons unknown to me, the Broadcom drivers are full of
random `if (.. == NULL)` checks, which makes the code hard to review, as
it's never clear whether the functions are re-entrant or not.
Thanks
>
> >
> > Thanks
next prev parent reply other threads:[~2026-01-15 11:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 8:10 [PATCH net-next v5 0/5] bnxt_fwctl: fwctl for Broadcom Netxtreme devices Pavan Chebbi
2025-10-14 8:10 ` [PATCH net-next v5 1/5] bnxt_en: Move common definitions to include/linux/bnxt/ Pavan Chebbi
2025-10-14 8:10 ` [PATCH net-next v5 2/5] bnxt_en: Refactor aux bus functions to be more generic Pavan Chebbi
2025-10-19 12:52 ` Leon Romanovsky
2026-01-15 9:28 ` Pavan Chebbi
2026-01-15 11:00 ` Leon Romanovsky [this message]
2026-01-15 12:21 ` Pavan Chebbi
2025-10-14 8:10 ` [PATCH net-next v5 3/5] bnxt_en: Create an aux device for fwctl Pavan Chebbi
2025-10-14 8:10 ` [PATCH net-next v5 4/5] bnxt_fwctl: Add bnxt fwctl device Pavan Chebbi
2025-10-16 0:40 ` Jakub Kicinski
2025-10-28 16:44 ` Jonathan Cameron
2025-10-14 8:10 ` [PATCH net-next v5 5/5] bnxt_fwctl: Add documentation entries Pavan Chebbi
2025-10-28 16:46 ` Jonathan Cameron
2025-10-29 13:36 ` Jason Gunthorpe
2025-11-02 10:45 ` Leon Romanovsky
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=20260115110039.GE14359@unreal \
--to=leon@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=dave.jiang@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gospo@broadcom.com \
--cc=jgg@ziepe.ca \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=saeedm@nvidia.com \
--cc=selvin.xavier@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