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

ethtool: rejig the RSS notification machinery for more types

In anticipation for CREATE and DELETE notifications - explicitly
pass the notification type to ethtool_rss_notify(), when calling
from the IOCTL code.

Reviewed-by: Gal Pressman <gal@nvidia.com>
Link: https://patch.msgid.link/20250717234343.2328602-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+12 -9
+3 -2
net/ethtool/common.h
··· 76 76 bool __ethtool_dev_mm_supported(struct net_device *dev); 77 77 78 78 #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK) 79 - void ethtool_rss_notify(struct net_device *dev, u32 rss_context); 79 + void ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context); 80 80 #else 81 - static inline void ethtool_rss_notify(struct net_device *dev, u32 rss_context) 81 + static inline void 82 + ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context) 82 83 { 83 84 } 84 85 #endif
+7 -5
net/ethtool/ioctl.c
··· 1105 1105 if (rc) 1106 1106 return rc; 1107 1107 1108 - ethtool_rss_notify(dev, fields.rss_context); 1108 + ethtool_rss_notify(dev, ETHTOOL_MSG_RSS_NTF, fields.rss_context); 1109 1109 return 0; 1110 1110 } 1111 1111 ··· 1520 1520 struct ethtool_rxnfc rx_rings; 1521 1521 struct ethtool_rxfh rxfh; 1522 1522 bool create = false; 1523 - bool mod = false; 1524 1523 u8 *rss_config; 1524 + int ntf = 0; 1525 1525 int ret; 1526 1526 1527 1527 if (!ops->get_rxnfc || !ops->set_rxfh) ··· 1671 1671 rxfh_dev.input_xfrm = rxfh.input_xfrm; 1672 1672 1673 1673 if (!rxfh.rss_context) { 1674 + ntf = ETHTOOL_MSG_RSS_NTF; 1674 1675 ret = ops->set_rxfh(dev, &rxfh_dev, extack); 1675 1676 } else if (create) { 1676 1677 ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev, extack); ··· 1683 1682 ret = ops->remove_rxfh_context(dev, ctx, rxfh.rss_context, 1684 1683 extack); 1685 1684 } else { 1685 + ntf = ETHTOOL_MSG_RSS_NTF; 1686 1686 ret = ops->modify_rxfh_context(dev, ctx, &rxfh_dev, extack); 1687 1687 } 1688 1688 if (ret) { 1689 + ntf = 0; 1689 1690 if (create) { 1690 1691 /* failed to create, free our new tracking entry */ 1691 1692 xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context); ··· 1695 1692 } 1696 1693 goto out_unlock; 1697 1694 } 1698 - mod = !create && !rxfh_dev.rss_delete; 1699 1695 1700 1696 if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, rss_context), 1701 1697 &rxfh_dev.rss_context, sizeof(rxfh_dev.rss_context))) ··· 1734 1732 mutex_unlock(&dev->ethtool->rss_lock); 1735 1733 out_free: 1736 1734 kfree(rss_config); 1737 - if (mod) 1738 - ethtool_rss_notify(dev, rxfh.rss_context); 1735 + if (ntf) 1736 + ethtool_rss_notify(dev, ntf, rxfh.rss_context); 1739 1737 return ret; 1740 1738 } 1741 1739
+2 -2
net/ethtool/rss.c
··· 461 461 462 462 /* RSS_NTF */ 463 463 464 - void ethtool_rss_notify(struct net_device *dev, u32 rss_context) 464 + void ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context) 465 465 { 466 466 struct rss_req_info req_info = { 467 467 .rss_context = rss_context, 468 468 }; 469 469 470 - ethnl_notify(dev, ETHTOOL_MSG_RSS_NTF, &req_info.base); 470 + ethnl_notify(dev, type, &req_info.base); 471 471 } 472 472 473 473 /* RSS_SET */