]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
eth: e1000e: migrate to new RXFH callbacks
authorJakub Kicinski <kuba@kernel.org>
Sat, 14 Jun 2025 18:06:37 +0000 (11:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Jun 2025 01:14:25 +0000 (18:14 -0700)
Migrate to new callbacks added by commit 9bb00786fc61 ("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").
This driver's RXFH config is read only / fixed and it's the only
get_rxnfc sub-command the driver supports. So convert the get_rxnfc
handler into a get_rxfh_fields handler.

Reviewed-by: Joe Damato <joe@dama.to>
Reviewed-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20250614180638.4166766-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/e1000e/ethtool.c

index 9364bc2b4eb155337631906a9346db77357eba4b..c0bbb12eed2e97bbc768e62d00493592ced12092 100644 (file)
@@ -2096,54 +2096,47 @@ static void e1000_get_strings(struct net_device __always_unused *netdev,
        }
 }
 
-static int e1000_get_rxnfc(struct net_device *netdev,
-                          struct ethtool_rxnfc *info,
-                          u32 __always_unused *rule_locs)
+static int e1000_get_rxfh_fields(struct net_device *netdev,
+                                struct ethtool_rxfh_fields *info)
 {
-       info->data = 0;
+       struct e1000_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       u32 mrqc;
 
-       switch (info->cmd) {
-       case ETHTOOL_GRXFH: {
-               struct e1000_adapter *adapter = netdev_priv(netdev);
-               struct e1000_hw *hw = &adapter->hw;
-               u32 mrqc;
+       info->data = 0;
 
-               mrqc = er32(MRQC);
+       mrqc = er32(MRQC);
 
-               if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
-                       return 0;
-
-               switch (info->flow_type) {
-               case TCP_V4_FLOW:
-                       if (mrqc & E1000_MRQC_RSS_FIELD_IPV4_TCP)
-                               info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       fallthrough;
-               case UDP_V4_FLOW:
-               case SCTP_V4_FLOW:
-               case AH_ESP_V4_FLOW:
-               case IPV4_FLOW:
-                       if (mrqc & E1000_MRQC_RSS_FIELD_IPV4)
-                               info->data |= RXH_IP_SRC | RXH_IP_DST;
-                       break;
-               case TCP_V6_FLOW:
-                       if (mrqc & E1000_MRQC_RSS_FIELD_IPV6_TCP)
-                               info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       fallthrough;
-               case UDP_V6_FLOW:
-               case SCTP_V6_FLOW:
-               case AH_ESP_V6_FLOW:
-               case IPV6_FLOW:
-                       if (mrqc & E1000_MRQC_RSS_FIELD_IPV6)
-                               info->data |= RXH_IP_SRC | RXH_IP_DST;
-                       break;
-               default:
-                       break;
-               }
+       if (!(mrqc & E1000_MRQC_RSS_FIELD_MASK))
                return 0;
-       }
+
+       switch (info->flow_type) {
+       case TCP_V4_FLOW:
+               if (mrqc & E1000_MRQC_RSS_FIELD_IPV4_TCP)
+                       info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+               fallthrough;
+       case UDP_V4_FLOW:
+       case SCTP_V4_FLOW:
+       case AH_ESP_V4_FLOW:
+       case IPV4_FLOW:
+               if (mrqc & E1000_MRQC_RSS_FIELD_IPV4)
+                       info->data |= RXH_IP_SRC | RXH_IP_DST;
+               break;
+       case TCP_V6_FLOW:
+               if (mrqc & E1000_MRQC_RSS_FIELD_IPV6_TCP)
+                       info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+               fallthrough;
+       case UDP_V6_FLOW:
+       case SCTP_V6_FLOW:
+       case AH_ESP_V6_FLOW:
+       case IPV6_FLOW:
+               if (mrqc & E1000_MRQC_RSS_FIELD_IPV6)
+                       info->data |= RXH_IP_SRC | RXH_IP_DST;
+               break;
        default:
-               return -EOPNOTSUPP;
+               break;
        }
+       return 0;
 }
 
 static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
@@ -2352,7 +2345,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
        .get_sset_count         = e1000e_get_sset_count,
        .get_coalesce           = e1000_get_coalesce,
        .set_coalesce           = e1000_set_coalesce,
-       .get_rxnfc              = e1000_get_rxnfc,
+       .get_rxfh_fields        = e1000_get_rxfh_fields,
        .get_ts_info            = e1000e_get_ts_info,
        .get_eee                = e1000e_get_eee,
        .set_eee                = e1000e_set_eee,