DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 08/10] net/bnxt: consider vlan fields for the template match criteria
Date: Mon, 13 Jul 2020 11:58:26 +0530	[thread overview]
Message-ID: <20200713062828.19626-9-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200713062828.19626-1-somnath.kotur@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

The vlan mask fields were not setting the field bitmap causing
the template match process to ignore vlan fields. This change fixes
this bug.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |  7 +++----
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 34 +++++++++++++++++++++++---------
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 157c451..051a095 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -16,6 +16,7 @@
 #include "ulp_mark_mgr.h"
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
+#include "tf_util.h"
 
 static struct bnxt_ulp_glb_resource_info *
 ulp_mapper_glb_resource_info_list_get(uint32_t *num_entries)
@@ -719,15 +720,13 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,
 	/* Search identifier also increase the reference count */
 	rc = tf_search_identifier(tfp, &sparms);
 	if (rc) {
-		BNXT_TF_DBG(ERR, "Search ident %s:%s:%x failed.\n",
+		BNXT_TF_DBG(ERR, "Search ident %s:%x failed.\n",
 			    tf_dir_2_str(sparms.dir),
-			    tf_tbl_type_2_str(sparms.ident_type),
 			    sparms.search_id);
 		return rc;
 	}
-	BNXT_TF_INF("Search ident %s:%s:%x.success.\n",
+	BNXT_TF_DBG(INFO, "Search ident %s:%x.success.\n",
 		    tf_dir_2_str(sparms.dir),
-		    tf_tbl_type_2_str(sparms.ident_type),
 		    sparms.search_id);
 
 	/* Write it to the regfile */
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 63f4c17..68e59c4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -12,6 +12,11 @@
 #include "tfp.h"
 #include "ulp_port_db.h"
 
+/* Local defines for the parsing functions */
+#define ULP_VLAN_PRIORITY_SHIFT		13 /* First 3 bits */
+#define ULP_VLAN_PRIORITY_MASK		0x700
+#define ULP_VLAN_TAG_MASK		0xFFF /* Last 12 bits*/
+
 /* Utility function to skip the void items. */
 static inline int32_t
 ulp_rte_item_skip_void(const struct rte_flow_item **item, uint32_t increment)
@@ -545,8 +550,8 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 	 */
 	if (vlan_spec) {
 		vlan_tag = ntohs(vlan_spec->tci);
-		priority = htons(vlan_tag >> 13);
-		vlan_tag &= 0xfff;
+		priority = htons(vlan_tag >> ULP_VLAN_PRIORITY_SHIFT);
+		vlan_tag &= ULP_VLAN_TAG_MASK;
 		vlan_tag = htons(vlan_tag);
 
 		field = ulp_rte_parser_fld_copy(&params->hdr_field[idx],
@@ -562,16 +567,27 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 
 	if (vlan_mask) {
 		vlan_tag = ntohs(vlan_mask->tci);
-		priority = htons(vlan_tag >> 13);
+		priority = htons(vlan_tag >> ULP_VLAN_PRIORITY_SHIFT);
 		vlan_tag &= 0xfff;
+
+		/*
+		 * the storage for priority and vlan tag is 2 bytes
+		 * The mask of priority which is 3 bits if it is all 1's
+		 * then make the rest bits 13 bits as 1's
+		 * so that it is matched as exact match.
+		 */
+		if (priority == ULP_VLAN_PRIORITY_MASK)
+			priority |= ~ULP_VLAN_PRIORITY_MASK;
+		if (vlan_tag == ULP_VLAN_TAG_MASK)
+			vlan_tag |= ~ULP_VLAN_TAG_MASK;
 		vlan_tag = htons(vlan_tag);
 
-		field = &params->hdr_field[idx];
-		memcpy(field->mask, &priority, field->size);
-		field++;
-		memcpy(field->mask, &vlan_tag, field->size);
-		field++;
-		memcpy(field->mask, &vlan_mask->inner_type, field->size);
+		ulp_rte_prsr_mask_copy(params, &idx, &priority,
+				       sizeof(priority));
+		ulp_rte_prsr_mask_copy(params, &idx, &vlan_tag,
+				       sizeof(vlan_tag));
+		ulp_rte_prsr_mask_copy(params, &idx, &vlan_mask->inner_type,
+				       sizeof(vlan_mask->inner_type));
 	}
 	/* Set the vlan index to new incremented value */
 	params->vlan_idx += BNXT_ULP_PROTO_HDR_S_VLAN_NUM;
-- 
2.7.4


  parent reply	other threads:[~2020-07-13  6:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  6:28 [dpdk-dev] [v2 PATCH 00/10] bnxt patches Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 01/10] net/bnxt: add option to delay EEM sysmem mapping Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 02/10] net/bnxt: implement TF Identifier search Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 03/10] net/bnxt: check index range in bulk get Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 04/10] net/bnxt: add changes to support 2 table scopes Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 05/10] net/bnxt: add support to extract data from the ulp blob Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 06/10] net/bnxt: ignore ipv4 tos mask Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 07/10] net/bnxt: add support for identifier search and ref count Somnath Kotur
2020-07-13  6:28 ` Somnath Kotur [this message]
2020-07-13  6:28 ` [dpdk-dev] [PATCH 09/10] net/bnxt: increase the number of egress flow entries Somnath Kotur
2020-07-13  6:28 ` [dpdk-dev] [PATCH 10/10] net/bnxt: add support for decrement ttl action Somnath Kotur
2020-07-13  7:56 ` [dpdk-dev] [v2 PATCH 00/10] bnxt patches Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2020-07-13  6:15 [dpdk-dev] [PATCH " Somnath Kotur
2020-07-13  6:15 ` [dpdk-dev] [PATCH 08/10] net/bnxt: consider vlan fields for the template match criteria Somnath Kotur

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=20200713062828.19626-9-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).