netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: saeed@kernel.org
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Vu Pham <vuhuong@mellanox.com>,
	Mark Bloch <mbloch@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 10/16] net/mlx5: E-Switch, Check and enable metadata support flag before using
Date: Tue, 15 Sep 2020 13:25:27 -0700	[thread overview]
Message-ID: <20200915202533.64389-11-saeed@kernel.org> (raw)
In-Reply-To: <20200915202533.64389-1-saeed@kernel.org>

From: Vu Pham <vuhuong@mellanox.com>

Check E-Switch capabilities and enable metadata support flag
before using it to setup other features that need metadata.

Signed-off-by: Vu Pham <vuhuong@mellanox.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../mellanox/mlx5/core/eswitch_offloads.c         | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index b381cbca5852..4cbadb15297c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1968,16 +1968,9 @@ esw_vport_destroy_offloads_acl_tables(struct mlx5_eswitch *esw,
 static int esw_create_uplink_offloads_acl_tables(struct mlx5_eswitch *esw)
 {
 	struct mlx5_vport *vport;
-	int err;
-
-	if (esw_use_vport_metadata(esw))
-		esw->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA;
 
 	vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK);
-	err = esw_vport_create_offloads_acl_tables(esw, vport);
-	if (err)
-		esw->flags &= ~MLX5_ESWITCH_VPORT_MATCH_METADATA;
-	return err;
+	return esw_vport_create_offloads_acl_tables(esw, vport);
 }
 
 static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw)
@@ -1986,7 +1979,6 @@ static void esw_destroy_uplink_offloads_acl_tables(struct mlx5_eswitch *esw)
 
 	vport = mlx5_eswitch_get_vport(esw, MLX5_VPORT_UPLINK);
 	esw_vport_destroy_offloads_acl_tables(esw, vport);
-	esw->flags &= ~MLX5_ESWITCH_VPORT_MATCH_METADATA;
 }
 
 static int esw_offloads_steering_init(struct mlx5_eswitch *esw)
@@ -2146,6 +2138,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 	if (err)
 		goto err_vport_metadata;
 
+	if (esw_use_vport_metadata(esw))
+		esw->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA;
+
 	err = esw_set_passing_vport_metadata(esw, true);
 	if (err)
 		goto err_vport_metadata;
@@ -2178,6 +2173,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 err_steering_init:
 	esw_set_passing_vport_metadata(esw, false);
 err_vport_metadata:
+	esw->flags &= ~MLX5_ESWITCH_VPORT_MATCH_METADATA;
 	mlx5_rdma_disable_roce(esw->dev);
 	mutex_destroy(&esw->offloads.termtbl_mutex);
 	return err;
@@ -2211,6 +2207,7 @@ void esw_offloads_disable(struct mlx5_eswitch *esw)
 	esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
 	esw_set_passing_vport_metadata(esw, false);
 	esw_offloads_steering_cleanup(esw);
+	esw->flags &= ~MLX5_ESWITCH_VPORT_MATCH_METADATA;
 	mlx5_rdma_disable_roce(esw->dev);
 	mutex_destroy(&esw->offloads.termtbl_mutex);
 	esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
-- 
2.26.2


  parent reply	other threads:[~2020-09-15 22:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 20:25 [pull request][net-next 00/16] mlx5 updates 2020-09-15 saeed
2020-09-15 20:25 ` [net-next 01/16] net/mlx5: Fix uninitialized variable warning saeed
2020-09-15 20:25 ` [net-next 02/16] net/mlx5: remove erroneous fallthrough saeed
2020-09-15 20:25 ` [net-next 03/16] net/mlx5: Always use container_of to find mdev pointer from clock struct saeed
2020-09-15 20:25 ` [net-next 04/16] net/mlx5: Rename ptp clock info saeed
2020-09-15 20:25 ` [net-next 05/16] net/mlx5: Release clock lock before scheduling a PPS work saeed
2020-09-15 20:25 ` [net-next 06/16] net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow saeed
2020-09-15 20:25 ` [net-next 07/16] net/mlx5e: Return a valid errno if can't get lag device index saeed
2020-09-15 20:25 ` [net-next 08/16] net/mlx5e: Add LAG warning for unsupported tx type saeed
2020-09-15 20:25 ` [net-next 09/16] net/mlx5e: Add LAG warning if bond slave is not lag master saeed
2020-09-15 20:25 ` saeed [this message]
2020-09-15 20:25 ` [net-next 11/16] net/mlx5: E-Switch, Dedicated metadata for uplink vport saeed
2020-09-15 20:25 ` [net-next 12/16] net/mlx5: E-Switch, Setup all vports' metadata to support peer miss rule saeed
2020-09-15 20:25 ` [net-next 13/16] net/mlx5: E-Switch, Use vport metadata matching by default saeed
2020-09-15 20:25 ` [net-next 14/16] net/mlx5e: Add support for tc trap saeed
2020-09-15 20:25 ` [net-next 15/16] net/mlx5e: Add IPv6 traffic class (DSCP) header rewrite support saeed
2020-09-15 20:25 ` [net-next 16/16] net/mlx5e: Add CQE compression support for multi-strides packets saeed
2020-09-16 16:56 ` [pull request][net-next 00/16] mlx5 updates 2020-09-15 Jakub Kicinski
2020-09-17  6:01   ` Saeed Mahameed
2020-09-16 22:18 ` David Miller

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=20200915202533.64389-11-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=vuhuong@mellanox.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).