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

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

Breno Leitao says:

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

This series migrates Freescale 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 Freescale drivers:
- enetc
- dppa2
- gianfar
====================

Link: https://patch.msgid.link/20251128-gxring_freescale-v1-0-22a978abf29e@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+27 -32
+8 -3
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
··· 711 711 return 0; 712 712 } 713 713 714 + static u32 dpaa2_eth_get_rx_ring_count(struct net_device *net_dev) 715 + { 716 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 717 + 718 + return dpaa2_eth_queue_count(priv); 719 + } 720 + 714 721 static int dpaa2_eth_get_rxnfc(struct net_device *net_dev, 715 722 struct ethtool_rxnfc *rxnfc, u32 *rule_locs) 716 723 { ··· 726 719 int i, j = 0; 727 720 728 721 switch (rxnfc->cmd) { 729 - case ETHTOOL_GRXRINGS: 730 - rxnfc->data = dpaa2_eth_queue_count(priv); 731 - break; 732 722 case ETHTOOL_GRXCLSRLCNT: 733 723 rxnfc->rule_cnt = 0; 734 724 rxnfc->rule_cnt = dpaa2_eth_num_cls_rules(priv); ··· 953 949 .get_strings = dpaa2_eth_get_strings, 954 950 .get_rxnfc = dpaa2_eth_get_rxnfc, 955 951 .set_rxnfc = dpaa2_eth_set_rxnfc, 952 + .get_rx_ring_count = dpaa2_eth_get_rx_ring_count, 956 953 .get_rxfh_fields = dpaa2_eth_get_rxfh_fields, 957 954 .set_rxfh_fields = dpaa2_eth_set_rxfh_fields, 958 955 .get_ts_info = dpaa2_eth_get_ts_info,
+11 -26
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
··· 633 633 return enetc_set_fs_entry(si, &rfse, fs->location); 634 634 } 635 635 636 + static u32 enetc_get_rx_ring_count(struct net_device *ndev) 637 + { 638 + struct enetc_ndev_priv *priv = netdev_priv(ndev); 639 + 640 + return priv->num_rx_rings; 641 + } 642 + 636 643 static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc, 637 644 u32 *rule_locs) 638 645 { ··· 647 640 int i, j; 648 641 649 642 switch (rxnfc->cmd) { 650 - case ETHTOOL_GRXRINGS: 651 - rxnfc->data = priv->num_rx_rings; 652 - break; 653 643 case ETHTOOL_GRXCLSRLCNT: 654 644 /* total number of entries */ 655 645 rxnfc->data = priv->si->num_fs_entries; ··· 677 673 } 678 674 /* number of entries in use */ 679 675 rxnfc->rule_cnt = j; 680 - break; 681 - default: 682 - return -EOPNOTSUPP; 683 - } 684 - 685 - return 0; 686 - } 687 - 688 - /* i.MX95 ENETC does not support RFS table, but we can use ingress port 689 - * filter table to implement Wake-on-LAN filter or drop the matched flow, 690 - * so the implementation will be different from enetc_get_rxnfc() and 691 - * enetc_set_rxnfc(). Therefore, add enetc4_get_rxnfc() for ENETC v4 PF. 692 - */ 693 - static int enetc4_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc, 694 - u32 *rule_locs) 695 - { 696 - struct enetc_ndev_priv *priv = netdev_priv(ndev); 697 - 698 - switch (rxnfc->cmd) { 699 - case ETHTOOL_GRXRINGS: 700 - rxnfc->data = priv->num_rx_rings; 701 676 break; 702 677 default: 703 678 return -EOPNOTSUPP; ··· 1318 1335 .get_rmon_stats = enetc_get_rmon_stats, 1319 1336 .get_eth_ctrl_stats = enetc_get_eth_ctrl_stats, 1320 1337 .get_eth_mac_stats = enetc_get_eth_mac_stats, 1338 + .get_rx_ring_count = enetc_get_rx_ring_count, 1321 1339 .get_rxnfc = enetc_get_rxnfc, 1322 1340 .set_rxnfc = enetc_set_rxnfc, 1323 1341 .get_rxfh_key_size = enetc_get_rxfh_key_size, ··· 1347 1363 ETHTOOL_COALESCE_MAX_FRAMES | 1348 1364 ETHTOOL_COALESCE_USE_ADAPTIVE_RX, 1349 1365 .get_eth_mac_stats = enetc_ppm_get_eth_mac_stats, 1350 - .get_rxnfc = enetc4_get_rxnfc, 1366 + .get_rx_ring_count = enetc_get_rx_ring_count, 1351 1367 .get_rxfh_key_size = enetc_get_rxfh_key_size, 1352 1368 .get_rxfh_indir_size = enetc_get_rxfh_indir_size, 1353 1369 .get_rxfh = enetc_get_rxfh, ··· 1370 1386 .get_sset_count = enetc_get_sset_count, 1371 1387 .get_strings = enetc_get_strings, 1372 1388 .get_ethtool_stats = enetc_get_ethtool_stats, 1389 + .get_rx_ring_count = enetc_get_rx_ring_count, 1373 1390 .get_rxnfc = enetc_get_rxnfc, 1374 1391 .set_rxnfc = enetc_set_rxnfc, 1375 1392 .get_rxfh_indir_size = enetc_get_rxfh_indir_size, ··· 1398 1413 .set_wol = enetc_set_wol, 1399 1414 .get_pauseparam = enetc_get_pauseparam, 1400 1415 .set_pauseparam = enetc_set_pauseparam, 1401 - .get_rxnfc = enetc4_get_rxnfc, 1416 + .get_rx_ring_count = enetc_get_rx_ring_count, 1402 1417 .get_rxfh_key_size = enetc_get_rxfh_key_size, 1403 1418 .get_rxfh_indir_size = enetc_get_rxfh_indir_size, 1404 1419 .get_rxfh = enetc_get_rxfh,
+8 -3
drivers/net/ethernet/freescale/gianfar_ethtool.c
··· 1431 1431 return ret; 1432 1432 } 1433 1433 1434 + static u32 gfar_get_rx_ring_count(struct net_device *dev) 1435 + { 1436 + struct gfar_private *priv = netdev_priv(dev); 1437 + 1438 + return priv->num_rx_queues; 1439 + } 1440 + 1434 1441 static int gfar_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 1435 1442 u32 *rule_locs) 1436 1443 { ··· 1445 1438 int ret = 0; 1446 1439 1447 1440 switch (cmd->cmd) { 1448 - case ETHTOOL_GRXRINGS: 1449 - cmd->data = priv->num_rx_queues; 1450 - break; 1451 1441 case ETHTOOL_GRXCLSRLCNT: 1452 1442 cmd->rule_cnt = priv->rx_list.count; 1453 1443 break; ··· 1523 1519 #endif 1524 1520 .set_rxnfc = gfar_set_nfc, 1525 1521 .get_rxnfc = gfar_get_nfc, 1522 + .get_rx_ring_count = gfar_get_rx_ring_count, 1526 1523 .set_rxfh_fields = gfar_set_rxfh_fields, 1527 1524 .get_ts_info = gfar_get_ts_info, 1528 1525 .get_link_ksettings = phy_ethtool_get_link_ksettings,