mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: vikas.gupta@broadcom.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
	vsrama-krishna.nemani@broadcom.com,
	rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
	ajit.khaparde@broadcom.com
Subject: Re: [net-next, v4 10/10] bnge: add cpu_rmap support for IRQ affinity
Date: Thu, 01 Oct 2026 09:13:43 +0000	[thread overview]
Message-ID: <179084602395.434549.9769381174533285357@kernel.org> (raw)
In-Reply-To: <20260928061307.1172344-11-vikas.gupta@broadcom.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Now that this patch publishes rx_cpu_rmap, the core starts
  passing target queues to bnge_rx_flow_steer().

--

bnge: add cpu_rmap support for IRQ affinity

When CONFIG_RFS_ACCEL is enabled, this patch allocates dev->rx_cpu_rmap
and fills it with the RX IRQ vectors. The kernel's aRFS code can then map
flows to the RX queue serviced by the nearest CPU and call
ndo_rx_flow_steer() for that queue.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index de7818d2c2af2..a4156a12c8714 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c

[ ... ]

> @@ -2437,10 +2438,23 @@ static int bnge_setup_interrupts(struct bnge_net *bn)
>  {
>  	struct net_device *dev = bn->netdev;
>  	struct bnge_dev *bd = bn->bd;
> +	int rc;
>  
>  	bnge_setup_msix(bn);
>  
> -	return netif_set_real_num_queues(dev, bd->tx_nr_rings, bd->rx_nr_rings);
> +	rc = netif_set_real_num_queues(dev, bd->tx_nr_rings, bd->rx_nr_rings);
> +	if (rc)
> +		return rc;
> +
> +#ifdef CONFIG_RFS_ACCEL
> +	if (bn->priv_flags & BNGE_NET_EN_NTUPLE) {
> +		dev->rx_cpu_rmap = alloc_irq_cpu_rmap(bd->rx_nr_rings);

[Severity: Low]
Once dev->rx_cpu_rmap is set here, the core starts calling
bnge_rx_flow_steer() with CPU-derived target queues. That function came
from an earlier patch in this series ("bnge: add aRFS flow steering ndo
support"), but it can only be reached after this patch.

When bnge_rx_flow_steer() finds an existing filter for the flow, it
returns that filter's id. It never compares fltr->base.rxq with
rxq_index:

drivers/net/ethernet/broadcom/bnge/bnge_netdev.c:bnge_rx_flow_steer() {
    ...
	fltr = bnge_lookup_ntp_filter_from_idx(bn, new_fltr, idx);
	/* Filter already exists; return its id.  A stale filter (queue
	 * changed) is freed later via rps_may_expire_flow() and recreated.
	 */
	if (fltr) {
		rc = fltr->base.sw_id;
		rcu_read_unlock();
		goto err_free;
	}
    ...
}

set_rps_cpu() counts any non-negative return as success. It stores the id
in the target queue's flow table and clears the old queue's entry:

net/core/dev.c:set_rps_cpu() {
    ...
	rc = dev->netdev_ops->ndo_rx_flow_steer(dev, skb,
						rxq_index, flow_id);
	if (rc < 0)
		goto out;

	old_rflow = rflow;
	rflow = tmp_rflow;
	WRITE_ONCE(rflow->filter, rc);
	WRITE_ONCE(rflow->hash, hash);

	if (old_rflow->filter == rc)
		WRITE_ONCE(old_rflow->filter, RPS_NO_FILTER);
    ...
}

The hardware filter keeps steering to the old queue anyway.

Next, bnge_cfg_ntp_filters() calls rps_may_expire_flow() with
fltr->base.rxq, which is still the old queue. The core has already cleared
that slot, so the filter is expired and freed while the flow is still
active.

Is the "recreated" part of that comment actually guaranteed? The target
queue's entry still holds the sw_id, with cpu equal to next_cpu. After the
flow falls back to RSS, set_rps_cpu() can take this branch without calling
ndo_rx_flow_steer():

		if (READ_ONCE(tmp_rflow->filter) != RPS_NO_FILTER) {
			if (rps_flow_is_active(tmp_rflow,
					       rps_tag_to_log(q_tag_ptr),
					       tmp_cpu)) {
				if (hash != READ_ONCE(tmp_rflow->hash) ||
				    next_cpu == tmp_cpu)
					goto out;
			}
		}

That writes next_cpu into the RSS queue's entry. From then on,
get_rps_cpu() sees tcpu == next_cpu and never calls set_rps_cpu() again.

Could the flow then stay on software RFS, with no hardware filter, until
the application moves to another CPU?

mlx5 and sfc update the existing rule's queue in this case. bnxt uses the
same pattern as bnge.

Would it make sense for the existing-filter path to either reprogram the
filter to rxq_index, or return an error so the core doesn't move the
filter id to the new queue?

> +		if (!dev->rx_cpu_rmap)
> +			return -ENOMEM;
> +	}
> +#endif
> +
> +	return rc;
>  }

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260928061307.1172344-1-vikas.gupta%40broadcom.com

      reply	other threads:[~2026-10-01  9:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  6:12 [net-next, v4 00/10] add features to bnge Vikas Gupta
2026-09-28  6:12 ` [net-next, v4 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:12 ` [net-next, v4 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko
2026-09-28  6:13 ` [net-next, v4 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-10-01  9:13   ` netdev-bot+sashiko [this message]

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=179084602395.434549.9769381174533285357@kernel.org \
    --to=netdev-bot+sashiko@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=horms@kernel.org \
    --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

all inboxes | Powered by JetHome®