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-convert-drivers-to-get_rx_ring_count-part-2'

Breno Leitao says:

====================
net: convert drivers to .get_rx_ring_count (part 2)

Commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to
optimize RX ring queries") added specific support for GRXRINGS callback,
simplifying .get_rxnfc.

Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new
.get_rx_ring_count().

This simplifies the RX ring count retrieval and aligns the following
drivers with the new ethtool API for querying RX ring parameters.
* engleder/tsnep
* mediatek
* amazon/ena
* microchip/lan743x
* amd/xgbe
* chelsio/cxgb4
* wangxun/txgbe
* cadence/macb

All of these change were compile-tested only.
====================

Link: https://patch.msgid.link/20260115-grxring_big_v2-v1-0-b3e1b58bced5@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+50 -60
+3 -19
drivers/net/ethernet/amazon/ena/ena_ethtool.c
··· 835 835 return ena_com_fill_hash_ctrl(ena_dev, proto, hash_fields); 836 836 } 837 837 838 - static int ena_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info, 839 - u32 *rules) 838 + static u32 ena_get_rx_ring_count(struct net_device *netdev) 840 839 { 841 840 struct ena_adapter *adapter = netdev_priv(netdev); 842 - int rc = 0; 843 841 844 - switch (info->cmd) { 845 - case ETHTOOL_GRXRINGS: 846 - info->data = adapter->num_io_queues; 847 - rc = 0; 848 - break; 849 - case ETHTOOL_GRXCLSRLCNT: 850 - case ETHTOOL_GRXCLSRULE: 851 - case ETHTOOL_GRXCLSRLALL: 852 - default: 853 - netif_err(adapter, drv, netdev, 854 - "Command parameter %d is not supported\n", info->cmd); 855 - rc = -EOPNOTSUPP; 856 - } 857 - 858 - return rc; 842 + return adapter->num_io_queues; 859 843 } 860 844 861 845 static u32 ena_get_rxfh_indir_size(struct net_device *netdev) ··· 1080 1096 .get_sset_count = ena_get_sset_count, 1081 1097 .get_strings = ena_get_ethtool_strings, 1082 1098 .get_ethtool_stats = ena_get_ethtool_stats, 1083 - .get_rxnfc = ena_get_rxnfc, 1099 + .get_rx_ring_count = ena_get_rx_ring_count, 1084 1100 .get_rxfh_indir_size = ena_get_rxfh_indir_size, 1085 1101 .get_rxfh_key_size = ena_get_rxfh_key_size, 1086 1102 .get_rxfh = ena_get_rxfh,
+3 -12
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
··· 417 417 return 0; 418 418 } 419 419 420 - static int xgbe_get_rxnfc(struct net_device *netdev, 421 - struct ethtool_rxnfc *rxnfc, u32 *rule_locs) 420 + static u32 xgbe_get_rx_ring_count(struct net_device *netdev) 422 421 { 423 422 struct xgbe_prv_data *pdata = netdev_priv(netdev); 424 423 425 - switch (rxnfc->cmd) { 426 - case ETHTOOL_GRXRINGS: 427 - rxnfc->data = pdata->rx_ring_count; 428 - break; 429 - default: 430 - return -EOPNOTSUPP; 431 - } 432 - 433 - return 0; 424 + return pdata->rx_ring_count; 434 425 } 435 426 436 427 static u32 xgbe_get_rxfh_key_size(struct net_device *netdev) ··· 748 757 .get_strings = xgbe_get_strings, 749 758 .get_ethtool_stats = xgbe_get_ethtool_stats, 750 759 .get_sset_count = xgbe_get_sset_count, 751 - .get_rxnfc = xgbe_get_rxnfc, 760 + .get_rx_ring_count = xgbe_get_rx_ring_count, 752 761 .get_rxfh_key_size = xgbe_get_rxfh_key_size, 753 762 .get_rxfh_indir_size = xgbe_get_rxfh_indir_size, 754 763 .get_rxfh = xgbe_get_rxfh,
+8 -3
drivers/net/ethernet/cadence/macb_main.c
··· 3850 3850 return 0; 3851 3851 } 3852 3852 3853 + static u32 gem_get_rx_ring_count(struct net_device *netdev) 3854 + { 3855 + struct macb *bp = netdev_priv(netdev); 3856 + 3857 + return bp->num_queues; 3858 + } 3859 + 3853 3860 static int gem_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, 3854 3861 u32 *rule_locs) 3855 3862 { ··· 3864 3857 int ret = 0; 3865 3858 3866 3859 switch (cmd->cmd) { 3867 - case ETHTOOL_GRXRINGS: 3868 - cmd->data = bp->num_queues; 3869 - break; 3870 3860 case ETHTOOL_GRXCLSRLCNT: 3871 3861 cmd->rule_cnt = bp->rx_fs_list.count; 3872 3862 break; ··· 3945 3941 .set_ringparam = macb_set_ringparam, 3946 3942 .get_rxnfc = gem_get_rxnfc, 3947 3943 .set_rxnfc = gem_set_rxnfc, 3944 + .get_rx_ring_count = gem_get_rx_ring_count, 3948 3945 }; 3949 3946 3950 3947 static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+8 -3
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
··· 1784 1784 return 0; 1785 1785 } 1786 1786 1787 + static u32 get_rx_ring_count(struct net_device *dev) 1788 + { 1789 + const struct port_info *pi = netdev_priv(dev); 1790 + 1791 + return pi->nqsets; 1792 + } 1793 + 1787 1794 static int get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, 1788 1795 u32 *rules) 1789 1796 { ··· 1800 1793 int ret = 0; 1801 1794 1802 1795 switch (info->cmd) { 1803 - case ETHTOOL_GRXRINGS: 1804 - info->data = pi->nqsets; 1805 - return 0; 1806 1796 case ETHTOOL_GRXCLSRLCNT: 1807 1797 info->rule_cnt = 1808 1798 adap->ethtool_filters->port[pi->port_id].in_use; ··· 2204 2200 .get_regs = get_regs, 2205 2201 .get_rxnfc = get_rxnfc, 2206 2202 .set_rxnfc = set_rxnfc, 2203 + .get_rx_ring_count = get_rx_ring_count, 2207 2204 .get_rxfh_indir_size = get_rss_table_size, 2208 2205 .get_rxfh = get_rss_table, 2209 2206 .set_rxfh = set_rss_table,
+8 -3
drivers/net/ethernet/engleder/tsnep_ethtool.c
··· 257 257 } 258 258 } 259 259 260 + static u32 tsnep_ethtool_get_rx_ring_count(struct net_device *netdev) 261 + { 262 + struct tsnep_adapter *adapter = netdev_priv(netdev); 263 + 264 + return adapter->num_rx_queues; 265 + } 266 + 260 267 static int tsnep_ethtool_get_rxnfc(struct net_device *netdev, 261 268 struct ethtool_rxnfc *cmd, u32 *rule_locs) 262 269 { 263 270 struct tsnep_adapter *adapter = netdev_priv(netdev); 264 271 265 272 switch (cmd->cmd) { 266 - case ETHTOOL_GRXRINGS: 267 - cmd->data = adapter->num_rx_queues; 268 - return 0; 269 273 case ETHTOOL_GRXCLSRLCNT: 270 274 cmd->rule_cnt = adapter->rxnfc_count; 271 275 cmd->data = adapter->rxnfc_max; ··· 473 469 .get_sset_count = tsnep_ethtool_get_sset_count, 474 470 .get_rxnfc = tsnep_ethtool_get_rxnfc, 475 471 .set_rxnfc = tsnep_ethtool_set_rxnfc, 472 + .get_rx_ring_count = tsnep_ethtool_get_rx_ring_count, 476 473 .get_channels = tsnep_ethtool_get_channels, 477 474 .get_ts_info = tsnep_ethtool_get_ts_info, 478 475 .get_coalesce = tsnep_ethtool_get_coalesce,
+9 -6
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 4625 4625 } while (u64_stats_fetch_retry(&hwstats->syncp, start)); 4626 4626 } 4627 4627 4628 + static u32 mtk_get_rx_ring_count(struct net_device *dev) 4629 + { 4630 + if (dev->hw_features & NETIF_F_LRO) 4631 + return MTK_MAX_RX_RING_NUM; 4632 + 4633 + return 0; 4634 + } 4635 + 4628 4636 static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 4629 4637 u32 *rule_locs) 4630 4638 { 4631 4639 int ret = -EOPNOTSUPP; 4632 4640 4633 4641 switch (cmd->cmd) { 4634 - case ETHTOOL_GRXRINGS: 4635 - if (dev->hw_features & NETIF_F_LRO) { 4636 - cmd->data = MTK_MAX_RX_RING_NUM; 4637 - ret = 0; 4638 - } 4639 - break; 4640 4642 case ETHTOOL_GRXCLSRLCNT: 4641 4643 if (dev->hw_features & NETIF_F_LRO) { 4642 4644 struct mtk_mac *mac = netdev_priv(dev); ··· 4743 4741 .set_pauseparam = mtk_set_pauseparam, 4744 4742 .get_rxnfc = mtk_get_rxnfc, 4745 4743 .set_rxnfc = mtk_set_rxnfc, 4744 + .get_rx_ring_count = mtk_get_rx_ring_count, 4746 4745 .get_eee = mtk_get_eee, 4747 4746 .set_eee = mtk_set_eee, 4748 4747 };
+3 -10
drivers/net/ethernet/microchip/lan743x_ethtool.c
··· 931 931 return 0; 932 932 } 933 933 934 - static int lan743x_ethtool_get_rxnfc(struct net_device *netdev, 935 - struct ethtool_rxnfc *rxnfc, 936 - u32 *rule_locs) 934 + static u32 lan743x_ethtool_get_rx_ring_count(struct net_device *netdev) 937 935 { 938 - switch (rxnfc->cmd) { 939 - case ETHTOOL_GRXRINGS: 940 - rxnfc->data = LAN743X_USED_RX_CHANNELS; 941 - return 0; 942 - } 943 - return -EOPNOTSUPP; 936 + return LAN743X_USED_RX_CHANNELS; 944 937 } 945 938 946 939 static u32 lan743x_ethtool_get_rxfh_key_size(struct net_device *netdev) ··· 1362 1369 .get_priv_flags = lan743x_ethtool_get_priv_flags, 1363 1370 .set_priv_flags = lan743x_ethtool_set_priv_flags, 1364 1371 .get_sset_count = lan743x_ethtool_get_sset_count, 1365 - .get_rxnfc = lan743x_ethtool_get_rxnfc, 1372 + .get_rx_ring_count = lan743x_ethtool_get_rx_ring_count, 1366 1373 .get_rxfh_key_size = lan743x_ethtool_get_rxfh_key_size, 1367 1374 .get_rxfh_indir_size = lan743x_ethtool_get_rxfh_indir_size, 1368 1375 .get_rxfh = lan743x_ethtool_get_rxfh,
+8 -4
drivers/net/ethernet/wangxun/txgbe/txgbe_ethtool.c
··· 193 193 return 0; 194 194 } 195 195 196 + static u32 txgbe_get_rx_ring_count(struct net_device *dev) 197 + { 198 + struct wx *wx = netdev_priv(dev); 199 + 200 + return wx->num_rx_queues; 201 + } 202 + 196 203 static int txgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 197 204 u32 *rule_locs) 198 205 { ··· 208 201 int ret = -EOPNOTSUPP; 209 202 210 203 switch (cmd->cmd) { 211 - case ETHTOOL_GRXRINGS: 212 - cmd->data = wx->num_rx_queues; 213 - ret = 0; 214 - break; 215 204 case ETHTOOL_GRXCLSRLCNT: 216 205 cmd->rule_cnt = txgbe->fdir_filter_count; 217 206 ret = 0; ··· 590 587 .set_channels = txgbe_set_channels, 591 588 .get_rxnfc = txgbe_get_rxnfc, 592 589 .set_rxnfc = txgbe_set_rxnfc, 590 + .get_rx_ring_count = txgbe_get_rx_ring_count, 593 591 .get_rxfh_fields = wx_get_rxfh_fields, 594 592 .set_rxfh_fields = wx_set_rxfh_fields, 595 593 .get_rxfh_indir_size = wx_rss_indir_size,