From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Jiri Pirko <jiri@nvidia.com>, Shay Drory <shayd@nvidia.com>
Subject: [net-next V2 11/15] net/mlx5: Don't check vport->enabled in port ops
Date: Thu, 27 Jul 2023 11:39:10 -0700 [thread overview]
Message-ID: <20230727183914.69229-12-saeed@kernel.org> (raw)
In-Reply-To: <20230727183914.69229-1-saeed@kernel.org>
From: Jiri Pirko <jiri@nvidia.com>
vport->enabled is always set for a vport for which a devlink port is
registered, therefore the checks in the ops are pointless.
Remove those.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../mellanox/mlx5/core/eswitch_offloads.c | 28 ++++---------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index b4b8cb788573..c192000e3614 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -4125,7 +4125,6 @@ int mlx5_devlink_port_fn_migratable_get(struct devlink_port *port, bool *is_enab
{
struct mlx5_eswitch *esw;
struct mlx5_vport *vport;
- int err = -EOPNOTSUPP;
esw = mlx5_devlink_eswitch_get(port->devlink);
if (IS_ERR(esw))
@@ -4133,7 +4132,7 @@ int mlx5_devlink_port_fn_migratable_get(struct devlink_port *port, bool *is_enab
if (!MLX5_CAP_GEN(esw->dev, migration)) {
NL_SET_ERR_MSG_MOD(extack, "Device doesn't support migration");
- return err;
+ return -EOPNOTSUPP;
}
vport = mlx5_devlink_port_fn_get_vport(port, esw);
@@ -4143,12 +4142,9 @@ int mlx5_devlink_port_fn_migratable_get(struct devlink_port *port, bool *is_enab
}
mutex_lock(&esw->state_lock);
- if (vport->enabled) {
- *is_enabled = vport->info.mig_enabled;
- err = 0;
- }
+ *is_enabled = vport->info.mig_enabled;
mutex_unlock(&esw->state_lock);
- return err;
+ return 0;
}
int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable,
@@ -4177,10 +4173,6 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable,
}
mutex_lock(&esw->state_lock);
- if (!vport->enabled) {
- NL_SET_ERR_MSG_MOD(extack, "Eswitch vport is disabled");
- goto out;
- }
if (vport->info.mig_enabled == enable) {
err = 0;
@@ -4224,7 +4216,6 @@ int mlx5_devlink_port_fn_roce_get(struct devlink_port *port, bool *is_enabled,
{
struct mlx5_eswitch *esw;
struct mlx5_vport *vport;
- int err = -EOPNOTSUPP;
esw = mlx5_devlink_eswitch_get(port->devlink);
if (IS_ERR(esw))
@@ -4237,12 +4228,9 @@ int mlx5_devlink_port_fn_roce_get(struct devlink_port *port, bool *is_enabled,
}
mutex_lock(&esw->state_lock);
- if (vport->enabled) {
- *is_enabled = vport->info.roce_enabled;
- err = 0;
- }
+ *is_enabled = vport->info.roce_enabled;
mutex_unlock(&esw->state_lock);
- return err;
+ return 0;
}
int mlx5_devlink_port_fn_roce_set(struct devlink_port *port, bool enable,
@@ -4251,10 +4239,10 @@ int mlx5_devlink_port_fn_roce_set(struct devlink_port *port, bool enable,
int query_out_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out);
struct mlx5_eswitch *esw;
struct mlx5_vport *vport;
- int err = -EOPNOTSUPP;
void *query_ctx;
void *hca_caps;
u16 vport_num;
+ int err;
esw = mlx5_devlink_eswitch_get(port->devlink);
if (IS_ERR(esw))
@@ -4268,10 +4256,6 @@ int mlx5_devlink_port_fn_roce_set(struct devlink_port *port, bool enable,
vport_num = vport->vport;
mutex_lock(&esw->state_lock);
- if (!vport->enabled) {
- NL_SET_ERR_MSG_MOD(extack, "Eswitch vport is disabled");
- goto out;
- }
if (vport->info.roce_enabled == enable) {
err = 0;
--
2.41.0
next prev parent reply other threads:[~2023-07-27 18:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 18:38 [pull request][net-next V2 00/15] mlx5 updates 2023-07-24 Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 01/15] net/mlx5: Use shared code for checking lag is supported Saeed Mahameed
2023-07-28 20:50 ` patchwork-bot+netdevbpf
2023-07-27 18:39 ` [net-next V2 02/15] net/mlx5: Devcom, Infrastructure changes Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 03/15] net/mlx5e: E-Switch, Register devcom device with switch id key Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 04/15] net/mlx5e: E-Switch, Allow devcom initialization on more vports Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 05/15] net/mlx5: Re-organize mlx5_cmd struct Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 06/15] net/mlx5: Remove redundant cmdif revision check Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 07/15] net/mlx5: split mlx5_cmd_init() to probe and reload routines Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 08/15] net/mlx5: Allocate command stats with xarray Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 09/15] net/mlx5e: Remove duplicate code for user flow Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 10/15] net/mlx5e: Make flow classification filters static Saeed Mahameed
2023-07-27 18:39 ` Saeed Mahameed [this message]
2023-07-27 18:39 ` [net-next V2 12/15] net/mlx5: Remove pointless devlink_rate checks Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 13/15] net/mlx5: Make mlx5_esw_offloads_rep_load/unload() static Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 14/15] net/mlx5: Make mlx5_eswitch_load/unload_vport() static Saeed Mahameed
2023-07-27 18:39 ` [net-next V2 15/15] net/mlx5: Give esw_offloads_load/unload_rep() "mlx5_" prefix Saeed Mahameed
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=20230727183914.69229-12-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=shayd@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).