]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
eth: sfc: siena: migrate to new RXFH callbacks
authorJakub Kicinski <kuba@kernel.org>
Wed, 18 Jun 2025 20:38:15 +0000 (13:38 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Jun 2025 14:53:39 +0000 (07:53 -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 so the conversion
is purely factoring out the handling into a helper.

Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/20250618203823.1336156-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/sfc/siena/ethtool.c
drivers/net/ethernet/sfc/siena/ethtool_common.c
drivers/net/ethernet/sfc/siena/ethtool_common.h

index c5ad84db96137f66b98cc8d5cf87b7c241be512f..994909789bfea4a44eaeaf86c80337cf35aadd9c 100644 (file)
@@ -264,6 +264,7 @@ const struct ethtool_ops efx_siena_ethtool_ops = {
        .get_rxfh_key_size      = efx_siena_ethtool_get_rxfh_key_size,
        .get_rxfh               = efx_siena_ethtool_get_rxfh,
        .set_rxfh               = efx_siena_ethtool_set_rxfh,
+       .get_rxfh_fields        = efx_siena_ethtool_get_rxfh_fields,
        .get_ts_info            = efx_ethtool_get_ts_info,
        .get_module_info        = efx_siena_ethtool_get_module_info,
        .get_module_eeprom      = efx_siena_ethtool_get_module_eeprom,
index eeee676fdca7d1f1478f1a72426f0b747bea1379..47cd16a113cf1cc828278398c08cfeb3d4175a75 100644 (file)
@@ -801,6 +801,46 @@ static int efx_ethtool_get_class_rule(struct efx_nic *efx,
        return rc;
 }
 
+int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
+                                     struct ethtool_rxfh_fields *info)
+{
+       struct efx_nic *efx = netdev_priv(net_dev);
+       __u64 data;
+
+       data = 0;
+       if (!efx_rss_active(&efx->rss_context)) /* No RSS */
+               goto out_setdata;
+
+       switch (info->flow_type) {
+       case UDP_V4_FLOW:
+       case UDP_V6_FLOW:
+               if (efx->rss_context.rx_hash_udp_4tuple)
+                       data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
+                               RXH_IP_SRC | RXH_IP_DST);
+               else
+                       data = RXH_IP_SRC | RXH_IP_DST;
+               break;
+       case TCP_V4_FLOW:
+       case TCP_V6_FLOW:
+               data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
+                       RXH_IP_SRC | RXH_IP_DST);
+               break;
+       case SCTP_V4_FLOW:
+       case SCTP_V6_FLOW:
+       case AH_ESP_V4_FLOW:
+       case AH_ESP_V6_FLOW:
+       case IPV4_FLOW:
+       case IPV6_FLOW:
+               data = RXH_IP_SRC | RXH_IP_DST;
+               break;
+       default:
+               break;
+       }
+out_setdata:
+       info->data = data;
+       return 0;
+}
+
 int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
                                struct ethtool_rxnfc *info, u32 *rule_locs)
 {
@@ -813,43 +853,6 @@ int efx_siena_ethtool_get_rxnfc(struct net_device *net_dev,
                info->data = efx->n_rx_channels;
                return 0;
 
-       case ETHTOOL_GRXFH: {
-               __u64 data;
-
-               data = 0;
-               if (!efx_rss_active(&efx->rss_context)) /* No RSS */
-                       goto out_setdata;
-
-               switch (info->flow_type) {
-               case UDP_V4_FLOW:
-               case UDP_V6_FLOW:
-                       if (efx->rss_context.rx_hash_udp_4tuple)
-                               data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
-                                       RXH_IP_SRC | RXH_IP_DST);
-                       else
-                               data = RXH_IP_SRC | RXH_IP_DST;
-                       break;
-               case TCP_V4_FLOW:
-               case TCP_V6_FLOW:
-                       data = (RXH_L4_B_0_1 | RXH_L4_B_2_3 |
-                               RXH_IP_SRC | RXH_IP_DST);
-                       break;
-               case SCTP_V4_FLOW:
-               case SCTP_V6_FLOW:
-               case AH_ESP_V4_FLOW:
-               case AH_ESP_V6_FLOW:
-               case IPV4_FLOW:
-               case IPV6_FLOW:
-                       data = RXH_IP_SRC | RXH_IP_DST;
-                       break;
-               default:
-                       break;
-               }
-out_setdata:
-               info->data = data;
-               return rc;
-       }
-
        case ETHTOOL_GRXCLSRLCNT:
                info->data = efx_filter_get_rx_id_limit(efx);
                if (info->data == 0)
index d674bab0f65b17a3f22676fa48f8132c235c4c90..278d69e920d9f5986f5619f026708a4d5b84f841 100644 (file)
@@ -46,6 +46,8 @@ int efx_siena_ethtool_get_rxfh(struct net_device *net_dev,
 int efx_siena_ethtool_set_rxfh(struct net_device *net_dev,
                               struct ethtool_rxfh_param *rxfh,
                               struct netlink_ext_ack *extack);
+int efx_siena_ethtool_get_rxfh_fields(struct net_device *net_dev,
+                                     struct ethtool_rxfh_fields *info);
 int efx_siena_ethtool_reset(struct net_device *net_dev, u32 *flags);
 int efx_siena_ethtool_get_module_eeprom(struct net_device *net_dev,
                                        struct ethtool_eeprom *ee,