From patchwork Sun May 30 08:59:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 93595 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E9D1BA0524; Sun, 30 May 2021 11:07:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAB3A41210; Sun, 30 May 2021 11:02:09 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.11.229]) by mails.dpdk.org (Postfix) with ESMTP id F252241184 for ; Sun, 30 May 2021 11:02:04 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 90BEC7DAF; Sun, 30 May 2021 02:02:03 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 90BEC7DAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1622365324; bh=GcdCSIzeBhkYep7IYzID0Kdx56zbah7m/uw6C+HxCfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IyM+sAzNYObZnONFW9zGKRoH/OX1BUPijRX0Rr0Ep9rxPTG/ynQjbNu4J0vgZfN8V 8fKhmQ+lXg8X73jL4Tpa3nep5gbnhqXkSW21sn9zm723EZKr68reJLvdN1yHeAKqs7 JWNY8L1yof4YOHgN1DVhGMY3h0T/gJfxGF+C0Iuk= From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru Date: Sun, 30 May 2021 14:29:25 +0530 Message-Id: <20210530085929.29695-55-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> References: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 54/58] net/bnxt: add support for icmp6 ULP parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 This patch adds support for parsing rte_flow items for icmp6 flows. Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Randy Schacher --- drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 4 +- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 48 +++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 5 ++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c index 7bd499faa6..35e9858727 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c @@ -346,8 +346,8 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = { .proto_hdr_func = NULL }, [RTE_FLOW_ITEM_TYPE_ICMP6] = { - .hdr_type = BNXT_ULP_HDR_TYPE_NOT_SUPPORTED, - .proto_hdr_func = NULL + .hdr_type = BNXT_ULP_HDR_TYPE_SUPPORTED, + .proto_hdr_func = ulp_rte_icmp6_hdr_handler }, [RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS] = { .hdr_type = BNXT_ULP_HDR_TYPE_NOT_SUPPORTED, diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 0d52c0b93b..a55655a5bd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -1599,6 +1599,54 @@ ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item, return BNXT_TF_RC_SUCCESS; } +/* Function to handle the parsing of RTE Flow item ICMP6 Header. */ +int32_t +ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item, + struct ulp_rte_parser_params *params) +{ + const struct rte_flow_item_icmp6 *icmp_spec = item->spec; + const struct rte_flow_item_icmp6 *icmp_mask = item->mask; + struct ulp_rte_hdr_bitmap *hdr_bitmap = ¶ms->hdr_bitmap; + uint32_t idx = 0; + uint32_t size; + + if (ulp_rte_prsr_fld_size_validate(params, &idx, + BNXT_ULP_PROTO_HDR_ICMP_NUM)) { + BNXT_TF_DBG(ERR, "Error parsing protocol header\n"); + return BNXT_TF_RC_ERROR; + } + + size = sizeof(((struct rte_flow_item_icmp6 *)NULL)->type); + ulp_rte_prsr_fld_mask(params, &idx, size, + ulp_deference_struct(icmp_spec, type), + ulp_deference_struct(icmp_mask, type), + ULP_PRSR_ACT_DEFAULT); + + size = sizeof(((struct rte_flow_item_icmp6 *)NULL)->code); + ulp_rte_prsr_fld_mask(params, &idx, size, + ulp_deference_struct(icmp_spec, code), + ulp_deference_struct(icmp_mask, code), + ULP_PRSR_ACT_DEFAULT); + + size = sizeof(((struct rte_flow_item_icmp6 *)NULL)->checksum); + ulp_rte_prsr_fld_mask(params, &idx, size, + ulp_deference_struct(icmp_spec, checksum), + ulp_deference_struct(icmp_mask, checksum), + ULP_PRSR_ACT_DEFAULT); + + if (ULP_BITMAP_ISSET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_O_IPV4)) { + BNXT_TF_DBG(ERR, "Error: incorrect icmp version\n"); + return BNXT_TF_RC_ERROR; + } + + /* Update the hdr_bitmap with ICMP */ + if (ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_L3_TUN)) + ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_I_ICMP); + else + ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_O_ICMP); + return BNXT_TF_RC_SUCCESS; +} + /* Function to handle the parsing of RTE Flow item void Header */ int32_t ulp_rte_void_hdr_handler(const struct rte_flow_item *item __rte_unused, diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index 66abe8e656..bbba10108c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -147,6 +147,11 @@ int32_t ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item, struct ulp_rte_parser_params *params); +/* Function to handle the parsing of RTE Flow item ICMP6 Header. */ +int32_t +ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item, + struct ulp_rte_parser_params *params); + /* Function to handle the parsing of RTE Flow item void Header. */ int32_t ulp_rte_void_hdr_handler(const struct rte_flow_item *item,