netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 02/15] net/mlx5: DR, Replace local WIRE_PORT macro with the existing MLX5_VPORT_UPLINK
Date: Thu, 30 Sep 2021 16:20:37 -0700	[thread overview]
Message-ID: <20210930232050.41779-3-saeed@kernel.org> (raw)
In-Reply-To: <20210930232050.41779-1-saeed@kernel.org>

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

SW steering defines its own macro for uplink vport number.
Replace this macro with an already existing mlx5 macro.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/steering/dr_action.c   | 2 +-
 .../net/ethernet/mellanox/mlx5/core/steering/dr_domain.c   | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 4 ++--
 .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h    | 7 +++----
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
index 032b4a2546d3..8ca8fb804798 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
@@ -669,7 +669,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
 			attr.hit_gvmi = action->vport->caps->vhca_gvmi;
 			dest_action = action;
 			if (rx_rule) {
-				if (action->vport->caps->num == WIRE_PORT) {
+				if (action->vport->caps->num == MLX5_VPORT_UPLINK) {
 					mlx5dr_dbg(dmn, "Device doesn't support Loopback on WIRE vport\n");
 					return -EOPNOTSUPP;
 				}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
index ca299d480579..73646322c7bc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
@@ -170,7 +170,7 @@ static int dr_domain_query_vports(struct mlx5dr_domain *dmn)
 
 	/* Last vport is the wire port */
 	wire_vport = &dmn->info.caps.vports_caps[vport];
-	wire_vport->num = WIRE_PORT;
+	wire_vport->num = MLX5_VPORT_UPLINK;
 	wire_vport->icm_address_rx = esw_caps->uplink_icm_address_rx;
 	wire_vport->icm_address_tx = esw_caps->uplink_icm_address_tx;
 	wire_vport->vport_gvmi = 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
index aca80efc28fa..323ea138ad99 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c
@@ -1042,10 +1042,10 @@ static bool dr_rule_skip(enum mlx5dr_domain_type domain,
 		return false;
 
 	if (mask->misc.source_port) {
-		if (rx && value->misc.source_port != WIRE_PORT)
+		if (rx && value->misc.source_port != MLX5_VPORT_UPLINK)
 			return true;
 
-		if (!rx && value->misc.source_port == WIRE_PORT)
+		if (!rx && value->misc.source_port == MLX5_VPORT_UPLINK)
 			return true;
 	}
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
index 441c03e645db..8e171a6d3a9d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
@@ -4,7 +4,7 @@
 #ifndef	_DR_TYPES_
 #define	_DR_TYPES_
 
-#include <linux/mlx5/driver.h>
+#include <linux/mlx5/vport.h>
 #include <linux/refcount.h>
 #include "fs_core.h"
 #include "wq.h"
@@ -14,7 +14,6 @@
 
 #define DR_RULE_MAX_STES 18
 #define DR_ACTION_MAX_STES 5
-#define WIRE_PORT 0xFFFF
 #define DR_STE_SVLAN 0x1
 #define DR_STE_CVLAN 0x2
 #define DR_SZ_MATCH_PARAM (MLX5_ST_SZ_DW_MATCH_PARAM * 4)
@@ -1106,10 +1105,10 @@ static inline struct mlx5dr_cmd_vport_cap *
 mlx5dr_get_vport_cap(struct mlx5dr_cmd_caps *caps, u16 vport)
 {
 	if (!caps->vports_caps ||
-	    (vport >= caps->num_vports && vport != WIRE_PORT))
+	    (vport >= caps->num_vports && vport != MLX5_VPORT_UPLINK))
 		return NULL;
 
-	if (vport == WIRE_PORT)
+	if (vport == MLX5_VPORT_UPLINK)
 		vport = caps->num_vports;
 
 	return &caps->vports_caps[vport];
-- 
2.31.1


  parent reply	other threads:[~2021-09-30 23:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 23:20 [pull request][net-next 00/15] mlx5 updates 2021-09-30 Saeed Mahameed
2021-09-30 23:20 ` [net-next 01/15] net/mlx5: DR, Fix vport number data type to u16 Saeed Mahameed
2021-10-01 22:00   ` patchwork-bot+netdevbpf
2021-09-30 23:20 ` Saeed Mahameed [this message]
2021-09-30 23:20 ` [net-next 03/15] net/mlx5: DR, Add missing query for vport 0 Saeed Mahameed
2021-09-30 23:20 ` [net-next 04/15] net/mlx5: DR, Align error messages for failure to obtain vport caps Saeed Mahameed
2021-09-30 23:20 ` [net-next 05/15] net/mlx5: DR, Support csum recalculation flow table on SFs Saeed Mahameed
2021-09-30 23:20 ` [net-next 06/15] net/mlx5: DR, Add support for SF vports Saeed Mahameed
2021-09-30 23:20 ` [net-next 07/15] net/mlx5: DR, Increase supported num of actions to 32 Saeed Mahameed
2021-09-30 23:20 ` [net-next 08/15] net/mlx5: DR, Fix typo 'offeset' to 'offset' Saeed Mahameed
2021-09-30 23:20 ` [net-next 09/15] net/mlx5: DR, init_next_match only if needed Saeed Mahameed
2021-09-30 23:20 ` [net-next 10/15] net/mlx5: DR, Add missing string for action type SAMPLER Saeed Mahameed
2021-09-30 23:20 ` [net-next 11/15] net/mlx5: Warn for devlink reload when there are VFs alive Saeed Mahameed
2021-09-30 23:20 ` [net-next 12/15] net/mlx5: Tolerate failures in debug features while driver load Saeed Mahameed
2021-09-30 23:20 ` [net-next 13/15] net/mlx5: Use kvcalloc() instead of kvzalloc() Saeed Mahameed
2021-09-30 23:20 ` [net-next 14/15] net/mlx5: Use struct_size() helper in kvzalloc() Saeed Mahameed
2021-09-30 23:20 ` [net-next 15/15] net/mlx5e: Use array_size() helper 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=20210930232050.41779-3-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@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).