From: <edward.cree@amd.com>
To: <linux-net-drivers@amd.com>, <davem@davemloft.net>,
<kuba@kernel.org>, <edumazet@google.com>, <pabeni@redhat.com>
Cc: Edward Cree <ecree.xilinx@gmail.com>, <netdev@vger.kernel.org>,
<habetsm.xilinx@gmail.com>, <sudheer.mogilappagari@intel.com>,
<jdamato@fastly.com>, <mw@semihalf.com>, <linux@armlinux.org.uk>,
<sgoutham@marvell.com>, <gakula@marvell.com>,
<sbhatta@marvell.com>, <hkelam@marvell.com>, <saeedm@nvidia.com>,
<leon@kernel.org>, <jacob.e.keller@intel.com>, <andrew@lunn.ch>,
<ahmed.zaki@intel.com>, <horms@kernel.org>
Subject: [PATCH v7 net-next 8/9] net: ethtool: use the tracking array for get_rxfh on custom RSS contexts
Date: Mon, 24 Jun 2024 15:11:19 +0100 [thread overview]
Message-ID: <eb5338a20e18061b83c04fd2927410ebc6f50f0d.1719237940.git.ecree.xilinx@gmail.com> (raw)
In-Reply-To: <cover.1719237939.git.ecree.xilinx@gmail.com>
From: Edward Cree <ecree.xilinx@gmail.com>
On 'ethtool -x' with rss_context != 0, instead of calling the driver to
read the RSS settings for the context, just get the settings from the
rss_ctx xarray, and return them to the user with no driver involvement.
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
---
net/ethtool/ioctl.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 9d2d677770db..ad10ce44a3dd 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1199,6 +1199,7 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
const struct ethtool_ops *ops = dev->ethtool_ops;
struct ethtool_rxfh_param rxfh_dev = {};
u32 user_indir_size, user_key_size;
+ struct ethtool_rxfh_context *ctx;
struct ethtool_rxfh rxfh;
u32 indir_bytes;
u8 *rss_config;
@@ -1246,11 +1247,26 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev,
if (user_key_size)
rxfh_dev.key = rss_config + indir_bytes;
- rxfh_dev.rss_context = rxfh.rss_context;
-
- ret = dev->ethtool_ops->get_rxfh(dev, &rxfh_dev);
- if (ret)
- goto out;
+ if (rxfh.rss_context) {
+ ctx = xa_load(&dev->ethtool->rss_ctx, rxfh.rss_context);
+ if (!ctx) {
+ ret = -ENOENT;
+ goto out;
+ }
+ if (rxfh_dev.indir)
+ memcpy(rxfh_dev.indir, ethtool_rxfh_context_indir(ctx),
+ indir_bytes);
+ if (rxfh_dev.key)
+ memcpy(rxfh_dev.key, ethtool_rxfh_context_key(ctx),
+ user_key_size);
+ rxfh_dev.hfunc = ctx->hfunc;
+ rxfh_dev.input_xfrm = ctx->input_xfrm;
+ ret = 0;
+ } else {
+ ret = dev->ethtool_ops->get_rxfh(dev, &rxfh_dev);
+ if (ret)
+ goto out;
+ }
if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, hfunc),
&rxfh_dev.hfunc, sizeof(rxfh.hfunc))) {
next prev parent reply other threads:[~2024-06-24 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 14:11 [PATCH v7 net-next 0/9] ethtool: track custom RSS contexts in the core edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 1/9] net: move ethtool-related netdev state into its own struct edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 2/9] net: ethtool: attach an XArray of custom RSS contexts to a netdevice edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 3/9] net: ethtool: record custom RSS contexts in the XArray edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 4/9] net: ethtool: let the core choose RSS context IDs edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 5/9] net: ethtool: add an extack parameter to new rxfh_context APIs edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 6/9] net: ethtool: add a mutex protecting RSS contexts edward.cree
2024-06-24 14:11 ` [PATCH v7 net-next 7/9] sfc: use new rxfh_context API edward.cree
2024-06-24 14:11 ` edward.cree [this message]
2024-06-24 14:11 ` [PATCH v7 net-next 9/9] sfc: remove get_rxfh_context dead code edward.cree
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=eb5338a20e18061b83c04fd2927410ebc6f50f0d.1719237940.git.ecree.xilinx@gmail.com \
--to=edward.cree@amd.com \
--cc=ahmed.zaki@intel.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=habetsm.xilinx@gmail.com \
--cc=hkelam@marvell.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jdamato@fastly.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=linux@armlinux.org.uk \
--cc=mw@semihalf.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=sudheer.mogilappagari@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).