[RFC ethtool-next] rxclass: Remove flow mask inversion

From: Daniel Xu <hidden>
Date: 2024-11-11 19:39:53
Subsystem: the rest · Maintainer: Linus Torvalds

Previously, all flow masks were "inverted" such that a set bit (1) means
mask-out and an unset bit (0) means mask-in. This was originally done to
fixup the hardware-TCAM expected format (according to Alex).

I'm sending this RFC to check if the current output is still desired.
From what I understand, the kernel drivers see it the "natural" way (set
means mask-in and unset is mask-out). So it's unclear to me who/what the
current ethtool output benefits.

I've CC'd Alex (original author) as well as a few folks who've been
helping me dive into the RSS contexts API.

Before:

    # ethtool -N eth0 flow-type ip6 dst-ip ::1 context 1
    Added rule with ID 0

    # ethtool -n eth0
    32 RX rings available
    Total 1 rules

    Filter: 0
            Rule Type: Raw IPv6
            Src IP addr: :: mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
            Dest IP addr: ::1 mask: ::
            Traffic Class: 0x0 mask: 0xff
            Protocol: 0 mask: 0xff
            L4 bytes: 0x0 mask: 0xffffffff
            RSS Context ID: 1
            Action: Direct to queue 0

After:

    # ./ethtool -n eth0
    32 RX rings available
    Total 1 rules

    Filter: 0
            Rule Type: Raw IPv6
            Src IP addr: :: mask: ::
            Dest IP addr: ::1 mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
            Traffic Class: 0x0 mask: 0x0
            Protocol: 0 mask: 0x0
            L4 bytes: 0x0 mask: 0x0
            RSS Context ID: 1
            Action: Direct to queue 0

This patch was tested on both (and only) mlx5 and bnxt.

Signed-off-by: Daniel Xu <redacted>
---
 rxclass.c | 10 ----------
 1 file changed, 10 deletions(-)
diff --git a/rxclass.c b/rxclass.c
index ac9b529..02541bd 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -12,14 +12,6 @@
 #include <arpa/inet.h>
 #include "internal.h"
 
-static void invert_flow_mask(struct ethtool_rx_flow_spec *fsp)
-{
-	size_t i;
-
-	for (i = 0; i < sizeof(fsp->m_u); i++)
-		fsp->m_u.hdata[i] ^= 0xFF;
-}
-
 static void rxclass_print_ipv4_rule(__be32 sip, __be32 sipm, __be32 dip,
 				    __be32 dipm, u8 tos, u8 tosm)
 {
@@ -104,8 +96,6 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
 
 	flow_type = fsp->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT | FLOW_RSS);
 
-	invert_flow_mask(fsp);
-
 	switch (flow_type) {
 	case TCP_V4_FLOW:
 	case UDP_V4_FLOW:
-- 
2.46.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help