All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: subratp@marvell.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, edumazet@google.com, davem@davemloft.net,
	andrew+netdev@lunn.ch, sbhatta@marvell.com, rkannoth@marvell.com,
	gakula@marvell.com, sgoutham@marvell.com
Subject: Re: [PATCH net v2 1/2] octeontx2-pf: Fix aura BPID assignment when CONFIG_DCB is enabled
Date: Thu, 6 Aug 2026 08:30:20 -0700	[thread overview]
Message-ID: <20260806083020.3b747817@kernel.org> (raw)
In-Reply-To: <20260806152650.2562245-1-kuba@kernel.org>

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.

  reply	other threads:[~2026-08-06 15:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  5:53 [PATCH net v2 0/2] octeontx2: Misc fixes for RVU drivers Subrat Pandey
2026-07-31  5:53 ` [PATCH net v2 1/2] octeontx2-pf: Fix aura BPID assignment when CONFIG_DCB is enabled Subrat Pandey
2026-08-06 15:26   ` Jakub Kicinski
2026-08-06 15:30     ` Jakub Kicinski [this message]
2026-08-07  8:48       ` [EXTERNAL] " Subrat Pandey
2026-07-31  5:53 ` [PATCH net v2 2/2] octeontx2-af: mcs: Fix SC resource cleanup loop Subrat Pandey
2026-08-06 15:27   ` Jakub Kicinski
2026-08-07  8:59     ` [EXTERNAL] " Subrat Pandey

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=20260806083020.3b747817@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=subratp@marvell.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 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.