eth: finish migration to the new RXFH callbacks
Subsystems (12)
Jakub Kicinski
maintainercover eth: finish migration to the new RXFH callbacks
Finish drivers conversions to callbacks added by
commit 9bb00786fc61 ("net: ethtool: add dedicated callbacks for getting and setting rxfh fields"). Remove the conditional calling in the core, rxnfc callbacks are no longer used for RXFH.
Jakub Kicinski (10):
eth: sfc: falcon: migrate to new RXFH callbacks
eth: sfc: siena: migrate to new RXFH callbacks
eth: sfc: migrate to new RXFH callbacks
eth: benet: migrate to new RXFH callbacks
eth: qede: migrate to new RXFH callbacks
eth: mlx5: migrate to new RXFH callbacks
eth: nfp: migrate to new RXFH callbacks
eth: hinic: migrate to new RXFH callbacks
eth: hns3: migrate to new RXFH callbacks
net: ethtool: don't mux RXFH via rxnfc callbacks
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 +- .../hns3/hns3_common/hclge_comm_rss.h | 4 +- .../mellanox/mlx5/core/en/fs_ethtool.h | 14 +++ drivers/net/ethernet/sfc/ethtool_common.h | 2 + .../net/ethernet/sfc/siena/ethtool_common.h | 2 + .../net/ethernet/emulex/benet/be_ethtool.c | 57 +++++----- .../hns3/hns3_common/hclge_comm_rss.c | 6 +- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 33 ++++-- .../hisilicon/hns3/hns3pf/hclge_main.c | 4 +- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +- .../net/ethernet/huawei/hinic/hinic_ethtool.c | 47 +++----- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 19 ++++ .../mellanox/mlx5/core/en_fs_ethtool.c | 25 ++--- .../mellanox/mlx5/core/ipoib/ethtool.c | 19 ++++ .../ethernet/netronome/nfp/nfp_net_ethtool.c | 17 +-- .../net/ethernet/qlogic/qede/qede_ethtool.c | 22 ++-- 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 | 77 ++++++------- net/ethtool/ioctl.c | 59 +++------- 22 files changed, 308 insertions(+), 264 deletions(-)
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH 1/10 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
@@ -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
Jakub Kicinski
maintainerPATCH 2/10 eth: sfc: siena: 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.
---
v2:
- fix typo in the subject
v1: https://lore.kernel.org/[email protected]
--- .../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
@@ -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
@@ -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
Jakub Kicinski
maintainerPATCH 3/10 eth: sfc: 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. One thing of note that this is one of the two drivers which pays attention to rss_context.
---
v2:
- s/s32 rc/int rc/
v1: https://lore.kernel.org/[email protected]
--- 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
@@ -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
@@ -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
Jakub Kicinski
maintainerPATCH 4/10 eth: benet: 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").
The driver has no other RXNFC functionality so the SET callback can be now removed.
--- .../net/ethernet/emulex/benet/be_ethtool.c | 57 +++++++++---------- 1 file changed, 26 insertions(+), 31 deletions(-)
drivers/net/ethernet/emulex/benet/be_ethtool.c +26 -31
@@ -1073,10 +1073,19 @@ static void be_set_msg_level(struct net_device *netdev, u32 level) adapter->msg_enable = level; } -static u64 be_get_rss_hash_opts (struct be_adapter *adapter,u64 flow_type) +static int be_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *cmd) { +struct be_adapter *adapter =netdev_priv (netdev); +u64 flow_type = cmd->flow_type;u64 data =0 ; +if (!be_multi_rxq (adapter)) { +dev_info (&adapter->pdev->dev, +"ethtool::get_rxfh: RX flow hashing is disabled\n" ); +return -EINVAL ; + } +switch (flow_type) {case TCP_V4_FLOW :if (adapter->rss_info.rss_flags &RSS_ENABLE_IPV4 )
@@ -1104,7 +1113,8 @@ static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type)break ; } -return data; + cmd->data = data; +return 0 ; } static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
@@ -1119,9 +1129,6 @@ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, }switch (cmd->cmd) { -case ETHTOOL_GRXFH : - cmd->data =be_get_rss_hash_opts (adapter, cmd->flow_type); -break ;case ETHTOOL_GRXRINGS : cmd->data = adapter->num_rx_qs;break ;
@@ -1132,11 +1139,20 @@ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,return 0 ; } -static int be_set_rss_hash_opts (struct be_adapter *adapter, -struct ethtool_rxnfc *cmd) + +static int be_set_rxfh_fields (struct net_device *netdev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) { -int status; +struct be_adapter *adapter =netdev_priv (netdev);u32 rss_flags = adapter->rss_info.rss_flags; +int status; + +if (!be_multi_rxq (adapter)) { +dev_err (&adapter->pdev->dev, +"ethtool::set_rxfh: RX flow hashing is disabled\n" ); +return -EINVAL ; + }if (cmd->data !=L3_RSS_FLAGS && cmd->data != (L3_RSS_FLAGS |L4_RSS_FLAGS ))
@@ -1195,28 +1211,6 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter,return be_cmd_status (status); } -static int be_set_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd) -{ -struct be_adapter *adapter =netdev_priv (netdev); -int status =0 ; - -if (!be_multi_rxq (adapter)) { -dev_err (&adapter->pdev->dev, -"ethtool::set_rxnfc: RX flow hashing is disabled\n" ); -return -EINVAL ; - } - -switch (cmd->cmd) { -case ETHTOOL_SRXFH : - status =be_set_rss_hash_opts (adapter, cmd); -break ; -default : -return -EINVAL ; - } - -return status; -} -static void be_get_channels (struct net_device *netdev,struct ethtool_channels *ch) {
@@ -1449,7 +1443,8 @@ const struct ethtool_ops be_ethtool_ops = { .flash_device = be_do_flash, .self_test = be_self_test, .get_rxnfc = be_get_rxnfc, - .set_rxnfc = be_set_rxnfc, + .get_rxfh_fields = be_get_rxfh_fields, + .set_rxfh_fields = be_set_rxfh_fields, .get_rxfh_indir_size = be_get_rxfh_indir_size, .get_rxfh_key_size = be_get_rxfh_key_size, .get_rxfh = be_get_rxfh,
Signature · 1 line
2.49.0
Re: [PATCH net-next 04/10] eth: benet: 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").The driver has no other RXNFC functionality so the SET callback can be now removed.
Signed-off-by Jakub Kicinski <[email protected]>
...
drivers/net/ethernet/emulex/benet/be_ethtool.c static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, · line 1142
Quoted 7 lines
drivers/net/ethernet/emulex/benet/be_ethtool.c +1
-2@@ -1132,11 +1139,20 @@ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,return 0 ; } -static int be_set_rss_hash_opts (struct be_adapter *adapter, -struct ethtool_rxnfc *cmd) +
super nit: there are two consecutive blank lines are here now
Quoted 17 lines
drivers/net/ethernet/emulex/benet/be_ethtool.c +11
-1+static int be_set_rxfh_fields (struct net_device *netdev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) { -int status; +struct be_adapter *adapter =netdev_priv (netdev);u32 rss_flags = adapter->rss_info.rss_flags; +int status; + +if (!be_multi_rxq (adapter)) { +dev_err (&adapter->pdev->dev, +"ethtool::set_rxfh: RX flow hashing is disabled\n" ); +return -EINVAL ; + }if (cmd->data !=L3_RSS_FLAGS && cmd->data != (L3_RSS_FLAGS |L4_RSS_FLAGS ))
Jakub Kicinski
maintainerRe: [PATCH net-next 04/10] eth: benet: migrate to new RXFH callbacks
Quoted 5 lines · On Fri, 20 Jun 2025 10:48:52 +0100 Simon Horman wrote:
drivers/net/ethernet/emulex/benet/be_ethtool.c static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, · line 1142
Quoted 3 lines
drivers/net/ethernet/emulex/benet/be_ethtool.c +1
-2-static int be_set_rss_hash_opts (struct be_adapter *adapter, -struct ethtool_rxnfc *cmd) +super nit: there are two consecutive blank lines are here now
Fixed when applying, thanks for catching!
Jakub Kicinski
maintainerPATCH 5/10 eth: qede: 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").
--- .../net/ethernet/qlogic/qede/qede_ethtool.c | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_ethtool.c +13 -9
@@ -1168,8 +1168,11 @@ static int qede_set_phys_id(struct net_device *dev,return 0 ; } -static int qede_get_rss_flags (struct qede_dev *edev,struct ethtool_rxnfc *info) +static int qede_get_rxfh_fields (struct net_device *dev, +struct ethtool_rxfh_fields *info) { +struct qede_dev *edev =netdev_priv (dev); + info->data =RXH_IP_SRC |RXH_IP_DST ;switch (info->flow_type) {
@@ -1206,9 +1209,6 @@ static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,case ETHTOOL_GRXRINGS : info->data =QEDE_RSS_COUNT (edev);break ; -case ETHTOOL_GRXFH : - rc =qede_get_rss_flags (edev, info); -break ;case ETHTOOL_GRXCLSRLCNT : info->rule_cnt =qede_get_arfs_filter_count (edev); info->data =QEDE_RFS_MAX_FLTR ;
@@ -1227,14 +1227,17 @@ static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,return rc; } -static int qede_set_rss_flags (struct qede_dev *edev,struct ethtool_rxnfc *info) +static int qede_set_rxfh_fields (struct net_device *dev, +const struct ethtool_rxfh_fields *info, +struct netlink_ext_ack *extack) {struct qed_update_vport_params *vport_update_params; +struct qede_dev *edev =netdev_priv (dev);u8 set_caps =0 , clr_caps =0 ;int rc =0 ;DP_VERBOSE (edev,QED_MSG_DEBUG , -"Set rss flags command parameters: flow type = %d, data = %llu\n" , +"Set rss flags command parameters: flow type = %d, data = %u\n" , info->flow_type, info->data);switch (info->flow_type) {
@@ -1337,9 +1340,6 @@ static int qede_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)int rc;switch (info->cmd) { -case ETHTOOL_SRXFH : - rc =qede_set_rss_flags (edev, info); -break ;case ETHTOOL_SRXCLSRLINS : rc =qede_add_cls_rule (edev, info);break ;
@@ -2293,6 +2293,8 @@ static const struct ethtool_ops qede_ethtool_ops = { .get_rxfh_key_size = qede_get_rxfh_key_size, .get_rxfh = qede_get_rxfh, .set_rxfh = qede_set_rxfh, + .get_rxfh_fields = qede_get_rxfh_fields, + .set_rxfh_fields = qede_set_rxfh_fields, .get_ts_info = qede_get_ts_info, .get_channels = qede_get_channels, .set_channels = qede_set_channels,
@@ -2335,6 +2337,8 @@ static const struct ethtool_ops qede_vf_ethtool_ops = { .get_rxfh_key_size = qede_get_rxfh_key_size, .get_rxfh = qede_get_rxfh, .set_rxfh = qede_set_rxfh, + .get_rxfh_fields = qede_get_rxfh_fields, + .set_rxfh_fields = qede_set_rxfh_fields, .get_channels = qede_get_channels, .set_channels = qede_set_channels, .get_per_queue_coalesce = qede_get_per_coalesce,
Signature · 1 line
2.49.0
Re: [PATCH net-next 05/10] eth: qede: migrate to new RXFH callbacks
Quoted 4 lines · Jakub Kicinski
Migrate to new callbacks added by commit
9bb00786fc61("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").Signed-off-by Jakub Kicinski <[email protected]>
Jakub Kicinski
maintainerPATCH 6/10 eth: mlx5: 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").
--- .../mellanox/mlx5/core/en/fs_ethtool.h | 14 +++++++++++ .../ethernet/mellanox/mlx5/core/en_ethtool.c | 19 ++++++++++++++ .../mellanox/mlx5/core/en_fs_ethtool.c | 25 +++++++------------ .../mellanox/mlx5/core/ipoib/ethtool.c | 19 ++++++++++++++ 4 files changed, 61 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs_ethtool.h +14 -0
@@ -11,6 +11,11 @@ int mlx5e_ethtool_alloc(struct mlx5e_ethtool_steering **ethtool);void mlx5e_ethtool_free (struct mlx5e_ethtool_steering *ethtool);void mlx5e_ethtool_init_steering (struct mlx5e_flow_steering *fs);void mlx5e_ethtool_cleanup_steering (struct mlx5e_flow_steering *fs); +int mlx5e_ethtool_set_rxfh_fields (struct mlx5e_priv *priv, +const struct ethtool_rxfh_fields *nfc, +struct netlink_ext_ack *extack); +int mlx5e_ethtool_get_rxfh_fields (struct mlx5e_priv *priv, +struct ethtool_rxfh_fields *nfc);int mlx5e_ethtool_set_rxnfc (struct mlx5e_priv *priv,struct ethtool_rxnfc *cmd);int mlx5e_ethtool_get_rxnfc (struct mlx5e_priv *priv,struct ethtool_rxnfc *info,u32 *rule_locs);
@@ -20,6 +25,15 @@ static inline int mlx5e_ethtool_alloc(struct mlx5e_ethtool_steering **ethtool)static inline void mlx5e_ethtool_free (struct mlx5e_ethtool_steering *ethtool) { }static inline void mlx5e_ethtool_init_steering (struct mlx5e_flow_steering *fs) { }static inline void mlx5e_ethtool_cleanup_steering (struct mlx5e_flow_steering *fs) { } +static inline int +mlx5e_ethtool_set_rxfh_fields (struct mlx5e_priv *priv, +const struct ethtool_rxfh_fields *nfc, +struct netlink_ext_ack *extack) +{return -EOPNOTSUPP ; } +static inline int +mlx5e_ethtool_get_rxfh_fields (struct mlx5e_priv *priv, +struct ethtool_rxfh_fields *nfc) +{return -EOPNOTSUPP ; }static inline int mlx5e_ethtool_set_rxnfc (struct mlx5e_priv *priv,struct ethtool_rxnfc *cmd) {return -EOPNOTSUPP ; } static inline int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +19 -0
@@ -2399,6 +2399,23 @@ static u32 mlx5e_get_priv_flags(struct net_device *netdev)return priv->channels.params.pflags; } +static int mlx5e_get_rxfh_fields (struct net_device *dev, +struct ethtool_rxfh_fields *info) +{ +struct mlx5e_priv *priv =netdev_priv (dev); + +return mlx5e_ethtool_get_rxfh_fields (priv, info); +} + +static int mlx5e_set_rxfh_fields (struct net_device *dev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) +{ +struct mlx5e_priv *priv =netdev_priv (dev); + +return mlx5e_ethtool_set_rxfh_fields (priv, cmd, extack); +} +static int mlx5e_get_rxnfc (struct net_device *dev,struct ethtool_rxnfc *info,u32 *rule_locs) {
@@ -2666,6 +2683,8 @@ const struct ethtool_ops mlx5e_ethtool_ops = { .get_rxfh_indir_size = mlx5e_get_rxfh_indir_size, .get_rxfh = mlx5e_get_rxfh, .set_rxfh = mlx5e_set_rxfh, + .get_rxfh_fields = mlx5e_get_rxfh_fields, + .set_rxfh_fields = mlx5e_set_rxfh_fields, .get_rxnfc = mlx5e_get_rxnfc, .set_rxnfc = mlx5e_set_rxnfc, .get_tunable = mlx5e_get_tunable,
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +9 -16
@@ -894,17 +894,17 @@ static int flow_type_to_traffic_type(u32 flow_type) } } -static int mlx5e_set_rss_hash_opt (struct mlx5e_priv *priv, -struct ethtool_rxnfc *nfc) +int mlx5e_ethtool_set_rxfh_fields (struct mlx5e_priv *priv, +const struct ethtool_rxfh_fields *nfc, +struct netlink_ext_ack *extack) {u8 rx_hash_field =0 ;u32 flow_type =0 ; -u32 rss_idx =0 ; +u32 rss_idx;int err;int tt; -if (nfc->flow_type &FLOW_RSS ) - rss_idx = nfc->rss_context; + rss_idx = nfc->rss_context; flow_type =flow_type_mask (nfc->flow_type); tt =flow_type_to_traffic_type (flow_type);
@@ -941,16 +941,15 @@ static int mlx5e_set_rss_hash_opt(struct mlx5e_priv *priv,return err; } -static int mlx5e_get_rss_hash_opt (struct mlx5e_priv *priv, -struct ethtool_rxnfc *nfc) +int mlx5e_ethtool_get_rxfh_fields (struct mlx5e_priv *priv, +struct ethtool_rxfh_fields *nfc) {int hash_field =0 ;u32 flow_type =0 ; -u32 rss_idx =0 ; +u32 rss_idx;int tt; -if (nfc->flow_type &FLOW_RSS ) - rss_idx = nfc->rss_context; + rss_idx = nfc->rss_context; flow_type =flow_type_mask (nfc->flow_type); tt =flow_type_to_traffic_type (flow_type);
@@ -986,9 +985,6 @@ int mlx5e_ethtool_set_rxnfc(struct mlx5e_priv *priv, struct ethtool_rxnfc *cmd)case ETHTOOL_SRXCLSRLDEL : err =mlx5e_ethtool_flow_remove (priv, cmd->fs.location);break ; -case ETHTOOL_SRXFH : - err =mlx5e_set_rss_hash_opt (priv, cmd); -break ;default : err = -EOPNOTSUPP ;break ;
@@ -1013,9 +1009,6 @@ int mlx5e_ethtool_get_rxnfc(struct mlx5e_priv *priv,case ETHTOOL_GRXCLSRLALL : err =mlx5e_ethtool_get_all_flows (priv, info, rule_locs);break ; -case ETHTOOL_GRXFH : - err =mlx5e_get_rss_hash_opt (priv, info); -break ;default : err = -EOPNOTSUPP ;break ;
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +19 -0
@@ -238,6 +238,23 @@ static u32 mlx5i_flow_type_mask(u32 flow_type)return flow_type & ~(FLOW_EXT |FLOW_MAC_EXT |FLOW_RSS ); } +static int mlx5i_set_rxfh_fields (struct net_device *dev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) +{ +struct mlx5e_priv *priv =mlx5i_epriv (dev); + +return mlx5e_ethtool_set_rxfh_fields (priv, cmd, extack); +} + +static int mlx5i_get_rxfh_fields (struct net_device *dev, +struct ethtool_rxfh_fields *info) +{ +struct mlx5e_priv *priv =mlx5i_epriv (dev); + +return mlx5e_ethtool_get_rxfh_fields (priv, info); +} +static int mlx5i_set_rxnfc (struct net_device *dev,struct ethtool_rxnfc *cmd) {struct mlx5e_priv *priv =mlx5i_epriv (dev);
@@ -283,6 +300,8 @@ const struct ethtool_ops mlx5i_ethtool_ops = { .get_coalesce = mlx5i_get_coalesce, .set_coalesce = mlx5i_set_coalesce, .get_ts_info = mlx5i_get_ts_info, + .get_rxfh_fields = mlx5i_get_rxfh_fields, + .set_rxfh_fields = mlx5i_set_rxfh_fields, .get_rxnfc = mlx5i_get_rxnfc, .set_rxnfc = mlx5i_set_rxnfc, .get_link_ksettings = mlx5i_get_link_ksettings,
Signature · 1 line
2.49.0
Re: [PATCH net-next 06/10] eth: mlx5: migrate to new RXFH callbacks
Quoted 12 lines · Jakub Kicinski
Migrate to new callbacks added by commit
9bb00786fc61("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").Signed-off-by Jakub Kicinski <[email protected]>--- .../mellanox/mlx5/core/en/fs_ethtool.h | 14 +++++++++++ .../ethernet/mellanox/mlx5/core/en_ethtool.c | 19 ++++++++++++++ .../mellanox/mlx5/core/en_fs_ethtool.c | 25 +++++++------------ .../mellanox/mlx5/core/ipoib/ethtool.c | 19 ++++++++++++++ 4 files changed, 61 insertions(+), 16 deletions(-)
Thanks,
Dragos
Jakub Kicinski
maintainerPATCH 7/10 eth: nfp: 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").
--- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +9 -8
@@ -1303,9 +1303,10 @@ static u32 ethtool_flow_to_nfp_flag(u32 flow_type)return xlate_ethtool_to_nfp[flow_type]; } -static int nfp_net_get_rss_hash_opts (struct nfp_net *nn, -struct ethtool_rxnfc *cmd) +static int nfp_net_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *cmd) { +struct nfp_net *nn =netdev_priv (netdev);u32 nfp_rss_flag; cmd->data =0 ;
@@ -1451,16 +1452,16 @@ static int nfp_net_get_rxnfc(struct net_device *netdev,case ETHTOOL_GRXCLSRLALL : cmd->data =NFP_FS_MAX_ENTRY ;return nfp_net_get_fs_loc (nn, rule_locs); -case ETHTOOL_GRXFH : -return nfp_net_get_rss_hash_opts (nn, cmd);default :return -EOPNOTSUPP ; } } -static int nfp_net_set_rss_hash_opt (struct nfp_net *nn, -struct ethtool_rxnfc *nfc) +static int nfp_net_set_rxfh_fields (struct net_device *netdev, +const struct ethtool_rxfh_fields *nfc, +struct netlink_ext_ack *extack) { +struct nfp_net *nn =netdev_priv (netdev);u32 new_rss_cfg = nn->rss_cfg;u32 nfp_rss_flag;int err;
@@ -1763,8 +1764,6 @@ static int nfp_net_set_rxnfc(struct net_device *netdev,struct nfp_net *nn =netdev_priv (netdev);switch (cmd->cmd) { -case ETHTOOL_SRXFH : -return nfp_net_set_rss_hash_opt (nn, cmd);case ETHTOOL_SRXCLSRLINS :return nfp_net_fs_add (nn, cmd);case ETHTOOL_SRXCLSRLDEL :
@@ -2506,6 +2505,8 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { .get_rxfh_key_size = nfp_net_get_rxfh_key_size, .get_rxfh = nfp_net_get_rxfh, .set_rxfh = nfp_net_set_rxfh, + .get_rxfh_fields = nfp_net_get_rxfh_fields, + .set_rxfh_fields = nfp_net_set_rxfh_fields, .get_regs_len = nfp_net_get_regs_len, .get_regs = nfp_net_get_regs, .set_dump = nfp_app_set_dump,
Signature · 1 line
2.49.0
Re: [PATCH net-next 07/10] eth: nfp: migrate to new RXFH callbacks
Quoted 8 lines · Jakub Kicinski
Migrate to new callbacks added by commit
9bb00786fc61("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").Signed-off-by Jakub Kicinski <[email protected]>--- .../ethernet/netronome/nfp/nfp_net_ethtool.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
Jakub Kicinski
maintainerPATCH 8/10 eth: hinic: 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").
Zeroing data on SET is not necessary, the argument is not copied back to user space. The driver has no other RXNFC functionality so the SET callback can be now removed.
--- .../net/ethernet/huawei/hinic/hinic_ethtool.c | 47 +++++++------------ 1 file changed, 16 insertions(+), 31 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +16 -31
@@ -919,9 +919,10 @@ static int hinic_set_channels(struct net_device *netdev,return 0 ; } -static int hinic_get_rss_hash_opts (struct hinic_dev *nic_dev, -struct ethtool_rxnfc *cmd) +static int hinic_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *cmd) { +struct hinic_dev *nic_dev =netdev_priv (netdev);struct hinic_rss_type rss_type = {0 };int err;
@@ -964,7 +965,7 @@ static int hinic_get_rss_hash_opts(struct hinic_dev *nic_dev,return 0 ; } -static int set_l4_rss_hash_ops (struct ethtool_rxnfc *cmd, +static int set_l4_rss_hash_ops (const struct ethtool_rxfh_fields *cmd,struct hinic_rss_type *rss_type) {u8 rss_l4_en =0 ;
@@ -1000,16 +1001,18 @@ static int set_l4_rss_hash_ops(struct ethtool_rxnfc *cmd,return 0 ; } -static int hinic_set_rss_hash_opts (struct hinic_dev *nic_dev, -struct ethtool_rxnfc *cmd) +static int hinic_set_rxfh_fields (struct net_device *dev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) { -struct hinic_rss_type *rss_type = &nic_dev->rss_type; +struct hinic_dev *nic_dev =netdev_priv (dev); +struct hinic_rss_type *rss_type;int err; -if (!(nic_dev->flags &HINIC_RSS_ENABLE )) { - cmd->data =0 ; + rss_type = &nic_dev->rss_type; + +if (!(nic_dev->flags &HINIC_RSS_ENABLE ))return -EOPNOTSUPP ; - }/* RSS does not support anything other than hashing * to queues on src and dst IPs and ports
@@ -1108,26 +1111,6 @@ static int hinic_get_rxnfc(struct net_device *netdev,case ETHTOOL_GRXRINGS : cmd->data = nic_dev->num_qps;break ; -case ETHTOOL_GRXFH : - err =hinic_get_rss_hash_opts (nic_dev, cmd); -break ; -default : - err = -EOPNOTSUPP ; -break ; - } - -return err; -} - -static int hinic_set_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd) -{ -struct hinic_dev *nic_dev =netdev_priv (netdev); -int err =0 ; - -switch (cmd->cmd) { -case ETHTOOL_SRXFH : - err =hinic_set_rss_hash_opts (nic_dev, cmd); -break ;default : err = -EOPNOTSUPP ;break ;
@@ -1797,11 +1780,12 @@ static const struct ethtool_ops hinic_ethtool_ops = { .get_channels = hinic_get_channels, .set_channels = hinic_set_channels, .get_rxnfc = hinic_get_rxnfc, - .set_rxnfc = hinic_set_rxnfc, .get_rxfh_key_size = hinic_get_rxfh_key_size, .get_rxfh_indir_size = hinic_get_rxfh_indir_size, .get_rxfh = hinic_get_rxfh, .set_rxfh = hinic_set_rxfh, + .get_rxfh_fields = hinic_get_rxfh_fields, + .set_rxfh_fields = hinic_set_rxfh_fields, .get_sset_count = hinic_get_sset_count, .get_ethtool_stats = hinic_get_ethtool_stats, .get_strings = hinic_get_strings,
@@ -1829,11 +1813,12 @@ static const struct ethtool_ops hinicvf_ethtool_ops = { .get_channels = hinic_get_channels, .set_channels = hinic_set_channels, .get_rxnfc = hinic_get_rxnfc, - .set_rxnfc = hinic_set_rxnfc, .get_rxfh_key_size = hinic_get_rxfh_key_size, .get_rxfh_indir_size = hinic_get_rxfh_indir_size, .get_rxfh = hinic_get_rxfh, .set_rxfh = hinic_set_rxfh, + .get_rxfh_fields = hinic_get_rxfh_fields, + .set_rxfh_fields = hinic_set_rxfh_fields, .get_sset_count = hinic_get_sset_count, .get_ethtool_stats = hinic_get_ethtool_stats, .get_strings = hinic_get_strings,
Signature · 1 line
2.49.0
Re: [PATCH net-next 08/10] eth: hinic: migrate to new RXFH callbacks
Quoted 8 lines · Jakub Kicinski
Migrate to new callbacks added by commit
9bb00786fc61("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").Zeroing data on SET is not necessary, the argument is not copied back to user space. The driver has no other RXNFC functionality so the SET callback can be now removed.
Signed-off-by Jakub Kicinski <[email protected]>
Jakub Kicinski
maintainerPATCH 9/10 eth: hns3: 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 wins the award for most convoluted abstraction layers :/
--- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 +-- .../hns3/hns3_common/hclge_comm_rss.h | 4 +-- .../hns3/hns3_common/hclge_comm_rss.c | 6 ++-- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 33 ++++++++++++++----- .../hisilicon/hns3/hns3pf/hclge_main.c | 4 +-- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +-- 6 files changed, 36 insertions(+), 19 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hnae3.h +2 -2
@@ -690,9 +690,9 @@ struct hnae3_ae_ops {int (*set_rss)(struct hnae3_handle *handle,const u32 *indir,const u8 *key,const u8 hfunc);int (*set_rss_tuple)(struct hnae3_handle *handle, -struct ethtool_rxnfc *cmd); +const struct ethtool_rxfh_fields *cmd);int (*get_rss_tuple)(struct hnae3_handle *handle, -struct ethtool_rxnfc *cmd); +struct ethtool_rxfh_fields *cmd);int (*get_tc_size)(struct hnae3_handle *handle);
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.h +2 -2
@@ -108,7 +108,7 @@ void hclge_comm_get_rss_indir_tbl(struct hclge_comm_rss_cfg *rss_cfg,int hclge_comm_set_rss_algo_key (struct hclge_comm_hw *hw,const u8 hfunc,const u8 *key);int hclge_comm_init_rss_tuple_cmd (struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc, +const struct ethtool_rxfh_fields *nfc,struct hnae3_ae_dev *ae_dev,struct hclge_comm_rss_input_tuple_cmd *req);u64 hclge_comm_convert_rss_tuple (u8 tuple_sets);
@@ -129,5 +129,5 @@ int hclge_comm_set_rss_hash_key(struct hclge_comm_rss_cfg *rss_cfg,int hclge_comm_set_rss_tuple (struct hnae3_ae_dev *ae_dev,struct hclge_comm_hw *hw,struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc); +const struct ethtool_rxfh_fields *nfc);#endif
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c +3 -3
@@ -151,7 +151,7 @@ EXPORT_SYMBOL_GPL(hclge_comm_set_rss_hash_key);int hclge_comm_set_rss_tuple (struct hnae3_ae_dev *ae_dev,struct hclge_comm_hw *hw,struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclge_comm_rss_input_tuple_cmd *req;struct hclge_desc desc;
@@ -422,7 +422,7 @@ int hclge_comm_set_rss_algo_key(struct hclge_comm_hw *hw, const u8 hfunc, }EXPORT_SYMBOL_GPL (hclge_comm_set_rss_algo_key); -static u8 hclge_comm_get_rss_hash_bits (struct ethtool_rxnfc *nfc) +static u8 hclge_comm_get_rss_hash_bits (const struct ethtool_rxfh_fields *nfc) {u8 hash_sets = nfc->data &RXH_L4_B_0_1 ?HCLGE_COMM_S_PORT_BIT :0 ;
@@ -448,7 +448,7 @@ static u8 hclge_comm_get_rss_hash_bits(struct ethtool_rxnfc *nfc) }int hclge_comm_init_rss_tuple_cmd (struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc, +const struct ethtool_rxfh_fields *nfc,struct hnae3_ae_dev *ae_dev,struct hclge_comm_rss_input_tuple_cmd *req) {
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +25 -8
@@ -978,6 +978,16 @@ static int hns3_set_rss(struct net_device *netdev, rxfh->hfunc); } +static int hns3_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *cmd) +{ +struct hnae3_handle *h =hns3_get_handle (netdev); + +if (h->ae_algo->ops->get_rss_tuple) +return h->ae_algo->ops->get_rss_tuple (h, cmd); +return -EOPNOTSUPP ; +} +static int hns3_get_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd,u32 *rule_locs)
@@ -988,10 +998,6 @@ static int hns3_get_rxnfc(struct net_device *netdev,case ETHTOOL_GRXRINGS : cmd->data = h->kinfo.num_tqps;return 0 ; -case ETHTOOL_GRXFH : -if (h->ae_algo->ops->get_rss_tuple) -return h->ae_algo->ops->get_rss_tuple (h, cmd); -return -EOPNOTSUPP ;case ETHTOOL_GRXCLSRLCNT :if (h->ae_algo->ops->get_fd_rule_cnt)return h->ae_algo->ops->get_fd_rule_cnt (h, cmd);
@@ -1275,15 +1281,22 @@ static int hns3_set_ringparam(struct net_device *ndev,return ret; } +static int hns3_set_rxfh_fields (struct net_device *netdev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) +{ +struct hnae3_handle *h =hns3_get_handle (netdev); + +if (h->ae_algo->ops->set_rss_tuple) +return h->ae_algo->ops->set_rss_tuple (h, cmd); +return -EOPNOTSUPP ; +} +static int hns3_set_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd) {struct hnae3_handle *h =hns3_get_handle (netdev);switch (cmd->cmd) { -case ETHTOOL_SRXFH : -if (h->ae_algo->ops->set_rss_tuple) -return h->ae_algo->ops->set_rss_tuple (h, cmd); -return -EOPNOTSUPP ;case ETHTOOL_SRXCLSRLINS :if (h->ae_algo->ops->add_fd_entry)return h->ae_algo->ops->add_fd_entry (h, cmd);
@@ -2105,6 +2118,8 @@ static const struct ethtool_ops hns3vf_ethtool_ops = { .get_rxfh_indir_size = hns3_get_rss_indir_size, .get_rxfh = hns3_get_rss, .set_rxfh = hns3_set_rss, + .get_rxfh_fields = hns3_get_rxfh_fields, + .set_rxfh_fields = hns3_set_rxfh_fields, .get_link_ksettings = hns3_get_link_ksettings, .get_channels = hns3_get_channels, .set_channels = hns3_set_channels,
@@ -2142,6 +2157,8 @@ static const struct ethtool_ops hns3_ethtool_ops = { .get_rxfh_indir_size = hns3_get_rss_indir_size, .get_rxfh = hns3_get_rss, .set_rxfh = hns3_set_rss, + .get_rxfh_fields = hns3_get_rxfh_fields, + .set_rxfh_fields = hns3_set_rxfh_fields, .get_link_ksettings = hns3_get_link_ksettings, .set_link_ksettings = hns3_set_link_ksettings, .nway_reset = hns3_nway_reset,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -2
@@ -4872,7 +4872,7 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, }static int hclge_set_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclge_vport *vport =hclge_get_vport (handle);struct hclge_dev *hdev = vport->back;
@@ -4890,7 +4890,7 @@ static int hclge_set_rss_tuple(struct hnae3_handle *handle, }static int hclge_get_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +struct ethtool_rxfh_fields *nfc) {struct hclge_vport *vport =hclge_get_vport (handle);u8 tuple_sets;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2 -2
@@ -606,7 +606,7 @@ static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, }static int hclgevf_set_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclgevf_dev *hdev =hclgevf_ae_get_hdev (handle);int ret;
@@ -624,7 +624,7 @@ static int hclgevf_set_rss_tuple(struct hnae3_handle *handle, }static int hclgevf_get_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +struct ethtool_rxfh_fields *nfc) {struct hclgevf_dev *hdev =hclgevf_ae_get_hdev (handle);u8 tuple_sets;
Signature · 1 line
2.49.0
Re: [PATCH net-next 09/10] eth: hns3: migrate to new RXFH callbacks
Quoted 2 lines · Jakub Kicinski
Migrate to new callbacks added by commit
9bb00786fc61("net: ethtool:
add dedicated callbacks for getting and setting rxfh fields").
Thanks,
Quoted 4 lines
Signed-off-by Jakub Kicinski <[email protected]>---
This driver wins the award for most convoluted abstraction layers :/
HaHa, it is indeed a bit convoluted
But there's nothing wrong with the design.
Quoted 197 lines
--- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 +-- .../hns3/hns3_common/hclge_comm_rss.h | 4 +-- .../hns3/hns3_common/hclge_comm_rss.c | 6 ++-- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 33 ++++++++++++++----- .../hisilicon/hns3/hns3pf/hclge_main.c | 4 +-- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +-- 6 files changed, 36 insertions(+), 19 deletions(-)drivers/net/ethernet/hisilicon/hns3/hnae3.h +2
-2@@ -690,9 +690,9 @@ struct hnae3_ae_ops {int (*set_rss)(struct hnae3_handle *handle,const u32 *indir,const u8 *key,const u8 hfunc);int (*set_rss_tuple)(struct hnae3_handle *handle, -struct ethtool_rxnfc *cmd); +const struct ethtool_rxfh_fields *cmd);int (*get_rss_tuple)(struct hnae3_handle *handle, -struct ethtool_rxnfc *cmd); +struct ethtool_rxfh_fields *cmd);int (*get_tc_size)(struct hnae3_handle *handle);drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.h +2
-2@@ -108,7 +108,7 @@ void hclge_comm_get_rss_indir_tbl(struct hclge_comm_rss_cfg *rss_cfg,int hclge_comm_set_rss_algo_key (struct hclge_comm_hw *hw,const u8 hfunc,const u8 *key);int hclge_comm_init_rss_tuple_cmd (struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc, +const struct ethtool_rxfh_fields *nfc,struct hnae3_ae_dev *ae_dev,struct hclge_comm_rss_input_tuple_cmd *req);u64 hclge_comm_convert_rss_tuple (u8 tuple_sets);@@ -129,5 +129,5 @@ int hclge_comm_set_rss_hash_key(struct hclge_comm_rss_cfg *rss_cfg,int hclge_comm_set_rss_tuple (struct hnae3_ae_dev *ae_dev,struct hclge_comm_hw *hw,struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc); +const struct ethtool_rxfh_fields *nfc);#endif drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_rss.c +3
-3@@ -151,7 +151,7 @@ EXPORT_SYMBOL_GPL(hclge_comm_set_rss_hash_key);int hclge_comm_set_rss_tuple (struct hnae3_ae_dev *ae_dev,struct hclge_comm_hw *hw,struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclge_comm_rss_input_tuple_cmd *req;struct hclge_desc desc;@@ -422,7 +422,7 @@ int hclge_comm_set_rss_algo_key(struct hclge_comm_hw *hw, const u8 hfunc, }EXPORT_SYMBOL_GPL (hclge_comm_set_rss_algo_key); -static u8 hclge_comm_get_rss_hash_bits (struct ethtool_rxnfc *nfc) +static u8 hclge_comm_get_rss_hash_bits (const struct ethtool_rxfh_fields *nfc) {u8 hash_sets = nfc->data &RXH_L4_B_0_1 ?HCLGE_COMM_S_PORT_BIT :0 ;@@ -448,7 +448,7 @@ static u8 hclge_comm_get_rss_hash_bits(struct ethtool_rxnfc *nfc) }int hclge_comm_init_rss_tuple_cmd (struct hclge_comm_rss_cfg *rss_cfg, -struct ethtool_rxnfc *nfc, +const struct ethtool_rxfh_fields *nfc,struct hnae3_ae_dev *ae_dev,struct hclge_comm_rss_input_tuple_cmd *req) {drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +25
-8@@ -978,6 +978,16 @@ static int hns3_set_rss(struct net_device *netdev, rxfh->hfunc); } +static int hns3_get_rxfh_fields (struct net_device *netdev, +struct ethtool_rxfh_fields *cmd) +{ +struct hnae3_handle *h =hns3_get_handle (netdev); + +if (h->ae_algo->ops->get_rss_tuple) +return h->ae_algo->ops->get_rss_tuple (h, cmd); +return -EOPNOTSUPP ; +} +static int hns3_get_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd,u32 *rule_locs)@@ -988,10 +998,6 @@ static int hns3_get_rxnfc(struct net_device *netdev,case ETHTOOL_GRXRINGS : cmd->data = h->kinfo.num_tqps;return 0 ; -case ETHTOOL_GRXFH : -if (h->ae_algo->ops->get_rss_tuple) -return h->ae_algo->ops->get_rss_tuple (h, cmd); -return -EOPNOTSUPP ;case ETHTOOL_GRXCLSRLCNT :if (h->ae_algo->ops->get_fd_rule_cnt)return h->ae_algo->ops->get_fd_rule_cnt (h, cmd);@@ -1275,15 +1281,22 @@ static int hns3_set_ringparam(struct net_device *ndev,return ret; } +static int hns3_set_rxfh_fields (struct net_device *netdev, +const struct ethtool_rxfh_fields *cmd, +struct netlink_ext_ack *extack) +{ +struct hnae3_handle *h =hns3_get_handle (netdev); + +if (h->ae_algo->ops->set_rss_tuple) +return h->ae_algo->ops->set_rss_tuple (h, cmd); +return -EOPNOTSUPP ; +} +static int hns3_set_rxnfc (struct net_device *netdev,struct ethtool_rxnfc *cmd) {struct hnae3_handle *h =hns3_get_handle (netdev);switch (cmd->cmd) { -case ETHTOOL_SRXFH : -if (h->ae_algo->ops->set_rss_tuple) -return h->ae_algo->ops->set_rss_tuple (h, cmd); -return -EOPNOTSUPP ;case ETHTOOL_SRXCLSRLINS :if (h->ae_algo->ops->add_fd_entry)return h->ae_algo->ops->add_fd_entry (h, cmd);@@ -2105,6 +2118,8 @@ static const struct ethtool_ops hns3vf_ethtool_ops = { .get_rxfh_indir_size = hns3_get_rss_indir_size, .get_rxfh = hns3_get_rss, .set_rxfh = hns3_set_rss, + .get_rxfh_fields = hns3_get_rxfh_fields, + .set_rxfh_fields = hns3_set_rxfh_fields, .get_link_ksettings = hns3_get_link_ksettings, .get_channels = hns3_get_channels, .set_channels = hns3_set_channels,@@ -2142,6 +2157,8 @@ static const struct ethtool_ops hns3_ethtool_ops = { .get_rxfh_indir_size = hns3_get_rss_indir_size, .get_rxfh = hns3_get_rss, .set_rxfh = hns3_set_rss, + .get_rxfh_fields = hns3_get_rxfh_fields, + .set_rxfh_fields = hns3_set_rxfh_fields, .get_link_ksettings = hns3_get_link_ksettings, .set_link_ksettings = hns3_set_link_ksettings, .nway_reset = hns3_nway_reset,drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2
-2@@ -4872,7 +4872,7 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, }static int hclge_set_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclge_vport *vport =hclge_get_vport (handle);struct hclge_dev *hdev = vport->back;@@ -4890,7 +4890,7 @@ static int hclge_set_rss_tuple(struct hnae3_handle *handle, }static int hclge_get_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +struct ethtool_rxfh_fields *nfc) {struct hclge_vport *vport =hclge_get_vport (handle);u8 tuple_sets;drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2
-2@@ -606,7 +606,7 @@ static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, }static int hclgevf_set_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +const struct ethtool_rxfh_fields *nfc) {struct hclgevf_dev *hdev =hclgevf_ae_get_hdev (handle);int ret;@@ -624,7 +624,7 @@ static int hclgevf_set_rss_tuple(struct hnae3_handle *handle, }static int hclgevf_get_rss_tuple (struct hnae3_handle *handle, -struct ethtool_rxnfc *nfc) +struct ethtool_rxfh_fields *nfc) {struct hclgevf_dev *hdev =hclgevf_ae_get_hdev (handle);u8 tuple_sets;
Jakub Kicinski
maintainerPATCH 10/10 net: ethtool: don't mux RXFH via rxnfc callbacks
In reply to Jakub KicinskiAll drivers have been converted. Stop using the rxnfc fallbacks for Rx Flow Hashing configuration.
Joe pointed out in earlier review that in ethtool_set_rxfh() we need both .get_rxnfc and .get_rxfh_fields, because we need both the ring count and flow hashing (because we call ethtool_check_flow_types()). IOW the existing check added for transitioning drivers was buggy.
--- net/ethtool/ioctl.c | 59 ++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 41 deletions(-)
net/ethtool/ioctl.c +18 -41
@@ -1037,33 +1037,21 @@ static int ethtool_check_xfrm_rxfh(u32 input_xfrm, u64 rxfh)static int ethtool_check_flow_types (struct net_device *dev,u32 input_xfrm) {const struct ethtool_ops *ops = dev->ethtool_ops; -struct ethtool_rxnfc info = { - .cmd =ETHTOOL_GRXFH , - };int err;u32 i;for (i =0 ; i < __FLOW_TYPE_COUNT; i++) { +struct ethtool_rxfh_fields fields = { + .flow_type = i, + }; +if (!flow_type_hashable (i))continue ; - info.flow_type = i; +if (ops->get_rxfh_fields (dev, &fields)) +continue ; -if (ops->get_rxfh_fields) { -struct ethtool_rxfh_fields fields = { - .flow_type = info.flow_type, - }; - -if (ops->get_rxfh_fields (dev, &fields)) -continue ; - - info.data = fields.data; - }else { -if (ops->get_rxnfc (dev, &info,NULL )) -continue ; - } - - err =ethtool_check_xfrm_rxfh (input_xfrm, info.data); + err =ethtool_check_xfrm_rxfh (input_xfrm, fields.data);if (err)return err; }
@@ -1080,7 +1068,7 @@ ethtool_set_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)size_t info_size =sizeof (info);int rc; -if (!ops->set_rxnfc && !ops->set_rxfh_fields) +if (!ops->set_rxfh_fields)return -EOPNOTSUPP ; rc =ethtool_rxnfc_copy_struct (cmd, &info, &info_size, useraddr);
@@ -1103,9 +1091,6 @@ ethtool_set_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)return rc; } -if (!ops->set_rxfh_fields) -return ops->set_rxnfc (dev, &info); - fields.data = info.data; fields.flow_type = info.flow_type & ~FLOW_RSS ;if (info.flow_type &FLOW_RSS )
@@ -1120,9 +1105,10 @@ ethtool_get_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)struct ethtool_rxnfc info;size_t info_size =sizeof (info);const struct ethtool_ops *ops = dev->ethtool_ops; +struct ethtool_rxfh_fields fields = {};int ret; -if (!ops->get_rxnfc && !ops->get_rxfh_fields) +if (!ops->get_rxfh_fields)return -EOPNOTSUPP ; ret =ethtool_rxnfc_copy_struct (cmd, &info, &info_size, useraddr);
@@ -1133,24 +1119,15 @@ ethtool_get_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr) !ops->rxfh_per_ctx_fields)return -EINVAL ; -if (ops->get_rxfh_fields) { -struct ethtool_rxfh_fields fields = { - .flow_type = info.flow_type & ~FLOW_RSS , - }; + fields.flow_type = info.flow_type & ~FLOW_RSS ; +if (info.flow_type &FLOW_RSS ) + fields.rss_context = info.rss_context; -if (info.flow_type &FLOW_RSS ) - fields.rss_context = info.rss_context; + ret = ops->get_rxfh_fields (dev, &fields); +if (ret <0 ) +return ret; - ret = ops->get_rxfh_fields (dev, &fields); -if (ret <0 ) -return ret; - - info.data = fields.data; - }else { - ret = ops->get_rxnfc (dev, &info,NULL ); -if (ret <0 ) -return ret; - } + info.data = fields.data;return ethtool_rxnfc_copy_to_user (useraddr, &info, info_size,NULL ); }
@@ -1528,7 +1505,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,u8 *rss_config;int ret; -if ((!ops->get_rxnfc && !ops->get_rxfh_fields) || !ops->set_rxfh) +if (!ops->get_rxnfc || !ops->get_rxfh_fields || !ops->set_rxfh)return -EOPNOTSUPP ;if (ops->get_rxfh_indir_size)
Signature · 1 line
2.49.0
Re: [PATCH net-next 10/10] net: ethtool: don't mux RXFH via rxnfc callbacks
Quoted 10 lines · Jakub Kicinski
All drivers have been converted. Stop using the rxnfc fallbacks for Rx Flow Hashing configuration.
Joe pointed out in earlier review that in
ethtool_set_rxfh()we need both .get_rxnfc and .get_rxfh_fields, because we need both the ring count and flow hashing (because we callethtool_check_flow_types()). IOW the existing check added for transitioning drivers was buggy.Signed-off-by Jakub Kicinski <[email protected]>
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 17 lines · On Wed, 18 Jun 2025 13:38:13 -0700 you wrote:
Finish drivers conversions to callbacks added by
commit9bb00786fc61("net: ethtool: add dedicated callbacks for getting and setting rxfh fields"). Remove the conditional calling in the core, rxnfc callbacks are no longer used for RXFH.Jakub Kicinski (10):
eth: sfc: falcon: migrate to new RXFH callbacks
eth: sfc: siena: migrate to new RXFH callbacks
eth: sfc: migrate to new RXFH callbacks
eth: benet: migrate to new RXFH callbacks
eth: qede: migrate to new RXFH callbacks
eth: mlx5: migrate to new RXFH callbacks
eth: nfp: migrate to new RXFH callbacks
eth: hinic: migrate to new RXFH callbacks
eth: hns3: migrate to new RXFH callbacks
net: ethtool: don't mux RXFH via rxnfc callbacks
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,01/10] eth: sfc: falcon: migrate to new RXFH callbacks
https://git.kernel.org/netdev/net-next/c/80ec96cb245b - [net-next,02/10] eth: sfc: siena: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/c58b9d1829d4 - [net-next,03/10] eth: sfc: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/861b948ac18c - [net-next,04/10] eth: benet: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/92a95652650f - [net-next,05/10] eth: qede: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/06bb89e00f22 - [net-next,06/10] eth: mlx5: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/18f4e3898ac3 - [net-next,07/10] eth: nfp: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/6bfd8cf33859 - [net-next,08/10] eth: hinic: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/943c0ce30884 - [net-next,09/10] eth: hns3: migrate to new RXFH callbacks https://git.kernel.org/netdev/net-next/c/188793f082a5 - [net-next,10/10] net: ethtool: don't mux RXFH via rxnfc callbacks https://git.kernel.org/netdev/net-next/c/72792461c8e8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html