]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ethtool: rejig the RSS notification machinery for more types
authorJakub Kicinski <kuba@kernel.org>
Thu, 17 Jul 2025 23:43:37 +0000 (16:43 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 22 Jul 2025 01:20:19 +0000 (18:20 -0700)
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>
net/ethtool/common.h
net/ethtool/ioctl.c
net/ethtool/rss.c

index b2718afe38b56deb65cce6734287c6e0526e7683..c8385a268ceddf11f3221ffdaa3b3178cf45c49c 100644 (file)
@@ -76,9 +76,10 @@ int ethtool_get_module_eeprom_call(struct net_device *dev,
 bool __ethtool_dev_mm_supported(struct net_device *dev);
 
 #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)
-void ethtool_rss_notify(struct net_device *dev, u32 rss_context);
+void ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context);
 #else
-static inline void ethtool_rss_notify(struct net_device *dev, u32 rss_context)
+static inline void
+ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context)
 {
 }
 #endif
index 2dfeaaa099fb3a6981bd6480e7dab3a2718092af..beb17f3671a2853be1424c8743a9a875cedbb30d 100644 (file)
@@ -1105,7 +1105,7 @@ exit_unlock:
        if (rc)
                return rc;
 
-       ethtool_rss_notify(dev, fields.rss_context);
+       ethtool_rss_notify(dev, ETHTOOL_MSG_RSS_NTF, fields.rss_context);
        return 0;
 }
 
@@ -1520,8 +1520,8 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
        struct ethtool_rxnfc rx_rings;
        struct ethtool_rxfh rxfh;
        bool create = false;
-       bool mod = false;
        u8 *rss_config;
+       int ntf = 0;
        int ret;
 
        if (!ops->get_rxnfc || !ops->set_rxfh)
@@ -1671,6 +1671,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
        rxfh_dev.input_xfrm = rxfh.input_xfrm;
 
        if (!rxfh.rss_context) {
+               ntf = ETHTOOL_MSG_RSS_NTF;
                ret = ops->set_rxfh(dev, &rxfh_dev, extack);
        } else if (create) {
                ret = ops->create_rxfh_context(dev, ctx, &rxfh_dev, extack);
@@ -1682,9 +1683,11 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
                ret = ops->remove_rxfh_context(dev, ctx, rxfh.rss_context,
                                               extack);
        } else {
+               ntf = ETHTOOL_MSG_RSS_NTF;
                ret = ops->modify_rxfh_context(dev, ctx, &rxfh_dev, extack);
        }
        if (ret) {
+               ntf = 0;
                if (create) {
                        /* failed to create, free our new tracking entry */
                        xa_erase(&dev->ethtool->rss_ctx, rxfh.rss_context);
@@ -1692,7 +1695,6 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
                }
                goto out_unlock;
        }
-       mod = !create && !rxfh_dev.rss_delete;
 
        if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, rss_context),
                         &rxfh_dev.rss_context, sizeof(rxfh_dev.rss_context)))
@@ -1732,8 +1734,8 @@ out_unlock:
        mutex_unlock(&dev->ethtool->rss_lock);
 out_free:
        kfree(rss_config);
-       if (mod)
-               ethtool_rss_notify(dev, rxfh.rss_context);
+       if (ntf)
+               ethtool_rss_notify(dev, ntf, rxfh.rss_context);
        return ret;
 }
 
index bf45ebc223471d05153f26336d8375ddbc861b09..3c6a070ef875871da468c14da599a6c5c0261976 100644 (file)
@@ -461,13 +461,13 @@ int ethnl_rss_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 
 /* RSS_NTF */
 
-void ethtool_rss_notify(struct net_device *dev, u32 rss_context)
+void ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context)
 {
        struct rss_req_info req_info = {
                .rss_context = rss_context,
        };
 
-       ethnl_notify(dev, ETHTOOL_MSG_RSS_NTF, &req_info.base);
+       ethnl_notify(dev, type, &req_info.base);
 }
 
 /* RSS_SET */