eth: migrate to new RXFH callbacks (get-only drivres)
Subsystems (9)
Jakub Kicinski
maintainercover eth: migrate to new RXFH callbacks (get-only drivres)
Migrate the drivers which only implement ETHTOOL_GRXFH to the recently added dedicated .get_rxfh_fields ethtool callback.
Jakub Kicinski (6):
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
eth: sfc: falcon: 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 | 10 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 77 ++++++------- .../net/ethernet/microchip/lan743x_ethtool.c | 31 ++++-- drivers/net/ethernet/sfc/falcon/ethtool.c | 51 +++++---- 6 files changed, 145 insertions(+), 137 deletions(-)
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH 1/6 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 2/6 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 3/6 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 4/6 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
Jakub Kicinski
maintainerPATCH 5/6 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.
--- drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +4 -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,
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH 6/6 eth: sfc: falcon: 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.
--- drivers/net/ethernet/sfc/falcon/ethtool.c | 51 +++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-)
drivers/net/ethernet/sfc/falcon/ethtool.c +28 -23
@@ -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
Wei Fang
maintainerRE: [PATCH net-next 5/6] eth: enetc: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 9 lines
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +1
-0@@ -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,
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c const struct ethtool_ops enetc_vf_ethtool_ops = {
Quoted 8 lines
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +1
-1@@ -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, --
Hi Jakub,
The .get_rxfh_fields callback also needs to added to enetc4_pf_ethtool_ops.
Re: [PATCH net-next 1/6] eth: cisco: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 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 trivial.Signed-off-by Jakub Kicinski <[email protected]>--- drivers/net/ethernet/cisco/enic/enic_ethtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Re: [PATCH net-next 2/6] eth: cxgb4: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 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.Signed-off-by Jakub Kicinski <[email protected]>--- .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 105 +++++++++--------- 1 file changed, 55 insertions(+), 50 deletions(-)
Re: [PATCH net-next 3/6] eth: lan743x: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 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.Signed-off-by Jakub Kicinski <[email protected]>--- .../net/ethernet/microchip/lan743x_ethtool.c | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-)
Re: [PATCH net-next 4/6] eth: e1000e: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 10 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.Signed-off-by Jakub Kicinski <[email protected]>--- drivers/net/ethernet/intel/e1000e/ethtool.c | 77 ++++++++++----------- 1 file changed, 35 insertions(+), 42 deletions(-)
Re: [PATCH net-next 6/6] eth: sfc: falcon: migrate to new RXFH callbacks
In reply to Jakub KicinskiQuoted 33 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.Signed-off-by Jakub Kicinski <[email protected]>--- drivers/net/ethernet/sfc/falcon/ethtool.c | 51 +++++++++++++---------- 1 file changed, 28 insertions(+), 23 deletions(-)drivers/net/ethernet/sfc/falcon/ethtool.c +15
-0@@ -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 :
drivers/net/ethernet/sfc/falcon/ethtool.c static int ef4_ethtool_get_class_rule(struct ef4_nic *efx, · line 970
Quoted 10 lines
drivers/net/ethernet/sfc/falcon/ethtool.c +10
-0+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
... 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 :/
Jakub Kicinski
maintainerRe: [PATCH net-next 6/6] eth: sfc: falcon: migrate to new RXFH callbacks
Quoted 5 lines · On Fri, 13 Jun 2025 14:44:40 +0100 Edward Cree wrote:
So granted that you're only moving code, but looking at this it doesn't
actually make sense, since every path that setsinfo->datato nonzero also setsmin_revision, so why not just do theef4_nic_rev()check at the start? Answer, from git log spelunking, is that when this code was shared with Siena,EFX_REV_SIENA_A0supported IPv6 here.
Ack, I was tempted to clean this up, but it felt slightly outside of the objective. Looks like I need to respin for enetc - I can change it in v2 if you'd like?
Quoted 13 lines
Have a
Reviewed-by Edward Cree <[email protected]>... 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
Quoted 6 lines
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), sofalcon_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 :/
:D
Edward Cree
maintainerRe: [PATCH net-next 6/6] eth: sfc: falcon: migrate to new RXFH callbacks
Quoted 10 lines · Jakub Kicinski
Quoted 5 lines · On Fri, 13 Jun 2025 14:44:40 +0100 Edward Cree wrote:
So granted that you're only moving code, but looking at this it doesn't
actually make sense, since every path that setsinfo->datato nonzero also setsmin_revision, so why not just do theef4_nic_rev()check at the start? Answer, from git log spelunking, is that when this code was shared with Siena,EFX_REV_SIENA_A0supported IPv6 here.Ack, I was tempted to clean this up, but it felt slightly outside of the objective. Looks like I need to respin for enetc - I can change it in v2 if you'd like?
I'd say just keep your patch as is, then I'll send a follow-up that does
the refactor and also adds a comment about why the hashing config is what it is.