All of lore.kernel.org
 help / color / mirror / Atom feed
From: xuan.ding@intel.com
To: thomas@monjalon.net, ferruh.yigit@intel.com,
	andrew.rybchenko@oktetlabs.ru
Cc: dev@dpdk.org, stephen@networkplumber.org,
	mb@smartsharesystems.com, viacheslavo@nvidia.com,
	qi.z.zhang@intel.com, ping.yu@intel.com, wenxuanx.wu@intel.com,
	Xuan Ding <xuan.ding@intel.com>, Yuan Wang <yuanx.wang@intel.com>
Subject: [RFC,v2 2/3] app/testpmd: add header split configuration
Date: Tue, 22 Mar 2022 03:56:28 +0000	[thread overview]
Message-ID: <20220322035629.18756-3-xuan.ding@intel.com> (raw)
In-Reply-To: <20220322035629.18756-1-xuan.ding@intel.com>

From: Xuan Ding <xuan.ding@intel.com>

This patch adds header split configuration in testpmd. The header split
feature is off by default. To enable header split, you need:
1. Configure Rx queue with rx_offload header split on.
2. Set the protocol type of header split.

Command for set header split protocol type:
testpmd> port config <port_id> header_split mac|ipv4|ipv6|l3|tcp|udp|sctp|
		    l4|inner_mac|inner_ipv4|inner_ipv6|inner_l3|inner_tcp|
		    inner_udp|inner_sctp|inner_l4

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
---
 app/test-pmd/cmdline.c | 117 +++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.c |   6 ++-
 app/test-pmd/testpmd.h |   2 +
 3 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b4ba8da2b0..73257ddb38 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -866,6 +866,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"     Enable or disable a per port Rx offloading"
 			" on all Rx queues of a port\n\n"
 
+			"port config <port_id> header_split mac|ipv4|ipv6|l3|tcp|udp|sctp|l4|"
+			"inner_mac|inner_ipv4|inner_ipv6|inner_l3|inner_tcp|"
+			"inner_udp|inner_sctp|inner_l4\n"
+			"     Configure protocol for header split"
+			" on all Rx queues of a port\n\n"
+
 			"port (port_id) rxq (queue_id) rx_offload vlan_strip|"
 			"ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|"
 			"outer_ipv4_cksum|macsec_strip|header_split|"
@@ -16352,6 +16358,116 @@ cmdline_parse_inst_t cmd_config_per_port_rx_offload = {
 	}
 };
 
+/* config a per port header split protocol */
+struct cmd_config_per_port_headersplit_protocol_result {
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t config;
+	uint16_t port_id;
+	cmdline_fixed_string_t headersplit;
+	cmdline_fixed_string_t protocol;
+};
+
+cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_config_per_port_headersplit_protocol_result,
+		 port, "port");
+cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_config =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_config_per_port_headersplit_protocol_result,
+		 config, "config");
+cmdline_parse_token_num_t cmd_config_per_port_headersplit_protocol_result_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_config_per_port_headersplit_protocol_result,
+		 port_id, RTE_UINT16);
+cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_headersplit =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_config_per_port_headersplit_protocol_result,
+		 headersplit, "header_split");
+cmdline_parse_token_string_t cmd_config_per_port_headersplit_protocol_result_protocol =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_config_per_port_headersplit_protocol_result,
+		 protocol, "mac#ipv4#ipv6#l3#tcp#udp#sctp#l4#"
+			   "inner_mac#inner_ipv4#inner_ipv6#inner_l3#inner_tcp#"
+			   "inner_udp#inner_sctp#inner_l4");
+
+static void
+cmd_config_per_port_headersplit_protocol_parsed(void *parsed_result,
+				__rte_unused struct cmdline *cl,
+				__rte_unused void *data)
+{
+	struct cmd_config_per_port_headersplit_protocol_result *res = parsed_result;
+	portid_t port_id = res->port_id;
+	struct rte_port *port = &ports[port_id];
+	uint16_t protocol;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	if (port->port_status != RTE_PORT_STOPPED) {
+		fprintf(stderr,
+			"Error: Can't config offload when Port %d is not stopped\n",
+			port_id);
+		return;
+	}
+
+	if (!strcmp(res->protocol, "mac"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_MAC;
+	else if (!strcmp(res->protocol, "ipv4"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_IPV4;
+	else if (!strcmp(res->protocol, "ipv6"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_IPV6;
+	else if (!strcmp(res->protocol, "l3"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_L3;
+	else if (!strcmp(res->protocol, "tcp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_TCP;
+	else if (!strcmp(res->protocol, "udp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_UDP;
+	else if (!strcmp(res->protocol, "sctp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_SCTP;
+	else if (!strcmp(res->protocol, "l4"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_L4;
+	else if (!strcmp(res->protocol, "inner_mac"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_MAC;
+	else if (!strcmp(res->protocol, "inner_ipv4"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_IPV4;
+	else if (!strcmp(res->protocol, "inner_ipv6"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_IPV6;
+	else if (!strcmp(res->protocol, "inner_l3"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_L3;
+	else if (!strcmp(res->protocol, "inner_tcp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_TCP;
+	else if (!strcmp(res->protocol, "inner_udp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_UDP;
+	else if (!strcmp(res->protocol, "inner_sctp"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_SCTP;
+	else if (!strcmp(res->protocol, "inner_l4"))
+		protocol = RTE_ETH_RX_HEADER_SPLIT_INNER_L4;
+	else {
+		fprintf(stderr, "Unknown protocol name: %s\n", res->protocol);
+		return;
+	}
+
+	rx_pkt_header_split_proto = protocol;
+
+	cmd_reconfig_device_queue(port_id, 1, 1);
+}
+
+cmdline_parse_inst_t cmd_config_per_port_headersplit_protocol = {
+	.f = cmd_config_per_port_headersplit_protocol_parsed,
+	.data = NULL,
+	.help_str = "port config <port_id> header_split mac|ipv4|ipv6|l3|tcp|udp|sctp|l4|"
+		    "inner_mac|inner_ipv4|inner_ipv6|inner_l3|inner_tcp|"
+		    "inner_udp|inner_sctp|inner_l4",
+	.tokens = {
+		(void *)&cmd_config_per_port_headersplit_protocol_result_port,
+		(void *)&cmd_config_per_port_headersplit_protocol_result_config,
+		(void *)&cmd_config_per_port_headersplit_protocol_result_port_id,
+		(void *)&cmd_config_per_port_headersplit_protocol_result_headersplit,
+		(void *)&cmd_config_per_port_headersplit_protocol_result_protocol,
+		NULL,
+	}
+};
+
 /* Enable/Disable a per queue offloading */
 struct cmd_config_per_queue_rx_offload_result {
 	cmdline_fixed_string_t port;
@@ -18070,6 +18186,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_rx_offload_get_capa,
 	(cmdline_parse_inst_t *)&cmd_rx_offload_get_configuration,
 	(cmdline_parse_inst_t *)&cmd_config_per_port_rx_offload,
+	(cmdline_parse_inst_t *)&cmd_config_per_port_headersplit_protocol,
 	(cmdline_parse_inst_t *)&cmd_config_per_queue_rx_offload,
 	(cmdline_parse_inst_t *)&cmd_tx_offload_get_capa,
 	(cmdline_parse_inst_t *)&cmd_tx_offload_get_configuration,
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6d2e52c790..4aba8e4ac4 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -253,6 +253,8 @@ uint8_t  tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */
 enum tx_pkt_split tx_pkt_split = TX_PKT_SPLIT_OFF;
 /**< Split policy for packets to TX. */
 
+uint8_t rx_pkt_header_split_proto;
+
 uint8_t txonly_multi_flow;
 /**< Whether multiple flows are generated in TXONLY mode. */
 
@@ -2568,7 +2570,8 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	int ret;
 
 	if (rx_pkt_nb_segs <= 1 ||
-	    (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) == 0) {
+	    (((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) == 0) &&
+	     ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_HEADER_SPLIT) == 0))) {
 		rx_conf->rx_seg = NULL;
 		rx_conf->rx_nseg = 0;
 		ret = rte_eth_rx_queue_setup(port_id, rx_queue_id,
@@ -2592,6 +2595,7 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 		rx_seg->offset = i < rx_pkt_nb_offs ?
 				   rx_pkt_seg_offsets[i] : 0;
 		rx_seg->mp = mpx ? mpx : mp;
+		rx_seg->proto = rx_pkt_header_split_proto;
 	}
 	rx_conf->rx_nseg = rx_pkt_nb_segs;
 	rx_conf->rx_seg = rx_useg;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9967825044..a9681372a4 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -531,6 +531,8 @@ enum tx_pkt_split {
 
 extern enum tx_pkt_split tx_pkt_split;
 
+extern uint8_t rx_pkt_header_split_proto;
+
 extern uint8_t txonly_multi_flow;
 
 extern uint32_t rxq_share;
-- 
2.17.1


  parent reply	other threads:[~2022-03-22  4:00 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  6:01 [RFC] ethdev: introduce protocol type based header split xuan.ding
2022-03-03  8:55 ` Thomas Monjalon
2022-03-08  7:48   ` Ding, Xuan
2022-03-03 16:15 ` Stephen Hemminger
2022-03-04  9:58   ` Zhang, Qi Z
2022-03-04 11:54     ` Morten Brørup
2022-03-04 17:32     ` Stephen Hemminger
2022-03-22  3:56 ` [RFC,v2 0/3] " xuan.ding
2022-03-22  3:56   ` [RFC,v2 1/3] " xuan.ding
2022-03-22  7:14     ` Zhang, Qi Z
2022-03-22  7:43       ` Ding, Xuan
2022-03-22  3:56   ` xuan.ding [this message]
2022-03-22  3:56   ` [RFC,v2 3/3] net/ice: support header split in Rx data path xuan.ding
2022-03-29  6:49 ` [RFC,v3 0/3] ethdev: introduce protocol type based header split xuan.ding
2022-03-29  6:49   ` [RFC,v3 1/3] " xuan.ding
2022-03-29  7:56     ` Zhang, Qi Z
2022-03-29  8:18       ` Ding, Xuan
2022-03-29  6:49   ` [RFC,v3 2/3] app/testpmd: add header split configuration xuan.ding
2022-03-29  6:49   ` [RFC,v3 3/3] net/ice: support header split in Rx data path xuan.ding
2022-04-02 10:41 ` [v4 0/3] ethdev: introduce protocol type based header split wenxuanx.wu
2022-04-02 10:41   ` [v4 1/3] " wenxuanx.wu
2022-04-07 10:47     ` Andrew Rybchenko
2022-04-12 16:15       ` Ding, Xuan
2022-04-20 15:48         ` Andrew Rybchenko
2022-04-25 14:57           ` Ding, Xuan
2022-04-21 10:27         ` Thomas Monjalon
2022-04-25 15:05           ` Ding, Xuan
2022-04-07 13:26     ` Jerin Jacob
2022-04-12 16:40       ` Ding, Xuan
2022-04-20 14:39         ` Andrew Rybchenko
2022-04-21 10:36           ` Thomas Monjalon
2022-04-25  9:23           ` Ding, Xuan
2022-04-26 11:13     ` [PATCH v5 0/3] ethdev: introduce protocol based buffer split wenxuanx.wu
2022-04-26 11:13       ` [PATCH v5 1/4] lib/ethdev: introduce protocol type " wenxuanx.wu
2022-05-17 21:12         ` Thomas Monjalon
2022-05-19 14:40           ` Ding, Xuan
2022-05-26 14:58             ` Ding, Xuan
2022-04-26 11:13       ` [PATCH v5 2/4] app/testpmd: add proto based buffer split config wenxuanx.wu
2022-04-26 11:13       ` [PATCH v5 3/4] net/ice: support proto based buf split in Rx path wenxuanx.wu
2022-04-02 10:41   ` [v4 2/3] app/testpmd: add header split configuration wenxuanx.wu
2022-04-02 10:41   ` [v4 3/3] net/ice: support header split in Rx data path wenxuanx.wu
2022-05-27  7:54 ` [PATCH v6] ethdev: introduce protocol header based buffer split xuan.ding
2022-05-27  8:14 ` [PATCH v6 0/1] ethdev: introduce protocol " xuan.ding
2022-05-27  8:14   ` [PATCH v6 1/1] ethdev: introduce protocol header " xuan.ding
2022-05-30  9:43     ` Ray Kinsella
2022-06-01 13:06 ` [PATCH v7 0/3] ethdev: introduce protocol type based header split wenxuanx.wu
2022-06-01 13:06   ` [PATCH v7 1/3] ethdev: introduce protocol header based buffer split wenxuanx.wu
2022-06-01 13:06   ` [PATCH v7 2/3] net/ice: support buffer split in Rx path wenxuanx.wu
2022-06-01 13:06   ` [PATCH v7 3/3] app/testpmd: add rxhdrs commands and parameters wenxuanx.wu
2022-06-01 13:22 ` [PATCH v7 0/3] ethdev: introduce protocol type based header split wenxuanx.wu
2022-06-01 13:22   ` [PATCH v7 1/3] ethdev: introduce protocol header based buffer split wenxuanx.wu
2022-06-01 13:22   ` [PATCH v7 2/3] net/ice: support buffer split in Rx path wenxuanx.wu
2022-06-01 13:22   ` [PATCH v7 3/3] app/testpmd: add rxhdrs commands and parameters wenxuanx.wu
2022-06-01 13:50 ` [PATCH v8 0/3] ethdev: introduce protocol type based header split wenxuanx.wu
2022-06-01 13:50   ` [PATCH v8 1/3] ethdev: introduce protocol hdr based buffer split wenxuanx.wu
2022-06-02 13:20     ` Andrew Rybchenko
2022-06-03 16:30       ` Ding, Xuan
2022-06-04 14:25         ` Andrew Rybchenko
2022-06-07 10:13           ` Ding, Xuan
2022-06-07 10:48             ` Andrew Rybchenko
2022-06-10 15:04               ` Ding, Xuan
2022-06-01 13:50   ` [PATCH v8 1/3] ethdev: introduce protocol header " wenxuanx.wu
2022-06-02 13:20     ` Andrew Rybchenko
2022-06-02 13:44       ` Ding, Xuan
2022-06-01 13:50   ` [PATCH v8 2/3] net/ice: support buffer split in Rx path wenxuanx.wu
2022-06-01 13:50   ` [PATCH v8 3/3] app/testpmd: add rxhdrs commands and parameters wenxuanx.wu
2022-06-02 13:20   ` [PATCH v8 0/3] ethdev: introduce protocol type based header split Andrew Rybchenko
2022-06-13 10:25 ` [PATCH v9 0/4] add an api to support proto based buffer split wenxuanx.wu
2022-06-13 10:25   ` [PATCH v9 1/4] ethdev: introduce protocol header API wenxuanx.wu
2022-07-07  9:05     ` Thomas Monjalon
2022-08-01  7:09       ` Wang, YuanX
2022-08-01 10:01         ` Thomas Monjalon
2022-08-02 10:12           ` Wang, YuanX
2022-07-08 15:00     ` Andrew Rybchenko
2022-08-01  7:17       ` Wang, YuanX
2022-06-13 10:25   ` [PATCH v9 2/4] ethdev: introduce protocol hdr based buffer split wenxuanx.wu
2022-07-07  9:07     ` Thomas Monjalon
2022-07-11  9:54       ` Ding, Xuan
2022-07-11 10:12         ` Thomas Monjalon
2022-07-08 15:00     ` Andrew Rybchenko
2022-07-21  3:24       ` Ding, Xuan
2022-08-01 14:28         ` Andrew Rybchenko
2022-08-02  7:22           ` Ding, Xuan
2022-06-13 10:25   ` [PATCH v9 3/4] app/testpmd: add rxhdrs commands and parameters wenxuanx.wu
2022-06-13 10:25   ` [PATCH v9 4/4] net/ice: support buffer split in Rx path wenxuanx.wu
2022-06-21  8:56   ` [PATCH v9 0/4] add an api to support proto based buffer split Ding, Xuan
2022-07-07  9:10     ` Thomas Monjalon
2022-07-11 10:08       ` Ding, Xuan

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=20220322035629.18756-3-xuan.ding@intel.com \
    --to=xuan.ding@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=mb@smartsharesystems.com \
    --cc=ping.yu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=wenxuanx.wu@intel.com \
    --cc=yuanx.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.