From patchwork Wed Jun 10 11:44:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Somnath Kotur X-Patchwork-Id: 71163 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 85E18A051B; Wed, 10 Jun 2020 13:53:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 364C91BF9C; Wed, 10 Jun 2020 13:49:34 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 2225A1BF84 for ; Wed, 10 Jun 2020 13:49:31 +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 741711BD53A; Wed, 10 Jun 2020 04:49:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 741711BD53A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591789771; bh=9nU+KzgiI96cEaZ2dUouUqSUeeCMDDAMNa2Upbdl0ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nhqeJcB2bd4SmmkQeroH2D60novdFAP4i2d0xw5lGbhnO6fc1MzKSUryVooTao6mu 6St2OlnibqOjcJ070DGNpQoFSM0AIzujW7OtgVWaqj0jaLEjtKVRf4xInvWaUTfaKV vgU/K4OvcENyD7Q0EbFX0SKLuXlFCS/P0u5V0s+Y= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Wed, 10 Jun 2020 17:14:18 +0530 Message-Id: <20200610114427.22146-28-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200610114427.22146-1-somnath.kotur@broadcom.com> References: <20200610114427.22146-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 27/36] net/bnxt: parse ipv6 vtc_flow field for more granularly 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: Venkat Duvvuru ipv6 vtc_flow contains three fields 1. Version 2. Priority / Traffic Class 3. Flow Label Currently, these are not parsed separately and also not set separately in the field bitmap by the flow parser. However, the template treats them separately. As a result, the flow matching doesn't succeed because the bitmaps of parser and the template doesn't match. This patch fixes this problem by parsing the above mentioned fields individually to align with the template. Signed-off-by: Venkat Duvvuru Reviewed-by: Somnath Kotur Reviewed-by: Ajit Kumar Khaparde Reviewed-by: Michael Baucom Signed-off-by: Somnath Kotur --- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 37 ++++++++++++++++++++++++--- drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 10 ++++++++ drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 2 +- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 3dd941f..ec576a9 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -598,6 +598,7 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, uint32_t idx = params->field_idx; uint32_t size; uint32_t inner_l3, outer_l3; + uint32_t vtcf, vtcf_mask; inner_l3 = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_I_L3); if (inner_l3) { @@ -606,14 +607,27 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, } /* - * Copy the rte_flow_item for ipv4 into hdr_field using ipv4 + * Copy the rte_flow_item for ipv6 into hdr_field using ipv6 * header fields */ if (ipv6_spec) { size = sizeof(ipv6_spec->hdr.vtc_flow); + + vtcf = BNXT_ULP_GET_IPV6_VER(ipv6_spec->hdr.vtc_flow); field = ulp_rte_parser_fld_copy(¶ms->hdr_field[idx], - &ipv6_spec->hdr.vtc_flow, + &vtcf, + size); + + vtcf = BNXT_ULP_GET_IPV6_TC(ipv6_spec->hdr.vtc_flow); + field = ulp_rte_parser_fld_copy(field, + &vtcf, + size); + + vtcf = BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_spec->hdr.vtc_flow); + field = ulp_rte_parser_fld_copy(field, + &vtcf, size); + size = sizeof(ipv6_spec->hdr.payload_len); field = ulp_rte_parser_fld_copy(field, &ipv6_spec->hdr.payload_len, @@ -636,9 +650,24 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, size); } if (ipv6_mask) { + size = sizeof(ipv6_mask->hdr.vtc_flow); + + vtcf_mask = BNXT_ULP_GET_IPV6_VER(ipv6_mask->hdr.vtc_flow); + ulp_rte_prsr_mask_copy(params, &idx, + &vtcf_mask, + size); + + vtcf_mask = BNXT_ULP_GET_IPV6_TC(ipv6_mask->hdr.vtc_flow); ulp_rte_prsr_mask_copy(params, &idx, - &ipv6_mask->hdr.vtc_flow, - sizeof(ipv6_mask->hdr.vtc_flow)); + &vtcf_mask, + size); + + vtcf_mask = + BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_mask->hdr.vtc_flow); + ulp_rte_prsr_mask_copy(params, &idx, + &vtcf_mask, + size); + ulp_rte_prsr_mask_copy(params, &idx, &ipv6_mask->hdr.payload_len, sizeof(ipv6_mask->hdr.payload_len)); diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index 868e6dc..c90bff4 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -21,6 +21,16 @@ #define BNXT_ULP_ENCAP_UDP_SIZE 4 #define BNXT_ULP_INVALID_SVIF_VAL -1U +#define BNXT_ULP_GET_IPV6_VER(vtcf) \ + (((vtcf) & BNXT_ULP_PARSER_IPV6_VER_MASK) >> 28) +#define BNXT_ULP_GET_IPV6_TC(vtcf) \ + (((vtcf) & BNXT_ULP_PARSER_IPV6_TC) >> 20) +#define BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf) \ + ((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL) +#define BNXT_ULP_PARSER_IPV6_VER_MASK 0xf0000000 +#define BNXT_ULP_PARSER_IPV6_TC 0x0ff00000 +#define BNXT_ULP_PARSER_IPV6_FLOW_LABEL 0x000fffff + /* Function to handle the parsing of the RTE port id. */ int32_t ulp_rte_parser_svif_process(struct ulp_rte_parser_params *params); diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index 9b1bdbb..36bf5a4 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -23,7 +23,7 @@ #define BNXT_ULP_PROTO_HDR_S_VLAN_NUM 3 #define BNXT_ULP_PROTO_HDR_VLAN_NUM 6 #define BNXT_ULP_PROTO_HDR_IPV4_NUM 10 -#define BNXT_ULP_PROTO_HDR_IPV6_NUM 6 +#define BNXT_ULP_PROTO_HDR_IPV6_NUM 8 #define BNXT_ULP_PROTO_HDR_UDP_NUM 4 #define BNXT_ULP_PROTO_HDR_TCP_NUM 9 #define BNXT_ULP_PROTO_HDR_VXLAN_NUM 4