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'

Breno Leitao says:

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

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.
* hns3
* hns
* qede
* niu
* funeth
* enic
* hinic
* octeontx2

PS: all of these change were compile-tested only.
====================

Link: https://patch.msgid.link/20260109-grxring_big_v1-v1-0-a0f77f732006@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+53 -55
+8 -3
drivers/net/ethernet/cisco/enic/enic_ethtool.c
··· 573 573 return 0; 574 574 } 575 575 576 + static u32 enic_get_rx_ring_count(struct net_device *dev) 577 + { 578 + struct enic *enic = netdev_priv(dev); 579 + 580 + return enic->rq_count; 581 + } 582 + 576 583 static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 577 584 u32 *rule_locs) 578 585 { ··· 587 580 int ret = 0; 588 581 589 582 switch (cmd->cmd) { 590 - case ETHTOOL_GRXRINGS: 591 - cmd->data = enic->rq_count; 592 - break; 593 583 case ETHTOOL_GRXCLSRLCNT: 594 584 spin_lock_bh(&enic->rfs_h.lock); 595 585 cmd->rule_cnt = enic->rfs_h.max - enic->rfs_h.free; ··· 693 689 .get_coalesce = enic_get_coalesce, 694 690 .set_coalesce = enic_set_coalesce, 695 691 .get_rxnfc = enic_get_rxnfc, 692 + .get_rx_ring_count = enic_get_rx_ring_count, 696 693 .get_rxfh_key_size = enic_get_rxfh_key_size, 697 694 .get_rxfh = enic_get_rxfh, 698 695 .set_rxfh = enic_set_rxfh,
+3 -11
drivers/net/ethernet/fungible/funeth/funeth_ethtool.c
··· 946 946 #undef TX_STAT 947 947 #undef FEC_STAT 948 948 949 - static int fun_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd, 950 - u32 *rule_locs) 949 + static u32 fun_get_rx_ring_count(struct net_device *netdev) 951 950 { 952 - switch (cmd->cmd) { 953 - case ETHTOOL_GRXRINGS: 954 - cmd->data = netdev->real_num_rx_queues; 955 - return 0; 956 - default: 957 - break; 958 - } 959 - return -EOPNOTSUPP; 951 + return netdev->real_num_rx_queues; 960 952 } 961 953 962 954 static int fun_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *info) ··· 1161 1169 .get_sset_count = fun_get_sset_count, 1162 1170 .get_strings = fun_get_strings, 1163 1171 .get_ethtool_stats = fun_get_ethtool_stats, 1164 - .get_rxnfc = fun_get_rxnfc, 1165 1172 .set_rxnfc = fun_set_rxnfc, 1173 + .get_rx_ring_count = fun_get_rx_ring_count, 1166 1174 .get_rxfh_indir_size = fun_get_rxfh_indir_size, 1167 1175 .get_rxfh_key_size = fun_get_rxfh_key_size, 1168 1176 .get_rxfh = fun_get_rxfh,
+3 -13
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
··· 1230 1230 rxfh->indir, rxfh->key, rxfh->hfunc); 1231 1231 } 1232 1232 1233 - static int hns_get_rxnfc(struct net_device *netdev, 1234 - struct ethtool_rxnfc *cmd, 1235 - u32 *rule_locs) 1233 + static u32 hns_get_rx_ring_count(struct net_device *netdev) 1236 1234 { 1237 1235 struct hns_nic_priv *priv = netdev_priv(netdev); 1238 1236 1239 - switch (cmd->cmd) { 1240 - case ETHTOOL_GRXRINGS: 1241 - cmd->data = priv->ae_handle->q_num; 1242 - break; 1243 - default: 1244 - return -EOPNOTSUPP; 1245 - } 1246 - 1247 - return 0; 1237 + return priv->ae_handle->q_num; 1248 1238 } 1249 1239 1250 1240 static const struct ethtool_ops hns_ethtool_ops = { ··· 1263 1273 .get_rxfh_indir_size = hns_get_rss_indir_size, 1264 1274 .get_rxfh = hns_get_rss, 1265 1275 .set_rxfh = hns_set_rss, 1266 - .get_rxnfc = hns_get_rxnfc, 1276 + .get_rx_ring_count = hns_get_rx_ring_count, 1267 1277 .get_link_ksettings = hns_nic_get_link_ksettings, 1268 1278 .set_link_ksettings = hns_nic_set_link_ksettings, 1269 1279 };
+9 -3
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
··· 988 988 return -EOPNOTSUPP; 989 989 } 990 990 991 + static u32 hns3_get_rx_ring_count(struct net_device *netdev) 992 + { 993 + struct hnae3_handle *h = hns3_get_handle(netdev); 994 + 995 + return h->kinfo.num_tqps; 996 + } 997 + 991 998 static int hns3_get_rxnfc(struct net_device *netdev, 992 999 struct ethtool_rxnfc *cmd, 993 1000 u32 *rule_locs) ··· 1002 995 struct hnae3_handle *h = hns3_get_handle(netdev); 1003 996 1004 997 switch (cmd->cmd) { 1005 - case ETHTOOL_GRXRINGS: 1006 - cmd->data = h->kinfo.num_tqps; 1007 - return 0; 1008 998 case ETHTOOL_GRXCLSRLCNT: 1009 999 if (h->ae_algo->ops->get_fd_rule_cnt) 1010 1000 return h->ae_algo->ops->get_fd_rule_cnt(h, cmd); ··· 2152 2148 .get_sset_count = hns3_get_sset_count, 2153 2149 .get_rxnfc = hns3_get_rxnfc, 2154 2150 .set_rxnfc = hns3_set_rxnfc, 2151 + .get_rx_ring_count = hns3_get_rx_ring_count, 2155 2152 .get_rxfh_key_size = hns3_get_rss_key_size, 2156 2153 .get_rxfh_indir_size = hns3_get_rss_indir_size, 2157 2154 .get_rxfh = hns3_get_rss, ··· 2192 2187 .get_sset_count = hns3_get_sset_count, 2193 2188 .get_rxnfc = hns3_get_rxnfc, 2194 2189 .set_rxnfc = hns3_set_rxnfc, 2190 + .get_rx_ring_count = hns3_get_rx_ring_count, 2195 2191 .get_rxfh_key_size = hns3_get_rss_key_size, 2196 2192 .get_rxfh_indir_size = hns3_get_rss_indir_size, 2197 2193 .get_rxfh = hns3_get_rss,
+4 -15
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
··· 1101 1101 return 0; 1102 1102 } 1103 1103 1104 - static int hinic_get_rxnfc(struct net_device *netdev, 1105 - struct ethtool_rxnfc *cmd, u32 *rule_locs) 1104 + static u32 hinic_get_rx_ring_count(struct net_device *netdev) 1106 1105 { 1107 1106 struct hinic_dev *nic_dev = netdev_priv(netdev); 1108 - int err = 0; 1109 1107 1110 - switch (cmd->cmd) { 1111 - case ETHTOOL_GRXRINGS: 1112 - cmd->data = nic_dev->num_qps; 1113 - break; 1114 - default: 1115 - err = -EOPNOTSUPP; 1116 - break; 1117 - } 1118 - 1119 - return err; 1108 + return nic_dev->num_qps; 1120 1109 } 1121 1110 1122 1111 static int hinic_get_rxfh(struct net_device *netdev, ··· 1768 1779 .set_pauseparam = hinic_set_pauseparam, 1769 1780 .get_channels = hinic_get_channels, 1770 1781 .set_channels = hinic_set_channels, 1771 - .get_rxnfc = hinic_get_rxnfc, 1782 + .get_rx_ring_count = hinic_get_rx_ring_count, 1772 1783 .get_rxfh_key_size = hinic_get_rxfh_key_size, 1773 1784 .get_rxfh_indir_size = hinic_get_rxfh_indir_size, 1774 1785 .get_rxfh = hinic_get_rxfh, ··· 1801 1812 .set_per_queue_coalesce = hinic_set_per_queue_coalesce, 1802 1813 .get_channels = hinic_get_channels, 1803 1814 .set_channels = hinic_set_channels, 1804 - .get_rxnfc = hinic_get_rxnfc, 1815 + .get_rx_ring_count = hinic_get_rx_ring_count, 1805 1816 .get_rxfh_key_size = hinic_get_rxfh_key_size, 1806 1817 .get_rxfh_indir_size = hinic_get_rxfh_indir_size, 1807 1818 .get_rxfh = hinic_get_rxfh,
+9 -4
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
··· 568 568 return 0; 569 569 } 570 570 571 + static u32 otx2_get_rx_ring_count(struct net_device *dev) 572 + { 573 + struct otx2_nic *pfvf = netdev_priv(dev); 574 + 575 + return pfvf->hw.rx_queues; 576 + } 577 + 571 578 static int otx2_get_rss_hash_opts(struct net_device *dev, 572 579 struct ethtool_rxfh_fields *nfc) 573 580 { ··· 749 742 int ret = -EOPNOTSUPP; 750 743 751 744 switch (nfc->cmd) { 752 - case ETHTOOL_GRXRINGS: 753 - nfc->data = pfvf->hw.rx_queues; 754 - ret = 0; 755 - break; 756 745 case ETHTOOL_GRXCLSRLCNT: 757 746 if (netif_running(dev) && ntuple) { 758 747 nfc->rule_cnt = pfvf->flow_cfg->nr_flows; ··· 1347 1344 .set_coalesce = otx2_set_coalesce, 1348 1345 .get_rxnfc = otx2_get_rxnfc, 1349 1346 .set_rxnfc = otx2_set_rxnfc, 1347 + .get_rx_ring_count = otx2_get_rx_ring_count, 1350 1348 .get_rxfh_key_size = otx2_get_rxfh_key_size, 1351 1349 .get_rxfh_indir_size = otx2_get_rxfh_indir_size, 1352 1350 .get_rxfh = otx2_get_rxfh, ··· 1466 1462 .get_channels = otx2_get_channels, 1467 1463 .get_rxnfc = otx2_get_rxnfc, 1468 1464 .set_rxnfc = otx2_set_rxnfc, 1465 + .get_rx_ring_count = otx2_get_rx_ring_count, 1469 1466 .get_rxfh_key_size = otx2_get_rxfh_key_size, 1470 1467 .get_rxfh_indir_size = otx2_get_rxfh_indir_size, 1471 1468 .get_rxfh = otx2_get_rxfh,
+9 -3
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
··· 1199 1199 return 0; 1200 1200 } 1201 1201 1202 + static u32 qede_get_rx_ring_count(struct net_device *dev) 1203 + { 1204 + struct qede_dev *edev = netdev_priv(dev); 1205 + 1206 + return QEDE_RSS_COUNT(edev); 1207 + } 1208 + 1202 1209 static int qede_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, 1203 1210 u32 *rule_locs) 1204 1211 { ··· 1213 1206 int rc = 0; 1214 1207 1215 1208 switch (info->cmd) { 1216 - case ETHTOOL_GRXRINGS: 1217 - info->data = QEDE_RSS_COUNT(edev); 1218 - break; 1219 1209 case ETHTOOL_GRXCLSRLCNT: 1220 1210 info->rule_cnt = qede_get_arfs_filter_count(edev); 1221 1211 info->data = QEDE_RFS_MAX_FLTR; ··· 2293 2289 .get_sset_count = qede_get_sset_count, 2294 2290 .get_rxnfc = qede_get_rxnfc, 2295 2291 .set_rxnfc = qede_set_rxnfc, 2292 + .get_rx_ring_count = qede_get_rx_ring_count, 2296 2293 .get_rxfh_indir_size = qede_get_rxfh_indir_size, 2297 2294 .get_rxfh_key_size = qede_get_rxfh_key_size, 2298 2295 .get_rxfh = qede_get_rxfh, ··· 2338 2333 .get_sset_count = qede_get_sset_count, 2339 2334 .get_rxnfc = qede_get_rxnfc, 2340 2335 .set_rxnfc = qede_set_rxnfc, 2336 + .get_rx_ring_count = qede_get_rx_ring_count, 2341 2337 .get_rxfh_indir_size = qede_get_rxfh_indir_size, 2342 2338 .get_rxfh_key_size = qede_get_rxfh_key_size, 2343 2339 .get_rxfh = qede_get_rxfh,
+8 -3
drivers/net/ethernet/sun/niu.c
··· 7302 7302 return ret; 7303 7303 } 7304 7304 7305 + static u32 niu_get_rx_ring_count(struct net_device *dev) 7306 + { 7307 + struct niu *np = netdev_priv(dev); 7308 + 7309 + return np->num_rx_rings; 7310 + } 7311 + 7305 7312 static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 7306 7313 u32 *rule_locs) 7307 7314 { ··· 7316 7309 int ret = 0; 7317 7310 7318 7311 switch (cmd->cmd) { 7319 - case ETHTOOL_GRXRINGS: 7320 - cmd->data = np->num_rx_rings; 7321 - break; 7322 7312 case ETHTOOL_GRXCLSRLCNT: 7323 7313 cmd->rule_cnt = tcam_get_valid_entry_cnt(np); 7324 7314 break; ··· 7932 7928 .set_phys_id = niu_set_phys_id, 7933 7929 .get_rxnfc = niu_get_nfc, 7934 7930 .set_rxnfc = niu_set_nfc, 7931 + .get_rx_ring_count = niu_get_rx_ring_count, 7935 7932 .get_rxfh_fields = niu_get_rxfh_fields, 7936 7933 .set_rxfh_fields = niu_set_rxfh_fields, 7937 7934 .get_link_ksettings = niu_get_link_ksettings,