From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Joe Damato <joe@dama.to>,
Michael Chan <michael.chan@broadcom.com>,
Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>,
pavan.chebbi@broadcom.com, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.12] bnxt_en: Allow ntuple filters for drops
Date: Sat, 14 Feb 2026 16:23:41 -0500 [thread overview]
Message-ID: <20260214212452.782265-76-sashal@kernel.org> (raw)
In-Reply-To: <20260214212452.782265-1-sashal@kernel.org>
From: Joe Damato <joe@dama.to>
[ Upstream commit 61cef6454cfbb9fcdbe41401fb53895f86603081 ]
It appears that in commit 7efd79c0e689 ("bnxt_en: Add drop action
support for ntuple"), bnxt gained support for ntuple filters for packet
drops.
However, support for this does not seem to work in recent kernels or
against net-next:
% sudo ethtool -U eth0 flow-type udp4 src-ip 1.1.1.1 action -1
rmgr: Cannot insert RX class rule: Operation not supported
Cannot insert classification rule
The issue is that the existing code uses ethtool_get_flow_spec_ring_vf,
which will return a non-zero value if the ring_cookie is set to
RX_CLS_FLOW_DISC, which then causes bnxt_add_ntuple_cls_rule to return
-EOPNOTSUPP because it thinks the user is trying to set an ntuple filter
for a vf.
Fix this by first checking that the ring_cookie is not RX_CLS_FLOW_DISC.
After this patch, ntuple filters for drops can be added:
% sudo ethtool -U eth0 flow-type udp4 src-ip 1.1.1.1 action -1
Added rule with ID 0
% ethtool -n eth0
44 RX rings available
Total 1 rules
Filter: 0
Rule Type: UDP over IPv4
Src IP addr: 1.1.1.1 mask: 0.0.0.0
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 0 mask: 0xffff
Action: Drop
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260131003042.2570434-1-joe@dama.to
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis
### Commit Message Analysis
The commit fixes a bug where ntuple filters for packet drops (`action
-1` / `RX_CLS_FLOW_DISC`) don't work on bnxt_en network devices, despite
support being added in commit 7efd79c0e689. The user gets `-EOPNOTSUPP`
when trying to add a drop rule via ethtool. The commit message is clear,
includes a reproducer, and shows the fix working.
### Code Change Analysis
The fix is small and surgical, modifying a single file
(`bnxt_ethtool.c`) with minimal changes:
1. **The core bug**: When `ring_cookie` is set to `RX_CLS_FLOW_DISC`
(indicating a drop action), the old code calls
`ethtool_get_flow_spec_ring_vf(fs->ring_cookie)` which returns a non-
zero value for `RX_CLS_FLOW_DISC`. This causes the function to
incorrectly return `-EOPNOTSUPP`, thinking the user is trying to set
a VF filter.
2. **The fix**: Check if `ring_cookie == RX_CLS_FLOW_DISC` first. If it
is, skip the VF check entirely (drops don't target a VF or ring). The
FLOW_MAC_EXT/FLOW_EXT check is also separated out for clarity.
3. **Additional cleanup**: The `ring` variable is removed;
`ethtool_get_flow_spec_ring()` is now called inline only in the else
branch (when it's not a drop action), which is correct since drop
actions don't need a ring number. The `vf` variable is also removed
since it's only used in the condition now.
### Bug Classification
This is a **real bug fix** — a feature that was intentionally added
(drop action support for ntuple filters) is broken and returns an error
to users. The `ethtool_get_flow_spec_ring_vf()` function misinterprets
`RX_CLS_FLOW_DISC` (which is `(u64)-1` / all bits set) as containing VF
information, since the VF bits are part of the upper bits of
`ring_cookie`.
### Scope and Risk Assessment
- **Lines changed**: Very small — a few lines of logic restructuring in
one function
- **Files touched**: 1 file (`bnxt_ethtool.c`)
- **Risk**: Very low. The change only affects the ntuple filter add
path. The logic is straightforward:
- If `ring_cookie == RX_CLS_FLOW_DISC`, skip the VF check (correct,
drops don't have a VF)
- Otherwise, check for VF as before
- The ring extraction is moved to where it's actually used (the non-
drop path)
- **Could it break something?**: Extremely unlikely. The only behavioral
change is that drop rules now work instead of being rejected. Non-drop
rules follow the same logic as before.
### User Impact
- **Who is affected**: Users of Broadcom bnxt_en network adapters (very
common in data center/enterprise environments) who want to use ethtool
ntuple filters for packet drops
- **Severity**: Medium — the feature is completely broken, returning
`-EOPNOTSUPP`
- **Workaround**: None apparent — the drop action simply doesn't work
### Stability Indicators
- **Reviewed-by**: Michael Chan (Broadcom maintainer for bnxt)
- **Accepted by**: Jakub Kicinski (net maintainer)
- The fix is obviously correct from reading the code
### Dependency Check
The fix is self-contained. It modifies existing code in `bnxt_ethtool.c`
that has been present since commit 7efd79c0e689 was merged. No
dependencies on other patches.
### Stable Criteria Assessment
1. **Obviously correct and tested**: Yes — reviewed by subsystem
maintainer, clear logic
2. **Fixes a real bug**: Yes — ntuple drop filters are broken, returning
EOPNOTSUPP
3. **Important issue**: Moderate — broken network filtering feature on a
widely-used NIC driver
4. **Small and contained**: Yes — minimal changes to one function in one
file
5. **No new features**: Correct — this restores functionality that was
intended but broken
6. **Applies cleanly**: Should apply to any stable tree that has commit
7efd79c0e689
This is a clear bug fix that restores broken functionality in a widely-
used network driver. The fix is small, obviously correct, reviewed by
the subsystem maintainer, and carries minimal risk.
**YES**
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 068e191ede19e..c76a7623870be 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1346,16 +1346,17 @@ static int bnxt_add_ntuple_cls_rule(struct bnxt *bp,
struct bnxt_l2_filter *l2_fltr;
struct bnxt_flow_masks *fmasks;
struct flow_keys *fkeys;
- u32 idx, ring;
+ u32 idx;
int rc;
- u8 vf;
if (!bp->vnic_info)
return -EAGAIN;
- vf = ethtool_get_flow_spec_ring_vf(fs->ring_cookie);
- ring = ethtool_get_flow_spec_ring(fs->ring_cookie);
- if ((fs->flow_type & (FLOW_MAC_EXT | FLOW_EXT)) || vf)
+ if (fs->flow_type & (FLOW_MAC_EXT | FLOW_EXT))
+ return -EOPNOTSUPP;
+
+ if (fs->ring_cookie != RX_CLS_FLOW_DISC &&
+ ethtool_get_flow_spec_ring_vf(fs->ring_cookie))
return -EOPNOTSUPP;
if (flow_type == IP_USER_FLOW) {
@@ -1481,7 +1482,7 @@ static int bnxt_add_ntuple_cls_rule(struct bnxt *bp,
if (fs->ring_cookie == RX_CLS_FLOW_DISC)
new_fltr->base.flags |= BNXT_ACT_DROP;
else
- new_fltr->base.rxq = ring;
+ new_fltr->base.rxq = ethtool_get_flow_spec_ring(fs->ring_cookie);
__set_bit(BNXT_FLTR_VALID, &new_fltr->base.state);
rc = bnxt_insert_ntp_filter(bp, new_fltr, idx);
if (!rc) {
--
2.51.0
next prev parent reply other threads:[~2026-02-14 21:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260214212452.782265-1-sashal@kernel.org>
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-5.10] myri10ge: avoid uninitialized variable use Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.1] net: mctp-i2c: fix duplicate reception of old data Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] net: wwan: mhi: Add network support for Foxconn T99W760 Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-5.10] net/rds: Clear reconnect pending bit Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] ipv6: annotate data-races over sysctl.flowlabel_reflect Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-5.15] ipv6: exthdrs: annotate data-race over multiple sysctl Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] octeontx2-af: Workaround SQM/PSE stalls by disabling sticky Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.15] ipv6: annotate data-races in ip6_multipath_hash_{policy,fields}() Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.6] ipv4: igmp: annotate data-races around idev->mr_maxdelay Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] net/rds: No shortcut out of RDS_CONN_ERROR Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.18] ipv6: annotate data-races in net/ipv6/route.c Sasha Levin
2026-02-14 21:23 ` Sasha Levin [this message]
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.18] ptp: ptp_vmclock: add 'VMCLOCK' to ACPI device match Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] ipv4: fib: Annotate access to struct fib_alias.fa_state Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.12] net: sfp: add quirk for Lantech 8330-265D Sasha Levin
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=20260214212452.782265-76-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=joe@dama.to \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=pavan.chebbi@broadcom.com \
--cc=stable@vger.kernel.org \
/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