Skip to contentSkip to conversation

ethdev: introduce Rx buffer split

RFC In review Slava Ovsiienko 10 participants 172 messages Aug 17, 2020 – Oct 19, 2020 Network drivers Page 3 of 3

lore
Share & tools
lore
#167 lore raw

PATCH v12 4/6 app/testpmd: add rxpkts commands and parameters

In reply to Viacheslav Ovsiienko

Add command line parameter:

--rxpkts=X[,Y]

Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).

Add interactive mode command:

testpmd> set rxpkts (x[,y]*)

Where x[,y]* represents a CSV list of values, without white space.

Sets the length of segments to scatter packets on receiving if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only). Optionally the multiple memory pools can be specified with --mbuf-size command line parameter and the mbufs to receive will be allocated sequentially from these extra memory pools.

---
 app/test-pmd/cmdline.c                      | 61 +++++++++++++++++++++++++++--
 app/test-pmd/config.c                       | 48 ++++++++++++++++++++++-
 app/test-pmd/parameters.c                   | 15 +++++++
 app/test-pmd/testpmd.c                      |  7 ++++
 app/test-pmd/testpmd.h                      | 11 +++++-
 doc/guides/testpmd_app_ug/run_app.rst       |  9 +++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 +++++++++-
 7 files changed, 165 insertions(+), 7 deletions(-)
app/test-pmd/cmdline.c +58 -3
index 0ef87c9..a195e37 100644
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"show (rxq|txq) info (port_id) (queue_id)\n"
 			"    Display information for configured RX/TX queue.\n\n"
 
-			"show config (rxtx|cores|fwd|txpkts)\n"
+			"show config (rxtx|cores|fwd|rxpkts|txpkts)\n"
 			"    Display the given configuration.\n\n"
 
 			"read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"    Set the transmit delay time and number of retries,"
 			" effective when retry is enabled.\n\n"
 
+			"set rxpkts (x[,y]*)\n"
+			"    Set the length of each segment to scatter"
+			" packets on receiving if split feature is engaged."
+			" Affects only the queues configured with split"
+			" offloads.\n\n"
+
 			"set txpkts (x[,y]*)\n"
 			"    Set the length of each segment of TXONLY"
 			" and optionally CSUM packets.\n\n"
@@ -3907,6 +3913,52 @@ struct cmd_set_log_result {
 	},
 };
 
+/* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */
+
+struct cmd_set_rxpkts_result {
+	cmdline_fixed_string_t cmd_keyword;
+	cmdline_fixed_string_t rxpkts;
+	cmdline_fixed_string_t seg_lengths;
+};
+
+static void
+cmd_set_rxpkts_parsed(void *parsed_result,
+		      __rte_unused struct cmdline *cl,
+		      __rte_unused void *data)
+{
+	struct cmd_set_rxpkts_result *res;
+	unsigned int seg_lengths[MAX_SEGS_BUFFER_SPLIT];
+	unsigned int nb_segs;
+
+	res = parsed_result;
+	nb_segs = parse_item_list(res->seg_lengths, "segment lengths",
+				  MAX_SEGS_BUFFER_SPLIT, seg_lengths, 0);
+	if (nb_segs > 0)
+		set_rx_pkt_segments(seg_lengths, nb_segs);
+}
+
+cmdline_parse_token_string_t cmd_set_rxpkts_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result,
+				 cmd_keyword, "set");
+cmdline_parse_token_string_t cmd_set_rxpkts_name =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result,
+				 rxpkts, "rxpkts");
+cmdline_parse_token_string_t cmd_set_rxpkts_lengths =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxpkts_result,
+				 seg_lengths, NULL);
+
+cmdline_parse_inst_t cmd_set_rxpkts = {
+	.f = cmd_set_rxpkts_parsed,
+	.data = NULL,
+	.help_str = "set rxpkts <len0[,len1]*>",
+	.tokens = {
+		(void *)&cmd_set_rxpkts_keyword,
+		(void *)&cmd_set_rxpkts_name,
+		(void *)&cmd_set_rxpkts_lengths,
+		NULL,
+	},
+};
+
 /* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */
 
 struct cmd_set_txpkts_result {
@@ -7535,6 +7587,8 @@ static void cmd_showcfg_parsed(void *parsed_result,
 		fwd_lcores_config_display();
 	else if (!strcmp(res->what, "fwd"))
 		pkt_fwd_config_display(&cur_fwd_config);
+	else if (!strcmp(res->what, "rxpkts"))
+		show_rx_pkt_segments();
 	else if (!strcmp(res->what, "txpkts"))
 		show_tx_pkt_segments();
 	else if (!strcmp(res->what, "txtimes"))
@@ -7547,12 +7601,12 @@ static void cmd_showcfg_parsed(void *parsed_result,
 	TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");
 cmdline_parse_token_string_t cmd_showcfg_what =
 	TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what,
-				 "rxtx#cores#fwd#txpkts#txtimes");
+				 "rxtx#cores#fwd#rxpkts#txpkts#txtimes");
 
 cmdline_parse_inst_t cmd_showcfg = {
 	.f = cmd_showcfg_parsed,
 	.data = NULL,
-	.help_str = "show config rxtx|cores|fwd|txpkts|txtimes",
+	.help_str = "show config rxtx|cores|fwd|rxpkts|txpkts|txtimes",
 	.tokens = {
 		(void *)&cmd_showcfg_show,
 		(void *)&cmd_showcfg_port,
@@ -19825,6 +19879,7 @@ struct cmd_showport_macs_result {
 	(cmdline_parse_inst_t *)&cmd_reset,
 	(cmdline_parse_inst_t *)&cmd_set_numbers,
 	(cmdline_parse_inst_t *)&cmd_set_log,
+	(cmdline_parse_inst_t *)&cmd_set_rxpkts,
 	(cmdline_parse_inst_t *)&cmd_set_txpkts,
 	(cmdline_parse_inst_t *)&cmd_set_txsplit,
 	(cmdline_parse_inst_t *)&cmd_set_txtimes,
app/test-pmd/config.c +46 -2

62 lines not on this page · raw message

app/test-pmd/parameters.c +15 -0
index 4db4987..e4e3635 100644
@@ -184,6 +184,7 @@
 	       "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
 	printf("  --no-flush-rx: Don't flush RX streams before forwarding."
 	       " Used mainly with PCAP drivers.\n");
+	printf("  --rxpkts=X[,Y]*: set RX segment sizes to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
 	printf("  --txonly-multi-flow: generate multiple flows in txonly mode\n");
@@ -662,6 +663,7 @@
 		{ "rx-queue-stats-mapping",	1, 0, 0 },
 		{ "no-flush-rx",	0, 0, 0 },
 		{ "flow-isolate-all",	        0, 0, 0 },
+		{ "rxpkts",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
 		{ "txonly-multi-flow",		0, 0, 0 },
 		{ "disable-link-check",		0, 0, 0 },
@@ -1272,6 +1274,19 @@
 						 "invalid RX queue statistics mapping config entered\n");
 				}
 			}
+			if (!strcmp(lgopts[opt_idx].name, "rxpkts")) {
+				unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT];
+				unsigned int nb_segs;
+
+				nb_segs = parse_item_list
+						(optarg, "rxpkt segments",
+						 MAX_SEGS_BUFFER_SPLIT,
+						 seg_len, 0);
+				if (nb_segs > 0)
+					set_rx_pkt_segments(seg_len, nb_segs);
+				else
+					rte_exit(EXIT_FAILURE, "bad rxpkts\n");
+			}
 			if (!strcmp(lgopts[opt_idx].name, "txpkts")) {
 				unsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];
 				unsigned int nb_segs;
app/test-pmd/testpmd.c +7 -0
index a0578e3..acd269e 100644
@@ -210,6 +210,13 @@ struct fwd_engine * fwd_engines[] = {
 uint8_t f_quit;
 
 /*
+ * Configuration of packet segments used to scatter received packets
+ * if some of split features is configured.
+ */
+uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
+uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+
+/*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
 uint16_t tx_pkt_length = TXONLY_DEF_PACKET_LEN; /**< TXONLY packet length. */
app/test-pmd/testpmd.h +10 -1
index f889698..6e82321 100644
@@ -433,6 +433,13 @@ struct queue_stats_mappings {
 extern struct rte_fdir_conf fdir_conf;
 
 /*
+ * Configuration of packet segments used to scatter received packets
+ * if some of split features is configured.
+ */
+extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
+extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+
+/*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
 #define TXONLY_DEF_PACKET_LEN 64
@@ -840,7 +847,9 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,
 void set_record_core_cycles(uint8_t on_off);
 void set_record_burst_stats(uint8_t on_off);
 void set_verbose_level(uint16_t vb_level);
-void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
+void set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs);
+void show_rx_pkt_segments(void);
+void set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs);
 void show_tx_pkt_segments(void);
 void set_tx_pkt_times(unsigned int *tx_times);
 void show_tx_pkt_times(void);
doc/guides/testpmd_app_ug/run_app.rst +9 -0
index 1eb0a10..463b76c 100644
@@ -361,6 +361,15 @@ The command line options are:
 
     Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD.
 
+*   ``--rxpkts=X[,Y]``
+
+    Set the length of segments to scatter packets on receiving if split
+    feature is engaged. Affects only the queues configured
+    with split offloads (currently BUFFER_SPLIT is supported only).
+    Optionally the multiple memory pools can be specified with --mbuf-size
+    command line parameter and the mbufs to receive will be allocated
+    sequentially from these extra memory pools.
+
 *   ``--txpkts=X[,Y]``
 
     Set TX segment sizes or total packet length. Valid for ``tx-only``
doc/guides/testpmd_app_ug/testpmd_funcs.rst +20 -1
index 43c0ea0..b9fad3a 100644
@@ -273,7 +273,7 @@ show config
 Displays the configuration of the application.
 The configuration comes from the command-line, the runtime or the application defaults::
 
-   testpmd> show config (rxtx|cores|fwd|txpkts|txtimes)
+   testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes)
 
 The available information categories are:
 
@@ -283,6 +283,8 @@ The available information categories are:
 
 * ``fwd``: Packet forwarding configuration.
 
+* ``rxpkts``: Packets to RX split configuration.
+
 * ``txpkts``: Packets to TX configuration.
 
 * ``txtimes``: Burst time pattern for Tx only mode.
@@ -774,6 +776,23 @@ When retry is enabled, the transmit delay time and number of retries can also be
 
    testpmd> set burst tx delay (microseconds) retry (num)
 
+set rxpkts
+~~~~~~~~~~
+
+Set the length of segments to scatter packets on receiving if split
+feature is engaged. Affects only the queues configured with split offloads
+(currently BUFFER_SPLIT is supported only). Optionally the multiple memory
+pools can be specified with --mbuf-size command line parameter and the mbufs
+to receive will be allocated sequentially from these extra memory pools (the
+mbuf for the first segment is allocated from the first pool, the second one
+from the second pool, and so on, if segment number is greater then pool's the
+mbuf for remaining segments will be allocated from the last valid pool).
+
+   testpmd> set rxpkts (x[,y]*)
+
+Where x[,y]* represents a CSV list of values, without white space. Zero value
+means to use the corresponding memory pool data buffer size.
+
 set txpkts
 ~~~~~~~~~~
 
Signature · 1 line
1.8.3.1
#168 lore raw

PATCH v12 5/6 app/testpmd: add rxoffs commands and parameters

In reply to Viacheslav Ovsiienko

Add command line parameter:

--rxoffs=X[,Y]

Sets the offsets of packet segments from the beginning of the receiving buffer if split feature is engaged. Affects only the queues configured with split offloads (currently BUFFER_SPLIT is supported only).

Add interactive mode command, providing the same:

testpmd> set rxoffs (x[,y]*)

Where x[,y]* represents a CSV list of values, without white space.

---
 app/test-pmd/cmdline.c                      | 61 +++++++++++++++++++++++++++--
 app/test-pmd/config.c                       | 44 +++++++++++++++++++++
 app/test-pmd/parameters.c                   | 15 +++++++
 app/test-pmd/testpmd.c                      |  2 +
 app/test-pmd/testpmd.h                      |  4 ++
 doc/guides/testpmd_app_ug/run_app.rst       |  6 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 17 +++++++-
 7 files changed, 145 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +58 -3
index a195e37..e09df36 100644
@@ -183,7 +183,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"show (rxq|txq) info (port_id) (queue_id)\n"
 			"    Display information for configured RX/TX queue.\n\n"
 
-			"show config (rxtx|cores|fwd|rxpkts|txpkts)\n"
+			"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\n"
 			"    Display the given configuration.\n\n"
 
 			"read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -294,6 +294,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"    Set the transmit delay time and number of retries,"
 			" effective when retry is enabled.\n\n"
 
+			"set rxoffs (x[,y]*)\n"
+			"    Set the offset of each packet segment on"
+			" receiving if split feature is engaged."
+			" Affects only the queues configured with split"
+			" offloads.\n\n"
+
 			"set rxpkts (x[,y]*)\n"
 			"    Set the length of each segment to scatter"
 			" packets on receiving if split feature is engaged."
@@ -3913,6 +3919,52 @@ struct cmd_set_log_result {
 	},
 };
 
+/* *** SET SEGMENT OFFSETS OF RX PACKETS SPLIT *** */
+
+struct cmd_set_rxoffs_result {
+	cmdline_fixed_string_t cmd_keyword;
+	cmdline_fixed_string_t rxoffs;
+	cmdline_fixed_string_t seg_offsets;
+};
+
+static void
+cmd_set_rxoffs_parsed(void *parsed_result,
+		      __rte_unused struct cmdline *cl,
+		      __rte_unused void *data)
+{
+	struct cmd_set_rxoffs_result *res;
+	unsigned int seg_offsets[MAX_SEGS_BUFFER_SPLIT];
+	unsigned int nb_segs;
+
+	res = parsed_result;
+	nb_segs = parse_item_list(res->seg_offsets, "segment offsets",
+				  MAX_SEGS_BUFFER_SPLIT, seg_offsets, 0);
+	if (nb_segs > 0)
+		set_rx_pkt_offsets(seg_offsets, nb_segs);
+}
+
+cmdline_parse_token_string_t cmd_set_rxoffs_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result,
+				 cmd_keyword, "set");
+cmdline_parse_token_string_t cmd_set_rxoffs_name =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result,
+				 rxoffs, "rxoffs");
+cmdline_parse_token_string_t cmd_set_rxoffs_offsets =
+	TOKEN_STRING_INITIALIZER(struct cmd_set_rxoffs_result,
+				 seg_offsets, NULL);
+
+cmdline_parse_inst_t cmd_set_rxoffs = {
+	.f = cmd_set_rxoffs_parsed,
+	.data = NULL,
+	.help_str = "set rxoffs <len0[,len1]*>",
+	.tokens = {
+		(void *)&cmd_set_rxoffs_keyword,
+		(void *)&cmd_set_rxoffs_name,
+		(void *)&cmd_set_rxoffs_offsets,
+		NULL,
+	},
+};
+
 /* *** SET SEGMENT LENGTHS OF RX PACKETS SPLIT *** */
 
 struct cmd_set_rxpkts_result {
@@ -7587,6 +7639,8 @@ static void cmd_showcfg_parsed(void *parsed_result,
 		fwd_lcores_config_display();
 	else if (!strcmp(res->what, "fwd"))
 		pkt_fwd_config_display(&cur_fwd_config);
+	else if (!strcmp(res->what, "rxoffs"))
+		show_rx_pkt_offsets();
 	else if (!strcmp(res->what, "rxpkts"))
 		show_rx_pkt_segments();
 	else if (!strcmp(res->what, "txpkts"))
@@ -7601,12 +7655,12 @@ static void cmd_showcfg_parsed(void *parsed_result,
 	TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");
 cmdline_parse_token_string_t cmd_showcfg_what =
 	TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what,
-				 "rxtx#cores#fwd#rxpkts#txpkts#txtimes");
+				 "rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes");
 
 cmdline_parse_inst_t cmd_showcfg = {
 	.f = cmd_showcfg_parsed,
 	.data = NULL,
-	.help_str = "show config rxtx|cores|fwd|rxpkts|txpkts|txtimes",
+	.help_str = "show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes",
 	.tokens = {
 		(void *)&cmd_showcfg_show,
 		(void *)&cmd_showcfg_port,
@@ -19879,6 +19933,7 @@ struct cmd_showport_macs_result {
 	(cmdline_parse_inst_t *)&cmd_reset,
 	(cmdline_parse_inst_t *)&cmd_set_numbers,
 	(cmdline_parse_inst_t *)&cmd_set_log,
+	(cmdline_parse_inst_t *)&cmd_set_rxoffs,
 	(cmdline_parse_inst_t *)&cmd_set_rxpkts,
 	(cmdline_parse_inst_t *)&cmd_set_txpkts,
 	(cmdline_parse_inst_t *)&cmd_set_txsplit,
app/test-pmd/config.c +44 -0

50 lines not on this page · raw message

app/test-pmd/parameters.c +15 -0
index e4e3635..2298ba5 100644
@@ -184,6 +184,7 @@
 	       "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
 	printf("  --no-flush-rx: Don't flush RX streams before forwarding."
 	       " Used mainly with PCAP drivers.\n");
+	printf("  --rxoffs=X[,Y]*: set RX segment offsets for split.\n");
 	printf("  --rxpkts=X[,Y]*: set RX segment sizes to split.\n");
 	printf("  --txpkts=X[,Y]*: set TX segment sizes"
 		" or total packet length.\n");
@@ -663,6 +664,7 @@
 		{ "rx-queue-stats-mapping",	1, 0, 0 },
 		{ "no-flush-rx",	0, 0, 0 },
 		{ "flow-isolate-all",	        0, 0, 0 },
+		{ "rxoffs",			1, 0, 0 },
 		{ "rxpkts",			1, 0, 0 },
 		{ "txpkts",			1, 0, 0 },
 		{ "txonly-multi-flow",		0, 0, 0 },
@@ -1274,6 +1276,19 @@
 						 "invalid RX queue statistics mapping config entered\n");
 				}
 			}
+			if (!strcmp(lgopts[opt_idx].name, "rxoffs")) {
+				unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT];
+				unsigned int nb_offs;
+
+				nb_offs = parse_item_list
+						(optarg, "rxpkt offsets",
+						 MAX_SEGS_BUFFER_SPLIT,
+						 seg_off, 0);
+				if (nb_offs > 0)
+					set_rx_pkt_offsets(seg_off, nb_offs);
+				else
+					rte_exit(EXIT_FAILURE, "bad rxoffs\n");
+			}
 			if (!strcmp(lgopts[opt_idx].name, "rxpkts")) {
 				unsigned int seg_len[MAX_SEGS_BUFFER_SPLIT];
 				unsigned int nb_segs;
app/test-pmd/testpmd.c +2 -0
index acd269e..99b6fd1 100644
@@ -215,6 +215,8 @@ struct fwd_engine * fwd_engines[] = {
  */
 uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
+uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
app/test-pmd/testpmd.h +4 -0
index 6e82321..253d3c0 100644
@@ -438,6 +438,8 @@ struct queue_stats_mappings {
  */
 extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];
 extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */
+extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];
+extern uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */
 
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
@@ -849,6 +851,8 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,
 void set_verbose_level(uint16_t vb_level);
 void set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs);
 void show_rx_pkt_segments(void);
+void set_rx_pkt_offsets(unsigned int *seg_offsets, unsigned int nb_offs);
+void show_rx_pkt_offsets(void);
 void set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs);
 void show_tx_pkt_segments(void);
 void set_tx_pkt_times(unsigned int *tx_times);
doc/guides/testpmd_app_ug/run_app.rst +6 -0
index 463b76c..9b0a84a 100644
@@ -361,6 +361,12 @@ The command line options are:
 
     Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD.
 
+*   ``--rxoffs=X[,Y]``
+
+    Set the offsets of packet segments on receiving if split
+    feature is engaged. Affects only the queues configured
+    with split offloads (currently BUFFER_SPLIT is supported only).
+
 *   ``--rxpkts=X[,Y]``
 
     Set the length of segments to scatter packets on receiving if split
doc/guides/testpmd_app_ug/testpmd_funcs.rst +16 -1
index b9fad3a..e73530e 100644
@@ -273,7 +273,7 @@ show config
 Displays the configuration of the application.
 The configuration comes from the command-line, the runtime or the application defaults::
 
-   testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes)
+   testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes)
 
 The available information categories are:
 
@@ -283,6 +283,8 @@ The available information categories are:
 
 * ``fwd``: Packet forwarding configuration.
 
+* ``rxoffs``: Packet offsets for RX split.
+
 * ``rxpkts``: Packets to RX split configuration.
 
 * ``txpkts``: Packets to TX configuration.
@@ -776,6 +778,19 @@ When retry is enabled, the transmit delay time and number of retries can also be
 
    testpmd> set burst tx delay (microseconds) retry (num)
 
+set rxoffs
+~~~~~~~~~~
+
+Set the offsets of segments relating to the data buffer beginning on receiving
+if split feature is engaged. Affects only the queues configured with split
+offloads (currently BUFFER_SPLIT is supported only).
+
+   testpmd> set rxoffs (x[,y]*)
+
+Where x[,y]* represents a CSV list of values, without white space. If the list
+of offsets is shorter than the list of segments the zero offsets will be used
+for the remaining segments.
+
 set rxpkts
 ~~~~~~~~~~
 
Signature · 1 line
1.8.3.1
#169 lore raw

PATCH v12 6/6 app/testpmd: add extended Rx queue setup

In reply to Viacheslav Ovsiienko

If Rx queue is configured with split feature the extended setup with specified segment sizes and pool will be performed.

---
 app/test-pmd/cmdline.c | 12 ++++++------
 app/test-pmd/testpmd.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
 app/test-pmd/testpmd.h |  5 +++++
 3 files changed, 58 insertions(+), 8 deletions(-)
app/test-pmd/cmdline.c +6 -6
index e09df36..07ee4e4 100644
@@ -2945,12 +2945,12 @@ struct cmd_setup_rxtx_queue {
 				rxring_numa[res->portid]);
 			return;
 		}
-		ret = rte_eth_rx_queue_setup(res->portid,
-					     res->qid,
-					     port->nb_rx_desc[res->qid],
-					     socket_id,
-					     &port->rx_conf[res->qid],
-					     mp);
+		ret = rx_queue_setup(res->portid,
+				     res->qid,
+				     port->nb_rx_desc[res->qid],
+				     socket_id,
+				     &port->rx_conf[res->qid],
+				     mp);
 		if (ret)
 			printf("Failed to setup RX queue\n");
 	} else {
app/test-pmd/testpmd.c +47 -2

67 lines not on this page · raw message

app/test-pmd/testpmd.h +5 -0
index 253d3c0..ad0a636 100644
@@ -900,6 +900,11 @@ void port_rss_reta_info(portid_t port_id,
 
 void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);
 
+int
+rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
+	       uint16_t nb_rx_desc, unsigned int socket_id,
+	       struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);
+
 int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
 int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
 				uint64_t q_msk);
Signature · 1 line
1.8.3.1
#170 lore raw
In reply to Viacheslav Ovsiienko
Quoted 160 lines · Viacheslav Ovsiienko

The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.

In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.

The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.

The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:

struct rte_eth_rxseg_split {

struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */
};

The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array

If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.

There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.

f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.

For example, let's suppose we configured the Rx queue with the following segments:

     seg0 - pool0, len0=14B, off0=2
     seg1 - pool1, len1=20B, off1=128B
     seg2 - pool2, len2=20B, off2=0B
     seg3 - pool3, len3=512B, off3=0B

The packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2

The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3

The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and configured to support new buffer split feature (if rx_nseg is greater than one).

The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.

The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.

---

v1: http://patches.dpdk.org/patch/79594/
v2: http://patches.dpdk.org/patch/79893/
- add feature support to mlx5 PMD

v3: http://patches.dpdk.org/patch/80389/
- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT
- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part

v4: http://patches.dpdk.org/patch/80401/
- common part of rx_queue_setup/rxseg_queue_setup

v5: http://patches.dpdk.org/patch/80609/
- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series

v6: http://patches.dpdk.org/patch/80785/
- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed

v7: http://patches.dpdk.org/patch/80978/
- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy

v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed

v9: http://patches.dpdk.org/patch/81080/
- simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags

v10: - missed in mailing list, see v11 for changes

v11: http://patches.dpdk.org/patch/81116/
- documentation cleanup (removed rxq_info_get mention)
- max_nseg moved from the recored and converted to uint16_t;
- reserved uint16_t is added to rte_eth_rxseg_capa;

v12: - __rte_experimental at structure declarations
converted to the tag in the comment
- testpmd pool names shortened, prefix provided
- comments reworded

Quoted 9 lines

---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup

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

#171 lore raw
Quoted 252 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, October 16, 2020 20:05
To: Slava Ovsiienko <[email protected]>; [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v12 0/6] ethdev: introduce Rx buffer split

Quoted 77 lines · Viacheslav Ovsiienko

The DPDK datapath in the transmit direction is very flexible. An application can build the multi-segment packet and manages almost all data aspects - the memory pools where segments are allocated from, the segment lengths, the memory attributes like external buffers, registered for DMA, etc.

In the receiving direction, the datapath is much less flexible, an application can only specify the memory pool to configure the receiving queue and nothing more. In order to extend receiving datapath capabilities it is proposed to add the way to provide extended information how to split the packets being received.

The new offload flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT in device capabilities is introduced to present the way for PMD to report to application about supporting Rx packet split to configurable segments. Prior invoking the rte_eth_rx_queue_setup() routine application should check RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT flag.

The following structure is introduced to specify the Rx packet segment for RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT offload:

struct rte_eth_rxseg_split {

struct rte_mempool *mp; /* memory pools to allocate segment from */ uint16_t length; /* segment maximal data length,
configures "split point" */
uint16_t offset; /* data offset from beginning
of mbuf data buffer */
uint32_t reserved; /* reserved field */ };

The segment descriptions are added to the rte_eth_rxconf structure:
rx_seg - pointer the array of segment descriptions, each element
describes the memory pool, maximal data length, initial data offset from the beginning of data buffer in mbuf.
This array allows to specify the different settings for each segment in individual fashion.
rx_nseg - number of elements in the array

If the extended segment descriptions is provided with these new fields the mp parameter of the rte_eth_rx_queue_setup must be specified as NULL to avoid ambiguity.

There are two options to specify Rx buffer configuration:
- mp is not NULL, rx_conf.rx_seg is NULL, rx_conf.rx_nseg is zero, it is compatible configuration, follows existing implementation, provides single pool and no description for segment sizes and offsets.
- mp is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not zero, it provides the extended configuration, individually for each segment.

f the Rx queue is configured with new settings the packets being received will be split into multiple segments pushed to the mbufs with specified attributes. The PMD will split the received packets into multiple segments according to the specification in the description array.

For example, let's suppose we configured the Rx queue with the following segments:

     seg0 - pool0, len0=14B, off0=2
     seg1 - pool1, len1=20B, off1=128B
     seg2 - pool2, len2=20B, off2=0B
     seg3 - pool3, len3=512B, off3=0B

The packet 46 bytes long will look like the following:
seg0 - 14B long @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B long @ 128 in mbuf from pool1
seg2 - 12B long @ 0 in mbuf from pool2

The packet 1500 bytes long will look like the following:
seg0 - 14B @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0 seg1 - 20B @ 128 in mbuf from pool1
seg2 - 20B @ 0 in mbuf from pool2
seg3 - 512B @ 0 in mbuf from pool3
seg4 - 512B @ 0 in mbuf from pool3
seg5 - 422B @ 0 in mbuf from pool3

Quoted 1 line

The offload RTE_ETH_RX_OFFLOAD_SCATTER must be present and

configured

Quoted 16 lines

to support new buffer split feature (if rx_nseg is greater than one).

The split limitations imposed by underlying PMD is reported in the new introduced rte_eth_dev_info->rx_seg_capa field.

The new approach would allow splitting the ingress packets into multiple parts pushed to the memory with different attributes. For example, the packet headers can be pushed to the embedded data buffers within mbufs and the application data into the external buffers attached to mbufs allocated from the different memory pools. The memory attributes for the split parts may differ either - for example the application data may be pushed into the external memory located on the dedicated physical device, say GPU or NVMe. This would improve the DPDK receiving datapath flexibility with preserving compatibility with existing API.

Quoted 6 lines

---

v1:
https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch

es.dpdk.org%2Fpatch%2F79594%2F&amp;data=04%7C01%7Cviacheslavo%40n vidia

Quoted 1 line

.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39efd 9cc

Quoted 1 line

c17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4w

Quoted 1 line

LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp; sdat

Quoted 1 line

a=78ja3UHYl%2Blyg%2Fjv1hDLqCCy2Gf9WRFyidgrKTnwfbk%3D&amp;reserved =0

Quoted 1 line

v2:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F79893%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=rLC8kS6CxFR7IprwFjAL16Po6Exqw%2BtqVn1soNZ3v6 A%3D&amp;reserved=0

Quoted 3 lines

- add feature support to mlx5 PMD

v3:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F80389%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=bLZ4mnluEMojl%2FP%2BmFDBgO8jTHpDoc7Rj362Ws mdbJk%3D&amp;reserved=0

Quoted 2 lines

- rte_eth_rx_queue_setup_ex is renamed to rte_eth_rxseg_queue_setup
- DEV_RX_OFFLOAD_BUFFER_SPLIT is renamed to

RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT

Quoted 6 lines

- commit message update
- documentaion provided
- release notes update
- minor bug fixes in testpmd related part

v4:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F80401%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=5lbRRML9If9i5mupJ57eX%2BUhfidisNrRHHkhUibjwSs %3D&amp;reserved=0

Quoted 3 lines

- common part of rx_queue_setup/rxseg_queue_setup

v5:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F80609%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=QqfwQd6DMkrfsS68ENksClFDbRu3VWqoVOdow7AqO XU%3D&amp;reserved=0

Quoted 10 lines

- refactored to approach of providing split configuration in the rte_eth_rxconf structure instead of introducing the new API routine
- added support for rxoffs command to testpmd to provide segment offsets for complete testing of split configurations
- patchset is split into two parts - PMD part will be presented as separate series

v6:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F80785%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=winuZo94BCsyX2tKbeQJKZnZgUA75r5%2BptD9Y1b6n Yo%3D&amp;reserved=0

Quoted 7 lines

- wordy comments rephrased
- typos fixed
- rte_eth_rx_queue_setup configuration check isolated for two main options
- the rest of comments addressed

v7:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F80978%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=o6vyym10K%2BpEpBtJQYYMnWEEoQDC2pcgXQSku8 %2FJ2PE%3D&amp;reserved=0

Quoted 10 lines

- description as union of feature dedicated segment split description
- the split limitations reported in the rte_eth_dev_info->rx_seg_capa
- comments made less wordy

v8: - bitfield instead of uint8;
- named union to avoid warinings;
- typos fixed

v9:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F81080%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=H3cmcZO7fWt2A3quAPFNlJKVSv97c51vZWmzM86hE Ms%3D&amp;reserved=0

Quoted 8 lines

- simplified rte_eth_rxseg union
- moved out wordy comment from rte_eth_rxconf
- rte_eth_rxseg_capa uint32 bitfield and naming
- added experimental tags

v10: - missed in mailing list, see v11 for changes

v11:

https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatches
.dpdk.org%2Fpatch%2F81116%2F&amp;data=04%7C01%7Cviacheslavo%40nvi dia.com%7C2acfee0f2bf14ffcf9c008d871f5b3fa%7C43083d15727340c1b7db39 efd9ccc17a%7C0%7C0%7C637384647418293191%7CUnknown%7CTWFpbGZsb 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0% 3D%7C1000&amp;sdata=CR5SFYRE1odbQAzWAhOxER0KcgIXadTj1UDEq%2BRr 4Ek%3D&amp;reserved=0

Quoted 9 lines

- documentation cleanup (removed rxq_info_get mention)
- max_nseg moved from the recored and converted to uint16_t;
- reserved uint16_t is added to rte_eth_rxseg_capa;

v12: - __rte_experimental at structure declarations
converted to the tag in the comment
- testpmd pool names shortened, prefix provided
- comments reworded

Quoted 9 lines

---
Viacheslav Ovsiienko (6):
ethdev: introduce Rx buffer split app/testpmd: add multiple pools per core creation app/testpmd: add buffer split offload configuration app/testpmd: add rxpkts commands and parameters app/testpmd: add rxoffs commands and parameters app/testpmd: add extended Rx queue setup

Quoted 1 line

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

Thanks to all whoever was involved, for discussion and help in series polishing!