DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/multi_process: add options to control port configuration
@ 2022-02-17 15:17 Wenwu Ma
  2022-02-17  9:06 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Wenwu Ma @ 2022-02-17 15:17 UTC (permalink / raw)
  To: anatoly.burakov; +Cc: dev, jiayu.hu, yinan.wang, xingguang.he, Wenwu Ma

The default values of rx mq_mode and rx offloads for port
will cause symmetric_mp startup failure if the port do
not support rss or csum. Therefore, we added two new options
--rx-mq-mode and --rx-offloads, through which the user can set
the values appropriately according to the situation to make
app startup normally.

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
 examples/multi_process/symmetric_mp/main.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 050337765f..df41abe682 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -52,6 +52,8 @@
 
 #define PARAM_PROC_ID "proc-id"
 #define PARAM_NUM_PROCS "num-procs"
+#define PARAM_RX_OFFLOADS "rx-offloads"
+#define PARAM_RX_MQ_MODE "rx-mq-mode"
 
 /* for each lcore, record the elements of the ports array to use */
 struct lcore_ports{
@@ -69,6 +71,8 @@ struct port_stats{
 
 static int proc_id = -1;
 static unsigned num_procs = 0;
+static uint64_t rx_offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM;
+static enum rte_eth_rx_mq_mode rx_mq_mode = RTE_ETH_MQ_RX_RSS;
 
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0;
@@ -84,9 +88,13 @@ smp_usage(const char *prgname, const char *errmsg)
 	printf("\n%s [EAL options] -- -p <port mask> "
 			"--"PARAM_NUM_PROCS" <n>"
 			" --"PARAM_PROC_ID" <id>\n"
+			" --"PARAM_RX_OFFLOADS" <offload>\n"
+			" --"PARAM_RX_MQ_MODE" <mode>\n"
 			"-p         : a hex bitmask indicating what ports are to be used\n"
 			"--num-procs: the number of processes which will be used\n"
 			"--proc-id  : the id of the current process (id < num-procs)\n"
+			"--rx-offloads : rx offload capabilities of ports\n"
+			"--rx-mq-mode : the multi-queue packet distribution mode, e.g. RSS.\n"
 			"\n",
 			prgname);
 	exit(1);
@@ -119,6 +127,8 @@ smp_parse_args(int argc, char **argv)
 	static struct option lgopts[] = {
 			{PARAM_NUM_PROCS, 1, 0, 0},
 			{PARAM_PROC_ID, 1, 0, 0},
+			{PARAM_RX_OFFLOADS, 1, 0, 0},
+			{PARAM_RX_MQ_MODE, 1, 0, 0},
 			{NULL, 0, 0, 0}
 	};
 
@@ -137,6 +147,10 @@ smp_parse_args(int argc, char **argv)
 				num_procs = atoi(optarg);
 			else if (strncmp(lgopts[option_index].name, PARAM_PROC_ID, 7) == 0)
 				proc_id = atoi(optarg);
+			else if (strncmp(lgopts[option_index].name, PARAM_RX_OFFLOADS, 11) == 0)
+				rx_offloads = atoi(optarg);
+			else if (strncmp(lgopts[option_index].name, PARAM_RX_MQ_MODE, 10) == 0)
+				rx_mq_mode = atoi(optarg);
 			break;
 
 		default:
@@ -175,9 +189,9 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
 {
 	struct rte_eth_conf port_conf = {
 			.rxmode = {
-				.mq_mode	= RTE_ETH_MQ_RX_RSS,
+				.mq_mode	= rx_mq_mode,
 				.split_hdr_size = 0,
-				.offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM,
+				.offloads = rx_offloads,
 			},
 			.rx_adv_conf = {
 				.rss_conf = {
-- 
2.25.1


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

end of thread, other threads:[~2022-03-08 13:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 15:17 [PATCH] examples/multi_process: add options to control port configuration Wenwu Ma
2022-02-17  9:06 ` Bruce Richardson
2022-02-18  6:49   ` Ma, WenwuX
2022-02-18  9:41     ` Bruce Richardson
2022-02-18 10:10       ` Ma, WenwuX
2022-02-18 10:22         ` Bruce Richardson
2022-02-21 15:35 ` [PATCH v2] examples/multi_process: reconfigure port when rss or csum isn't supported Wenwu Ma
2022-02-21  9:21   ` Bruce Richardson
2022-02-22 10:51 ` [PATCH v3] " Wenwu Ma
2022-02-22  9:41   ` Bruce Richardson
2022-02-28  7:55     ` Ling, WeiX
2022-03-08 13:22       ` Thomas Monjalon

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).