From: Simon Horman <horms@kernel•org>
To: edward.cree@amd•com
Cc: linux-net-drivers@amd•com, davem@davemloft•net, kuba@kernel•org,
edumazet@google•com, pabeni@redhat•com,
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
Subject: Re: [PATCH v6 net-next 8/9] net: ethtool: use the tracking array for get_rxfh on custom RSS contexts
Date: Thu, 20 Jun 2024 20:42:14 +0100 [thread overview]
Message-ID: <20240620194214.GT959333@kernel.org> (raw)
In-Reply-To: <2f024e0b6d32880ff443c4e880af16ec2b5e456a.1718862050.git.ecree.xilinx@gmail.com>
On Thu, Jun 20, 2024 at 06:47:11AM +0100, edward.cree@amd•com wrote:
> 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 | 25 ++++++++++++++++++++-----
> 1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
> index 9d2d677770db..ac562ee3662e 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,25 @@ 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;
Hi Edward,
The last line of this function is:
return ret;
With this patch applied, Smatch complains that ret may be used there
when unintialised.
I think that occurs when the code reaches the line where this
commentary has been placed in this email.
> + } 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-20 19:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 5:47 [PATCH v6 net-next 0/9] ethtool: track custom RSS contexts in the core edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 1/9] net: move ethtool-related netdev state into its own struct edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 2/9] net: ethtool: attach an XArray of custom RSS contexts to a netdevice edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 3/9] net: ethtool: record custom RSS contexts in the XArray edward.cree
2024-06-20 6:32 ` Przemek Kitszel
2024-06-20 6:37 ` Edward Cree
2024-06-25 7:17 ` Przemek Kitszel
2024-06-25 9:27 ` Edward Cree
2024-06-25 13:39 ` Edward Cree
2024-06-26 9:05 ` Przemek Kitszel
2024-06-27 14:24 ` Edward Cree
2024-06-28 12:15 ` Przemek Kitszel
2024-06-20 5:47 ` [PATCH v6 net-next 4/9] net: ethtool: let the core choose RSS context IDs edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 5/9] net: ethtool: add an extack parameter to new rxfh_context APIs edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 6/9] net: ethtool: add a mutex protecting RSS contexts edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 7/9] sfc: use new rxfh_context API edward.cree
2024-06-20 5:47 ` [PATCH v6 net-next 8/9] net: ethtool: use the tracking array for get_rxfh on custom RSS contexts edward.cree
2024-06-20 19:42 ` Simon Horman [this message]
2024-06-24 13:31 ` Edward Cree
2024-06-20 5:47 ` [PATCH v6 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=20240620194214.GT959333@kernel.org \
--to=horms@kernel$(echo .)org \
--cc=ahmed.zaki@intel$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=ecree.xilinx@gmail$(echo .)com \
--cc=edumazet@google$(echo .)com \
--cc=edward.cree@amd$(echo .)com \
--cc=gakula@marvell$(echo .)com \
--cc=habetsm.xilinx@gmail$(echo .)com \
--cc=hkelam@marvell$(echo .)com \
--cc=jacob.e.keller@intel$(echo .)com \
--cc=jdamato@fastly$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=leon@kernel$(echo .)org \
--cc=linux-net-drivers@amd$(echo .)com \
--cc=linux@armlinux$(echo .)org.uk \
--cc=mw@semihalf$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=saeedm@nvidia$(echo .)com \
--cc=sbhatta@marvell$(echo .)com \
--cc=sgoutham@marvell$(echo .)com \
--cc=sudheer.mogilappagari@intel$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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