Re: [EXTERNAL] Re: [PATCH net v2 1/2] octeontx2-pf: Fix aura BPID assignment when CONFIG_DCB is enabled

Subrat Pandey <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel
Message-ID <DM4PR18MB4384129AAD6E2A3DF0494C36ABD12@DM4PR18MB4384.namprd18.prod.outlook.com>


________________________________________
From: Jakub Kicinski <[email protected]>
Sent: Thursday, August 6, 2026 9:00 PM
To: Subrat Pandey
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Subbaraya Sundeep Bhatta; Ratheesh Kannoth; Geethasowjanya Akula; Sunil Kovvuri Goutham
Subject: [EXTERNAL] Re: [PATCH net v2 1/2] octeontx2-pf: Fix aura BPID assignment when CONFIG_DCB is enabled

On Thu, 6 Aug 2026 08: 26: 50 -0700 Jakub Kicinski wrote: > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common. c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common. c > > index 3d253132a17f0. . b4691472d2a3e 100644

> On Thu,  6 Aug 2026 08:26:50 -0700 Jakub Kicinski wrote:
> > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > index 3d253132a17f0..b4691472d2a3e 100644
> > > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > @@ -1132,10 +1132,10 @@ int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx)
> > >             if (!is_otx2_lbkvf(pfvf->pdev)) {
> > >                     /* Enable receive CQ backpressure */
> > >                     aq->cq.bp_ena = 1;
> > > -#ifdef CONFIG_DCB
> > > -                   aq->cq.bpid = pfvf->bpid[pfvf->queue_to_pfc_map[qidx]];
> > > -#else
> > >                     aq->cq.bpid = pfvf->bpid[0];
> > > +#ifdef CONFIG_DCB
> > > +                   if (pfvf->queue_to_pfc_map)
> > > +                           aq->cq.bpid = pfvf->bpid[pfvf->queue_to_pfc_map[qidx]];
> > >  #endif
> >
> > [Severity: Low]
> > This isn't a bug, but the same #ifdef CONFIG_DCB plus NULL test idiom now
> > appears in three places: cn20k_aura_bpid_idx(), otx2_cq_init() and
> > otx2_aura_aq_init().  cn20k_aura_bpid_idx() already encapsulates exactly this
> > logic.  Would it be cleaner to generalize it into a single accessor, say
> > otx2_get_bpid_idx(pfvf, qidx), and use it from all three sites?
> >
> > Alternatively, could queue_to_pfc_map simply be allocated unconditionally
> > (it is only pfvf->hw.rx_queues bytes) instead of being tied to dcbnl_ops
>
> AI is getting better I guess. I was going to suggest this as well.
> Please avoid hiding struct members under ifdefs unless there's a major
> size win on the structures. If you care about runtime cost you can use
> IS_ENABLED() inside the if () condition and compiler will eliminate it.
> No ifdefs needed at that point.
>

Thanks for the feedback.
We will fix it and submit next version.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.