[v1] net/mlx5: add test for hot upgrade

Message ID 20230516054137.1396922-1-rongweil@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series [v1] net/mlx5: add test for hot upgrade |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Rongwei Liu May 16, 2023, 5:41 a.m. UTC
  This patch adds testpmd app a runtime function to test the hot
upgrade API.

    testpmd> mlx5 set flow_engine <0|1> (flag)
0 stands for active mode while 1 for standby mode.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 doc/guides/nics/mlx5.rst        | 10 ++++++
 drivers/net/mlx5/mlx5_testpmd.c | 63 +++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
  

Comments

Raslan Darawsheh June 19, 2023, 12:09 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Rongwei Liu <rongweil@nvidia.com>
> Sent: Tuesday, May 16, 2023 8:42 AM
> To: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>
> Subject: [PATCH v1] net/mlx5: add test for hot upgrade
> 
> This patch adds testpmd app a runtime function to test the hot
> upgrade API.
> 
>     testpmd> mlx5 set flow_engine <0|1> (flag)
> 0 stands for active mode while 1 for standby mode.
> 
> Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  
Thomas Monjalon June 26, 2023, 8:22 p.m. UTC | #2
16/05/2023 07:41, Rongwei Liu:
> This patch adds testpmd app a runtime function to test the hot
> upgrade API.
> 
>     testpmd> mlx5 set flow_engine <0|1> (flag)
> 0 stands for active mode while 1 for standby mode.
> 
> Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -2057,3 +2057,13 @@ where:
>  * ``sw_queue_id``: queue index in range [64536, 65535].
>    This range is the highest 1000 numbers.
>  * ``hw_queue_id``: queue index given by HW in queue creation.
> +
> +Set Flow Engine Mode
> +^^^^^^^^^^^^^^^^^^^^

The title is made as a sub-section of "port map external Rx queue",
which looks wrong.

> +
> +Set the flow engine to active(0) or standby(1) mode with specific flags::
> +   testpmd> mlx5 set flow_engine <0|1> (flags)

It should be said it is for testing live migration.

Also the flags are not described. Should we pass an integer?

> +
> +This command works for software steering only.
> +Default FDB jump should be disabled if switchdev is enabled.
> +The mode will propagate to all the probed ports.

For the reasons above, I prefer not pulling this patch in the main branch.
  
Rongwei Liu Sept. 18, 2023, 12:17 p.m. UTC | #3
Hi Thomas:

BR
Rongwei

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, June 27, 2023 04:23
> To: Rongwei Liu <rongweil@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>
> Cc: dev@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Maayan Kashani
> <mkashani@nvidia.com>
> Subject: Re: [PATCH v1] net/mlx5: add test for hot upgrade
> 
> External email: Use caution opening links or attachments
> 
> 
> 16/05/2023 07:41, Rongwei Liu:
> > This patch adds testpmd app a runtime function to test the hot upgrade
> > API.
> >
> >     testpmd> mlx5 set flow_engine <0|1> (flag)
> > 0 stands for active mode while 1 for standby mode.
> >
> > Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
> > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> > ---
> > --- a/doc/guides/nics/mlx5.rst
> > +++ b/doc/guides/nics/mlx5.rst
> > @@ -2057,3 +2057,13 @@ where:
> >  * ``sw_queue_id``: queue index in range [64536, 65535].
> >    This range is the highest 1000 numbers.
> >  * ``hw_queue_id``: queue index given by HW in queue creation.
> > +
> > +Set Flow Engine Mode
> > +^^^^^^^^^^^^^^^^^^^^
> 
> The title is made as a sub-section of "port map external Rx queue", which
> looks wrong.
>
Will change the "^^^^" to "~~~~", totally in parallel with " port map external Rx queue "
> > +
> > +Set the flow engine to active(0) or standby(1) mode with specific flags::
> > +   testpmd> mlx5 set flow_engine <0|1> (flags)
> 
> It should be said it is for testing live migration.
> 
Sure.
> Also the flags are not described. Should we pass an integer?
> 
There is information to describe mode, like active(0)/standby(1).
Or we can change to this style:  "mlx5 set flow_engine <active|standby> [<flag>]"
> > +
> > +This command works for software steering only.
> > +Default FDB jump should be disabled if switchdev is enabled.
> > +The mode will propagate to all the probed ports.
> 
> For the reasons above, I prefer not pulling this patch in the main branch.
> 
This command line is a good starting point to play with mlx5 live migration feature.
Keeping it is user-friendly per my view.
  

Patch

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 7a137d5f6a..1867b2a3c0 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -2057,3 +2057,13 @@  where:
 * ``sw_queue_id``: queue index in range [64536, 65535].
   This range is the highest 1000 numbers.
 * ``hw_queue_id``: queue index given by HW in queue creation.
+
+Set Flow Engine Mode
+^^^^^^^^^^^^^^^^^^^^
+
+Set the flow engine to active(0) or standby(1) mode with specific flags::
+   testpmd> mlx5 set flow_engine <0|1> (flags)
+
+This command works for software steering only.
+Default FDB jump should be disabled if switchdev is enabled.
+The mode will propagate to all the probed ports.
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index 879ea2826e..cb0cafe1e9 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -561,6 +561,64 @@  cmdline_parse_inst_t mlx5_cmd_unmap_ext_rxq = {
 	}
 };
 
+/* Set flow engine mode with flags command. */
+struct mlx5_cmd_set_flow_engine_mode {
+	cmdline_fixed_string_t mlx5;
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t flow_engine;
+	uint8_t mode;
+	uint32_t flags;
+};
+
+
+static void
+mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result,
+				     __rte_unused struct cmdline *cl,
+				     __rte_unused void *data)
+{
+	struct mlx5_cmd_set_flow_engine_mode *res = parsed_result;
+	int ret;
+
+	ret = rte_pmd_mlx5_flow_engine_set_mode((enum mlx5_flow_engine_mode)res->mode, res->flags);
+
+	if (ret < 0)
+		fprintf(stderr, "Fail to set flow_engine to %s mode with flags %x, error %s\n",
+			!res->mode ? "active" : "standby", res->flags, strerror(-ret));
+	else
+		TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flags %x\n", ret,
+			    !res->mode ? "active" : "standby", res->flags);
+}
+
+cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_mlx5 =
+	TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, mlx5,
+				 "mlx5");
+cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_set =
+	TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, set,
+				 "set");
+cmdline_parse_token_string_t mlx5_cmd_set_flow_engine_mode_flow_engine =
+	TOKEN_STRING_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, flow_engine,
+				 "flow_engine");
+cmdline_parse_token_num_t mlx5_cmd_set_flow_engine_mode_mode =
+	TOKEN_NUM_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, mode,
+			      RTE_UINT8);
+cmdline_parse_token_num_t mlx5_cmd_set_flow_engine_mode_flags =
+	TOKEN_NUM_INITIALIZER(struct mlx5_cmd_set_flow_engine_mode, flags,
+			      RTE_UINT32);
+
+cmdline_parse_inst_t mlx5_cmd_set_flow_engine_mode = {
+	.f = &mlx5_cmd_set_flow_engine_mode_parsed,
+	.data = NULL,
+	.help_str = "mlx5 set flow_engine <0|1> (flag)",
+	.tokens = {
+		(void *)&mlx5_cmd_set_flow_engine_mode_mlx5,
+		(void *)&mlx5_cmd_set_flow_engine_mode_set,
+		(void *)&mlx5_cmd_set_flow_engine_mode_flow_engine,
+		(void *)&mlx5_cmd_set_flow_engine_mode_mode,
+		(void *)&mlx5_cmd_set_flow_engine_mode_flags,
+		NULL,
+	}
+};
+
 static struct testpmd_driver_commands mlx5_driver_cmds = {
 	.commands = {
 		{
@@ -588,6 +646,11 @@  static struct testpmd_driver_commands mlx5_driver_cmds = {
 			.help = "mlx5 port (port_id) ext_rxq unmap (sw_queue_id)\n"
 				"    Unmap external Rx queue ethdev index mapping\n\n",
 		},
+		{
+			.ctx = &mlx5_cmd_set_flow_engine_mode,
+			.help = "mlx5 set flow_engine (mode) (flag)\n"
+				"    Set flow_engine to the specific mode with flags.\n\n"
+		},
 		{
 			.ctx = NULL,
 		},