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 142CBA00C5; Mon, 6 Jul 2020 10:33:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D923F1DAF5; Mon, 6 Jul 2020 10:30:26 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id D5E771DA09 for ; Mon, 6 Jul 2020 10:30:07 +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 66A63298769; Mon, 6 Jul 2020 01:30:07 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 66A63298769 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1594024207; bh=iOQHv52dVYEB1k/gyz7uO1CkDx8ixtke8D5NHOpmZn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hn1147sucvQbqglurwriYuaurNY4LJegy1IyVgntKYIwVs01Y+NtEd/CgAKJC9vk6 h2Nka7aPKYGYHjD1XIMSQQRvsF/wSJh5dySHS1D2AzmJDKXnBFWGRBM0F5SH/54E5z rmfODzA8StxdUGFBGK8lZW3Iedqyx57UxwSRL0uw= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 6 Jul 2020 13:54:58 +0530 Message-Id: <20200706082502.26935-17-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200706082502.26935-1-somnath.kotur@broadcom.com> References: <20200706082502.26935-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 16/20] net/bnxt: add support for nat rte action items 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 Added support for set ipv4 address action items. It allows the source or destination ip address to be changed for a given flow. Signed-off-by: Kishore Padmanabha Reviewed-by: Michael Baucom Signed-off-by: Somnath Kotur Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 42 ++++++++++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 10 ++++++ drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h | 6 ++-- drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 8 ++--- 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index e828325..ac432b2 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -1694,3 +1694,45 @@ ulp_rte_of_set_vlan_pcp_act_handler(const struct rte_flow_action *action_item, BNXT_TF_DBG(ERR, "Parse Error: Vlan pcp arg is invalid\n"); return BNXT_TF_RC_ERROR; } + +/* Function to handle the parsing of RTE Flow action set ipv4 src.*/ +int32_t +ulp_rte_set_ipv4_src_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params) +{ + const struct rte_flow_action_set_ipv4 *set_ipv4; + struct ulp_rte_act_prop *act = ¶ms->act_prop; + + set_ipv4 = action_item->conf; + if (set_ipv4) { + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_SET_IPV4_SRC], + &set_ipv4->ipv4_addr, BNXT_ULP_ACT_PROP_SZ_SET_IPV4_SRC); + /* Update the hdr_bitmap with set ipv4 src */ + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_SET_IPV4_SRC); + return BNXT_TF_RC_SUCCESS; + } + BNXT_TF_DBG(ERR, "Parse Error: set ipv4 src arg is invalid\n"); + return BNXT_TF_RC_ERROR; +} + +/* Function to handle the parsing of RTE Flow action set ipv4 dst.*/ +int32_t +ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params) +{ + const struct rte_flow_action_set_ipv4 *set_ipv4; + struct ulp_rte_act_prop *act = ¶ms->act_prop; + + set_ipv4 = action_item->conf; + if (set_ipv4) { + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_SET_IPV4_DST], + &set_ipv4->ipv4_addr, BNXT_ULP_ACT_PROP_SZ_SET_IPV4_DST); + /* Update the hdr_bitmap with set ipv4 dst */ + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_SET_IPV4_DST); + return BNXT_TF_RC_SUCCESS; + } + BNXT_TF_DBG(ERR, "Parse Error: set ipv4 dst arg is invalid\n"); + return BNXT_TF_RC_ERROR; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index a440280..6cb83b9 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -196,4 +196,14 @@ int32_t ulp_rte_of_set_vlan_pcp_act_handler(const struct rte_flow_action *action_item, struct ulp_rte_parser_params *params); +/* Function to handle the parsing of RTE Flow action set ipv4 src.*/ +int32_t +ulp_rte_set_ipv4_src_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params); + +/* Function to handle the parsing of RTE Flow action set ipv4 dst.*/ +int32_t +ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params); + #endif /* _ULP_RTE_PARSER_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h index 2d73ea3..436f54c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h @@ -6,7 +6,7 @@ #ifndef ULP_TEMPLATE_DB_H_ #define ULP_TEMPLATE_DB_H_ -#define BNXT_ULP_REGFILE_MAX_SZ 17 +#define BNXT_ULP_REGFILE_MAX_SZ 19 #define BNXT_ULP_MAX_NUM_DEVICES 4 #define BNXT_ULP_LOG2_MAX_NUM_DEV 2 #define BNXT_ULP_CACHE_TBL_MAX_SZ 4 @@ -261,7 +261,9 @@ enum bnxt_ulp_regfile_index { BNXT_ULP_REGFILE_INDEX_CRITICAL_RESOURCE = 14, BNXT_ULP_REGFILE_INDEX_FLOW_CNTR_PTR_0 = 15, BNXT_ULP_REGFILE_INDEX_MAIN_SP_PTR = 16, - BNXT_ULP_REGFILE_INDEX_LAST = 17 + BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_SRC_PTR_0 = 17, + BNXT_ULP_REGFILE_INDEX_MODIFY_IPV4_DST_PTR_0 = 18, + BNXT_ULP_REGFILE_INDEX_LAST = 19 }; enum bnxt_ulp_search_before_alloc { diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c index 2cc3458..6fa74f8 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c @@ -231,12 +231,12 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { .proto_act_func = NULL }, [RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC] = { - .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, - .proto_act_func = NULL + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_set_ipv4_src_act_handler }, [RTE_FLOW_ACTION_TYPE_SET_IPV4_DST] = { - .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, - .proto_act_func = NULL + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_set_ipv4_dst_act_handler }, [RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC] = { .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, -- 2.7.4