bnxt_en: ethtool: Remove ip4/ip6 ntuple support for IPPROTO_RAW
authorDaniel Xu <dxu@dxuuu.xyz>
Tue, 5 Nov 2024 04:13:19 +0000 (21:13 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 Nov 2024 01:39:59 +0000 (17:39 -0800)
Commit 9ba0e56199e3 ("bnxt_en: Enhance ethtool ntuple support for ip
flows besides TCP/UDP") added support for ip4/ip6 ntuple rules.
However, if you wanted to wildcard over l4proto, you had to provide
0xFF.

The choice of 0xFF is non-standard and non-intuitive. Delete support for
it in this commit. Next commit we will introduce a cleaner way to
wildcard l4proto.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/a5ba0d3bd926d27977c317efa7fdfbc8a704d2b8.1730778566.git.dxu@dxuuu.xyz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 6ef06579df53d9c37b68ce60cdbb31884693671b..41160aed94768718487434d718fca5eae849b842 100644 (file)
@@ -1124,14 +1124,10 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
        fkeys = &fltr->fkeys;
        fmasks = &fltr->fmasks;
        if (fkeys->basic.n_proto == htons(ETH_P_IP)) {
-               if (fkeys->basic.ip_proto == IPPROTO_ICMP ||
-                   fkeys->basic.ip_proto == IPPROTO_RAW) {
+               if (fkeys->basic.ip_proto == IPPROTO_ICMP) {
                        fs->flow_type = IP_USER_FLOW;
                        fs->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4;
-                       if (fkeys->basic.ip_proto == IPPROTO_ICMP)
-                               fs->h_u.usr_ip4_spec.proto = IPPROTO_ICMP;
-                       else
-                               fs->h_u.usr_ip4_spec.proto = IPPROTO_RAW;
+                       fs->h_u.usr_ip4_spec.proto = IPPROTO_ICMP;
                        fs->m_u.usr_ip4_spec.proto = BNXT_IP_PROTO_FULL_MASK;
                } else if (fkeys->basic.ip_proto == IPPROTO_TCP) {
                        fs->flow_type = TCP_V4_FLOW;
@@ -1153,13 +1149,9 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
                        fs->m_u.tcp_ip4_spec.pdst = fmasks->ports.dst;
                }
        } else {
-               if (fkeys->basic.ip_proto == IPPROTO_ICMPV6 ||
-                   fkeys->basic.ip_proto == IPPROTO_RAW) {
+               if (fkeys->basic.ip_proto == IPPROTO_ICMPV6) {
                        fs->flow_type = IPV6_USER_FLOW;
-                       if (fkeys->basic.ip_proto == IPPROTO_ICMPV6)
-                               fs->h_u.usr_ip6_spec.l4_proto = IPPROTO_ICMPV6;
-                       else
-                               fs->h_u.usr_ip6_spec.l4_proto = IPPROTO_RAW;
+                       fs->h_u.usr_ip6_spec.l4_proto = IPPROTO_ICMPV6;
                        fs->m_u.usr_ip6_spec.l4_proto = BNXT_IP_PROTO_FULL_MASK;
                } else if (fkeys->basic.ip_proto == IPPROTO_TCP) {
                        fs->flow_type = TCP_V6_FLOW;
@@ -1285,7 +1277,7 @@ static bool bnxt_verify_ntuple_ip4_flow(struct ethtool_usrip4_spec *ip_spec,
        if (ip_mask->l4_4_bytes || ip_mask->tos ||
            ip_spec->ip_ver != ETH_RX_NFC_IP4 ||
            ip_mask->proto != BNXT_IP_PROTO_FULL_MASK ||
-           (ip_spec->proto != IPPROTO_RAW && ip_spec->proto != IPPROTO_ICMP))
+           ip_spec->proto != IPPROTO_ICMP)
                return false;
        return true;
 }
@@ -1295,8 +1287,7 @@ static bool bnxt_verify_ntuple_ip6_flow(struct ethtool_usrip6_spec *ip_spec,
 {
        if (ip_mask->l4_4_bytes || ip_mask->tclass ||
            ip_mask->l4_proto != BNXT_IP_PROTO_FULL_MASK ||
-           (ip_spec->l4_proto != IPPROTO_RAW &&
-            ip_spec->l4_proto != IPPROTO_ICMPV6))
+           ip_spec->l4_proto != IPPROTO_ICMPV6)
                return false;
        return true;
 }