diff options
author | Jakub Kicinski <kuba@kernel.org> | 2025-06-30 08:41:32 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-06-30 08:41:33 -0700 |
commit | 647496422ba9d2784fb8e15b3fda7fe801b1f2ff (patch) | |
tree | 9904df6952d0f6cbfcdb511350606348aa9672ce /net/ethtool/rss.c | |
parent | 99e3eb454cc48b9f2691256780aeb247bdc0ee3d (diff) | |
parent | 040cef30b5e67271e3193e0206f82b206fc97095 (diff) |
Merge branch 'net-ethtool-consistently-take-rss_lock-for-all-rxfh-ops'
Jakub Kicinski says:
====================
net: ethtool: consistently take rss_lock for all rxfh ops
I'd like to bring RXFH and RXFHINDIR ioctls under a single set of
Netlink ops. It appears that while core takes the ethtool->rss_lock
around some of the RXFHINDIR ops, drivers (sfc) take it internally
for the RXFH.
Consistently take the lock around all ops and accesses to the XArray
within the core. This should hopefully make the rss_lock a lot less
confusing.
====================
Link: https://patch.msgid.link/20250626202848.104457-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ethtool/rss.c')
-rw-r--r-- | net/ethtool/rss.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/ethtool/rss.c b/net/ethtool/rss.c index 3adddca7e215..e717f23cbc10 100644 --- a/net/ethtool/rss.c +++ b/net/ethtool/rss.c @@ -139,6 +139,15 @@ rss_prepare_ctx(const struct rss_req_info *request, struct net_device *dev, } static int +rss_prepare(const struct rss_req_info *request, struct net_device *dev, + struct rss_reply_data *data, const struct genl_info *info) +{ + if (request->rss_context) + return rss_prepare_ctx(request, dev, data, info); + return rss_prepare_get(request, dev, data, info); +} + +static int rss_prepare_data(const struct ethnl_req_info *req_base, struct ethnl_reply_data *reply_base, const struct genl_info *info) @@ -147,20 +156,22 @@ rss_prepare_data(const struct ethnl_req_info *req_base, struct rss_req_info *request = RSS_REQINFO(req_base); struct net_device *dev = reply_base->dev; const struct ethtool_ops *ops; + int ret; ops = dev->ethtool_ops; if (!ops->get_rxfh) return -EOPNOTSUPP; /* Some drivers don't handle rss_context */ - if (request->rss_context) { - if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context) - return -EOPNOTSUPP; + if (request->rss_context && + !ops->cap_rss_ctx_supported && !ops->create_rxfh_context) + return -EOPNOTSUPP; - return rss_prepare_ctx(request, dev, data, info); - } + mutex_lock(&dev->ethtool->rss_lock); + ret = rss_prepare(request, dev, data, info); + mutex_unlock(&dev->ethtool->rss_lock); - return rss_prepare_get(request, dev, data, info); + return ret; } static int |