eth: migrate to new RXFH callbacks (get-only drivers)
Subsystems (8)
Jakub Kicinski
maintainerv2 cover eth: migrate to new RXFH callbacks (get-only drivers)
Migrate the drivers which only implement ETHTOOL_GRXFH to the recently added dedicated .get_rxfh_fields ethtool callback.
v2:
- fix enetc
- move the sfc falcon patch to later series in case I need to refactor
v1: https://lore.kernel.org/[email protected]
Jakub Kicinski (5):
eth: cisco: migrate to new RXFH callbacks
eth: cxgb4: migrate to new RXFH callbacks
eth: lan743x: migrate to new RXFH callbacks
eth: e1000e: migrate to new RXFH callbacks
eth: enetc: migrate to new RXFH callbacks
.../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 105 +++++++++--------- .../net/ethernet/cisco/enic/enic_ethtool.c | 8 +- .../ethernet/freescale/enetc/enetc_ethtool.c | 11 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 77 ++++++------- .../net/ethernet/microchip/lan743x_ethtool.c | 31 ++++-- 5 files changed, 118 insertions(+), 114 deletions(-)
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 1/5 eth: cisco: 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 trivial.
--- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/cisco/enic/enic_ethtool.c +4 -4
@@ -528,8 +528,10 @@ static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd)return 0 ; } -static int enic_get_rx_flow_hash (struct enic *enic,struct ethtool_rxnfc *cmd) +static int enic_get_rx_flow_hash (struct net_device *dev, +struct ethtool_rxfh_fields *cmd) { +struct enic *enic =netdev_priv (dev);u8 rss_hash_type =0 ; cmd->data =0 ;
@@ -597,9 +599,6 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, ret =enic_grxclsrule (enic, cmd);spin_unlock_bh (&enic->rfs_h.lock);break ; -case ETHTOOL_GRXFH : - ret =enic_get_rx_flow_hash (enic, cmd); -break ;default : ret = -EOPNOTSUPP ;break ;
@@ -693,6 +692,7 @@ static const struct ethtool_ops enic_ethtool_ops = { .get_rxfh_key_size = enic_get_rxfh_key_size, .get_rxfh = enic_get_rxfh, .set_rxfh = enic_set_rxfh, + .get_rxfh_fields = enic_get_rx_flow_hash, .get_link_ksettings = enic_get_ksettings, .get_ts_info = enic_get_ts_info, .get_channels = enic_get_channels,
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 2/5 eth: cxgb4: migrate to new RXFH callbacks
In reply to Jakub KicinskiMigrate 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.
--- .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 105 +++++++++--------- 1 file changed, 55 insertions(+), 50 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +55 -50
@@ -1730,6 +1730,60 @@ static int cxgb4_ntuple_get_filter(struct net_device *dev,return 0 ; } +static int cxgb4_get_rxfh_fields (struct net_device *dev, +struct ethtool_rxfh_fields *info) +{ +const struct port_info *pi =netdev_priv (dev); +unsigned int v = pi->rss_mode; + + info->data =0 ; +switch (info->flow_type) { +case TCP_V4_FLOW : +if (v &FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST | +RXH_L4_B_0_1 |RXH_L4_B_2_3 ; +else if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; +case UDP_V4_FLOW : +if ((v &FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F ) && + (v &FW_RSS_VI_CONFIG_CMD_UDPEN_F )) + info->data =RXH_IP_SRC |RXH_IP_DST | +RXH_L4_B_0_1 |RXH_L4_B_2_3 ; +else if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; +case SCTP_V4_FLOW : +case AH_ESP_V4_FLOW : +case IPV4_FLOW : +if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; +case TCP_V6_FLOW : +if (v &FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST | +RXH_L4_B_0_1 |RXH_L4_B_2_3 ; +else if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; +case UDP_V6_FLOW : +if ((v &FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F ) && + (v &FW_RSS_VI_CONFIG_CMD_UDPEN_F )) + info->data =RXH_IP_SRC |RXH_IP_DST | +RXH_L4_B_0_1 |RXH_L4_B_2_3 ; +else if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; +case SCTP_V6_FLOW : +case AH_ESP_V6_FLOW : +case IPV6_FLOW : +if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) + info->data =RXH_IP_SRC |RXH_IP_DST ; +break ; + } +return 0 ; +} +static int get_rxnfc (struct net_device *dev,struct ethtool_rxnfc *info,u32 *rules) {
@@ -1739,56 +1793,6 @@ static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,int ret =0 ;switch (info->cmd) { -case ETHTOOL_GRXFH : { -unsigned int v = pi->rss_mode; - - info->data =0 ; -switch (info->flow_type) { -case TCP_V4_FLOW : -if (v &FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST | -RXH_L4_B_0_1 |RXH_L4_B_2_3 ; -else if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; -case UDP_V4_FLOW : -if ((v &FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN_F ) && - (v &FW_RSS_VI_CONFIG_CMD_UDPEN_F )) - info->data =RXH_IP_SRC |RXH_IP_DST | -RXH_L4_B_0_1 |RXH_L4_B_2_3 ; -else if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; -case SCTP_V4_FLOW : -case AH_ESP_V4_FLOW : -case IPV4_FLOW : -if (v &FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; -case TCP_V6_FLOW : -if (v &FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST | -RXH_L4_B_0_1 |RXH_L4_B_2_3 ; -else if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; -case UDP_V6_FLOW : -if ((v &FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN_F ) && - (v &FW_RSS_VI_CONFIG_CMD_UDPEN_F )) - info->data =RXH_IP_SRC |RXH_IP_DST | -RXH_L4_B_0_1 |RXH_L4_B_2_3 ; -else if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; -case SCTP_V6_FLOW : -case AH_ESP_V6_FLOW : -case IPV6_FLOW : -if (v &FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN_F ) - info->data =RXH_IP_SRC |RXH_IP_DST ; -break ; - } -return 0 ; - }case ETHTOOL_GRXRINGS : info->data = pi->nqsets;return 0 ;
@@ -2199,6 +2203,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = { .get_rxfh_indir_size = get_rss_table_size, .get_rxfh = get_rss_table, .set_rxfh = set_rss_table, + .get_rxfh_fields = cxgb4_get_rxfh_fields, .self_test = cxgb4_self_test, .flash_device = set_flash, .get_ts_info = get_ts_info,
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 3/5 eth: lan743x: migrate to new RXFH callbacks
In reply to Jakub KicinskiMigrate 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/microchip/lan743x_ethtool.c | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/net/ethernet/microchip/lan743x_ethtool.c +19 -12
@@ -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,
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 4/5 eth: e1000e: migrate to new RXFH callbacks
In reply to Jakub KicinskiMigrate 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.
--- drivers/net/ethernet/intel/e1000e/ethtool.c | 77 ++++++++++----------- 1 file changed, 35 insertions(+), 42 deletions(-)
drivers/net/ethernet/intel/e1000e/ethtool.c +35 -42
@@ -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) { +struct e1000_adapter *adapter =netdev_priv (netdev); +struct e1000_hw *hw = &adapter->hw; +u32 mrqc; + info->data =0 ; -switch (info->cmd) { -case ETHTOOL_GRXFH : { -struct e1000_adapter *adapter =netdev_priv (netdev); -struct e1000_hw *hw = &adapter->hw; -u32 mrqc; + 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,
Signature · 1 line
2.49.0
Re: [PATCH net-next v2 4/5] eth: e1000e: migrate to new RXFH callbacks
Quoted 7 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 and it's the onlyget_rxnfcsub-command the driver supports. So convert theget_rxnfchandler into aget_rxfh_fieldshandler.Reviewed-by Joe Damato <[email protected]>
Quoted 1 line
Signed-off-by Jakub Kicinski <[email protected]>
Jakub Kicinski
maintainerPATCH v2 5/5 eth: enetc: migrate to new RXFH callbacks
In reply to Jakub KicinskiMigrate 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 trivial.
---
v2:
- add get_rxfh_fields to enetc4_pf_ethtool_ops
v1: https://lore.kernel.org/[email protected]
--- drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +5 -6
@@ -467,7 +467,8 @@ static void enetc_get_rmon_stats(struct net_device *ndev,#define ENETC_RSSHASH_L3 (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO | RXH_IP_SRC | \ RXH_IP_DST)#define ENETC_RSSHASH_L4 (ENETC_RSSHASH_L3 | RXH_L4_B_0_1 | RXH_L4_B_2_3) -static int enetc_get_rsshash (struct ethtool_rxnfc *rxnfc) +static int enetc_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *rxnfc) {static const u32 rsshash[] = { [TCP_V4_FLOW ] =ENETC_RSSHASH_L4 ,
@@ -584,9 +585,6 @@ static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc,case ETHTOOL_GRXRINGS : rxnfc->data = priv->num_rx_rings;break ; -case ETHTOOL_GRXFH : -/* get RSS hash config */ -return enetc_get_rsshash (rxnfc);case ETHTOOL_GRXCLSRLCNT :/* total number of entries */ rxnfc->data = priv->si->num_fs_entries;
@@ -639,8 +637,6 @@ static int enetc4_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfccase ETHTOOL_GRXRINGS : rxnfc->data = priv->num_rx_rings;break ; -case ETHTOOL_GRXFH : -return enetc_get_rsshash (rxnfc);default :return -EOPNOTSUPP ; }
@@ -1228,6 +1224,7 @@ const struct ethtool_ops enetc_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce,
@@ -1258,6 +1255,7 @@ const struct ethtool_ops enetc_vf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, .get_ringparam = enetc_get_ringparam, .get_coalesce = enetc_get_coalesce, .set_coalesce = enetc_set_coalesce,
@@ -1284,6 +1282,7 @@ const struct ethtool_ops enetc4_pf_ethtool_ops = { .get_rxfh_indir_size = enetc_get_rxfh_indir_size, .get_rxfh = enetc_get_rxfh, .set_rxfh = enetc_set_rxfh, + .get_rxfh_fields = enetc_get_rxfh_fields, };void enetc_set_ethtool_ops (struct net_device *ndev)
Signature · 1 line
2.49.0
Re: [PATCH net-next v2 5/5] eth: enetc: migrate to new RXFH callbacks
Quoted 5 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 trivial.
Quoted 9 lines
Signed-off-by Jakub Kicinski <[email protected]>---
v2:
- addget_rxfh_fieldstoenetc4_pf_ethtool_ops
v1: https://lore.kernel.org/[email protected]--- drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
RE: [PATCH net-next v2 5/5] eth: enetc: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 9 lines
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 trivial.Signed-off-by Jakub Kicinski <[email protected]>---
v2:
- addget_rxfh_fieldstoenetc4_pf_ethtool_ops
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Sat, 14 Jun 2025 11:06:33 -0700 you wrote:
Migrate the drivers which only implement
ETHTOOL_GRXFHto the recently added dedicated .get_rxfh_fields ethtool callback.v2:
- fix enetc
- move the sfc falcon patch to later series in case I need to refactor
v1: https://lore.kernel.org/[email protected][...]
Here is the summary with links:
- [net-next,v2,1/5] eth: cisco: migrate to new RXFH callbacks
https://git.kernel.org/netdev/net-next/c/b4512e36ec9e - [net-next,v2,2/5] eth: cxgb4: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/8d90593fd539 - [net-next,v2,3/5] eth: lan743x: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/a689e2300e17 - [net-next,v2,4/5] eth: e1000e: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/b8379a59b282 - [net-next,v2,5/5] eth: enetc: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/9a9f7ce8cb77
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html