Re: [PATCH net-next 6/6] eth: sfc: falcon: migrate to new RXFH callbacks

From
Edward Cree <ecree.xilinx@gmail.com>
Date
2025-06-13 13:44:43
Also in
imx
Reply to
Jakub Kicinski, 2025-06-13
On 13/06/2025 01:54, Jakub Kicinski wrote:
quoted hunk ↗ jump to hunk
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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/sfc/falcon/ethtool.c | 51 +++++++++++++----------
 1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/sfc/falcon/ethtool.c b/drivers/net/ethernet/sfc/falcon/ethtool.c
index 04766448a545..6685e71ab13f 100644
--- a/drivers/net/ethernet/sfc/falcon/ethtool.c
+++ b/drivers/net/ethernet/sfc/falcon/ethtool.c
@@ -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;
So granted that you're only moving code, but looking at this it doesn't
 actually make sense, since every path that sets info->data to nonzero
 also sets min_revision, so why not just do the ef4_nic_rev() check at
 the start?  Answer, from git log spelunking, is that when this code was
 shared with Siena, EFX_REV_SIENA_A0 supported IPv6 here.

Have a
Reviewed-By: Edward Cree <ecree.xilinx@gmail.com>
... but this patch could be followed-up with a simplification to put
	if (ef4_nic_rev(efx) < EF4_REV_FALCON_B0)
		return 0;
 before the switch and get rid of min_revision.
Falcon is long since end-of-life, so I don't have any NICs and can't run
 any tests, which maybe means the smart thing to do is just to leave well
 alone and not touch this code beyond your factoring.

*twitches with barely-suppressed urge to fix it anyway*
-ed

PS: I spent about two hours reading device documentation from 2008
 because I thought it said Falcon did 4-tuple hashing on UDP too.  For
 the record: the 'Falcon hash' was broken (in some unspecified way), so
 falcon_init_rx_cfg() selects the Toeplitz hash which does indeed only
 consume port numbers on these devices if protocol is TCP.  And I will
 never get that time back :/
Thread (15 messages) 15 messages, 4 authors, last reply 2025-06-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help