DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions
@ 2021-04-04  9:49 Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol

This series adds support for VXLAN and NVGRE encap as a sample actions with the proper
documentation, this series depends on [1] and [2] for the documentation part.

[1] http://patches.dpdk.org/project/dpdk/patch/1615907899-399082-1-git-send-email-jiaweiw@nvidia.com/
[2] http://patches.dpdk.org/project/dpdk/patch/1617244796-358287-1-git-send-email-jiaweiw@nvidia.com/

Jiawei Wang (1):
  app/testpmd: store VXLAN/NVGRE encap data globally

Salem Sol (6):
  net/mlx5: support VXLAN encap action in sample
  net/mlx5: support NVGRE encap action in sample
  app/testpmd: support VXLAN encap for sample action
  app/testpmd: support NVGRE encap for sample action
  doc: update sample actions support in testpmd guide
  doc: update sample actions support in mlx5 guide

 app/test-pmd/cmdline_flow.c                 | 86 ++++++++++++++-------
 doc/guides/nics/mlx5.rst                    |  4 +-
 doc/guides/rel_notes/release_21_05.rst      |  6 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 24 ++++++
 drivers/net/mlx5/mlx5_flow_dv.c             | 13 ++++
 5 files changed, 103 insertions(+), 30 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-06 14:54   ` Ferruh Yigit
  2021-04-07 11:48   ` [dpdk-dev] [v5 1/6] app/testpmd: prepare storing " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 2/7] net/mlx5: support VXLAN encap action in sample Salem Sol
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Jiawei Wang, Ori Kam, Xiaoyun Li

From: Jiawei Wang <jiaweiw@nvidia.com>

With the current code the VXLAN/NVGRE parsing routine
stored the configuration of the header on stack, this
might lead to overwriting the data on the stack.

This patch stores the external data of vxlan and nvgre encap
into global data as a pre-step to supporting vxlan and nvgre
encap as a sample actions.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 72 ++++++++++++++++++++++---------------
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 49d9f9c043..16b2120dbc 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -5244,31 +5244,11 @@ parse_vc_action_rss_queue(struct context *ctx, const struct token *token,
 	return len;
 }
 
-/** Parse VXLAN encap action. */
+/** Setup VXLAN encap configuration. */
 static int
-parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
-			    const char *str, unsigned int len,
-			    void *buf, unsigned int size)
+parse_setup_vxlan_encap_data(struct action_vxlan_encap_data *action_vxlan_encap_data)
 {
-	struct buffer *out = buf;
-	struct rte_flow_action *action;
-	struct action_vxlan_encap_data *action_vxlan_encap_data;
-	int ret;
-
-	ret = parse_vc(ctx, token, str, len, buf, size);
-	if (ret < 0)
-		return ret;
-	/* Nothing else to do if there is no buffer. */
-	if (!out)
-		return ret;
-	if (!out->args.vc.actions_n)
-		return -1;
-	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
-	/* Point to selected object. */
-	ctx->object = out->args.vc.data;
-	ctx->objmask = NULL;
 	/* Set up default configuration. */
-	action_vxlan_encap_data = ctx->object;
 	*action_vxlan_encap_data = (struct action_vxlan_encap_data){
 		.conf = (struct rte_flow_action_vxlan_encap){
 			.definition = action_vxlan_encap_data->items,
@@ -5372,19 +5352,18 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
 	}
 	memcpy(action_vxlan_encap_data->item_vxlan.vni, vxlan_encap_conf.vni,
 	       RTE_DIM(vxlan_encap_conf.vni));
-	action->conf = &action_vxlan_encap_data->conf;
-	return ret;
+	return 0;
 }
 
-/** Parse NVGRE encap action. */
+/** Parse VXLAN encap action. */
 static int
-parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
+parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
 			    const char *str, unsigned int len,
 			    void *buf, unsigned int size)
 {
 	struct buffer *out = buf;
 	struct rte_flow_action *action;
-	struct action_nvgre_encap_data *action_nvgre_encap_data;
+	struct action_vxlan_encap_data *action_vxlan_encap_data;
 	int ret;
 
 	ret = parse_vc(ctx, token, str, len, buf, size);
@@ -5399,8 +5378,17 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
 	/* Point to selected object. */
 	ctx->object = out->args.vc.data;
 	ctx->objmask = NULL;
+	action_vxlan_encap_data = ctx->object;
+	parse_setup_vxlan_encap_data(action_vxlan_encap_data);
+	action->conf = &action_vxlan_encap_data->conf;
+	return ret;
+}
+
+/** Setup NVGRE encap configuration. */
+static int
+parse_setup_nvgre_encap_data(struct action_nvgre_encap_data *action_nvgre_encap_data)
+{
 	/* Set up default configuration. */
-	action_nvgre_encap_data = ctx->object;
 	*action_nvgre_encap_data = (struct action_nvgre_encap_data){
 		.conf = (struct rte_flow_action_nvgre_encap){
 			.definition = action_nvgre_encap_data->items,
@@ -5463,6 +5451,34 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
 			RTE_FLOW_ITEM_TYPE_VOID;
 	memcpy(action_nvgre_encap_data->item_nvgre.tni, nvgre_encap_conf.tni,
 	       RTE_DIM(nvgre_encap_conf.tni));
+	return 0;
+}
+
+/** Parse NVGRE encap action. */
+static int
+parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
+			    const char *str, unsigned int len,
+			    void *buf, unsigned int size)
+{
+	struct buffer *out = buf;
+	struct rte_flow_action *action;
+	struct action_nvgre_encap_data *action_nvgre_encap_data;
+	int ret;
+
+	ret = parse_vc(ctx, token, str, len, buf, size);
+	if (ret < 0)
+		return ret;
+	/* Nothing else to do if there is no buffer. */
+	if (!out)
+		return ret;
+	if (!out->args.vc.actions_n)
+		return -1;
+	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
+	/* Point to selected object. */
+	ctx->object = out->args.vc.data;
+	ctx->objmask = NULL;
+	action_nvgre_encap_data = ctx->object;
+	parse_setup_nvgre_encap_data(action_nvgre_encap_data);
 	action->conf = &action_nvgre_encap_data->conf;
 	return ret;
 }
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 2/7] net/mlx5: support VXLAN encap action in sample
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-07 11:48   ` [dpdk-dev] [v5 2/6] " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 3/7] net/mlx5: support NVGRE " Salem Sol
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

Add support for VXLAN encap as a sample action
and validate it.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/rel_notes/release_21_05.rst |  6 ++++++
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 23f7f0bff9..38213c4f50 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -65,6 +65,12 @@ New Features
 
   * Added support for txgbevf PMD.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for VXLAN encap as a sample action.
+
 * **Updated testpmd.**
 
   * Added command to display Rx queue used descriptor count.
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1a74d5ac2b..4b2db47e39 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5242,6 +5242,16 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
 				return ret;
 			++actions_n;
 			break;
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+			ret = flow_dv_validate_action_l2_encap(dev,
+							       sub_action_flags,
+							       act, attr,
+							       error);
+			if (ret < 0)
+				return ret;
+			sub_action_flags |= MLX5_FLOW_ACTION_ENCAP;
+			++actions_n;
+			break;
 		default:
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ACTION,
@@ -10407,6 +10417,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 			action_flags |= MLX5_FLOW_ACTION_PORT_ID;
 			break;
 		}
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			/* Save the encap resource before sample */
 			pre_rix = dev_flow->handle->dvh.rix_encap_decap;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 3/7] net/mlx5: support NVGRE encap action in sample
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 2/7] net/mlx5: support VXLAN encap action in sample Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-07 11:49   ` [dpdk-dev] [v5 3/6] " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: support VXLAN encap for sample action Salem Sol
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

Add support for NVGRE encap as a sample action
and validate it.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/rel_notes/release_21_05.rst | 2 +-
 drivers/net/mlx5/mlx5_flow_dv.c        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 38213c4f50..cdedca6db7 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -69,7 +69,7 @@ New Features
 
   Updated the Mellanox mlx5 driver with new features and improvements, including:
 
-  * Added support for VXLAN encap as a sample action.
+  * Added support for VXLAN and NVGRE encap as sample actions.
 
 * **Updated testpmd.**
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4b2db47e39..590abdc822 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5243,6 +5243,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
 			++actions_n;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 			ret = flow_dv_validate_action_l2_encap(dev,
 							       sub_action_flags,
 							       act, attr,
@@ -10418,6 +10419,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 			break;
 		}
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			/* Save the encap resource before sample */
 			pre_rix = dev_flow->handle->dvh.rix_encap_decap;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 4/7] app/testpmd: support VXLAN encap for sample action
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
                   ` (2 preceding siblings ...)
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 3/7] net/mlx5: support NVGRE " Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-07 11:50   ` [dpdk-dev] [v5 4/6] " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: support NVGRE " Salem Sol
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Ori Kam, Xiaoyun Li

Add support for rte_flow_action_vxlan_encap as a sample action.

The example of test-pmd command:

1.  set vxlan ip-version ... vni ... udp-src ...
    set raw_encap 1 eth src.../ ipv4.../...
    set sample_actions 2 vxlan_encap / port_id id 0 / end
    flow create 0 ... pattern eth / end actions
       sample ratio 1 index 2 / raw_encap index 1 / port_id id 0...

    The flow will result in all the matched egress packets will be
    encapsulated and sent to wire, and also mirrored the packets
    using VXLAN encapsulation data and sent to wire.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 16b2120dbc..978ce9c2c7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -582,6 +582,7 @@ struct rte_flow_action_queue sample_queue[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_vxlan_encap_data sample_vxlan_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
 
@@ -1615,6 +1616,7 @@ static const enum index next_action_sample[] = {
 	ACTION_COUNT,
 	ACTION_PORT_ID,
 	ACTION_RAW_ENCAP,
+	ACTION_VXLAN_ENCAP,
 	ACTION_NEXT,
 	ZERO,
 };
@@ -7943,6 +7945,11 @@ cmd_set_raw_parsed_sample(const struct buffer *in)
 					(const void *)action->conf, size);
 			action->conf = &sample_vf[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+			size = sizeof(struct rte_flow_action_vxlan_encap);
+			parse_setup_vxlan_encap_data(&sample_vxlan_encap[idx]);
+			action->conf = &sample_vxlan_encap[idx].conf;
+			break;
 		default:
 			printf("Error - Not supported action\n");
 			return;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 5/7] app/testpmd: support NVGRE encap for sample action
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
                   ` (3 preceding siblings ...)
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: support VXLAN encap for sample action Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-07 11:50   ` [dpdk-dev] [v5 5/6] " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 6/7] doc: update sample actions support in testpmd guide Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide Salem Sol
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Ori Kam, Xiaoyun Li

Add support for rte_flow_action_nvge_encap as a sample action.

The example of test-pmd command:

1.  set nvgre ip-version ... tni ... ip-src ... ip-dst ...
    set raw_encap 1 eth src... / ipv4... /...
    set sample_actions 2 nvgre / port_id id 0 / end
    flow create 0 ... pattern eth / end actions
       sample ratio 1 index 2 / raw_encap index 1 / port_id id 0...

    The flow will result in all the matched egress packets will be
    encapsulated and sent to wire, and also mirrored the packets
    using NVGRE encapsulation data and sent to wire.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 978ce9c2c7..70896e27c7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -583,6 +583,7 @@ struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_vxlan_encap_data sample_vxlan_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_nvgre_encap_data sample_nvgre_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
 
@@ -1617,6 +1618,7 @@ static const enum index next_action_sample[] = {
 	ACTION_PORT_ID,
 	ACTION_RAW_ENCAP,
 	ACTION_VXLAN_ENCAP,
+	ACTION_NVGRE_ENCAP,
 	ACTION_NEXT,
 	ZERO,
 };
@@ -7950,6 +7952,11 @@ cmd_set_raw_parsed_sample(const struct buffer *in)
 			parse_setup_vxlan_encap_data(&sample_vxlan_encap[idx]);
 			action->conf = &sample_vxlan_encap[idx].conf;
 			break;
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
+			size = sizeof(struct rte_flow_action_nvgre_encap);
+			parse_setup_nvgre_encap_data(&sample_nvgre_encap[idx]);
+			action->conf = &sample_nvgre_encap[idx];
+			break;
 		default:
 			printf("Error - Not supported action\n");
 			return;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 6/7] doc: update sample actions support in testpmd guide
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
                   ` (4 preceding siblings ...)
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: support NVGRE " Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-07 11:51   ` [dpdk-dev] [v5 6/6] " Salem Sol
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide Salem Sol
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Xiaoyun Li

Update documentation for sample action usage in testpmd utilizing
rte_flow_action_vxlan_encap and rte_flow_action_nvgre_encap and
show the command line example.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2b407a3e9a..36f0a328a5 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4893,6 +4893,30 @@ encapsulation header and sent to port id 0.
  testpmd> flow create 0 ingress transfer pattern eth / end actions
         sample ratio 1 index 0  / port_id id 2 / end
 
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+VXLAN encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
+        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+NVGRE encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
+        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide
  2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
                   ` (5 preceding siblings ...)
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 6/7] doc: update sample actions support in testpmd guide Salem Sol
@ 2021-04-04  9:49 ` Salem Sol
  2021-04-06 14:45   ` Ferruh Yigit
  6 siblings, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-04  9:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

Updates the documentation with the added support for sample actions VXLAN
and NVGRE encap in E-Switch steering flow.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/nics/mlx5.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 96fce36e3c..378b7202d9 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -376,8 +376,8 @@ Limitations
     encapsulation actions.
   - For NIC Rx flow, supports ``MARK``, ``COUNT``, ``QUEUE``, ``RSS`` in the
     sample actions list.
-  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID`` in the
-    sample actions list.
+  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``,
+    ``VXLAN ENCAP``, ``NVGRE ENCAP`` in the sample actions list.
 
 - Modify Field flow:
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide Salem Sol
@ 2021-04-06 14:45   ` Ferruh Yigit
  0 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2021-04-06 14:45 UTC (permalink / raw)
  To: Salem Sol, dev; +Cc: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

On 4/4/2021 10:49 AM, Salem Sol wrote:
> Updates the documentation with the added support for sample actions VXLAN
> and NVGRE encap in E-Switch steering flow.
> 
> Signed-off-by: Salem Sol <salems@nvidia.com>
> ---
>   doc/guides/nics/mlx5.rst | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
> index 96fce36e3c..378b7202d9 100644
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -376,8 +376,8 @@ Limitations
>       encapsulation actions.
>     - For NIC Rx flow, supports ``MARK``, ``COUNT``, ``QUEUE``, ``RSS`` in the
>       sample actions list.
> -  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID`` in the
> -    sample actions list.
> +  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``,
> +    ``VXLAN ENCAP``, ``NVGRE ENCAP`` in the sample actions list.
>   
>   - Modify Field flow:
>   
> 

Can you please distribute this mlx5 doc patch to the patches that actually adds 
the support, very similarly like done with the release notes update patch?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
@ 2021-04-06 14:54   ` Ferruh Yigit
  2021-04-07 11:48   ` [dpdk-dev] [v5 1/6] app/testpmd: prepare storing " Salem Sol
  1 sibling, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2021-04-06 14:54 UTC (permalink / raw)
  To: Salem Sol, dev; +Cc: Jiawei Wang, Ori Kam, Xiaoyun Li

On 4/4/2021 10:49 AM, Salem Sol wrote:
> From: Jiawei Wang <jiaweiw@nvidia.com>
> 
> With the current code the VXLAN/NVGRE parsing routine
> stored the configuration of the header on stack, this
> might lead to overwriting the data on the stack.
> 
> This patch stores the external data of vxlan and nvgre encap
> into global data as a pre-step to supporting vxlan and nvgre
> encap as a sample actions.
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>

Hi Salem,

I put some comments on v3 of this patch, can you please check it?

And can you please use 'git send-email' '--in-reply-to' argument to send new 
version of a patch to reply to previous version, this keeps all versions in same 
email thread and makes it easy to find previous version discussions/comments for 
reviewers also for the email archives.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 1/6] app/testpmd: prepare storing VXLAN/NVGRE encap data globally
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
  2021-04-06 14:54   ` Ferruh Yigit
@ 2021-04-07 11:48   ` Salem Sol
  2021-04-07 23:13     ` Ferruh Yigit
  1 sibling, 1 reply; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:48 UTC (permalink / raw)
  To: dev; +Cc: Jiawei Wang, Ori Kam, Xiaoyun Li

From: Jiawei Wang <jiaweiw@nvidia.com>

With the current code the VXLAN/NVGRE parsing routine
stored the configuration of the header on stack, this
might lead to overwriting the data on the stack.

Currently having VXLAN/NVGRE encap as sample actions
is done using RAW_ENCAP, for example:
1. set raw_encap 1 eth src.../ vxlan vni.../ ipv4.../ ...
   set sample_actions 0 raw_encap / port_id id 0 / end
   flow create 0 ... pattern eth / end actions
      sample ration 1 index 0 / jump group 1 / end

The goal is to utilize the rte_flow_action_vxlan_encap
and rte_flow_action_nvgre_encap for sample actions.

This patch prepares storing the external data of vxlan and
nvgre encap into global data as a pre-step to supporting
vxlan and nvgre encap as a sample actions.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 72 ++++++++++++++++++++++---------------
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 49d9f9c043..16b2120dbc 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -5244,31 +5244,11 @@ parse_vc_action_rss_queue(struct context *ctx, const struct token *token,
 	return len;
 }
 
-/** Parse VXLAN encap action. */
+/** Setup VXLAN encap configuration. */
 static int
-parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
-			    const char *str, unsigned int len,
-			    void *buf, unsigned int size)
+parse_setup_vxlan_encap_data(struct action_vxlan_encap_data *action_vxlan_encap_data)
 {
-	struct buffer *out = buf;
-	struct rte_flow_action *action;
-	struct action_vxlan_encap_data *action_vxlan_encap_data;
-	int ret;
-
-	ret = parse_vc(ctx, token, str, len, buf, size);
-	if (ret < 0)
-		return ret;
-	/* Nothing else to do if there is no buffer. */
-	if (!out)
-		return ret;
-	if (!out->args.vc.actions_n)
-		return -1;
-	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
-	/* Point to selected object. */
-	ctx->object = out->args.vc.data;
-	ctx->objmask = NULL;
 	/* Set up default configuration. */
-	action_vxlan_encap_data = ctx->object;
 	*action_vxlan_encap_data = (struct action_vxlan_encap_data){
 		.conf = (struct rte_flow_action_vxlan_encap){
 			.definition = action_vxlan_encap_data->items,
@@ -5372,19 +5352,18 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
 	}
 	memcpy(action_vxlan_encap_data->item_vxlan.vni, vxlan_encap_conf.vni,
 	       RTE_DIM(vxlan_encap_conf.vni));
-	action->conf = &action_vxlan_encap_data->conf;
-	return ret;
+	return 0;
 }
 
-/** Parse NVGRE encap action. */
+/** Parse VXLAN encap action. */
 static int
-parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
+parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,
 			    const char *str, unsigned int len,
 			    void *buf, unsigned int size)
 {
 	struct buffer *out = buf;
 	struct rte_flow_action *action;
-	struct action_nvgre_encap_data *action_nvgre_encap_data;
+	struct action_vxlan_encap_data *action_vxlan_encap_data;
 	int ret;
 
 	ret = parse_vc(ctx, token, str, len, buf, size);
@@ -5399,8 +5378,17 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
 	/* Point to selected object. */
 	ctx->object = out->args.vc.data;
 	ctx->objmask = NULL;
+	action_vxlan_encap_data = ctx->object;
+	parse_setup_vxlan_encap_data(action_vxlan_encap_data);
+	action->conf = &action_vxlan_encap_data->conf;
+	return ret;
+}
+
+/** Setup NVGRE encap configuration. */
+static int
+parse_setup_nvgre_encap_data(struct action_nvgre_encap_data *action_nvgre_encap_data)
+{
 	/* Set up default configuration. */
-	action_nvgre_encap_data = ctx->object;
 	*action_nvgre_encap_data = (struct action_nvgre_encap_data){
 		.conf = (struct rte_flow_action_nvgre_encap){
 			.definition = action_nvgre_encap_data->items,
@@ -5463,6 +5451,34 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
 			RTE_FLOW_ITEM_TYPE_VOID;
 	memcpy(action_nvgre_encap_data->item_nvgre.tni, nvgre_encap_conf.tni,
 	       RTE_DIM(nvgre_encap_conf.tni));
+	return 0;
+}
+
+/** Parse NVGRE encap action. */
+static int
+parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,
+			    const char *str, unsigned int len,
+			    void *buf, unsigned int size)
+{
+	struct buffer *out = buf;
+	struct rte_flow_action *action;
+	struct action_nvgre_encap_data *action_nvgre_encap_data;
+	int ret;
+
+	ret = parse_vc(ctx, token, str, len, buf, size);
+	if (ret < 0)
+		return ret;
+	/* Nothing else to do if there is no buffer. */
+	if (!out)
+		return ret;
+	if (!out->args.vc.actions_n)
+		return -1;
+	action = &out->args.vc.actions[out->args.vc.actions_n - 1];
+	/* Point to selected object. */
+	ctx->object = out->args.vc.data;
+	ctx->objmask = NULL;
+	action_nvgre_encap_data = ctx->object;
+	parse_setup_nvgre_encap_data(action_nvgre_encap_data);
 	action->conf = &action_nvgre_encap_data->conf;
 	return ret;
 }
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 2/6] net/mlx5: support VXLAN encap action in sample
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 2/7] net/mlx5: support VXLAN encap action in sample Salem Sol
@ 2021-04-07 11:48   ` Salem Sol
  0 siblings, 0 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:48 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

Add support for VXLAN encap as a sample action
and validate it.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/nics/mlx5.rst               |  4 ++--
 doc/guides/rel_notes/release_21_05.rst |  6 ++++++
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 96fce36e3c..303b756b13 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -376,8 +376,8 @@ Limitations
     encapsulation actions.
   - For NIC Rx flow, supports ``MARK``, ``COUNT``, ``QUEUE``, ``RSS`` in the
     sample actions list.
-  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID`` in the
-    sample actions list.
+  - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``,
+    ``VXLAN ENCAP`` in the sample actions list.
 
 - Modify Field flow:
 
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 23f7f0bff9..38213c4f50 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -65,6 +65,12 @@ New Features
 
   * Added support for txgbevf PMD.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated the Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for VXLAN encap as a sample action.
+
 * **Updated testpmd.**
 
   * Added command to display Rx queue used descriptor count.
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1a74d5ac2b..4b2db47e39 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5242,6 +5242,16 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
 				return ret;
 			++actions_n;
 			break;
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+			ret = flow_dv_validate_action_l2_encap(dev,
+							       sub_action_flags,
+							       act, attr,
+							       error);
+			if (ret < 0)
+				return ret;
+			sub_action_flags |= MLX5_FLOW_ACTION_ENCAP;
+			++actions_n;
+			break;
 		default:
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ACTION,
@@ -10407,6 +10417,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 			action_flags |= MLX5_FLOW_ACTION_PORT_ID;
 			break;
 		}
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			/* Save the encap resource before sample */
 			pre_rix = dev_flow->handle->dvh.rix_encap_decap;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 3/6] net/mlx5: support NVGRE encap action in sample
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 3/7] net/mlx5: support NVGRE " Salem Sol
@ 2021-04-07 11:49   ` Salem Sol
  0 siblings, 0 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:49 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

Add support for NVGRE encap as a sample action
and validate it.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/nics/mlx5.rst               | 2 +-
 doc/guides/rel_notes/release_21_05.rst | 2 +-
 drivers/net/mlx5/mlx5_flow_dv.c        | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 303b756b13..378b7202d9 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -377,7 +377,7 @@ Limitations
   - For NIC Rx flow, supports ``MARK``, ``COUNT``, ``QUEUE``, ``RSS`` in the
     sample actions list.
   - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``,
-    ``VXLAN ENCAP`` in the sample actions list.
+    ``VXLAN ENCAP``, ``NVGRE ENCAP`` in the sample actions list.
 
 - Modify Field flow:
 
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 38213c4f50..cdedca6db7 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -69,7 +69,7 @@ New Features
 
   Updated the Mellanox mlx5 driver with new features and improvements, including:
 
-  * Added support for VXLAN encap as a sample action.
+  * Added support for VXLAN and NVGRE encap as sample actions.
 
 * **Updated testpmd.**
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4b2db47e39..590abdc822 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5243,6 +5243,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
 			++actions_n;
 			break;
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 			ret = flow_dv_validate_action_l2_encap(dev,
 							       sub_action_flags,
 							       act, attr,
@@ -10418,6 +10419,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 			break;
 		}
 		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 			/* Save the encap resource before sample */
 			pre_rix = dev_flow->handle->dvh.rix_encap_decap;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 4/6] app/testpmd: support VXLAN encap for sample action
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: support VXLAN encap for sample action Salem Sol
@ 2021-04-07 11:50   ` Salem Sol
  0 siblings, 0 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:50 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Ori Kam, Xiaoyun Li

Add support for rte_flow_action_vxlan_encap as a sample action.

The example of test-pmd command:

1.  set vxlan ip-version ... vni ... udp-src ...
    set raw_encap 1 eth src.../ ipv4.../...
    set sample_actions 2 vxlan_encap / port_id id 0 / end
    flow create 0 ... pattern eth / end actions
       sample ratio 1 index 2 / raw_encap index 1 / port_id id 0...

    The flow will result in all the matched egress packets will be
    encapsulated and sent to wire, and also mirrored the packets
    using VXLAN encapsulation data and sent to wire.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 16b2120dbc..978ce9c2c7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -582,6 +582,7 @@ struct rte_flow_action_queue sample_queue[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_vxlan_encap_data sample_vxlan_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
 
@@ -1615,6 +1616,7 @@ static const enum index next_action_sample[] = {
 	ACTION_COUNT,
 	ACTION_PORT_ID,
 	ACTION_RAW_ENCAP,
+	ACTION_VXLAN_ENCAP,
 	ACTION_NEXT,
 	ZERO,
 };
@@ -7943,6 +7945,11 @@ cmd_set_raw_parsed_sample(const struct buffer *in)
 					(const void *)action->conf, size);
 			action->conf = &sample_vf[idx];
 			break;
+		case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
+			size = sizeof(struct rte_flow_action_vxlan_encap);
+			parse_setup_vxlan_encap_data(&sample_vxlan_encap[idx]);
+			action->conf = &sample_vxlan_encap[idx].conf;
+			break;
 		default:
 			printf("Error - Not supported action\n");
 			return;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 5/6] app/testpmd: support NVGRE encap for sample action
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: support NVGRE " Salem Sol
@ 2021-04-07 11:50   ` Salem Sol
  0 siblings, 0 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:50 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Ori Kam, Xiaoyun Li

Add support for rte_flow_action_nvge_encap as a sample action.

The example of test-pmd command:

1.  set nvgre ip-version ... tni ... ip-src ... ip-dst ...
    set raw_encap 1 eth src... / ipv4... /...
    set sample_actions 2 nvgre / port_id id 0 / end
    flow create 0 ... pattern eth / end actions
       sample ratio 1 index 2 / raw_encap index 1 / port_id id 0...

    The flow will result in all the matched egress packets will be
    encapsulated and sent to wire, and also mirrored the packets
    using NVGRE encapsulation data and sent to wire.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 978ce9c2c7..70896e27c7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -583,6 +583,7 @@ struct rte_flow_action_count sample_count[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_port_id sample_port_id[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_raw_encap sample_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_vxlan_encap_data sample_vxlan_encap[RAW_SAMPLE_CONFS_MAX_NUM];
+struct action_nvgre_encap_data sample_nvgre_encap[RAW_SAMPLE_CONFS_MAX_NUM];
 struct action_rss_data sample_rss_data[RAW_SAMPLE_CONFS_MAX_NUM];
 struct rte_flow_action_vf sample_vf[RAW_SAMPLE_CONFS_MAX_NUM];
 
@@ -1617,6 +1618,7 @@ static const enum index next_action_sample[] = {
 	ACTION_PORT_ID,
 	ACTION_RAW_ENCAP,
 	ACTION_VXLAN_ENCAP,
+	ACTION_NVGRE_ENCAP,
 	ACTION_NEXT,
 	ZERO,
 };
@@ -7950,6 +7952,11 @@ cmd_set_raw_parsed_sample(const struct buffer *in)
 			parse_setup_vxlan_encap_data(&sample_vxlan_encap[idx]);
 			action->conf = &sample_vxlan_encap[idx].conf;
 			break;
+		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
+			size = sizeof(struct rte_flow_action_nvgre_encap);
+			parse_setup_nvgre_encap_data(&sample_nvgre_encap[idx]);
+			action->conf = &sample_nvgre_encap[idx];
+			break;
 		default:
 			printf("Error - Not supported action\n");
 			return;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [v5 6/6] doc: update sample actions support in testpmd guide
  2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 6/7] doc: update sample actions support in testpmd guide Salem Sol
@ 2021-04-07 11:51   ` Salem Sol
  0 siblings, 0 replies; 17+ messages in thread
From: Salem Sol @ 2021-04-07 11:51 UTC (permalink / raw)
  To: dev; +Cc: Salem Sol, Xiaoyun Li

Update documentation for sample action usage in testpmd utilizing
rte_flow_action_vxlan_encap and rte_flow_action_nvgre_encap and
show the command line example.

Signed-off-by: Salem Sol <salems@nvidia.com>
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 24 +++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2b407a3e9a..36f0a328a5 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -4893,6 +4893,30 @@ encapsulation header and sent to port id 0.
  testpmd> flow create 0 ingress transfer pattern eth / end actions
         sample ratio 1 index 0  / port_id id 2 / end
 
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+VXLAN encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
+        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+NVGRE encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
+        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [v5 1/6] app/testpmd: prepare storing VXLAN/NVGRE encap data globally
  2021-04-07 11:48   ` [dpdk-dev] [v5 1/6] app/testpmd: prepare storing " Salem Sol
@ 2021-04-07 23:13     ` Ferruh Yigit
  0 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2021-04-07 23:13 UTC (permalink / raw)
  To: Salem Sol, dev; +Cc: Jiawei Wang, Ori Kam, Xiaoyun Li

On 4/7/2021 12:48 PM, Salem Sol wrote:
> From: Jiawei Wang <jiaweiw@nvidia.com>
> 
> With the current code the VXLAN/NVGRE parsing routine
> stored the configuration of the header on stack, this
> might lead to overwriting the data on the stack.
> 
> Currently having VXLAN/NVGRE encap as sample actions
> is done using RAW_ENCAP, for example:
> 1. set raw_encap 1 eth src.../ vxlan vni.../ ipv4.../ ...
>     set sample_actions 0 raw_encap / port_id id 0 / end
>     flow create 0 ... pattern eth / end actions
>        sample ration 1 index 0 / jump group 1 / end
> 
> The goal is to utilize the rte_flow_action_vxlan_encap
> and rte_flow_action_nvgre_encap for sample actions.
> 
> This patch prepares storing the external data of vxlan and
> nvgre encap into global data as a pre-step to supporting
> vxlan and nvgre encap as a sample actions.
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>

For testpmd patches in set,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Moved Slava's ack from previous version for mlx5 patches,
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-04-07 23:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04  9:49 [dpdk-dev] [PATCH v4 0/7] Add support for VXLAN and NVGRE encap as a sample actions Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 1/7] app/testpmd: store VXLAN/NVGRE encap data globally Salem Sol
2021-04-06 14:54   ` Ferruh Yigit
2021-04-07 11:48   ` [dpdk-dev] [v5 1/6] app/testpmd: prepare storing " Salem Sol
2021-04-07 23:13     ` Ferruh Yigit
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 2/7] net/mlx5: support VXLAN encap action in sample Salem Sol
2021-04-07 11:48   ` [dpdk-dev] [v5 2/6] " Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 3/7] net/mlx5: support NVGRE " Salem Sol
2021-04-07 11:49   ` [dpdk-dev] [v5 3/6] " Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: support VXLAN encap for sample action Salem Sol
2021-04-07 11:50   ` [dpdk-dev] [v5 4/6] " Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: support NVGRE " Salem Sol
2021-04-07 11:50   ` [dpdk-dev] [v5 5/6] " Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 6/7] doc: update sample actions support in testpmd guide Salem Sol
2021-04-07 11:51   ` [dpdk-dev] [v5 6/6] " Salem Sol
2021-04-04  9:49 ` [dpdk-dev] [PATCH v4 7/7] doc: update sample actions support in mlx5 guide Salem Sol
2021-04-06 14:45   ` Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git