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 'eth-migrate-more-drivers-to-new-rxfh-callbacks'

Jakub Kicinski says:

====================
eth: migrate more drivers to new RXFH callbacks

Migrate a batch of drivers to the recently added dedicated
.get_rxfh_fields and .set_rxfh_fields ethtool callbacks.
====================

Link: https://patch.msgid.link/20250617014848.436741-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+80 -105
+7 -37
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
··· 263 263 ethtool_puts(&data, dpaa_stats_global[i]); 264 264 } 265 265 266 - static int dpaa_get_hash_opts(struct net_device *dev, 267 - struct ethtool_rxnfc *cmd) 266 + static int dpaa_get_rxfh_fields(struct net_device *dev, 267 + struct ethtool_rxfh_fields *cmd) 268 268 { 269 269 struct dpaa_priv *priv = netdev_priv(dev); 270 270 ··· 299 299 return 0; 300 300 } 301 301 302 - static int dpaa_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 303 - u32 *unused) 304 - { 305 - int ret = -EOPNOTSUPP; 306 - 307 - switch (cmd->cmd) { 308 - case ETHTOOL_GRXFH: 309 - ret = dpaa_get_hash_opts(dev, cmd); 310 - break; 311 - default: 312 - break; 313 - } 314 - 315 - return ret; 316 - } 317 - 318 302 static void dpaa_set_hash(struct net_device *net_dev, bool enable) 319 303 { 320 304 struct mac_device *mac_dev; ··· 313 329 priv->keygen_in_use = enable; 314 330 } 315 331 316 - static int dpaa_set_hash_opts(struct net_device *dev, 317 - struct ethtool_rxnfc *nfc) 332 + static int dpaa_set_rxfh_fields(struct net_device *dev, 333 + const struct ethtool_rxfh_fields *nfc, 334 + struct netlink_ext_ack *extack) 318 335 { 319 336 int ret = -EINVAL; 320 337 ··· 341 356 case ESP_V6_FLOW: 342 357 dpaa_set_hash(dev, !!nfc->data); 343 358 ret = 0; 344 - break; 345 - default: 346 - break; 347 - } 348 - 349 - return ret; 350 - } 351 - 352 - static int dpaa_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) 353 - { 354 - int ret = -EOPNOTSUPP; 355 - 356 - switch (cmd->cmd) { 357 - case ETHTOOL_SRXFH: 358 - ret = dpaa_set_hash_opts(dev, cmd); 359 359 break; 360 360 default: 361 361 break; ··· 480 510 .get_strings = dpaa_get_strings, 481 511 .get_link_ksettings = dpaa_get_link_ksettings, 482 512 .set_link_ksettings = dpaa_set_link_ksettings, 483 - .get_rxnfc = dpaa_get_rxnfc, 484 - .set_rxnfc = dpaa_set_rxnfc, 513 + .get_rxfh_fields = dpaa_get_rxfh_fields, 514 + .set_rxfh_fields = dpaa_set_rxfh_fields, 485 515 .get_ts_info = dpaa_get_ts_info, 486 516 .get_coalesce = dpaa_get_coalesce, 487 517 .set_coalesce = dpaa_set_coalesce,
+24 -12
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
··· 719 719 int i, j = 0; 720 720 721 721 switch (rxnfc->cmd) { 722 - case ETHTOOL_GRXFH: 723 - /* we purposely ignore cmd->flow_type for now, because the 724 - * classifier only supports a single set of fields for all 725 - * protocols 726 - */ 727 - rxnfc->data = priv->rx_hash_fields; 728 - break; 729 722 case ETHTOOL_GRXRINGS: 730 723 rxnfc->data = dpaa2_eth_queue_count(priv); 731 724 break; ··· 760 767 int err = 0; 761 768 762 769 switch (rxnfc->cmd) { 763 - case ETHTOOL_SRXFH: 764 - if ((rxnfc->data & DPAA2_RXH_SUPPORTED) != rxnfc->data) 765 - return -EOPNOTSUPP; 766 - err = dpaa2_eth_set_hash(net_dev, rxnfc->data); 767 - break; 768 770 case ETHTOOL_SRXCLSRLINS: 769 771 err = dpaa2_eth_update_cls_rule(net_dev, &rxnfc->fs, rxnfc->fs.location); 770 772 break; ··· 771 783 } 772 784 773 785 return err; 786 + } 787 + 788 + static int dpaa2_eth_get_rxfh_fields(struct net_device *net_dev, 789 + struct ethtool_rxfh_fields *rxnfc) 790 + { 791 + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 792 + 793 + /* we purposely ignore cmd->flow_type for now, because the 794 + * classifier only supports a single set of fields for all 795 + * protocols 796 + */ 797 + rxnfc->data = priv->rx_hash_fields; 798 + return 0; 799 + } 800 + 801 + static int dpaa2_eth_set_rxfh_fields(struct net_device *net_dev, 802 + const struct ethtool_rxfh_fields *rxnfc, 803 + struct netlink_ext_ack *extack) 804 + { 805 + if ((rxnfc->data & DPAA2_RXH_SUPPORTED) != rxnfc->data) 806 + return -EOPNOTSUPP; 807 + return dpaa2_eth_set_hash(net_dev, rxnfc->data); 774 808 } 775 809 776 810 int dpaa2_phc_index = -1; ··· 949 939 .get_strings = dpaa2_eth_get_strings, 950 940 .get_rxnfc = dpaa2_eth_get_rxnfc, 951 941 .set_rxnfc = dpaa2_eth_set_rxnfc, 942 + .get_rxfh_fields = dpaa2_eth_get_rxfh_fields, 943 + .set_rxfh_fields = dpaa2_eth_set_rxfh_fields, 952 944 .get_ts_info = dpaa2_eth_get_ts_info, 953 945 .get_tunable = dpaa2_eth_get_tunable, 954 946 .set_tunable = dpaa2_eth_set_tunable,
+4 -2
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
··· 1618 1618 return 0; 1619 1619 } 1620 1620 1621 - int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info) 1621 + int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, 1622 + const struct ethtool_rxfh_fields *info) 1622 1623 { 1623 1624 u16 hash_opts = 0; 1624 1625 u32 flow_type; ··· 1657 1656 return mvpp2_port_rss_hash_opts_set(port, flow_type, hash_opts); 1658 1657 } 1659 1658 1660 - int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, struct ethtool_rxnfc *info) 1659 + int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, 1660 + struct ethtool_rxfh_fields *info) 1661 1661 { 1662 1662 unsigned long hash_opts; 1663 1663 u32 flow_type;
+4 -2
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.h
··· 272 272 int mvpp22_port_rss_ctx_indir_get(struct mvpp2_port *port, u32 rss_ctx, 273 273 u32 *indir); 274 274 275 - int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, struct ethtool_rxnfc *info); 276 - int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info); 275 + int mvpp2_ethtool_rxfh_get(struct mvpp2_port *port, 276 + struct ethtool_rxfh_fields *info); 277 + int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, 278 + const struct ethtool_rxfh_fields *info); 277 279 278 280 void mvpp2_cls_init(struct mvpp2 *priv); 279 281
+25 -6
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 5588 5588 return -EOPNOTSUPP; 5589 5589 5590 5590 switch (info->cmd) { 5591 - case ETHTOOL_GRXFH: 5592 - ret = mvpp2_ethtool_rxfh_get(port, info); 5593 - break; 5594 5591 case ETHTOOL_GRXRINGS: 5595 5592 info->data = port->nrxqs; 5596 5593 break; ··· 5625 5628 return -EOPNOTSUPP; 5626 5629 5627 5630 switch (info->cmd) { 5628 - case ETHTOOL_SRXFH: 5629 - ret = mvpp2_ethtool_rxfh_set(port, info); 5630 - break; 5631 5631 case ETHTOOL_SRXCLSRLINS: 5632 5632 ret = mvpp2_ethtool_cls_rule_ins(port, info); 5633 5633 break; ··· 5741 5747 return mvpp2_modify_rxfh_context(dev, NULL, rxfh, extack); 5742 5748 } 5743 5749 5750 + static int mvpp2_ethtool_get_rxfh_fields(struct net_device *dev, 5751 + struct ethtool_rxfh_fields *info) 5752 + { 5753 + struct mvpp2_port *port = netdev_priv(dev); 5754 + 5755 + if (!mvpp22_rss_is_supported(port)) 5756 + return -EOPNOTSUPP; 5757 + 5758 + return mvpp2_ethtool_rxfh_get(port, info); 5759 + } 5760 + 5761 + static int mvpp2_ethtool_set_rxfh_fields(struct net_device *dev, 5762 + const struct ethtool_rxfh_fields *info, 5763 + struct netlink_ext_ack *extack) 5764 + { 5765 + struct mvpp2_port *port = netdev_priv(dev); 5766 + 5767 + if (!mvpp22_rss_is_supported(port)) 5768 + return -EOPNOTSUPP; 5769 + 5770 + return mvpp2_ethtool_rxfh_set(port, info); 5771 + } 5772 + 5744 5773 static int mvpp2_ethtool_get_eee(struct net_device *dev, 5745 5774 struct ethtool_keee *eee) 5746 5775 { ··· 5830 5813 .get_rxfh_indir_size = mvpp2_ethtool_get_rxfh_indir_size, 5831 5814 .get_rxfh = mvpp2_ethtool_get_rxfh, 5832 5815 .set_rxfh = mvpp2_ethtool_set_rxfh, 5816 + .get_rxfh_fields = mvpp2_ethtool_get_rxfh_fields, 5817 + .set_rxfh_fields = mvpp2_ethtool_set_rxfh_fields, 5833 5818 .create_rxfh_context = mvpp2_create_rxfh_context, 5834 5819 .modify_rxfh_context = mvpp2_modify_rxfh_context, 5835 5820 .remove_rxfh_context = mvpp2_remove_rxfh_context,
+7 -38
drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
··· 308 308 return 0; 309 309 } 310 310 311 - static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv, 312 - struct ethtool_rxnfc *cmd) 311 + static int sxgbe_get_rxfh_fields(struct net_device *dev, 312 + struct ethtool_rxfh_fields *cmd) 313 313 { 314 314 cmd->data = 0; 315 315 ··· 344 344 return 0; 345 345 } 346 346 347 - static int sxgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 348 - u32 *rule_locs) 347 + static int sxgbe_set_rxfh_fields(struct net_device *dev, 348 + const struct ethtool_rxfh_fields *cmd, 349 + struct netlink_ext_ack *extack) 349 350 { 350 351 struct sxgbe_priv_data *priv = netdev_priv(dev); 351 - int ret = -EOPNOTSUPP; 352 - 353 - switch (cmd->cmd) { 354 - case ETHTOOL_GRXFH: 355 - ret = sxgbe_get_rss_hash_opts(priv, cmd); 356 - break; 357 - default: 358 - break; 359 - } 360 - 361 - return ret; 362 - } 363 - 364 - static int sxgbe_set_rss_hash_opt(struct sxgbe_priv_data *priv, 365 - struct ethtool_rxnfc *cmd) 366 - { 367 352 u32 reg_val = 0; 368 353 369 354 /* RSS does not support anything other than hashing ··· 406 421 return 0; 407 422 } 408 423 409 - static int sxgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) 410 - { 411 - struct sxgbe_priv_data *priv = netdev_priv(dev); 412 - int ret = -EOPNOTSUPP; 413 - 414 - switch (cmd->cmd) { 415 - case ETHTOOL_SRXFH: 416 - ret = sxgbe_set_rss_hash_opt(priv, cmd); 417 - break; 418 - default: 419 - break; 420 - } 421 - 422 - return ret; 423 - } 424 - 425 424 static void sxgbe_get_regs(struct net_device *dev, 426 425 struct ethtool_regs *regs, void *space) 427 426 { ··· 458 489 .get_channels = sxgbe_get_channels, 459 490 .get_coalesce = sxgbe_get_coalesce, 460 491 .set_coalesce = sxgbe_set_coalesce, 461 - .get_rxnfc = sxgbe_get_rxnfc, 462 - .set_rxnfc = sxgbe_set_rxnfc, 492 + .get_rxfh_fields = sxgbe_get_rxfh_fields, 493 + .set_rxfh_fields = sxgbe_set_rxfh_fields, 463 494 .get_regs = sxgbe_get_regs, 464 495 .get_regs_len = sxgbe_get_regs_len, 465 496 .get_eee = sxgbe_get_eee,
+9 -8
drivers/net/ethernet/sun/niu.c
··· 7077 7077 7078 7078 } 7079 7079 7080 - static int niu_get_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc) 7080 + static int niu_get_rxfh_fields(struct net_device *dev, 7081 + struct ethtool_rxfh_fields *nfc) 7081 7082 { 7083 + struct niu *np = netdev_priv(dev); 7082 7084 u64 class; 7083 7085 7084 7086 nfc->data = 0; ··· 7292 7290 int ret = 0; 7293 7291 7294 7292 switch (cmd->cmd) { 7295 - case ETHTOOL_GRXFH: 7296 - ret = niu_get_hash_opts(np, cmd); 7297 - break; 7298 7293 case ETHTOOL_GRXRINGS: 7299 7294 cmd->data = np->num_rx_rings; 7300 7295 break; ··· 7312 7313 return ret; 7313 7314 } 7314 7315 7315 - static int niu_set_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc) 7316 + static int niu_set_rxfh_fields(struct net_device *dev, 7317 + const struct ethtool_rxfh_fields *nfc, 7318 + struct netlink_ext_ack *extack) 7316 7319 { 7320 + struct niu *np = netdev_priv(dev); 7317 7321 u64 class; 7318 7322 u64 flow_key = 0; 7319 7323 unsigned long flags; ··· 7658 7656 int ret = 0; 7659 7657 7660 7658 switch (cmd->cmd) { 7661 - case ETHTOOL_SRXFH: 7662 - ret = niu_set_hash_opts(np, cmd); 7663 - break; 7664 7659 case ETHTOOL_SRXCLSRLINS: 7665 7660 ret = niu_add_ethtool_tcam_entry(np, cmd); 7666 7661 break; ··· 7911 7912 .set_phys_id = niu_set_phys_id, 7912 7913 .get_rxnfc = niu_get_nfc, 7913 7914 .set_rxnfc = niu_set_nfc, 7915 + .get_rxfh_fields = niu_get_rxfh_fields, 7916 + .set_rxfh_fields = niu_set_rxfh_fields, 7914 7917 .get_link_ksettings = niu_get_link_ksettings, 7915 7918 .set_link_ksettings = niu_set_link_ksettings, 7916 7919 };