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 16/20] net/bnxt: add support for nat rte action items
Date: Mon,  6 Jul 2020 13:54:58 +0530	[thread overview]
Message-ID: <20200706082502.26935-17-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200706082502.26935-1-somnath.kotur@broadcom.com>

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

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 <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 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 = &params->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 = &params->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


  parent reply	other threads:[~2020-07-06  8:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  8:24 [dpdk-dev] [PATCH 00/20] bnxt patches Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 01/20] net/bnxt: vxlan encap and decap with src property enabled Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 02/20] net/bnxt: add support vlan header bitmap Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 03/20] net/bnxt: add support for negative conditional opcodes Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 04/20] net/bnxt: add validations to dpdk port id and phy port parsing Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 05/20] net/bnxt: add support for index opcode constant Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 06/20] net/bnxt: updated hsi_struct_def_dpdk.h Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 07/20] nxt/bnxt: added HWRM support for global cfg Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 08/20] net/bnxt: cleanup and refactoring Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 09/20] net/bnxt: add support for vlan push and vlan pop actions Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 10/20] net/bnxt: remove vnic and vport act bits from template matching Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 11/20] net/bnxt: fix vxlan outer ip protocol id encapsulation Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 12/20] net/bnxt: add number of vlan tags in the computed field list Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 13/20] net/bnxt: enable support for PF and VF port action items Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 14/20] net/bnxt: port configuration changes to support full offload Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 15/20] net/bnxt: add support for conditional opcodes for mapper result table Somnath Kotur
2020-07-06  8:24 ` Somnath Kotur [this message]
2020-07-06  8:24 ` [dpdk-dev] [PATCH 17/20] net/bnxt: add support for tp src/dst rte action items Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 18/20] net/bnxt: use VF vnic when port action is for a VF rep port Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 19/20] net/bnxt: enable flow ctrl ops for the VF-rep device Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 20/20] net/bnxt: use byte/pkt count shift/masks from the device template 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=20200706082502.26935-17-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).