From patchwork Thu Feb 17 15:17:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, WenwuX" X-Patchwork-Id: 107715 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45068A0032; Thu, 17 Feb 2022 08:19:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3005840150; Thu, 17 Feb 2022 08:19:00 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 2069140042 for ; Thu, 17 Feb 2022 08:18:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645082339; x=1676618339; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xfZbRt7pK3MfnUL1+OJAewouu8QYpz0N1s9UNiGA5Sk=; b=Lg/MRJ6HKwQlwR02SnsD4q3+aGClW34cjOAD+ZVuR8O85lyURBxa/E1E Shpk7f6nJjcPOak5mFpzvW/x5jGB36iHZ8mRxFgPIOyc2cBziew5FSSgC 9gD+bQi2000/Q7u5r6qDNwh6uNuDAkKjPShlXiI9DTlmS+5LTLSXgy+Gl u58EUIG28WZjUEXs5lmfFMX7Baizc9o3ImgZm/uj+hF0DG2p5kqTbhlPI 0P+djCp+QnXTFRxgwnwQ1y1X743GEfUx2OrKi6Py3JZ8vofE5U4lARo4k noy3Dod+YraY2MIeXKtRa7TEGPus3DugOONg5RDIV197X7tCFusIyc0ac Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="311556210" X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="311556210" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:18:56 -0800 X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="503382759" Received: from unknown (HELO localhost.localdomain) ([10.239.251.209]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 23:18:53 -0800 From: Wenwu Ma To: anatoly.burakov@intel.com Cc: dev@dpdk.org, jiayu.hu@intel.com, yinan.wang@intel.com, xingguang.he@intel.com, Wenwu Ma Subject: [PATCH] examples/multi_process: add options to control port configuration Date: Thu, 17 Feb 2022 15:17:55 +0000 Message-Id: <20220217151755.442306-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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 " "--"PARAM_NUM_PROCS" " " --"PARAM_PROC_ID" \n" + " --"PARAM_RX_OFFLOADS" \n" + " --"PARAM_RX_MQ_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 = {