DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hanumanth Pothula <hpothula@marvell.com>
To: Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Cc: <dev@dpdk.org>, <andrew.rybchenko@oktetlabs.ru>,
	<viacheslavo@nvidia.com>,  <jerinj@marvell.com>,
	<ndabilpuram@marvell.com>, <hpothula@marvell.com>
Subject: [PATCH v4 2/2] app/testpmd: add command to process Rx metadata negotiation
Date: Wed, 21 Dec 2022 01:32:50 +0530	[thread overview]
Message-ID: <20221220200250.2413443-2-hpothula@marvell.com> (raw)
In-Reply-To: <20221220200250.2413443-1-hpothula@marvell.com>

Presently, Rx metadata is sent to PMD by default, leading
to a performance drop as processing for the same in Rx path
takes extra cycles.

Hence, add new testpmd command,
  'enable port <port_id> nic_to_pmd_rx_metadata'

This command helps in sending Rx metadata to PMD and thereby
Rx metadata flow command requests are processed.

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
 app/test-pmd/cmdline.c                      | 58 +++++++++++++++++++++
 app/test-pmd/config.c                       |  9 ++++
 app/test-pmd/testpmd.c                      |  5 +-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  6 +++
 4 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b32dc8bfd4..56946b2520 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -610,6 +610,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set port (port_id) fec_mode auto|off|rs|baser\n"
 			"    set fec mode for a specific port\n\n"
 
+			"enable port <port_id> nic_to_pmd_rx_metadata"
+			"    Allow nic to pmd Rx metadata negotiation\n\n"
+
 			, list_pkt_forwarding_modes()
 		);
 	}
@@ -12621,6 +12624,60 @@ static cmdline_parse_inst_t cmd_show_port_flow_transfer_proxy = {
 	}
 };
 
+/* Allow negotiating Rx metadata between NIC and PMD */
+struct cmd_config_port_rx_metadata {
+	cmdline_fixed_string_t enable;
+	cmdline_fixed_string_t port;
+	uint16_t port_id;
+	cmdline_fixed_string_t nic_to_pmd_rx_metadata;
+};
+
+static void
+cmd_config_port_rx_metadata_parsed(void *parsed_result,
+				__rte_unused struct cmdline *cl,
+				__rte_unused void *data)
+{
+	struct cmd_config_port_rx_metadata *res = parsed_result;
+
+	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+		return;
+	if (!port_is_stopped(res->port_id)) {
+		fprintf(stderr, "Please stop port %u first\n", res->port_id);
+		return;
+	}
+
+	ports[res->port_id].dev_conf.nic_to_pmd_rx_metadata = 1;
+
+	reset_port(res->port_id);
+}
+
+
+static cmdline_parse_token_string_t cmd_config_port_rx_metadata_enable =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, enable,
+								"enable");
+static cmdline_parse_token_string_t cmd_config_port_rx_metadata_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, port,
+								"port");
+static cmdline_parse_token_num_t cmd_config_port_rx_metadata_id =
+	TOKEN_NUM_INITIALIZER(struct cmd_config_port_rx_metadata, port_id,
+								RTE_UINT16);
+static cmdline_parse_token_string_t cmd_config_port_rx_metadata_nic_to_pmd_rx_metadata =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_port_rx_metadata, nic_to_pmd_rx_metadata,
+								"nic_to_pmd_rx_metadata");
+
+static cmdline_parse_inst_t cmd_config_port_rx_metadata_parse = {
+	.f = cmd_config_port_rx_metadata_parsed,
+	.data = NULL,
+	.help_str = "enable port <port_id> nic_to_pmd_rx_metadata",
+	.tokens = {
+		(void *)&cmd_config_port_rx_metadata_enable,
+		(void *)&cmd_config_port_rx_metadata_port,
+		(void *)&cmd_config_port_rx_metadata_id,
+		(void *)&cmd_config_port_rx_metadata_nic_to_pmd_rx_metadata,
+		NULL,
+	},
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -12851,6 +12908,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_capability,
 	(cmdline_parse_inst_t *)&cmd_set_flex_is_pattern,
 	(cmdline_parse_inst_t *)&cmd_set_flex_spec_pattern,
+	(cmdline_parse_inst_t *)&cmd_config_port_rx_metadata_parse,
 	NULL,
 };
 
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index acccb6b035..47fce3accb 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3249,6 +3249,15 @@ port_flow_create(portid_t port_id,
 		}
 		id = port->flow_list->id + 1;
 	}
+
+	if (port->dev_conf.nic_to_pmd_rx_metadata == 0 &&
+	   (actions->type == RTE_FLOW_ACTION_TYPE_MARK ||
+	    actions->type == RTE_FLOW_ACTION_TYPE_FLAG)) {
+		fprintf(stderr,
+			"rx metadata is not negotiated with PMD\n");
+		return -EINVAL;
+	}
+
 	if (tunnel_ops->enabled) {
 		pft = port_flow_tunnel_offload_cmd_prep(port_id, pattern,
 							actions, tunnel_ops);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 134d79a555..22e5e08fc1 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1604,8 +1604,6 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id)
 	int ret;
 	int i;
 
-	eth_rx_metadata_negotiate_mp(pid);
-
 	port->dev_conf.txmode = tx_mode;
 	port->dev_conf.rxmode = rx_mode;
 
@@ -2946,6 +2944,9 @@ start_port(portid_t pid)
 				port->update_conf = 0;
 			}
 
+			if (port->dev_conf.nic_to_pmd_rx_metadata)
+				eth_rx_metadata_negotiate_mp(pi);
+
 			/* configure port */
 			diag = eth_dev_configure_mp(pi, nb_rxq + nb_hairpinq,
 						     nb_txq + nb_hairpinq,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 0037506a79..024dbf6012 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1558,6 +1558,12 @@ Enable or disable a per port Rx offloading on all Rx queues of a port::
 
 This command should be run when the port is stopped, or else it will fail.
 
+Enable Rx metadata negotiation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Enable NIC to PMD Rx metadata negotiation::
+   testpmd> enable port <port_id> nic_to_pmd_rx_metadata
+
 config per queue Rx offloading
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.25.1


  reply	other threads:[~2022-12-20 20:03 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  4:41 [PATCH] app/testpmd: add command line argument 'rx-metadata' Hanumanth Pothula
2022-08-01 13:11 ` Hanumanth Pothula
2022-08-01 13:13 ` Hanumanth Pothula
2022-08-01 19:41   ` Ivan Malov
2022-08-02 16:45   ` [PATCH] app/testpmd: add command line argument 'nic-to-pmd-rx-metadata' Hanumanth Pothula
2022-08-02 16:45     ` [PATCH v2 1/2] version: 22.11-rc0 Hanumanth Pothula
2022-08-02 16:45     ` [PATCH v2 2/2] app/testpmd: add command line argument 'nic-to-pmd-rx-metadata' Hanumanth Pothula
2022-08-02 17:51   ` [PATCH v2 1/1] " Hanumanth Pothula
2022-08-30 12:36     ` Hanumanth Reddy Pothula
2022-09-01  8:03     ` Singh, Aman Deep
2022-10-04 14:48       ` Andrew Rybchenko
2022-10-06 18:35     ` [PATCH v3 1/1] app/testpmd: control passing Rx metadata to PMD Hanumanth Pothula
2022-10-17  8:32       ` Andrew Rybchenko
2022-10-27  7:34         ` Thomas Monjalon
2022-10-27 12:54           ` Thomas Monjalon
2022-12-02 16:14             ` [EXT] " Hanumanth Reddy Pothula
2022-12-02 19:41               ` Thomas Monjalon
2022-12-05  7:59                 ` Hanumanth Reddy Pothula
2022-12-05  8:28                   ` Thomas Monjalon
2022-12-05  9:43                     ` Slava Ovsiienko
2022-12-20 20:02       ` [PATCH v4 1/2] ethdev: control Rx metadata negotiation Hanumanth Pothula
2022-12-20 20:02         ` Hanumanth Pothula [this message]
2022-12-20 21:23           ` [PATCH v4 2/2] app/testpmd: add command to process " Stephen Hemminger
2022-12-21  2:07         ` [PATCH v5 1/2] ethdev: fix ethdev configuration state on reset Hanumanth Pothula
2022-12-21  2:07           ` [PATCH v5 2/2] app/testpmd: add command to process Rx metadata negotiation Hanumanth Pothula
2023-01-18 10:32             ` Thomas Monjalon
2023-01-19 10:33               ` [EXT] " Hanumanth Reddy Pothula
2023-01-25 12:51                 ` Thomas Monjalon
2023-01-24 18:04             ` Ferruh Yigit
2023-01-25  9:30               ` [EXT] " Hanumanth Reddy Pothula
2023-01-25 12:55                 ` Thomas Monjalon
2023-01-25 13:55                   ` Ferruh Yigit
2023-01-25 13:59                     ` Thomas Monjalon
2023-01-25 14:42                       ` Nithin Kumar Dabilpuram
2023-01-26 11:03                         ` Thomas Monjalon
2023-01-27  5:02                           ` Nithin Kumar Dabilpuram
2023-01-27  8:54                             ` Thomas Monjalon
2023-01-27 10:42                               ` Nithin Kumar Dabilpuram
2023-01-27 15:01                                 ` Thomas Monjalon
2023-01-31 16:17                                   ` Jerin Jacob
2023-01-31 23:03                                     ` Thomas Monjalon
2023-02-01  6:10                                       ` Ivan Malov
2023-02-01  7:16                                         ` Andrew Rybchenko
2023-02-01  8:53                                           ` Jerin Jacob
2023-02-01  9:00                                             ` Ori Kam
2023-02-01  9:05                                               ` Thomas Monjalon
2023-02-01  9:07                                                 ` Andrew Rybchenko
2023-02-01  9:14                                                   ` Jerin Jacob
2023-02-01  9:29                                                     ` Andrew Rybchenko
2023-02-01 10:48                                                       ` Jerin Jacob
2023-02-01 10:58                                                         ` Andrew Rybchenko
2023-02-01 11:04                                                           ` Thomas Monjalon
2023-02-01 11:15                                                             ` Jerin Jacob
2023-02-01 11:35                                                               ` Ferruh Yigit
2023-02-01 13:48                                                                 ` Jerin Jacob
2023-02-01 14:50                                                                   ` Ferruh Yigit
2023-02-01 15:22                                                                     ` Jerin Jacob
2023-02-02  8:43                                                                       ` Ferruh Yigit
2023-02-02  8:50                                                                         ` Ivan Malov
2023-02-02  9:17                                                                           ` Ferruh Yigit
2023-02-02 10:41                                                                             ` Ivan Malov
2023-02-02 10:48                                                                               ` Ivan Malov
2023-02-02 11:41                                                                                 ` Thomas Monjalon
2023-02-02 11:55                                                                                   ` Ivan Malov
2023-02-02 12:03                                                                                     ` Thomas Monjalon
2023-02-02 12:21                                                                                       ` Andrew Rybchenko
2023-02-01 11:20                                                             ` Ivan Malov
2023-01-25 13:17                 ` Ferruh Yigit
2023-01-25 13:21                   ` Ferruh Yigit
2023-01-25 13:21                 ` Ferruh Yigit
2023-01-16 10:43           ` [PATCH v5 1/2] ethdev: fix ethdev configuration state on reset Hanumanth Reddy Pothula
2023-01-18 10:29           ` Thomas Monjalon
2023-01-24 18:14             ` Ferruh Yigit

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=20221220200250.2413443-2-hpothula@marvell.com \
    --to=hpothula@marvell.com \
    --cc=aman.deep.singh@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=viacheslavo@nvidia.com \
    --cc=yuying.zhang@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).