Skip to contentSkip to conversation

eth: sfc: migrate to new RXFH callbacks

PATCH In review Jakub Kicinski 2 participants 6 messages Jun 17, 2025 – Jun 18, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover eth: sfc: migrate to new RXFH callbacks

Migrate AMD/Solarflare drivers to the recently added dedicated .get_rxfh_fields ethtool callback.

Jakub Kicinski (3):
eth: sfc: falcon: migrate to new RXFH callbacks
eth: sfc: sienna: migrate to new RXFH callbacks
eth: sfc: migrate to new RXFH callbacks

 drivers/net/ethernet/sfc/ethtool_common.h     |   2 +
 .../net/ethernet/sfc/siena/ethtool_common.h   |   2 +
 drivers/net/ethernet/sfc/ethtool.c            |   1 +
 drivers/net/ethernet/sfc/ethtool_common.c     | 104 +++++++++---------
 drivers/net/ethernet/sfc/falcon/ethtool.c     |  51 +++++----
 drivers/net/ethernet/sfc/siena/ethtool.c      |   1 +
 .../net/ethernet/sfc/siena/ethtool_common.c   |  78 ++++++-------
 7 files changed, 130 insertions(+), 109 deletions(-)
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 1/3 eth: sfc: falcon: migrate to new RXFH callbacks

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.

---
 drivers/net/ethernet/sfc/falcon/ethtool.c | 51 +++++++++++++----------
 1 file changed, 28 insertions(+), 23 deletions(-)
drivers/net/ethernet/sfc/falcon/ethtool.c +28 -23
index 04766448a545..6685e71ab13f 100644
@@ -943,6 +943,33 @@ static int ef4_ethtool_get_class_rule(struct ef4_nic *efx,
 	return rc;
 }
 
+static int
+ef4_ethtool_get_rxfh_fields(struct net_device *net_dev,
+			    struct ethtool_rxfh_fields *info)
+{
+	struct ef4_nic *efx = netdev_priv(net_dev);
+	unsigned int min_revision = 0;
+
+	info->data = 0;
+	switch (info->flow_type) {
+	case TCP_V4_FLOW:
+		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:
+		info->data |= RXH_IP_SRC | RXH_IP_DST;
+		min_revision = EF4_REV_FALCON_B0;
+		break;
+	default:
+		break;
+	}
+	if (ef4_nic_rev(efx) < min_revision)
+		info->data = 0;
+	return 0;
+}
+
 static int
 ef4_ethtool_get_rxnfc(struct net_device *net_dev,
 		      struct ethtool_rxnfc *info, u32 *rule_locs)
@@ -954,29 +981,6 @@ ef4_ethtool_get_rxnfc(struct net_device *net_dev,
 		info->data = efx->n_rx_channels;
 		return 0;
 
-	case ETHTOOL_GRXFH: {
-		unsigned min_revision = 0;
-
-		info->data = 0;
-		switch (info->flow_type) {
-		case TCP_V4_FLOW:
-			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:
-			info->data |= RXH_IP_SRC | RXH_IP_DST;
-			min_revision = EF4_REV_FALCON_B0;
-			break;
-		default:
-			break;
-		}
-		if (ef4_nic_rev(efx) < min_revision)
-			info->data = 0;
-		return 0;
-	}
-
 	case ETHTOOL_GRXCLSRLCNT:
 		info->data = ef4_filter_get_rx_id_limit(efx);
 		if (info->data == 0)
@@ -1343,6 +1347,7 @@ const struct ethtool_ops ef4_ethtool_ops = {
 	.get_rxfh_indir_size	= ef4_ethtool_get_rxfh_indir_size,
 	.get_rxfh		= ef4_ethtool_get_rxfh,
 	.set_rxfh		= ef4_ethtool_set_rxfh,
+	.get_rxfh_fields	= ef4_ethtool_get_rxfh_fields,
 	.get_module_info	= ef4_ethtool_get_module_info,
 	.get_module_eeprom	= ef4_ethtool_get_module_eeprom,
 	.get_link_ksettings	= ef4_ethtool_get_link_ksettings,
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

PATCH 2/3 eth: sfc: sienna: migrate to new RXFH callbacks

In reply to Jakub Kicinski

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.

---
 .../net/ethernet/sfc/siena/ethtool_common.h   |  2 +
 drivers/net/ethernet/sfc/siena/ethtool.c      |  1 +
 .../net/ethernet/sfc/siena/ethtool_common.c   | 77 ++++++++++---------
 3 files changed, 43 insertions(+), 37 deletions(-)
drivers/net/ethernet/sfc/siena/ethtool_common.h +2 -0
index d674bab0f65b..278d69e920d9 100644
@@ -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,
drivers/net/ethernet/sfc/siena/ethtool.c +1 -0
index c5ad84db9613..994909789bfe 100644
@@ -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,
drivers/net/ethernet/sfc/siena/ethtool_common.c +40 -37

89 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 2/3
#3 lore raw

Re: [PATCH net-next 2/3] eth: sfc: sienna: migrate to new RXFH callbacks

Quoted 6 lines · Jakub Kicinski

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.

Typo in subject: "sienna" should be "siena".
Apart from that,

author maintainer
#4 lore raw

PATCH 3/3 eth: sfc: migrate to new RXFH callbacks

In reply to Jakub Kicinski

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. One thing of note that this is one of the two drivers which pays attention to rss_context.

---
 drivers/net/ethernet/sfc/ethtool_common.h |   2 +
 drivers/net/ethernet/sfc/ethtool.c        |   1 +
 drivers/net/ethernet/sfc/ethtool_common.c | 104 ++++++++++++----------
 3 files changed, 58 insertions(+), 49 deletions(-)
drivers/net/ethernet/sfc/ethtool_common.h +2 -0
index fc52e891637d..24db4fccbe78 100644
@@ -49,6 +49,8 @@ int efx_ethtool_get_rxfh(struct net_device *net_dev,
 int efx_ethtool_set_rxfh(struct net_device *net_dev,
 			 struct ethtool_rxfh_param *rxfh,
 			 struct netlink_ext_ack *extack);
+int efx_ethtool_get_rxfh_fields(struct net_device *net_dev,
+				struct ethtool_rxfh_fields *info);
 int efx_ethtool_create_rxfh_context(struct net_device *net_dev,
 				    struct ethtool_rxfh_context *ctx,
 				    const struct ethtool_rxfh_param *rxfh,
drivers/net/ethernet/sfc/ethtool.c +1 -0
index afbedca63b29..23c6a7df78d0 100644
@@ -268,6 +268,7 @@ const struct ethtool_ops efx_ethtool_ops = {
 	.rxfh_priv_size		= sizeof(struct efx_rss_context_priv),
 	.get_rxfh		= efx_ethtool_get_rxfh,
 	.set_rxfh		= efx_ethtool_set_rxfh,
+	.get_rxfh_fields	= efx_ethtool_get_rxfh_fields,
 	.create_rxfh_context	= efx_ethtool_create_rxfh_context,
 	.modify_rxfh_context	= efx_ethtool_modify_rxfh_context,
 	.remove_rxfh_context	= efx_ethtool_remove_rxfh_context,
drivers/net/ethernet/sfc/ethtool_common.c +55 -49

116 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 3/3
#5 lore raw
Quoted 9 lines · Jakub Kicinski

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. One thing of note that this is one of the two drivers which pays attention to rss_context.

Although,

drivers/net/ethernet/sfc/ethtool_common.c static int efx_ethtool_get_class_rule(struct efx_nic *efx, · line 809

Quoted 7 lines
drivers/net/ethernet/sfc/ethtool_common.c +7 -0
+int efx_ethtool_get_rxfh_fields(struct net_device *net_dev,
+				struct ethtool_rxfh_fields *info)
+{
+	struct efx_nic *efx = efx_netdev_priv(net_dev);
+	struct efx_rss_context_priv *ctx;
+	__u64 data;
+	s32 rc = 0;

this could just be an int; it's only an s32 in efx_ethtool_get_rxnfc() for the sake of the ETHTOOL_GRXCLSRLALL path which uses it for more than just 0/negative error. Up to you whether to change and respin.