Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-intel-migrate-to-get_rx_ring_count-ethtool-callback'

Breno Leitao says:

====================
net: intel: migrate to .get_rx_ring_count() ethtool callback

This series migrates Intel network drivers to use the new .get_rx_ring_count()
ethtool callback introduced in commit 84eaf4359c36 ("net: ethtool: add
get_rx_ring_count callback to optimize RX ring queries").

The new callback simplifies the .get_rxnfc() implementation by removing
ETHTOOL_GRXRINGS handling and moving it to a dedicated callback. This provides
a cleaner separation of concerns and aligns these drivers with the modern
ethtool API.

The series updates the following Intel drivers:
- idpf
- igb
- igc
- ixgbevf
- fm10k
====================

Link: https://patch.msgid.link/20251125-gxring_intel-v2-0-f55cd022d28b@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+86 -47
+3 -14
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
··· 734 734 return 0; 735 735 } 736 736 737 - static int fm10k_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 738 - u32 __always_unused *rule_locs) 737 + static u32 fm10k_get_rx_ring_count(struct net_device *dev) 739 738 { 740 739 struct fm10k_intfc *interface = netdev_priv(dev); 741 - int ret = -EOPNOTSUPP; 742 740 743 - switch (cmd->cmd) { 744 - case ETHTOOL_GRXRINGS: 745 - cmd->data = interface->num_rx_queues; 746 - ret = 0; 747 - break; 748 - default: 749 - break; 750 - } 751 - 752 - return ret; 741 + return interface->num_rx_queues; 753 742 } 754 743 755 744 static int fm10k_set_rssh_fields(struct net_device *dev, ··· 1149 1160 .set_ringparam = fm10k_set_ringparam, 1150 1161 .get_coalesce = fm10k_get_coalesce, 1151 1162 .set_coalesce = fm10k_set_coalesce, 1152 - .get_rxnfc = fm10k_get_rxnfc, 1163 + .get_rx_ring_count = fm10k_get_rx_ring_count, 1153 1164 .get_regs = fm10k_get_regs, 1154 1165 .get_regs_len = fm10k_get_regs_len, 1155 1166 .self_test = fm10k_self_test,
+15 -4
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 3522 3522 } 3523 3523 3524 3524 /** 3525 + * i40e_get_rx_ring_count - get RX ring count 3526 + * @netdev: network interface device structure 3527 + * 3528 + * Return: number of RX rings. 3529 + **/ 3530 + static u32 i40e_get_rx_ring_count(struct net_device *netdev) 3531 + { 3532 + struct i40e_netdev_priv *np = netdev_priv(netdev); 3533 + struct i40e_vsi *vsi = np->vsi; 3534 + 3535 + return vsi->rss_size; 3536 + } 3537 + 3538 + /** 3525 3539 * i40e_get_rxnfc - command to get RX flow classification rules 3526 3540 * @netdev: network interface device structure 3527 3541 * @cmd: ethtool rxnfc command ··· 3552 3538 int ret = -EOPNOTSUPP; 3553 3539 3554 3540 switch (cmd->cmd) { 3555 - case ETHTOOL_GRXRINGS: 3556 - cmd->data = vsi->rss_size; 3557 - ret = 0; 3558 - break; 3559 3541 case ETHTOOL_GRXCLSRLCNT: 3560 3542 cmd->rule_cnt = pf->fdir_pf_active_filters; 3561 3543 /* report total rule count */ ··· 5829 5819 .set_msglevel = i40e_set_msglevel, 5830 5820 .get_rxnfc = i40e_get_rxnfc, 5831 5821 .set_rxnfc = i40e_set_rxnfc, 5822 + .get_rx_ring_count = i40e_get_rx_ring_count, 5832 5823 .self_test = i40e_diag_test, 5833 5824 .get_strings = i40e_get_strings, 5834 5825 .get_eee = i40e_get_eee,
+14 -4
drivers/net/ethernet/intel/iavf/iavf_ethtool.c
··· 1639 1639 } 1640 1640 1641 1641 /** 1642 + * iavf_get_rx_ring_count - get RX ring count 1643 + * @netdev: network interface device structure 1644 + * 1645 + * Return: number of RX rings. 1646 + **/ 1647 + static u32 iavf_get_rx_ring_count(struct net_device *netdev) 1648 + { 1649 + struct iavf_adapter *adapter = netdev_priv(netdev); 1650 + 1651 + return adapter->num_active_queues; 1652 + } 1653 + 1654 + /** 1642 1655 * iavf_get_rxnfc - command to get RX flow classification rules 1643 1656 * @netdev: network interface device structure 1644 1657 * @cmd: ethtool rxnfc command ··· 1666 1653 int ret = -EOPNOTSUPP; 1667 1654 1668 1655 switch (cmd->cmd) { 1669 - case ETHTOOL_GRXRINGS: 1670 - cmd->data = adapter->num_active_queues; 1671 - ret = 0; 1672 - break; 1673 1656 case ETHTOOL_GRXCLSRLCNT: 1674 1657 if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) 1675 1658 break; ··· 1875 1866 .set_per_queue_coalesce = iavf_set_per_queue_coalesce, 1876 1867 .set_rxnfc = iavf_set_rxnfc, 1877 1868 .get_rxnfc = iavf_get_rxnfc, 1869 + .get_rx_ring_count = iavf_get_rx_ring_count, 1878 1870 .get_rxfh_indir_size = iavf_get_rxfh_indir_size, 1879 1871 .get_rxfh = iavf_get_rxfh, 1880 1872 .set_rxfh = iavf_set_rxfh,
+15 -4
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 3084 3084 } 3085 3085 3086 3086 /** 3087 + * ice_get_rx_ring_count - get RX ring count 3088 + * @netdev: network interface device structure 3089 + * 3090 + * Return: number of RX rings. 3091 + */ 3092 + static u32 ice_get_rx_ring_count(struct net_device *netdev) 3093 + { 3094 + struct ice_netdev_priv *np = netdev_priv(netdev); 3095 + struct ice_vsi *vsi = np->vsi; 3096 + 3097 + return vsi->rss_size; 3098 + } 3099 + 3100 + /** 3087 3101 * ice_get_rxnfc - command to get Rx flow classification rules 3088 3102 * @netdev: network interface device structure 3089 3103 * @cmd: ethtool rxnfc command ··· 3117 3103 hw = &vsi->back->hw; 3118 3104 3119 3105 switch (cmd->cmd) { 3120 - case ETHTOOL_GRXRINGS: 3121 - cmd->data = vsi->rss_size; 3122 - ret = 0; 3123 - break; 3124 3106 case ETHTOOL_GRXCLSRLCNT: 3125 3107 cmd->rule_cnt = hw->fdir_active_fltr; 3126 3108 /* report total rule count */ ··· 4863 4853 .get_sset_count = ice_get_sset_count, 4864 4854 .get_rxnfc = ice_get_rxnfc, 4865 4855 .set_rxnfc = ice_set_rxnfc, 4856 + .get_rx_ring_count = ice_get_rx_ring_count, 4866 4857 .get_ringparam = ice_get_ringparam, 4867 4858 .set_ringparam = ice_set_ringparam, 4868 4859 .nway_reset = ice_nway_reset,
+20 -3
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
··· 6 6 #include "idpf_virtchnl.h" 7 7 8 8 /** 9 + * idpf_get_rx_ring_count - get RX ring count 10 + * @netdev: network interface device structure 11 + * 12 + * Return: number of RX rings. 13 + */ 14 + static u32 idpf_get_rx_ring_count(struct net_device *netdev) 15 + { 16 + struct idpf_vport *vport; 17 + u32 num_rxq; 18 + 19 + idpf_vport_ctrl_lock(netdev); 20 + vport = idpf_netdev_to_vport(netdev); 21 + num_rxq = vport->num_rxq; 22 + idpf_vport_ctrl_unlock(netdev); 23 + 24 + return num_rxq; 25 + } 26 + 27 + /** 9 28 * idpf_get_rxnfc - command to get RX flow classification rules 10 29 * @netdev: network interface device structure 11 30 * @cmd: ethtool rxnfc command ··· 47 28 user_config = &np->adapter->vport_config[np->vport_idx]->user_config; 48 29 49 30 switch (cmd->cmd) { 50 - case ETHTOOL_GRXRINGS: 51 - cmd->data = vport->num_rxq; 52 - break; 53 31 case ETHTOOL_GRXCLSRLCNT: 54 32 cmd->rule_cnt = user_config->num_fsteer_fltrs; 55 33 cmd->data = idpf_fsteer_max_rules(vport); ··· 1773 1757 .get_channels = idpf_get_channels, 1774 1758 .get_rxnfc = idpf_get_rxnfc, 1775 1759 .set_rxnfc = idpf_set_rxnfc, 1760 + .get_rx_ring_count = idpf_get_rx_ring_count, 1776 1761 .get_rxfh_key_size = idpf_get_rxfh_key_size, 1777 1762 .get_rxfh_indir_size = idpf_get_rxfh_indir_size, 1778 1763 .get_rxfh = idpf_get_rxfh,
+8 -4
drivers/net/ethernet/intel/igb/igb_ethtool.c
··· 2541 2541 return 0; 2542 2542 } 2543 2543 2544 + static u32 igb_get_rx_ring_count(struct net_device *dev) 2545 + { 2546 + struct igb_adapter *adapter = netdev_priv(dev); 2547 + 2548 + return adapter->num_rx_queues; 2549 + } 2550 + 2544 2551 static int igb_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 2545 2552 u32 *rule_locs) 2546 2553 { ··· 2555 2548 int ret = -EOPNOTSUPP; 2556 2549 2557 2550 switch (cmd->cmd) { 2558 - case ETHTOOL_GRXRINGS: 2559 - cmd->data = adapter->num_rx_queues; 2560 - ret = 0; 2561 - break; 2562 2551 case ETHTOOL_GRXCLSRLCNT: 2563 2552 cmd->rule_cnt = adapter->nfc_filter_count; 2564 2553 ret = 0; ··· 3476 3473 .get_ts_info = igb_get_ts_info, 3477 3474 .get_rxnfc = igb_get_rxnfc, 3478 3475 .set_rxnfc = igb_set_rxnfc, 3476 + .get_rx_ring_count = igb_get_rx_ring_count, 3479 3477 .get_eee = igb_get_eee, 3480 3478 .set_eee = igb_set_eee, 3481 3479 .get_module_info = igb_get_module_info,
+8 -3
drivers/net/ethernet/intel/igc/igc_ethtool.c
··· 1091 1091 return 0; 1092 1092 } 1093 1093 1094 + static u32 igc_ethtool_get_rx_ring_count(struct net_device *dev) 1095 + { 1096 + struct igc_adapter *adapter = netdev_priv(dev); 1097 + 1098 + return adapter->num_rx_queues; 1099 + } 1100 + 1094 1101 static int igc_ethtool_get_rxnfc(struct net_device *dev, 1095 1102 struct ethtool_rxnfc *cmd, u32 *rule_locs) 1096 1103 { 1097 1104 struct igc_adapter *adapter = netdev_priv(dev); 1098 1105 1099 1106 switch (cmd->cmd) { 1100 - case ETHTOOL_GRXRINGS: 1101 - cmd->data = adapter->num_rx_queues; 1102 - return 0; 1103 1107 case ETHTOOL_GRXCLSRLCNT: 1104 1108 cmd->rule_cnt = adapter->nfc_rule_count; 1105 1109 return 0; ··· 2174 2170 .set_coalesce = igc_ethtool_set_coalesce, 2175 2171 .get_rxnfc = igc_ethtool_get_rxnfc, 2176 2172 .set_rxnfc = igc_ethtool_set_rxnfc, 2173 + .get_rx_ring_count = igc_ethtool_get_rx_ring_count, 2177 2174 .get_rxfh_indir_size = igc_ethtool_get_rxfh_indir_size, 2178 2175 .get_rxfh = igc_ethtool_get_rxfh, 2179 2176 .set_rxfh = igc_ethtool_set_rxfh,
+3 -11
drivers/net/ethernet/intel/ixgbevf/ethtool.c
··· 867 867 return 0; 868 868 } 869 869 870 - static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, 871 - u32 *rules __always_unused) 870 + static u32 ixgbevf_get_rx_ring_count(struct net_device *dev) 872 871 { 873 872 struct ixgbevf_adapter *adapter = netdev_priv(dev); 874 873 875 - switch (info->cmd) { 876 - case ETHTOOL_GRXRINGS: 877 - info->data = adapter->num_rx_queues; 878 - return 0; 879 - default: 880 - hw_dbg(&adapter->hw, "Command parameters not supported\n"); 881 - return -EOPNOTSUPP; 882 - } 874 + return adapter->num_rx_queues; 883 875 } 884 876 885 877 static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev) ··· 979 987 .get_ethtool_stats = ixgbevf_get_ethtool_stats, 980 988 .get_coalesce = ixgbevf_get_coalesce, 981 989 .set_coalesce = ixgbevf_set_coalesce, 982 - .get_rxnfc = ixgbevf_get_rxnfc, 990 + .get_rx_ring_count = ixgbevf_get_rx_ring_count, 983 991 .get_rxfh_indir_size = ixgbevf_get_rxfh_indir_size, 984 992 .get_rxfh_key_size = ixgbevf_get_rxfh_key_size, 985 993 .get_rxfh = ixgbevf_get_rxfh,