From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, andrew@lunn.ch,
donald.hunter@gmail.com, shuah@kernel.org,
kory.maincent@bootlin.com, gal@nvidia.com,
ecree.xilinx@gmail.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 2/8] ethtool: rejig the RSS notification machinery for more types
Date: Thu, 17 Jul 2025 16:43:37 -0700 [thread overview]
Message-ID: <20250717234343.2328602-3-kuba@kernel.org> (raw)
In-Reply-To: <20250717234343.2328602-1-kuba@kernel.org>
In anticipation for CREATE and DELETE notifications - explicitly
pass the notification type to ethtool_rss_notify(), when calling
from the IOCTL code.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/ethtool/common.h | 5 +++--
net/ethtool/ioctl.c | 12 +++++++-----
| 4 ++--
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/ethtool/common.h b/net/ethtool/common.h
index b2718afe38b5..c8385a268ced 100644
--- a/net/ethtool/common.h
+++ b/net/ethtool/common.h
@@ -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
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 2dfeaaa099fb..beb17f3671a2 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1105,7 +1105,7 @@ ethtool_set_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)
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 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
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;
}
--git a/net/ethtool/rss.c b/net/ethtool/rss.c
index bf45ebc22347..3c6a070ef875 100644
--- a/net/ethtool/rss.c
+++ b/net/ethtool/rss.c
@@ -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 */
--
2.50.1
next prev parent reply other threads:[~2025-07-17 23:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 23:43 [PATCH net-next 0/8] ethtool: rss: support creating and removing contexts via Netlink Jakub Kicinski
2025-07-17 23:43 ` [PATCH net-next 1/8] ethtool: assert that drivers with sym hash are consistent for RSS contexts Jakub Kicinski
2025-07-17 23:43 ` Jakub Kicinski [this message]
2025-07-20 11:09 ` [PATCH net-next 2/8] ethtool: rejig the RSS notification machinery for more types Gal Pressman
2025-07-17 23:43 ` [PATCH net-next 3/8] ethtool: rss: factor out allocating memory for response Jakub Kicinski
2025-07-17 23:43 ` [PATCH net-next 4/8] ethtool: rss: factor out populating response from context Jakub Kicinski
2025-07-20 11:12 ` Gal Pressman
2025-07-17 23:43 ` [PATCH net-next 5/8] ethtool: move ethtool_rxfh_ctx_alloc() to common code Jakub Kicinski
2025-07-20 11:15 ` Gal Pressman
2025-07-17 23:43 ` [PATCH net-next 6/8] ethtool: rss: support creating contexts via Netlink Jakub Kicinski
2025-07-20 11:42 ` Gal Pressman
2025-07-21 15:21 ` Jakub Kicinski
2025-07-21 18:35 ` Gal Pressman
2025-07-17 23:43 ` [PATCH net-next 7/8] ethtool: rss: support removing " Jakub Kicinski
2025-07-17 23:43 ` [PATCH net-next 8/8] selftests: drv-net: rss_api: context create and delete tests Jakub Kicinski
2025-07-22 1:40 ` [PATCH net-next 0/8] ethtool: rss: support creating and removing contexts via Netlink patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250717234343.2328602-3-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.