From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Aya Levin <ayal@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 02/12] net/mlx5e: Add error flow for ethtool -X command
Date: Fri, 24 Sep 2021 11:47:58 -0700 [thread overview]
Message-ID: <20210924184808.796968-3-saeed@kernel.org> (raw)
In-Reply-To: <20210924184808.796968-1-saeed@kernel.org>
From: Aya Levin <ayal@nvidia.com>
Prior to this patch, ethtool -X fail but the user receives a success
status. Try to roll-back when failing and return success status
accordingly.
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
| 27 +++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
--git a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
index 625cd49ef96c..b8b481b335cf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rss.c
@@ -391,7 +391,7 @@ int mlx5e_rss_obtain_tirn(struct mlx5e_rss *rss,
return 0;
}
-static void mlx5e_rss_apply(struct mlx5e_rss *rss, u32 *rqns, unsigned int num_rqns)
+static int mlx5e_rss_apply(struct mlx5e_rss *rss, u32 *rqns, unsigned int num_rqns)
{
int err;
@@ -399,6 +399,7 @@ static void mlx5e_rss_apply(struct mlx5e_rss *rss, u32 *rqns, unsigned int num_r
if (err)
mlx5e_rss_warn(rss->mdev, "Failed to redirect RQT %#x to channels: err = %d\n",
mlx5e_rqt_get_rqtn(&rss->rqt), err);
+ return err;
}
void mlx5e_rss_enable(struct mlx5e_rss *rss, u32 *rqns, unsigned int num_rqns)
@@ -490,6 +491,14 @@ int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
{
bool changed_indir = false;
bool changed_hash = false;
+ struct mlx5e_rss *old_rss;
+ int err = 0;
+
+ old_rss = mlx5e_rss_alloc();
+ if (!old_rss)
+ return -ENOMEM;
+
+ *old_rss = *rss;
if (hfunc && *hfunc != rss->hash.hfunc) {
switch (*hfunc) {
@@ -497,7 +506,8 @@ int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
case ETH_RSS_HASH_TOP:
break;
default:
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}
changed_hash = true;
changed_indir = true;
@@ -520,13 +530,20 @@ int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
rss->indir.table[i] = indir[i];
}
- if (changed_indir && rss->enabled)
- mlx5e_rss_apply(rss, rqns, num_rqns);
+ if (changed_indir && rss->enabled) {
+ err = mlx5e_rss_apply(rss, rqns, num_rqns);
+ if (err) {
+ *rss = *old_rss;
+ goto out;
+ }
+ }
if (changed_hash)
mlx5e_rss_update_tirs(rss);
- return 0;
+out:
+ mlx5e_rss_free(old_rss);
+ return err;
}
struct mlx5e_rss_params_hash mlx5e_rss_get_hash(struct mlx5e_rss *rss)
--
2.31.1
next prev parent reply other threads:[~2021-09-24 18:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 18:47 [pull request][net-next 00/12] mlx5 updates 2021-09-24 Saeed Mahameed
2021-09-24 18:47 ` [net-next 01/12] net/mlx5: DR, Fix code indentation in dr_ste_v1 Saeed Mahameed
2021-09-25 10:40 ` patchwork-bot+netdevbpf
2021-09-24 18:47 ` Saeed Mahameed [this message]
2021-09-24 18:47 ` [net-next 03/12] net/mlx5e: Use correct return type Saeed Mahameed
2021-09-24 18:48 ` [net-next 04/12] net/mlx5e: Remove incorrect addition of action fwd flag Saeed Mahameed
2021-09-24 18:48 ` [net-next 05/12] net/mlx5e: Set action fwd flag when parsing tc action goto Saeed Mahameed
2021-09-24 18:48 ` [net-next 06/12] net/mlx5e: Check action fwd/drop flag exists also for nic flows Saeed Mahameed
2021-09-24 18:48 ` [net-next 07/12] net/mlx5e: Remove redundant priv arg from parse_pedit_to_reformat() Saeed Mahameed
2021-09-24 18:48 ` [net-next 08/12] net/mlx5e: Use tc sample stubs instead of ifdefs in source file Saeed Mahameed
2021-09-24 18:48 ` [net-next 09/12] net/mlx5e: Use NL_SET_ERR_MSG_MOD() for errors parsing tunnel attributes Saeed Mahameed
2021-09-24 18:48 ` [net-next 10/12] net/mlx5e: loopback test is not supported in switchdev mode Saeed Mahameed
2021-09-24 18:48 ` [net-next 11/12] net/mlx5e: Enable TC offload for egress MACVLAN Saeed Mahameed
2021-09-24 18:48 ` [net-next 12/12] net/mlx5e: Enable TC offload for ingress MACVLAN Saeed Mahameed
2021-09-25 0:25 ` [pull request][net-next 00/12] mlx5 updates 2021-09-24 Jakub Kicinski
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=20210924184808.796968-3-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=ayal@nvidia.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.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).