Netdev List
 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: [PATCH net-next v8 08/10] bnge: add NTUPLE filter support in ethtool
Date: Thu, 19 Nov 2026 17:09:10 +0000	[thread overview]
Message-ID: <179510815010.3136.2518748601962705515@kernel.org> (raw)
In-Reply-To: <20261116140653.1685797-9-vikas.gupta@broadcom.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 3

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message gets the old unicast-filter behaviour wrong
  and hides a policy change that affects every user of the driver,…
- [Medium] bnge_hwrm_l2_filter_alloc() now sets
  CFA_L2_FILTER_ALLOC_REQ_FLAGS_TRAFFIC_L2 (0x1 << 4) for user…
- [Low] The patch adds a user-visible limit on the RSS ethtool uAPI that
  the commit message never mentions.
- [Low] The new restore and ring-lost messages identify a rule by its
  internal bitmap index (fltr->sw_id), not by the ethtool location the…
- [Low] In bnge_cfg_rx_mode() the overflow check no longer matches the
  fill loop, although the comment above the uc_count loop still says it…

--

bnge: add NTUPLE filter support in ethtool

This adds ethtool rxnfc get/set operations for ntuple and ETHER_FLOW
rules in bnge. User rules are kept in software across down/up and are
programmed again on open. Unicast address filters now share the L2
filter pool with user ETHER_FLOW rules: BNGE_MAX_UC_ADDRS is removed and
l2_filters[] and uc_list are sized by BNGE_MAX_L2_FLTRS.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c b/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
> index 1bb9c30197695..ac93b0e123ad1 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c

[ ... ]

> @@ -999,6 +1001,12 @@ static int bnge_set_rxfh_fields(struct net_device *dev,
>  		return -EBUSY;
>  	}
>  
> +	if (bnge_has_usr_ntp_fltr(bn)) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Delete user ntuple rules before changing the RSS hash fields");
> +		return -EBUSY;
> +	}
> +
>  	bd->rss_hash_cfg = rss_hash_cfg;
>  
>  	return 0;
> @@ -1060,6 +1068,12 @@ static int bnge_set_rxfh(struct net_device *dev,
>  		return -EBUSY;
>  	}
>  
> +	if (rxfh->key && bnge_has_usr_ntp_fltr(bn)) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Delete user ntuple rules before changing the RSS hash key");
> +		return -EBUSY;
> +	}
> +

[Severity: Low]
This isn't a bug, but should the commit message mention this new limit?

While any user ntuple rule exists, bnge_set_rxfh_fields() returns
-EBUSY. bnge_set_rxfh() does the same whenever a key is supplied. To
change the RSS hash key or the rx-flow-hash fields, the user has to
delete every ntuple rule first.

The only explanation is the comment above bnge_has_usr_ntp_fltr(). The
rules sit in ntp_fltr_hash_tbl at an index computed by
bnge_get_ntp_filter_idx()->bnge_toeplitz(). That index depends on the
default VNIC rss_hash_key and on rss_hash_cfg, and the rules are never
rehashed.

Since users can see this limit on the RSS ethtool interface, could the
changelog describe it?

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> index 3ebb3cae4829b..e2dc3a34cad33 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> @@ -584,3 +584,134 @@ int bnge_hwrm_set_vnic_filter(struct bnge_net *bn, u16 vnic_id, u16 idx,

[ ... ]

> +static bool bnge_usr_fltr_ring_lost(struct bnge_net *bn,
> +				    struct bnge_filter_base *fltr)
> +{
> +	if (fltr->flags & (BNGE_ACT_DROP | BNGE_ACT_RSS_CTX) ||
> +	    fltr->rxq < bn->bd->rx_nr_rings)
> +		return false;
> +
> +	netdev_warn(bn->netdev, "filter id %d: rx ring %u no longer exists\n",
> +		    fltr->sw_id, fltr->rxq);
> +	return true;
> +}
> +
> +static void bnge_cfg_one_usr_fltr(struct bnge_net *bn,
> +				  struct bnge_filter_base *fltr)
> +{
> +	struct bnge_ntuple_filter *ntp_fltr;
> +	struct bnge_l2_filter *l2_fltr;
> +
> +	if (list_empty(&fltr->list_node))
> +		return;
> +
> +	if (fltr->type == BNGE_FLTR_TYPE_NTUPLE) {
> +		ntp_fltr = container_of(fltr, struct bnge_ntuple_filter, base);
> +		l2_fltr = bn->vnic_info[BNGE_VNIC_DEFAULT].l2_filters[0];
> +		ntp_fltr->l2_filter_id = l2_fltr->base.filter_id;
> +		if (bnge_usr_fltr_ring_lost(bn, fltr) ||
> +		    bnge_hwrm_cfa_ntuple_filter_alloc(bn->bd, ntp_fltr)) {
> +			netdev_err(bn->netdev,
> +				   "restoring previously configured ntuple filter id %d failed\n",
> +				   fltr->sw_id);

[Severity: Low]
Do these messages print the rule number the user sees?

Users see ntuple rules at location BNGE_MAX_L2_FLTRS + sw_id. For
example, bnge_add_ntuple_cls_rule() does:

	fs->location = BNGE_MAX_L2_FLTRS + new_fltr->base.sw_id;

bnge_grxclsrlall(), bnge_grxclsrule() and bnge_srxclsrldel() use the same
offset. These messages print the raw sw_id instead.

The L2 and ntuple sw_id spaces both start at 0. So if ethtool rule 128
is dropped after a down/up, the log says "filter id 0: rx ring N no
longer exists" or "restoring previously configured ntuple filter id 0
failed". Rule 0 may be an unrelated L2 rule, or it may not exist. The
ring-lost message also does not say which filter type it means. bnxt
prints sw_id the same way.

Would it be clearer to print the ethtool location here?

[ ... ]

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
> index 76f8bb73056dd..305f0054742c8 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
> @@ -885,15 +885,18 @@ int bnge_hwrm_l2_filter_alloc(struct bnge_dev *bd, struct bnge_l2_filter *fltr)

[ ... ]

> -	req->flags = cpu_to_le32(CFA_L2_FILTER_ALLOC_REQ_FLAGS_PATH_RX);
> -
> -	req->flags |= cpu_to_le32(CFA_L2_FILTER_ALLOC_REQ_FLAGS_OUTERMOST);
> +	flags = CFA_L2_FILTER_ALLOC_REQ_FLAGS_PATH_RX |
> +		CFA_L2_FILTER_ALLOC_REQ_FLAGS_OUTERMOST;
> +	if (BNGE_L2_FLTR_IS_NTP_MAC(fltr))
> +		flags |= CFA_L2_FILTER_ALLOC_REQ_FLAGS_TRAFFIC_L2;
> +	req->flags = cpu_to_le32(flags);

[Severity: Medium]
How does this traffic type interact with RoCE?

Every other L2 filter in bnge and bnxt leaves the traffic field at 0
(CFA_L2_FILTER_ALLOC_REQ_FLAGS_TRAFFIC_NO_ROCE_L2). This is the only
place in the tree that sets TRAFFIC_L2. The commit message states the
change but gives no reason and does not mention RoCE.

When the aux device is registered, bnge_hwrm_vnic_cfg() puts the default
VNIC in RoCE dual mode:

	if (vnic->vnic_id == BNGE_VNIC_DEFAULT && bnge_aux_registered(bd))
		req->flags |= cpu_to_le32(BNGE_VNIC_CFG_ROCE_DUAL_MODE);

Suppose TRAFFIC_L2 means non-RoCE L2 only. Take a MAC that a user rule
shadows, such as a macvlan MAC. bnge_cfg_rx_mode() gets -EEXIST for it
and installs no type 0 default VNIC filter. Would RoCE frames for that
MAC then match no filter and never reach the default VNIC?

Now suppose TRAFFIC_L2 means all L2 traffic, including RoCE.
bnge_add_l2_cls_rule() accepts rules for MAC/VLAN pairs that carry RoCE
traffic, for example the port MAC with a VLAN. Such a rule would send
RoCE frames to a plain ring on the ntuple VNIC. Is that intended?

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index 2b26576f0e997..b71e427d3ba10 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c

[ ... ]

> @@ -2079,7 +2082,14 @@ static int bnge_cfg_rx_mode(struct bnge_net *bn, struct netdev_hw_addr_list *uc,
>  	netdev_hw_addr_list_for_each(ha, uc)
>  		if (!ether_addr_equal(ha->addr, dev->dev_addr))
>  			uc_count++;
> -	if (uc_count > BNGE_MAX_UC_ADDRS - 1) {
> +	/* The unicast addresses and the user ETHER_FLOW rules share the L2
> +	 * filters. Receive the addresses that do not fit in promiscuous mode.
> +	 * The firmware supports many more L2 filters than BNGE_MAX_L2_FLTRS,
> +	 * so it is not expected to refuse a filter in the loop below.
> +	 */
> +	l2_free = BNGE_MAX_L2_FLTRS -
> +		  bitmap_weight(bn->l2_fltr_bmap, BNGE_MAX_L2_FLTRS);
> +	if (uc_count > BNGE_MAX_L2_FLTRS - 1 || uc_count > l2_free) {

[Severity: Medium]
The commit message says:

    bnge_cfg_rx_mode() counts the free L2 filters, and when the
    addresses do not fit it receives them in promiscuous mode, as
    it already does for more than BNGE_MAX_L2_FLTRS - 1 addresses.

Does that match the old behaviour? Before this patch the check was
uc_count > BNGE_MAX_UC_ADDRS - 1, so four or more extra unicast
addresses already meant promiscuous mode.

With the new check, the driver programs up to 127 L2 filters before it
falls back. That affects every user of the driver, even with ntuple
disabled.

The message also calls BNGE_MAX_L2_FLTRS "the number of L2 filters of a
function". It is actually a driver constant (128).
bnge_hwrm_func_qcaps() fills in the limit reported by the firmware,
hw_resc->max_l2_ctxs, but nothing here uses it.

Suppose the firmware does refuse a filter partway through the fill
loop. The error path then does:

		if (rc) {
			...
			vnic->uc_filter_count = i;
			return rc;
		}

This returns before skip_uc:, so it skips both the promiscuous fallback
and bnge_hwrm_cfa_l2_set_rx_mask(). Would the remaining addresses then
not be received at all? The old code received them in promiscuous mode.

Should the threshold take max_l2_ctxs into account? Could the commit
message also describe the change from 3 to 127 addresses?

[ ... ]

> @@ -2095,6 +2105,11 @@ static int bnge_cfg_rx_mode(struct bnge_net *bn, struct netdev_hw_addr_list *uc,
>  
>  	for (i = 1, off = 0; i < vnic->uc_filter_count; i++, off += ETH_ALEN) {
>  		rc = bnge_hwrm_set_vnic_filter(bn, 0, i, vnic->uc_list + off);
> +		if (rc == -EEXIST) {
> +			/* Already delivered by a user L2 rule */
> +			vnic->l2_filters[i] = NULL;
> +			continue;
> +		}

[Severity: Low]
Does the overflow check above still match this loop?

uc_count includes addresses that already have a user ETHER_FLOW rule.
It is compared against l2_free, which already excludes the l2_fltr_bmap
bits that those same rules hold.

In this loop, bnge_hwrm_set_vnic_filter()->bnge_alloc_l2_filter() finds
the user rule in l2_fltr_hash_tbl and returns -EEXIST. No L2 filter is
used for those addresses.

So each shared MAC is counted twice. Take k user rules whose MACs are
also in the uc list, plus m other addresses. The VNIC goes promiscuous
when k + m > 127 - k, even though only m filters are needed.

bnge_del_usr_l2_filter() does not run this decision again, so the VNIC
stays promiscuous until the next address list change.

The comment above the uc_count loop also still says "Count only the
entries that will actually be programmed so the overflow check matches
the fill loop below", which is no longer true.

[ ... ]

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

  reply	other threads:[~2026-11-19 17:09 UTC|newest]

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

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=179510815010.3136.2518748601962705515@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