From a689e2300e17f1ef6a31ed2f249cb794beee343a Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Sat, 14 Jun 2025 11:06:36 -0700 Subject: [PATCH] eth: lan743x: 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. Reviewed-by: Joe Damato Link: https://patch.msgid.link/20250614180638.4166766-4-kuba@kernel.org Signed-off-by: Jakub Kicinski --- .../net/ethernet/microchip/lan743x_ethtool.c | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c index 64a3b953cc175..40002d9fe2749 100644 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c @@ -913,23 +913,29 @@ static int lan743x_ethtool_get_sset_count(struct net_device *netdev, int sset) } } +static int lan743x_ethtool_get_rxfh_fields(struct net_device *netdev, + struct ethtool_rxfh_fields *fields) +{ + fields->data = 0; + + switch (fields->flow_type) { + case TCP_V4_FLOW:case UDP_V4_FLOW: + case TCP_V6_FLOW:case UDP_V6_FLOW: + fields->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; + fallthrough; + case IPV4_FLOW: case IPV6_FLOW: + fields->data |= RXH_IP_SRC | RXH_IP_DST; + return 0; + } + + return 0; +} + static int lan743x_ethtool_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *rxnfc, u32 *rule_locs) { switch (rxnfc->cmd) { - case ETHTOOL_GRXFH: - rxnfc->data = 0; - switch (rxnfc->flow_type) { - case TCP_V4_FLOW:case UDP_V4_FLOW: - case TCP_V6_FLOW:case UDP_V6_FLOW: - rxnfc->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; - fallthrough; - case IPV4_FLOW: case IPV6_FLOW: - rxnfc->data |= RXH_IP_SRC | RXH_IP_DST; - return 0; - } - break; case ETHTOOL_GRXRINGS: rxnfc->data = LAN743X_USED_RX_CHANNELS; return 0; @@ -1368,6 +1374,7 @@ const struct ethtool_ops lan743x_ethtool_ops = { .get_rxfh_indir_size = lan743x_ethtool_get_rxfh_indir_size, .get_rxfh = lan743x_ethtool_get_rxfh, .set_rxfh = lan743x_ethtool_set_rxfh, + .get_rxfh_fields = lan743x_ethtool_get_rxfh_fields, .get_ts_info = lan743x_ethtool_get_ts_info, .get_eee = lan743x_ethtool_get_eee, .set_eee = lan743x_ethtool_set_eee, -- 2.47.2