From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40E74A0540; Mon, 13 Jul 2020 08:22:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD5951D178; Mon, 13 Jul 2020 08:21:24 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 13FC51C1BC for ; Mon, 13 Jul 2020 08:21:12 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 3ABFF29C684; Sun, 12 Jul 2020 23:21:11 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 3ABFF29C684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1594621271; bh=GlDtDZ62mxhuu6ruIXtCzzF0ZFBPvDovk0w2gqNmRYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0y0CtjS7ogZqA/KBnyre5W/u26hoBEhxwPvB9A6BwFJ9BR11HXuFA+TdVJUdSRW3 yJr/5ETuajaxEpMW/K1gxZw3ylZl2qGIPplOLirR8UDjcAd328xwLprLRmO1q+eC/b /ctf3LCOVLb8mc08/dasu8tkTQhBCgeH0wtePj0Y= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 13 Jul 2020 11:45:58 +0530 Message-Id: <20200713061600.19456-9-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200713061600.19456-1-somnath.kotur@broadcom.com> References: <20200713061600.19456-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 08/10] net/bnxt: consider vlan fields for the template match criteria X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kishore Padmanabha 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 Reviewed-by: Michael Baucom Signed-off-by: Somnath Kotur --- 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 c9237b4..b63a454 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(¶ms->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 = ¶ms->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