From patchwork Sun Mar 21 22:31:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89607 X-Patchwork-Delegate: david.marchand@redhat.com 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 1619AA034F; Sun, 21 Mar 2021 23:32:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F1D46140DE0; Sun, 21 Mar 2021 23:31:57 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 7148B140DDB for ; Sun, 21 Mar 2021 23:31:55 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 12B2A1223; Sun, 21 Mar 2021 18:31:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:31:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=ql1ArSEH28J4g Ov97og9YPDLexCyN2SYZtqVQNJpwjA=; b=kQP+YlFPexdtZLToY0FVNhjpf2HTF bEImpu9ojSHw354Q1RHG5jpVd9maA5pn8NU+qiqxDgg5ivyLzyCgkn+YxwMyJjuH fIza5G1Q5pA0NU0oPavnjuHiN0goOrnZth09jO3/ayH8VmEHim+PcSUmuiu9g0Nb BUOteG475imW4uo1EIwqwPw3V6Z+rQ3ZJswESWLSEmHOVpi2vZ8xAxQ111N1Gz+L vqL5+6+biYKt2PCQne4Y/4SqAxQ+uGwwAk8GnuWEbZBONi0M7HKxVaWroMzr8zRb SYP9LkBMZBrJy/5p98dazzHEWdzC0Ysy2rw82GovxYkPLzJE97Wen8Hvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=ql1ArSEH28J4gOv97og9YPDLexCyN2SYZtqVQNJpwjA=; b=Ggq6ZfHY F3VVcVxxDHZRb9TO/OYT0Xoq4BGnmnHMNp+nFXeKtFbmXfC3CyDe921uLsd0Qsb0 YWWj6Fw8tBxb4n/DayMc1WXbEa6AYai7GEJ9AhIn+0PkVdIxf080uEliNp68CP8p ObU8rKKPYgFFLPFcQ5kpw/6r3LiYFAUI2HO9ssRFcZZrYpXs54dP6yzyO2ZboTz1 9Z4P20MIECtG66pKrT4m9hPv99SPqmf2cvKPuVQpSBcwB2r7Yh+6SrKX/Q68Z+QH fOxt9jbbKZlQMTB43O7FOvA0OAZAfBvsbVmgVB5GXsrVIsLO93sNcv2Dx/d9pB64 3s/e4y0DYfdBlg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id B53AF24035D; Sun, 21 Mar 2021 18:31:52 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko Date: Sun, 21 Mar 2021 23:31:05 +0100 Message-Id: <20210321223116.1340974-2-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 01/11] eal: explain argv behaviour during init 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 Sender: "dev" After argument parsing done by rte_eal_init(), the remaining arguments are to be parsed by the application by progressing in the argv array. In this context, the first string represented by argv[0] is still the same program name as the original argv[0], while the next strings are the application arguments. This is because rte_eal_init() manipulates the argv array after EAL parsing, before returning to the application. This note was missing in the doxygen comment of the API. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/include/rte_eal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rte_eal.h index eaf6469e50..0cbeedb594 100644 --- a/lib/librte_eal/include/rte_eal.h +++ b/lib/librte_eal/include/rte_eal.h @@ -76,6 +76,8 @@ int rte_eal_iopl_init(void); * @param argv * An array of strings. The contents of the array, as well as the strings * which are pointed to by the array, may be modified by this function. + * The program name pointer argv[0] is copied into the last parsed argv + * so that argv[0] is still the same after deducing the parsed arguments. * @return * - On success, the number of parsed arguments, which is greater or * equal to zero. After the call to rte_eal_init(), From patchwork Sun Mar 21 22:31:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89608 X-Patchwork-Delegate: david.marchand@redhat.com 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 4B1C7A034F; Sun, 21 Mar 2021 23:32:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D482140DE7; Sun, 21 Mar 2021 23:31:59 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 194CF140DDC for ; Sun, 21 Mar 2021 23:31:56 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 810FB5C00FE; Sun, 21 Mar 2021 18:31:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:31:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=34oe4RIb6/Bvq NYUhXUrMSDwSZkg5QDgPH8jdQyJuvM=; b=WoAtXflqAYdIL86OjB3Lu3mSsvd+4 +zWjnwARV3dWAXZeCObVtlzg0KXVCzYIZS31GmdTm+Iqtj7dmMya3XEzc3CX7nil FsAcQgpQhVjKfXqfdBR9Mg6gJAp3l3uW75IeIz5Tr+eNSJwgkteDtD5eNDf9WsyV M2YBYeCkUywxkrRs4oGQ+GCvGs7deehdsBYYbbfkCjjbydsVrOsf6GWCwx1sU/G/ 3CKjcwfn3L6UprBsPET7nJ6oh41FGMW4iSZfirQyqTWY9GJBEsKeSJeNbFhyV2UY iIuMpPKM20RemSdP5u5eB05SLkAiJ75PQG7BbDDw6kYk5hF0/nPxsW9+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=34oe4RIb6/BvqNYUhXUrMSDwSZkg5QDgPH8jdQyJuvM=; b=qyWii7Ko OYJDu9twH9wwfja0J+bEICe3MZkr4Rxzs9euTCRa19lSquz+J2j7L0MAMdmyZJdu 377IPY+rNWnzBwuIDhnEmnxYrDJL781gNp0S47RxLF+drtBWRmWQXHGYYsaF5bpS XTOBYACGP+0Pw5kiDmJLFlURp7oDogsILVESWg4adNK0E71MnMlKwN+QDpFIaH2O Vfcsn5mbdNTvKYJw043tYJOZzaT7N2WKQQA9Xz9h9Fqs47kueRC2SQ6mDusorPnj STuFZzDDjE2kuE/0z3nv0UoG16fe/sQGm3qxcME9TX9CV2O1nxfYswOARDy8E1th 3kZEbwdHjvGH6w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 4D2FB2402E7; Sun, 21 Mar 2021 18:31:54 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Sun, 21 Mar 2021 23:31:06 +0100 Message-Id: <20210321223116.1340974-3-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 02/11] eal: improve options usage text 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 Sender: "dev" The description of the EAL options was printed before the application description provided via the hook. It is better to let the application print the global syntax and describes the detail of the EAL options below. Also, some useless lines are removed, and the alignment of few options is fixed. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_options.c | 11 +++++------ lib/librte_eal/freebsd/eal.c | 8 ++++---- lib/librte_eal/linux/eal.c | 12 ++++++------ lib/librte_eal/windows/eal.c | 10 ++++------ 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 622c7bc429..0635b0d4ce 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -2022,8 +2022,7 @@ rte_vect_set_max_simd_bitwidth(uint16_t bitwidth) void eal_common_usage(void) { - printf("[options]\n\n" - "EAL common options:\n" + printf("EAL common options:\n" " -c COREMASK Hexadecimal bitmask of cores to run on\n" " -l CORELIST List of cores to run on\n" " The argument format is [-c2][,c3[-c4],...]\n" @@ -2053,7 +2052,7 @@ eal_common_usage(void) " --"OPT_VDEV" Add a virtual device.\n" " The argument format is [,key=val,...]\n" " (ex: --vdev=net_pcap0,iface=eth2).\n" - " --"OPT_IOVA_MODE" Set IOVA mode. 'pa' for IOVA_PA\n" + " --"OPT_IOVA_MODE" Set IOVA mode. 'pa' for IOVA_PA\n" " 'va' for IOVA_VA\n" " -d LIB.so|DIR Add a driver or driver directory\n" " (can be used multiple times)\n" @@ -2092,11 +2091,11 @@ eal_common_usage(void) #endif /* !RTE_EXEC_ENV_WINDOWS */ " -v Display version information on startup\n" " -h, --help This help\n" - " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n" + " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n" " disable secondary process support\n" " --"OPT_BASE_VIRTADDR" Base virtual address\n" - " --"OPT_TELEMETRY" Enable telemetry support (on by default)\n" - " --"OPT_NO_TELEMETRY" Disable telemetry support\n" + " --"OPT_TELEMETRY" Enable telemetry support (on by default)\n" + " --"OPT_NO_TELEMETRY" Disable telemetry support\n" " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwidth\n" "\nEAL options for DEBUG use only:\n" " --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n" diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index 62320d610f..6e414f5e7e 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -421,13 +421,13 @@ eal_usage(const char *prgname) { rte_usage_hook_t hook = eal_get_application_usage_hook(); - printf("\nUsage: %s ", prgname); - eal_common_usage(); - /* Allow the application to print its usage message too if hook is set */ if (hook) { - printf("===== Application Usage =====\n\n"); + /* Print application usage through EAL options parsing. */ (hook)(prgname); + printf("\n"); } + + eal_common_usage(); } static inline size_t diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 9ffb4b3314..9aa585e04f 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -534,7 +534,12 @@ eal_usage(const char *prgname) { rte_usage_hook_t hook = eal_get_application_usage_hook(); - printf("\nUsage: %s ", prgname); + if (hook) { + /* Print application usage through EAL options parsing. */ + (hook)(prgname); + printf("\n"); + } + eal_common_usage(); printf("EAL Linux options:\n" " --"OPT_SOCKET_MEM" Memory to allocate on sockets (comma separated values)\n" @@ -548,11 +553,6 @@ eal_usage(const char *prgname) " --"OPT_SINGLE_FILE_SEGMENTS" Put all hugepage memory in single files\n" " --"OPT_MATCH_ALLOCATIONS" Free hugepages exactly as allocated\n" "\n"); - /* Allow the application to print its usage message too if hook is set */ - if (hook) { - printf("===== Application Usage =====\n\n"); - (hook)(prgname); - } } static int diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index 2fc3d6141c..ec13ac1a9f 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -79,15 +79,13 @@ eal_usage(const char *prgname) { rte_usage_hook_t hook = eal_get_application_usage_hook(); - printf("\nUsage: %s ", prgname); - eal_common_usage(); - /* Allow the application to print its usage message too - * if hook is set - */ if (hook) { - printf("===== Application Usage =====\n\n"); + /* Print application usage through EAL options parsing. */ (hook)(prgname); + printf("\n"); } + + eal_common_usage(); } /* Parse the arguments for --log-level only */ From patchwork Sun Mar 21 22:31:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89609 X-Patchwork-Delegate: david.marchand@redhat.com 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 E7F16A034F; Sun, 21 Mar 2021 23:32:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D36A140DF0; Sun, 21 Mar 2021 23:32:04 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id A8AC7140DDC for ; Sun, 21 Mar 2021 23:31:57 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 12EDB5C00C2; Sun, 21 Mar 2021 18:31:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:31:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=lv2RPg/5nWMf/ L6jj8F4R2nCuOYGcWl/OvSWlRn5wCg=; b=N68STbD6gHH+hlrhe4tVM1vbwLmoB YlB6tQX2cw0uIOlKR49EWJHn3GZrEEZRG/G9Faos0r8GVR4x7WeEKSkYk0/1Gta+ 8UhEsd9iiMJIFJFXR6u2FyHWeJnIO8oCYs8RUi2P5+Ld10CD3kL0MNIGkRIiu5tW qqXbt9tzOIIz3ygHa0zmLU8Zx78Mh/nefUw1w57Q8ebemoygYHFBmIZNqiZXZrGv 7peN0KrXdeD1uGGtBAav/CZvqa9J9Dl3KP2A7+0/SItTGq9uNWKPKUnDjdB6/Oz2 UECseGYMKTuchoQVbEqhWRbXvLnac10Iw8cZfHZORMWGe6ENwiBB0wgcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=lv2RPg/5nWMf/L6jj8F4R2nCuOYGcWl/OvSWlRn5wCg=; b=k68AAT5W PRjMw9QEm9zIK62azBFRlAYogb1oRS8P5Ayof6voPSNlYMNGZqxcTzpeYq6ubQY6 eK5ky0YR9/y44WdswjWOKR3Sl2fF6D56V1wszvJXdd/oiCfo8svYezcHLVLxKVod zhNUCKiV/cWm3QTQoxUSmTAuPCwe3LMcxu71c+HUUn5wzVpcY1kD1zv86aLo03NO sTaIg05zvpyzr2Vwg8RLCjI8KnqaVmCC0aDP4u/2SytDjwbTOgM/ZPBm+XWPnxmN z/5tx7GnOhbjxj/jQqMfRz3Osn8TM1QNrj5LdZFHUfDVpdfBCP5ge+BqbOoZi+z5 osSPWzOnI8aYjQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 15C882402E7; Sun, 21 Mar 2021 18:31:56 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Sun, 21 Mar 2021 23:31:07 +0100 Message-Id: <20210321223116.1340974-4-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 03/11] eal: use macros for help option 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 Sender: "dev" The macros OPT_HELP and OPT_HELP_NUM were not used where appropriate. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_options.c | 2 +- lib/librte_eal/freebsd/eal.c | 2 +- lib/librte_eal/linux/eal.c | 2 +- lib/librte_eal/windows/eal.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 0635b0d4ce..52fedb81e5 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -2090,7 +2090,7 @@ eal_common_usage(void) " must be specified once only.\n" #endif /* !RTE_EXEC_ENV_WINDOWS */ " -v Display version information on startup\n" - " -h, --help This help\n" + " -h, --"OPT_HELP" This help\n" " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n" " disable secondary process support\n" " --"OPT_BASE_VIRTADDR" Base virtual address\n" diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index 6e414f5e7e..91048efc35 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -549,7 +549,7 @@ eal_parse_args(int argc, char **argv) } break; } - case 'h': + case OPT_HELP_NUM: eal_usage(prgname); exit(EXIT_SUCCESS); default: diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index 9aa585e04f..c8ea590a05 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -716,7 +716,7 @@ eal_parse_args(int argc, char **argv) continue; switch (opt) { - case 'h': + case OPT_HELP_NUM: eal_usage(prgname); exit(EXIT_SUCCESS); diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index ec13ac1a9f..4dd2fc1403 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -158,7 +158,7 @@ eal_parse_args(int argc, char **argv) continue; switch (opt) { - case 'h': + case OPT_HELP_NUM: eal_usage(prgname); exit(EXIT_SUCCESS); default: From patchwork Sun Mar 21 22:31:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89610 X-Patchwork-Delegate: david.marchand@redhat.com 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 67211A034F; Sun, 21 Mar 2021 23:32:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 705F2140E02; Sun, 21 Mar 2021 23:32:05 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 283EC140DE5 for ; Sun, 21 Mar 2021 23:31:59 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B2FC05C00C5; Sun, 21 Mar 2021 18:31:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:31:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=HUwhBa6sWFCjn 6HxwD3p1+NcsgIR2fP1aMtmc9ovK20=; b=z4TCIKJ9NqfScV1Skg5AJ9hBif/5y C0kWWMIRLalq32BU/84KeWOng8OT92HYKHZq3fYwJ2WgzMOOlTZVABMBLdDigkXX yxRRWcKIkYpvcZsLummIXRkqFByMPwFg9yAjwYU8p4BWkBGiy+zGz5iNdZFaM+ql VWVThHvFD/biWuXwcTg/BXxnScmIhrQV3MvqS0ynX6VcSFg/0mdfJn6//Z9UWfwW AZ+/6Ytk5yw4wHZ7BRu5m6up+HIB0AaNkPBaOIYfE9NALzbPGArHD/GYQm2h/7AS HDvPgpIEjO1peuevg4u3zvLnFcVSqbaW8z/GK4tokcnzBHIoo1GnZjOTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=HUwhBa6sWFCjn6HxwD3p1+NcsgIR2fP1aMtmc9ovK20=; b=EzwiSXWF IvRN6bgMMOU+YHEdh/R0fa3IWyo6BKiGW3f/kEg8yUa4BudFN64+28BHyrF3apyI Sh+Lhwg1Bv9hloGVIAL0ufrv15y/6PZ9BUzchck4zoAwYuZDALbBrGFHCsKaxPsj d4Li/LJvjDwnib0jwRZH5Bu9vv+r1gopBvuo95/WEzQm6TBV8VOOuY+jo11m2cCC 80VYAJxsU5439LxmRvR+XP7q8tQrr+DqTjEKCN86j1U1HoYqUPCdna0ThBflZhwM +AXi4yfZeJ/pruAcBRaFVRJGK19v4PIVl0hm1JkY02S7ajTjQkbwlz9M8hJogrsC VrZUJ/mZUSM5RQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id C24352402E7; Sun, 21 Mar 2021 18:31:57 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Sun, 21 Mar 2021 23:31:08 +0100 Message-Id: <20210321223116.1340974-5-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 04/11] eal: move private log functions 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 Sender: "dev" Some private log functions had a wrong "rte_" prefix. All private log functions are moved from eal_private.h to the new file eal_log.h: rte_eal_log_init -> eal_log_init rte_log_save_regexp -> eal_log_save_regexp rte_log_save_pattern -> eal_log_save_pattern eal_log_set_default The static functions in the file eal_common_log.c are renamed: rte_log_save_level -> log_save_level rte_log_init -> log_init Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_log.c | 18 ++++++++------ lib/librte_eal/common/eal_common_options.c | 5 ++-- lib/librte_eal/common/eal_log.h | 27 ++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 29 ---------------------- lib/librte_eal/linux/eal.c | 3 ++- lib/librte_eal/linux/eal_log.c | 4 +-- lib/librte_eal/windows/eal.c | 3 ++- lib/librte_eal/windows/eal_log.c | 6 +++-- 8 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 lib/librte_eal/common/eal_log.h diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index c5554badb2..aee7c44c6a 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -15,7 +15,7 @@ #include #include -#include "eal_private.h" +#include "eal_log.h" struct rte_log_dynamic_type { const char *name; @@ -178,8 +178,8 @@ rte_log_set_level_regexp(const char *regex, uint32_t level) * Save the type string and the loglevel for later dynamic * logtypes which may register later. */ -static int rte_log_save_level(int priority, - const char *regex, const char *pattern) +static int +log_save_level(uint32_t priority, const char *regex, const char *pattern) { struct rte_eal_opt_loglevel *opt_ll = NULL; @@ -207,9 +207,10 @@ static int rte_log_save_level(int priority, return -1; } -int rte_log_save_regexp(const char *regex, int tmp) +int +eal_log_save_regexp(const char *regex, uint32_t level) { - return rte_log_save_level(tmp, regex, NULL); + return log_save_level(level, regex, NULL); } /* set log level based on globbing pattern */ @@ -232,9 +233,10 @@ rte_log_set_level_pattern(const char *pattern, uint32_t level) return 0; } -int rte_log_save_pattern(const char *pattern, int priority) +int +eal_log_save_pattern(const char *pattern, uint32_t level) { - return rte_log_save_level(priority, NULL, pattern); + return log_save_level(level, NULL, pattern); } /* get the current loglevel for the message being processed */ @@ -376,7 +378,7 @@ static const struct logtype logtype_strings[] = { }; /* Logging should be first initializer (before drivers and bus) */ -RTE_INIT_PRIO(rte_log_init, LOG) +RTE_INIT_PRIO(log_init, LOG) { uint32_t i; diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 52fedb81e5..02374ee09e 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -41,6 +41,7 @@ #include "eal_options.h" #include "eal_filesystem.h" #include "eal_private.h" +#include "eal_log.h" #ifndef RTE_EXEC_ENV_WINDOWS #include "eal_trace.h" #endif @@ -1299,7 +1300,7 @@ eal_parse_log_level(const char *arg) regex, priority); goto fail; } - if (rte_log_save_regexp(regex, priority) < 0) + if (eal_log_save_regexp(regex, priority) < 0) goto fail; } else if (pattern) { if (rte_log_set_level_pattern(pattern, priority) < 0) { @@ -1307,7 +1308,7 @@ eal_parse_log_level(const char *arg) pattern, priority); goto fail; } - if (rte_log_save_pattern(pattern, priority) < 0) + if (eal_log_save_pattern(pattern, priority) < 0) goto fail; } else { rte_log_set_global_level(priority); diff --git a/lib/librte_eal/common/eal_log.h b/lib/librte_eal/common/eal_log.h new file mode 100644 index 0000000000..684650a17b --- /dev/null +++ b/lib/librte_eal/common/eal_log.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2021 Mellanox Technologies, Ltd + */ + +#ifndef EAL_LOG_H +#define EAL_LOG_H + +#include +#include + +/* + * Initialize the default log stream. + */ +int eal_log_init(const char *id, int facility); + +/* + * Determine where log data is written when no call to rte_openlog_stream. + */ +void eal_log_set_default(FILE *default_log); + +/* + * Save a log option for later. + */ +int eal_log_save_regexp(const char *regexp, uint32_t level); +int eal_log_save_pattern(const char *pattern, uint32_t level); + +#endif /* EAL_LOG_H */ diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index b8a0d20021..e3512111d9 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -79,19 +79,6 @@ struct rte_config *rte_eal_get_configuration(void); */ int rte_eal_memzone_init(void); -/** - * Common log initialization function (private to eal). Determines - * where log data is written when no call to rte_openlog_stream is - * in effect. - * - * @param default_log - * The default log stream to be used. - * @return - * - 0 on success - * - Negative on error - */ -void eal_log_set_default(FILE *default_log); - /** * Fill configuration with number of physical and logical processors * @@ -143,22 +130,6 @@ int rte_eal_memory_init(void); */ int rte_eal_timer_init(void); -/** - * Init the default log stream - * - * This function is private to EAL. - * - * @return - * 0 on success, negative on error - */ -int rte_eal_log_init(const char *id, int facility); - -/** - * Save the log regexp for later - */ -int rte_log_save_regexp(const char *type, int priority); -int rte_log_save_pattern(const char *pattern, int priority); - /** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index c8ea590a05..1e7264f1a2 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -58,6 +58,7 @@ #include "eal_hugepages.h" #include "eal_memcfg.h" #include "eal_trace.h" +#include "eal_log.h" #include "eal_options.h" #include "eal_vfio.h" #include "hotplug_mp.h" @@ -1160,7 +1161,7 @@ rte_eal_init(int argc, char **argv) #endif } - if (rte_eal_log_init(logid, internal_conf->syslog_facility) < 0) { + if (eal_log_init(logid, internal_conf->syslog_facility) < 0) { rte_eal_init_alert("Cannot init logging."); rte_errno = ENOMEM; __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED); diff --git a/lib/librte_eal/linux/eal_log.c b/lib/librte_eal/linux/eal_log.c index 2095df74c5..c0aa1007c4 100644 --- a/lib/librte_eal/linux/eal_log.c +++ b/lib/librte_eal/linux/eal_log.c @@ -17,7 +17,7 @@ #include #include -#include "eal_private.h" +#include "eal_log.h" /* * default log function @@ -46,7 +46,7 @@ static cookie_io_functions_t console_log_func = { * once memzones are available. */ int -rte_eal_log_init(const char *id, int facility) +eal_log_init(const char *id, int facility) { FILE *log_stream; diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index 4dd2fc1403..5bca3ace1c 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -22,6 +22,7 @@ #include "eal_hugepages.h" #include "eal_trace.h" +#include "eal_log.h" #include "eal_windows.h" #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL) @@ -265,7 +266,7 @@ rte_eal_init(int argc, char **argv) eal_get_internal_configuration(); int ret; - rte_eal_log_init(NULL, 0); + eal_log_init(NULL, 0); eal_log_level_parse(argc, argv); diff --git a/lib/librte_eal/windows/eal_log.c b/lib/librte_eal/windows/eal_log.c index 875981f139..d4ea47f1c8 100644 --- a/lib/librte_eal/windows/eal_log.c +++ b/lib/librte_eal/windows/eal_log.c @@ -2,11 +2,13 @@ * Copyright(c) 2017-2018 Intel Corporation */ -#include "eal_private.h" +#include +#include +#include "eal_log.h" /* set the log to default function, called during eal init process. */ int -rte_eal_log_init(__rte_unused const char *id, __rte_unused int facility) +eal_log_init(__rte_unused const char *id, __rte_unused int facility) { rte_openlog_stream(stderr); From patchwork Sun Mar 21 22:31:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89611 X-Patchwork-Delegate: david.marchand@redhat.com 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 A5F1EA034F; Sun, 21 Mar 2021 23:32:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC2CC140E25; Sun, 21 Mar 2021 23:32:06 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 7BA52140DBA for ; Sun, 21 Mar 2021 23:32:01 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 753DFFC5; Sun, 21 Mar 2021 18:32:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=LqiNWGwiQvE4T vTvTRLonf7s15GeEDAL4k6v0nygjqM=; b=3iuKqKV4ZUQsbAJKzewayFqaJq4z+ jPsV8nkObBGOfEcP92FzpIl1YnV6GF1l2jI4Bfla8CBiXBsXSwdK+qpaDzNw9j8g tkiEE35UAqobWU5ncCeNT52jROgfci4uARGeVraJoI0/XNqGLP0c8ntUoUbOvpqf iPXKENvlOxOawCYRm74W/zZJHGdMZxRlV0k6/68UwkQSHaje8vO6xByVHoQQnNpM q7g0JcG6zEfpzoYMn+vcGTvKVGhkXnYS/2pZbqeeQ+a9zmfgMdSBgOABrqXhwIJc C3PecffCGvSbkTzk2I4fKqCpVB4TqVAJFZ2T6M+8dmrTtOd28/5txob3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=LqiNWGwiQvE4TvTvTRLonf7s15GeEDAL4k6v0nygjqM=; b=iC+XQOzP puQGPuRQ3m86vmoe644y5UNnlSLP1YWyHMLvI6sbPQSh7lhowktIDhSABIAFIVlq S2XxnKEEsWqiTpMard+Ss1IurZhmncrmjvp/F8RRSEvkzhlGLnDPKzkxoUzxvVSx 5nlUUY/5oVCh1Lcd9nxANiamwhS42HmVcTlK0wDkKZlyp4WgEFYlBgAwa4yZJ2GE WEhnbA+jsnGr/+CMdwYtmN3s/8DV6V7kuyBKo8vzhLtn5t8tdlbNQjpqnXoQ6REM CbftSt0JNGYrcZhOeYvTdJ+SZKYRXMtb5z1CU+UJBvP5vxmXjBc0vQKNSaOM3jJM HaV8ywTV9gMF1Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 760F22402E7; Sun, 21 Mar 2021 18:31:59 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko Date: Sun, 21 Mar 2021 23:31:09 +0100 Message-Id: <20210321223116.1340974-6-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 05/11] eal: introduce maximum log level macro 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 Sender: "dev" RTE_DIM(...) and RTE_LOG_DEBUG were used to get the highest log level. For better clarity a new constant RTE_LOG_MAX is introduced and mapped to RTE_LOG_DEBUG. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_log.c | 8 ++++---- lib/librte_eal/common/eal_common_options.c | 2 +- lib/librte_eal/include/rte_log.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index aee7c44c6a..40cac36f89 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -140,7 +140,7 @@ rte_log_set_level(uint32_t type, uint32_t level) { if (type >= rte_logs.dynamic_types_len) return -1; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; rte_logs.dynamic_types[type].loglevel = level; @@ -155,7 +155,7 @@ rte_log_set_level_regexp(const char *regex, uint32_t level) regex_t r; size_t i; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; if (regcomp(&r, regex, 0) != 0) @@ -219,7 +219,7 @@ rte_log_set_level_pattern(const char *pattern, uint32_t level) { size_t i; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; for (i = 0; i < rte_logs.dynamic_types_len; i++) { @@ -323,7 +323,7 @@ rte_log_register_type_and_pick_level(const char *name, uint32_t level_def) return type; TAILQ_FOREACH(opt_ll, &opt_loglevel_list, next) { - if (opt_ll->level > RTE_LOG_DEBUG) + if (opt_ll->level > RTE_LOG_MAX) continue; if (opt_ll->pattern) { diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 02374ee09e..3675e55fc9 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1249,7 +1249,7 @@ eal_parse_log_priority(const char *level) return -1; /* look for named values, skip 0 which is not a valid level */ - for (i = 1; i < RTE_DIM(levels); i++) { + for (i = 1; i <= RTE_LOG_MAX; i++) { if (strncmp(levels[i], level, len) == 0) return i; } diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index 173004fd71..394e8682b9 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -72,6 +72,7 @@ extern "C" { #define RTE_LOG_NOTICE 6U /**< Normal but significant condition. */ #define RTE_LOG_INFO 7U /**< Informational. */ #define RTE_LOG_DEBUG 8U /**< Debug-level messages. */ +#define RTE_LOG_MAX RTE_LOG_DEBUG /**< Most detailed log level. */ /** * Change the stream that will be used by the logging system. From patchwork Sun Mar 21 22:31:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89612 X-Patchwork-Delegate: david.marchand@redhat.com 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 9C93CA034F; Sun, 21 Mar 2021 23:32:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 562F6140E30; Sun, 21 Mar 2021 23:32:08 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id DC803140DF0 for ; Sun, 21 Mar 2021 23:32:02 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id D4A0611F6; Sun, 21 Mar 2021 18:32:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=BlJKgr9N2Sc8x w5BWBp9B3vDQESft/zos79GhHzXwIE=; b=H6BTcCPgyiEAvJcrzYOxOf1c5CnDj CJ/y0HhZv92rHi+lsJonO1BTxeNlIXqF5wnNryN73vT3A7BJ+FX5RIRiG031qH7p P/y+IMrWDDZwKUszZS92xiCNK5QC+ZBUtV25Z0BIlvP/Bz9oCK8iJWCi6rydJPFZ tlNTCNvhZM41m2C7nx9S+2b2AYHcWCffmmS1VjUNvsXXrH464F8x3dorKqvqSH/G OhgnMDLe5UXmfIQNlygUUQYC+IdSUL1EaQNd3kMqG27kfICo4X4Bq/h/2Tx+BxHh ibueYb+FzkJqMk8FGuFNMljw/8ICUsFE40vXJs8D+hlc6acMj98OKBZbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=BlJKgr9N2Sc8xw5BWBp9B3vDQESft/zos79GhHzXwIE=; b=Ltq9U1DS e95uR9h6VAbsGvm5Lg8mLFKl1YyFGUmUvu3cUc2+FxaNd14986hdSaUVCf3cCRLU w9kIQxeR7+FhVxv3P6i2l+Yn2lrRGkrfyWH8neR4Y3IMYlAGKY9NqF9vVn4AyMcK kx03Te/IZKOg6KIzXU7S1bnYPQv5FQqRCOEqH42fEnhHn+kfnB2IRo2Q4bhvIDpi Q7XfDntGEQr40XUM//eceHEOZNncnzZMlBaX3UAG0qwzL7XbyFNRkIuBjl591R4+ MpYWRiSGvzPFn9bb5OFGwhTTZcMRRtjDVgGcMDy8wAU0sStL6wVKSWGyuzWgVLRI Q4NFRZDysKgwCg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D2B55240356; Sun, 21 Mar 2021 18:32:00 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko Date: Sun, 21 Mar 2021 23:31:10 +0100 Message-Id: <20210321223116.1340974-7-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 06/11] eal: catch invalid log level number 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 Sender: "dev" The parsing check for invalid log level was not trying to catch irrelevant numeric values. A log level 0 is now a failure in options parsing so it can be caught early. A log level higher than the max (8) is accepted with a warning message. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 3675e55fc9..2df3ae04ea 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1289,10 +1289,15 @@ eal_parse_log_level(const char *arg) } priority = eal_parse_log_priority(level); - if (priority < 0) { - fprintf(stderr, "invalid log priority: %s\n", level); + if (priority <= 0) { + fprintf(stderr, "Invalid log level: %s\n", level); goto fail; } + if (priority > (int)RTE_LOG_MAX) { + fprintf(stderr, "Log level %d higher than maximum (%d)\n", + priority, RTE_LOG_MAX); + priority = RTE_LOG_MAX; + } if (regex) { if (rte_log_set_level_regexp(regex, priority) < 0) { From patchwork Sun Mar 21 22:31:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89613 X-Patchwork-Delegate: david.marchand@redhat.com 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 8C0D9A034F; Sun, 21 Mar 2021 23:32:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92326140E4C; Sun, 21 Mar 2021 23:32:13 +0100 (CET) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id DEEBB140E02 for ; Sun, 21 Mar 2021 23:32:04 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id AC62EFC5; Sun, 21 Mar 2021 18:32:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=IMvN4Pm73Nfm9 V2TNPG6DWsEI+LZ6GGmYvHgwddxBL4=; b=sWCfdwQzLShW+k42nFQZdsZ+HB3uP RPHXtvZjFMCYEf4mU6edyCILMXJkofnTFrUQOopgyyGpZAj+yGhNZ8RKyFOZK2/u Huh778JsOZrPxR0pvg7l4kt1S+SGJdJekg3WosJ8Oe6z9sEv/VuIbBcTmmRWjEic 9fo5pcmgeLedXUYppcRGtm1HwjBniUotj/mUhlxg6ADZUJqEC5t9jiT5lik4BGzq 3qsfBhMJKDhAHenJkbvHCdRXjyqggXO4StDn6zkDvcJygb+xVRO4CcCRasJexmvj 5pgXxpl7fF8a1SvcP4OGMIAZ0jpvfRRdbpSOu8NZ8fgfqzlgsJ4Ra/nBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=IMvN4Pm73Nfm9V2TNPG6DWsEI+LZ6GGmYvHgwddxBL4=; b=u+RJSjLe nuB5yIvEhq+nAIEfkC1SIVve2fNWNxdFRLgRgY2xdHp3xr3W4fn9AWaW+ub4XAZW PUh+2lIjg0jX6KzJG9L1Hwi1fvCzgb2LNpn0J6uo2hrPttLQQ/y0qFzA1b7rK1bm Mavo3QqvILj66sU/uXD8h26R+qTGrEPVjlv8NAKpc3TwVe9oBcYutIBokuc9WdSy hXCZInkumD416t24KTxlqJGcwi7/rDAG5GGrH+CGBdt8xNFsc+4kOxA/5TDZZaJm QOXZ81QIKB+jAxCHNYVhdH5X4a9aisWIVZTLd63m7Bvu4TvnjpEm8ktBpNonVK7j evY0XQnB3IAAOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3C65B2402E7; Sun, 21 Mar 2021 18:32:02 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko , Ray Kinsella , Neil Horman Date: Sun, 21 Mar 2021 23:31:11 +0100 Message-Id: <20210321223116.1340974-8-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 07/11] eal: add log level help 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 Sender: "dev" The option --log-level was not completely described in the usage text, and it was difficult to guess the names of the log types and levels. A new value "help" is accepted after --log-level to give more details about the syntax and listing the log types and levels. The array "levels" used for level name parsing is replaced with a (modified) existing function which was used in rte_log_dump(). The new function rte_log_list_types() is exported in the API for allowing an application to give this info to the user if not exposing the EAL option --log-level. The list of log types cannot include all drivers if not linked in the application (shared object plugin case). Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_log.c | 24 +++++++++--- lib/librte_eal/common/eal_common_options.c | 44 +++++++++++++++------- lib/librte_eal/common/eal_log.h | 5 +++ lib/librte_eal/include/rte_log.h | 11 ++++++ lib/librte_eal/version.map | 1 + 5 files changed, 67 insertions(+), 18 deletions(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 40cac36f89..d695b04068 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -397,12 +397,12 @@ RTE_INIT_PRIO(log_init, LOG) rte_logs.dynamic_types_len = RTE_LOGTYPE_FIRST_EXT_ID; } -static const char * -loglevel_to_string(uint32_t level) +const char * +eal_log_level2str(uint32_t level) { switch (level) { case 0: return "disabled"; - case RTE_LOG_EMERG: return "emerg"; + case RTE_LOG_EMERG: return "emergency"; case RTE_LOG_ALERT: return "alert"; case RTE_LOG_CRIT: return "critical"; case RTE_LOG_ERR: return "error"; @@ -414,6 +414,20 @@ loglevel_to_string(uint32_t level) } } +/* Dump name of each logtype, one per line. */ +void +rte_log_list_types(FILE *out, const char *prefix) +{ + size_t type; + + for (type = 0; type < rte_logs.dynamic_types_len; ++type) { + if (rte_logs.dynamic_types[type].name == NULL) + continue; + fprintf(out, "%s%s\n", + prefix, rte_logs.dynamic_types[type].name); + } +} + /* dump global level and registered log types */ void rte_log_dump(FILE *f) @@ -421,14 +435,14 @@ rte_log_dump(FILE *f) size_t i; fprintf(f, "global log level is %s\n", - loglevel_to_string(rte_log_get_global_level())); + eal_log_level2str(rte_log_get_global_level())); for (i = 0; i < rte_logs.dynamic_types_len; i++) { if (rte_logs.dynamic_types[i].name == NULL) continue; fprintf(f, "id %zu: %s, level is %s\n", i, rte_logs.dynamic_types[i].name, - loglevel_to_string(rte_logs.dynamic_types[i].loglevel)); + eal_log_level2str(rte_logs.dynamic_types[i].loglevel)); } } diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 2df3ae04ea..1da6583d71 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1227,19 +1227,31 @@ eal_parse_syslog(const char *facility, struct internal_config *conf) } #endif +static void +eal_log_usage(void) +{ + unsigned int level; + + printf("Log type is a pattern matching items of this list" + " (plugins may be missing):\n"); + rte_log_list_types(stdout, "\t"); + printf("\n"); + printf("Syntax using globbing pattern: "); + printf("--"OPT_LOG_LEVEL" pattern:level\n"); + printf("Syntax using regular expression: "); + printf("--"OPT_LOG_LEVEL" regexp,level\n"); + printf("Syntax for the global level: "); + printf("--"OPT_LOG_LEVEL" level\n"); + printf("Logs are emitted if allowed by both global and specific levels.\n"); + printf("\n"); + printf("Log level can be a number or the first letters of its name:\n"); + for (level = 1; level <= RTE_LOG_MAX; level++) + printf("\t%d %s\n", level, eal_log_level2str(level)); +} + static int eal_parse_log_priority(const char *level) { - static const char * const levels[] = { - [RTE_LOG_EMERG] = "emergency", - [RTE_LOG_ALERT] = "alert", - [RTE_LOG_CRIT] = "critical", - [RTE_LOG_ERR] = "error", - [RTE_LOG_WARNING] = "warning", - [RTE_LOG_NOTICE] = "notice", - [RTE_LOG_INFO] = "info", - [RTE_LOG_DEBUG] = "debug", - }; size_t len = strlen(level); unsigned long tmp; char *end; @@ -1250,7 +1262,7 @@ eal_parse_log_priority(const char *level) /* look for named values, skip 0 which is not a valid level */ for (i = 1; i <= RTE_LOG_MAX; i++) { - if (strncmp(levels[i], level, len) == 0) + if (strncmp(eal_log_level2str(i), level, len) == 0) return i; } @@ -1274,6 +1286,11 @@ eal_parse_log_level(const char *arg) char *str, *level; int priority; + if (strcmp(arg, "help") == 0) { + eal_log_usage(); + exit(EXIT_SUCCESS); + } + str = strdup(arg); if (str == NULL) return -1; @@ -2067,9 +2084,10 @@ eal_common_usage(void) #ifndef RTE_EXEC_ENV_WINDOWS " --"OPT_SYSLOG" Set syslog facility\n" #endif - " --"OPT_LOG_LEVEL"= Set global log level\n" - " --"OPT_LOG_LEVEL"=:\n" + " --"OPT_LOG_LEVEL"= Set global log level\n" + " --"OPT_LOG_LEVEL"=:\n" " Set specific log level\n" + " --"OPT_LOG_LEVEL"=help Show log types and levels\n" #ifndef RTE_EXEC_ENV_WINDOWS " --"OPT_TRACE"=\n" " Enable trace based on regular expression trace name.\n" diff --git a/lib/librte_eal/common/eal_log.h b/lib/librte_eal/common/eal_log.h index 684650a17b..c784fa6043 100644 --- a/lib/librte_eal/common/eal_log.h +++ b/lib/librte_eal/common/eal_log.h @@ -24,4 +24,9 @@ void eal_log_set_default(FILE *default_log); int eal_log_save_regexp(const char *regexp, uint32_t level); int eal_log_save_pattern(const char *pattern, uint32_t level); +/* + * Convert log level to string. + */ +const char *eal_log_level2str(uint32_t level); + #endif /* EAL_LOG_H */ diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index 394e8682b9..e6192892c3 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -240,6 +240,17 @@ int rte_log_register(const char *name); __rte_experimental int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def); +/** + * Dump name of each logtype, one per line. + * + * @param out + * Stream where the list is sent. + * @param prefix + * String preceding each logtype in the output. + */ +__rte_experimental +void rte_log_list_types(FILE *out, const char *prefix); + /** * Dump log information. * diff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map index 48a2b55d57..c0686ebaf2 100644 --- a/lib/librte_eal/version.map +++ b/lib/librte_eal/version.map @@ -415,6 +415,7 @@ EXPERIMENTAL { rte_thread_tls_value_set; # added in 21.05 + rte_log_list_types; rte_version_minor; rte_version_month; rte_version_prefix; From patchwork Sun Mar 21 22:31:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89614 X-Patchwork-Delegate: david.marchand@redhat.com 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 9958DA034F; Sun, 21 Mar 2021 23:32:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3A89140E6B; Sun, 21 Mar 2021 23:32:14 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 4E2BE140E09 for ; Sun, 21 Mar 2021 23:32:05 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E7DE65C00C2; Sun, 21 Mar 2021 18:32:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=1XNn53/xNaZtB 0owFgCq6fnIUdxvNg2I/Wi8MAQgu7o=; b=gk6GtwqlAvwOyLLObxoPhtHjjdzJD 84X+Xr0o31ttzSjLJnren86JQ2TyF3STXFrv1v5oE2Ym6qh8OSYo/p9yQEZIg3Jk USpYqGAq8Q3enRPuruYKgxkZFqvscCq6ODOVB44DMfOZY9vbQY9T3FnQobAtXkga /7WMagmlNPXvn7Z1tyc4UvijZPb+vZfHW/COgFZVZN0TLKQe9wHl2Mm2TcEjhbq2 mVnc7wV3IfdeYS4dRQjWnQK83C1AUCNFryx/Zf70km8zm0R0tLDtgi8jldbFp7wI vfNbH4Qv6jkendps09JlEcWh7ttA+yYxeIcpzCHTy6CYa1Ql+dzF1H3XQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=1XNn53/xNaZtB0owFgCq6fnIUdxvNg2I/Wi8MAQgu7o=; b=mTsxbz4J Tq9sjItLGIrNQa07c3GB3preDtLS4dxLUfoCSrUjrIBlEvrIgU4wSHcvikk2LZzN ThMFV53Hh6lHVqLd/4lEm+REqFUvR4cgLS4oqL6vpQp3EZ4XMAjKQiQ+uvdysKU1 YSH2YrqPNVuQi1PAYF37LQmncIgb2CdYXgWSWF6kw5RbR6GplXQb4xYjPjTXdq7/ wbUBk6P5XHK55MJIuPz1qDHRMoQdD0codaoXczH35Jau3zWB00tdtbQVPOi/QqBC 91kAGqvwXE1/gI+3v5xJ3RN/ChODAVPNaM3md5fhcf6uTfkXhnvDNOwR8rw867mq gL/IJHWUFA31Bg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepkeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id B5FAE240356; Sun, 21 Mar 2021 18:32:03 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Wisam Jaddo , Ori Kam , Bruce Richardson , Andrew Rybchenko , Declan Doherty , Ciara Power , Xiaoyun Li Date: Sun, 21 Mar 2021 23:31:12 +0100 Message-Id: <20210321223116.1340974-9-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 08/11] app: fix exit messages 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 Sender: "dev" Some applications were printing useless messages with rte_exit() after showing the help. Using exit() is enough in this case. Some applications were using a redundant printf or fprintf() before calling rte_exit(). The messages are unified in a single rte_exit(). Some rte_exit() calls were missing a line feed or returning a wrong code. Signed-off-by: Thomas Monjalon Acked-by: Wisam Jaddo Acked-by: Ori Kam Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- .../comp_perf_options_parse.c | 2 +- app/test-crypto-perf/cperf_options_parsing.c | 2 +- app/test-flow-perf/main.c | 59 +++++++++---------- app/test-pmd/parameters.c | 4 +- app/test-regex/main.c | 3 +- 5 files changed, 33 insertions(+), 37 deletions(-) diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 04a8d2fbee..019eddb7bd 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -620,7 +620,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 0466f7baf8..40b6dfb648 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -983,7 +983,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 99d0463456..0aef767350 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -639,7 +639,7 @@ args_parse(int argc, char **argv) case 0: if (strcmp(lgopts[opt_idx].name, "help") == 0) { usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); } if (strcmp(lgopts[opt_idx].name, "group") == 0) { @@ -647,7 +647,7 @@ args_parse(int argc, char **argv) if (n >= 0) flow_group = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "flow group should be >= 0\n"); printf("group %d / ", flow_group); } @@ -667,7 +667,7 @@ args_parse(int argc, char **argv) if (n > 0) hairpin_queues_num = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "Hairpin queues should be > 0\n"); flow_actions[actions_idx++] = @@ -680,7 +680,7 @@ args_parse(int argc, char **argv) if (n > 0) hairpin_queues_num = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "Hairpin queues should be > 0\n"); flow_actions[actions_idx++] = @@ -704,11 +704,9 @@ args_parse(int argc, char **argv) break; } /* Reached last item with no match */ - if (i == (RTE_DIM(flow_options) - 1)) { - fprintf(stderr, "Invalid encap item: %s\n", token); - usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid encap item\n"); - } + if (i == (RTE_DIM(flow_options) - 1)) + rte_exit(EXIT_FAILURE, + "Invalid encap item: %s\n", token); } token = strtok(NULL, ","); } @@ -730,11 +728,9 @@ args_parse(int argc, char **argv) break; } /* Reached last item with no match */ - if (i == (RTE_DIM(flow_options) - 1)) { - fprintf(stderr, "Invalid decap item: %s\n", token); - usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid decap item\n"); - } + if (i == (RTE_DIM(flow_options) - 1)) + rte_exit(EXIT_FAILURE, + "Invalid decap item %s\n", token); } token = strtok(NULL, ","); } @@ -747,9 +743,9 @@ args_parse(int argc, char **argv) if (n >= DEFAULT_RULES_BATCH) rules_batch = n; else { - printf("\n\nrules_batch should be >= %d\n", + rte_exit(EXIT_FAILURE, + "rules_batch should be >= %d\n", DEFAULT_RULES_BATCH); - rte_exit(EXIT_SUCCESS, " "); } } if (strcmp(lgopts[opt_idx].name, @@ -758,7 +754,8 @@ args_parse(int argc, char **argv) if (n >= (int) rules_batch) rules_count = n; else { - printf("\n\nrules_count should be >= %d\n", + rte_exit(EXIT_FAILURE, + "rules_count should be >= %d\n", rules_batch); } } @@ -786,23 +783,23 @@ args_parse(int argc, char **argv) if (strcmp(lgopts[opt_idx].name, "cores") == 0) { n = atoi(optarg); if ((int) rte_lcore_count() <= n) { - printf("\nError: you need %d cores to run on multi-cores\n" + rte_exit(EXIT_FAILURE, + "Error: you need %d cores to run on multi-cores\n" "Existing cores are: %d\n", n, rte_lcore_count()); - rte_exit(EXIT_FAILURE, " "); } if (n <= RTE_MAX_LCORE && n > 0) mc_pool.cores_count = n; else { - printf("Error: cores count must be > 0 " - " and < %d\n", RTE_MAX_LCORE); - rte_exit(EXIT_FAILURE, " "); + rte_exit(EXIT_FAILURE, + "Error: cores count must be > 0 and < %d\n", + RTE_MAX_LCORE); } } break; default: - fprintf(stderr, "Invalid option: %s\n", argv[optind]); usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid option\n"); + rte_exit(EXIT_FAILURE, "Invalid option: %s\n", + argv[optind]); break; } } @@ -936,7 +933,7 @@ create_meter_rule(int port_id, uint32_t counter) printf("Port %u create meter idx(%d) error(%d) message: %s\n", port_id, counter, error.type, error.message ? error.message : "(no stated reason)"); - rte_exit(EXIT_FAILURE, "error in creating meter"); + rte_exit(EXIT_FAILURE, "Error in creating meter\n"); } } @@ -949,7 +946,7 @@ destroy_meter_rule(int port_id, uint32_t counter) printf("Port %u destroy meter(%d) error(%d) message: %s\n", port_id, counter, error.type, error.message ? error.message : "(no stated reason)"); - rte_exit(EXIT_FAILURE, "Error in deleting meter rule"); + rte_exit(EXIT_FAILURE, "Error in deleting meter rule\n"); } } @@ -1097,7 +1094,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) memset(&error, 0x33, sizeof(error)); if (rte_flow_destroy(port_id, flows_list[i], &error)) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "Error in deleting flow"); + rte_exit(EXIT_FAILURE, "Error in deleting flow\n"); } /* @@ -1160,7 +1157,7 @@ insert_flows(int port_id, uint8_t core_id) flows_list = rte_zmalloc("flows_list", (sizeof(struct rte_flow *) * rules_count_per_core) + 1, 0); if (flows_list == NULL) - rte_exit(EXIT_FAILURE, "No Memory available!"); + rte_exit(EXIT_FAILURE, "No Memory available!\n"); cpu_time_used = 0; flow_index = 0; @@ -1180,7 +1177,7 @@ insert_flows(int port_id, uint8_t core_id) if (flow == NULL) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "error in creating flow"); + rte_exit(EXIT_FAILURE, "Error in creating flow\n"); } flows_list[flow_index++] = flow; } @@ -1199,7 +1196,7 @@ insert_flows(int port_id, uint8_t core_id) if (!flow) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "error in creating flow"); + rte_exit(EXIT_FAILURE, "Error in creating flow\n"); } flows_list[flow_index++] = flow; @@ -1517,7 +1514,7 @@ packet_per_second_stats(void) old = rte_zmalloc("old", sizeof(struct lcore_info) * RTE_MAX_LCORE, 0); if (old == NULL) - rte_exit(EXIT_FAILURE, "No Memory available!"); + rte_exit(EXIT_FAILURE, "No Memory available!\n"); memcpy(old, lcore_infos, sizeof(struct lcore_info) * RTE_MAX_LCORE); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index a326c8ce4f..b7d4ef76b0 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -671,7 +671,7 @@ launch_args_parse(int argc, char** argv) case 0: /*long options */ if (!strcmp(lgopts[opt_idx].name, "help")) { usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); } #ifdef RTE_LIB_CMDLINE if (!strcmp(lgopts[opt_idx].name, "interactive")) { @@ -1413,7 +1413,7 @@ launch_args_parse(int argc, char** argv) break; case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; default: usage(argv[0]); diff --git a/app/test-regex/main.c b/app/test-regex/main.c index aea4fa6b88..7bb87bb1b8 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -154,9 +154,8 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, usage("RegEx test app"); break; default: - fprintf(stderr, "Invalid option: %s\n", argv[optind]); usage("RegEx test app"); - rte_exit(EXIT_FAILURE, "Invalid option\n"); + rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]); break; } } From patchwork Sun Mar 21 22:31:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89615 X-Patchwork-Delegate: david.marchand@redhat.com 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 490E8A034F; Sun, 21 Mar 2021 23:33:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 391C6140E92; Sun, 21 Mar 2021 23:32:16 +0100 (CET) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by mails.dpdk.org (Postfix) with ESMTP id AA5D4140DE6 for ; Sun, 21 Mar 2021 23:32:07 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 117AB58044F; Sun, 21 Mar 2021 18:32:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=whJfLY1QRx90K jr30aIm2kNiA9xxAlplMkzqxLHsWnQ=; b=YgRey1jgX5dI4sAPWGpS4KIVr73zA kjzXvlWLOks+IqeM/nY4nBLLEroH41770AK9lg39lnVfaaRG5iYEfwfNHlNTlHLH hDMI0q76yOzz6jDQyByI6la9fLh/NSNBQfMlQhsaO4XChHK9WCoypDoVneWFnCle I3pBPKKE982zsqyrKAY3m075UhFp4X1Hx02UFUW/mLd4tHW7Mh5oIgpcACl7z61e yV6C+W6wzKCA+H7FzO4ramk2HKY+BS+b6cJC0HmqsPkZjJvY+2JFSqCIt58YyqEI 3DQNqobQQWVapIu9yonLFkVnWSKdiyJBzwxl9f2cjSwXoHWmnJuRNCCFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=whJfLY1QRx90Kjr30aIm2kNiA9xxAlplMkzqxLHsWnQ=; b=q307BjFX 2UPRWRxP9FONRiFZSaiTmCKWESdenVN1c9oCNgnfhETo8dmw3sjUFBYfsyhiqrss g8ii4OY470YP21QJ5j7WhyVttVkKbbSiMJSlzKGE/EXGVsPZgdka3sEBDxJxEeHp 2WwVfmbvzFUAwPwPdEwz7qhZkm1vDqVSF4AjhLmRKTbt59+PRYvllhOm1ZJdVzv5 uTe0ixEqj3sveTyE6WPmceg4J1H2IeWOo+Fjr3qWy4l1KHWYFYiB16Og9XnrsONj tpHVDqZwYDXYINByL9wenwkzFQ+6crWLSUcLuZmNKMW6mQUuoBTSWbosOr0k2m2J am6SM94W+poevw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepkeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6F8672402E7; Sun, 21 Mar 2021 18:32:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Wisam Jaddo , Bruce Richardson , Andrew Rybchenko , Reshma Pattan , Maryam Tahhan , Konstantin Ananyev , Nicolas Chautru , Declan Doherty , Ciara Power , Vladimir Medvedkin , Xiaoyun Li , Ori Kam , Bernard Iremonger Date: Sun, 21 Mar 2021 23:31:13 +0100 Message-Id: <20210321223116.1340974-10-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 09/11] app: hook in EAL usage help 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 Sender: "dev" Use rte_set_application_usage_hook() in the test applications, so the full help including EAL options can be printed in one go with the EAL option -h or --help. Signed-off-by: Thomas Monjalon Acked-by: Wisam Jaddo Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- app/pdump/main.c | 2 ++ app/proc-info/main.c | 2 ++ app/test-acl/main.c | 2 ++ app/test-bbdev/main.c | 3 ++- app/test-compress-perf/comp_perf_options.h | 2 ++ app/test-compress-perf/comp_perf_options_parse.c | 8 ++++---- app/test-compress-perf/main.c | 3 ++- app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 8 ++++---- app/test-crypto-perf/main.c | 3 ++- app/test-fib/main.c | 8 ++++++++ app/test-flow-perf/main.c | 4 +++- app/test-pmd/parameters.c | 4 ++-- app/test-pmd/testpmd.c | 2 ++ app/test-pmd/testpmd.h | 1 + app/test-regex/main.c | 3 ++- app/test-sad/main.c | 7 +++++++ 17 files changed, 49 insertions(+), 15 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 63bbe65cd8..8641017f48 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -974,6 +974,8 @@ main(int argc, char **argv) char mp_flag[] = "--proc-type=secondary"; char *argp[argc + 2]; + rte_set_application_usage_hook(pdump_usage); + /* catch ctrl-c so we can print on exit */ signal(SIGINT, signal_handler); diff --git a/app/proc-info/main.c b/app/proc-info/main.c index b9587f7ded..e7d86bfa9d 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1361,6 +1361,8 @@ main(int argc, char **argv) char *argp[argc + 4]; uint16_t nb_ports; + rte_set_application_usage_hook(proc_info_usage); + /* preparse app arguments */ ret = proc_info_preparse_args(argc, argv); if (ret < 0) { diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 2cb2fe2579..9f95cb0fbf 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -1080,6 +1080,8 @@ main(int argc, char **argv) int ret; uint32_t lcore; + rte_set_application_usage_hook(print_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/test-bbdev/main.c b/app/test-bbdev/main.c index ff65173fdb..5960ec18b2 100644 --- a/app/test-bbdev/main.c +++ b/app/test-bbdev/main.c @@ -340,7 +340,8 @@ main(int argc, char **argv) { int ret; - /* Init EAL */ + rte_set_application_usage_hook(print_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) return 1; diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h index 0b777521c5..7dd785fba1 100644 --- a/app/test-compress-perf/comp_perf_options.h +++ b/app/test-compress-perf/comp_perf_options.h @@ -73,6 +73,8 @@ struct comp_test_data { uint32_t cyclecount_delay; }; +void comp_perf_usage(const char *progname); + int comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv); diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 019eddb7bd..39d7fd8c69 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -38,8 +38,8 @@ struct name_id_map { uint32_t id; }; -static void -usage(char *progname) +void +comp_perf_usage(const char *progname) { printf("%s [EAL options] --\n" " --ptest throughput / verify / pmd-cyclecount\n" @@ -619,7 +619,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) { switch (opt) { case 'h': - usage(argv[0]); + comp_perf_usage(argv[0]); exit(EXIT_SUCCESS); break; /* long options */ @@ -631,7 +631,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) break; default: - usage(argv[0]); + comp_perf_usage(argv[0]); return -EINVAL; } } diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index cc9951a9b1..dcd347528e 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -323,7 +323,8 @@ main(int argc, char **argv) uint8_t cdev_id; uint32_t lcore_id; - /* Initialise DPDK EAL */ + rte_set_application_usage_hook(comp_perf_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments!\n"); diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h index 9664a4b343..5f4a780614 100644 --- a/app/test-crypto-perf/cperf_options.h +++ b/app/test-crypto-perf/cperf_options.h @@ -153,6 +153,8 @@ struct cperf_options { uint8_t imix_distribution_count; }; +void cperf_usage(const char *progname); + void cperf_options_default(struct cperf_options *options); diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 40b6dfb648..3777bc7509 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -19,8 +19,8 @@ struct name_id_map { uint32_t id; }; -static void -usage(char *progname) +void +cperf_usage(const char *progname) { printf("%s [EAL options] --\n" " --silent: disable options dump\n" @@ -982,7 +982,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) { switch (opt) { case 'h': - usage(argv[0]); + cperf_usage(argv[0]); exit(EXIT_SUCCESS); break; /* long options */ @@ -994,7 +994,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) break; default: - usage(argv[0]); + cperf_usage(argv[0]); return -EINVAL; } } diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 49af812d8b..497c4c5226 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -519,7 +519,8 @@ main(int argc, char **argv) int ret; uint32_t lcore_id; - /* Initialise DPDK EAL */ + rte_set_application_usage_hook(cperf_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments!\n"); diff --git a/app/test-fib/main.c b/app/test-fib/main.c index b0a97b0d7e..420fe17c39 100644 --- a/app/test-fib/main.c +++ b/app/test-fib/main.c @@ -648,6 +648,12 @@ print_usage(void) config.prgname); } +static void +usage_hook(const char *prgname __rte_unused) +{ + print_usage(); +} + static int check_config(void) { @@ -1209,6 +1215,8 @@ main(int argc, char **argv) FILE *fl = NULL; uint8_t depth_lim; + rte_set_application_usage_hook(usage_hook); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 0aef767350..949a5e3e11 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -115,7 +115,7 @@ static struct multi_cores_pool mc_pool = { }; static void -usage(char *progname) +usage(const char *progname) { printf("\nusage: %s\n", progname); printf("\nControl configurations:\n"); @@ -1849,6 +1849,8 @@ main(int argc, char **argv) uint16_t port; struct rte_flow_error error; + rte_set_application_usage_hook(usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "EAL init failed\n"); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index b7d4ef76b0..156eff7697 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -46,8 +46,8 @@ #include "testpmd.h" -static void -usage(char* progname) +void +usage(const char *progname) { printf("usage: %s [EAL options] -- " #ifdef RTE_LIB_CMDLINE diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 98c3248c01..24c241b0f6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3779,6 +3779,8 @@ main(int argc, char** argv) rte_exit(EXIT_FAILURE, "Cannot register log type"); rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG); + rte_set_application_usage_hook(usage); + diag = rte_eal_init(argc, argv); if (diag < 0) rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n", diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index af40859170..2ab2c1b3d0 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -764,6 +764,7 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx) unsigned int parse_item_list(char* str, const char* item_name, unsigned int max_items, unsigned int *parsed_items, int check_unique_values); +void usage(const char *progname); void launch_args_parse(int argc, char** argv); void cmdline_read_from_file(const char *filename); void prompt(void); diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 7bb87bb1b8..ba09b20126 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -616,7 +616,8 @@ main(int argc, char **argv) uint32_t i; struct qps_per_lcore *qps_per_lcore; - /* Init EAL. */ + rte_set_application_usage_hook(usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "EAL init failed\n"); diff --git a/app/test-sad/main.c b/app/test-sad/main.c index 1024757add..14a8263f8c 100644 --- a/app/test-sad/main.c +++ b/app/test-sad/main.c @@ -149,7 +149,12 @@ print_usage(void) "[-p ]\n" "[-c ]\n", config.prgname); +} +static void +usage_hook(const char *prgname __rte_unused) +{ + print_usage(); } static int @@ -620,6 +625,8 @@ main(int argc, char **argv) struct rte_ipsec_sad_conf conf = {0}; unsigned int lcore_id; + rte_set_application_usage_hook(usage_hook); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); From patchwork Sun Mar 21 22:31:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89616 X-Patchwork-Delegate: david.marchand@redhat.com 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 BA5FFA034F; Sun, 21 Mar 2021 23:33:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9196E140EAC; Sun, 21 Mar 2021 23:32:17 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 3F315140E4A; Sun, 21 Mar 2021 23:32:09 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id DCA0B5C00C2; Sun, 21 Mar 2021 18:32:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=egk9sVCrDvB5H Q1ri4sggS836PDkGZnVuNEZ/6liEgE=; b=AjpjDEFdn6eOVBm6H+eVXUahs4TXE SJRN6tpuF4i+EEjyHswy1qmF3Q3F01Ln1TtmeOI4ZENWbjTXYzw6LN6GwD4G5kLu eqDlrZweLFfoHFyhlI803UFXHXRM18+YKjHGe3jkeHehUqz3129Tv7DPObfEUgyQ tFKOXKcoc1fZkBrV7NJkDueG0z0g825o/DTVugAm0fX4CpeJ45CXJijrADs2L0/G nrTtSo3bcg7LFlm0LkGOLr/6DvFJmLQCL0f1uL5t/dvweyIlcNS1SI7QqQodvf90 tcUl/PY9J59DTjg4gp7frI3K1N7GUTwNl0LZ291ttdKJ9zfFsfThTDb5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=egk9sVCrDvB5HQ1ri4sggS836PDkGZnVuNEZ/6liEgE=; b=XVmoQ83y 9rKKKN49urQYuTAjild9HBszpmzFgvjcmqyuo3I2U+3IsTGFjWNT01GuFxpFR5UG uhF2+5GOiL45Sj6CvVqZ4Vigl734TBAWBWgM2ojKEqN2ku8KCvkEi3J1QRPS6pva fF32cN61rqGBoWNCV4wVv1pxDMV+BrpYRMBnIzpYpX/aC6sdkbLd/JVUvRnDbJLz qtM/Q/YjIfgJKsoyPmC9VqmeSX9HlxA7nTGjIkVY/BUQ8uLcO+xHGG6PRPInmYMb EBvR29uns2BKEXtWJI29kT54IbmQcM+d90XQfMzgZKAnF3W5qfAqCgGQUaACamza tiU6ii6k89DKaA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepkeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id DEC2224035D; Sun, 21 Mar 2021 18:32:07 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, stable@dpdk.org, Ori Kam , Bruce Richardson , Andrew Rybchenko , Yuval Avnery Date: Sun, 21 Mar 2021 23:31:14 +0100 Message-Id: <20210321223116.1340974-11-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 10/11] app/regex: fix usage text 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 Sender: "dev" The usage syntax help includes the program name which was fake. It is replaced with the real name from argv. Fixes: de06137cb295 ("app/regex: add RegEx test application") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Ori Kam Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- app/test-regex/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index ba09b20126..73ba227fba 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -151,10 +151,10 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, *nb_lcores = atoi(optarg); break; case ARG_HELP: - usage("RegEx test app"); + usage(argv[0]); break; default: - usage("RegEx test app"); + usage(argv[0]); rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]); break; } From patchwork Sun Mar 21 22:31:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 89617 X-Patchwork-Delegate: david.marchand@redhat.com 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 69263A034F; Sun, 21 Mar 2021 23:33:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0485A140ECE; Sun, 21 Mar 2021 23:32:19 +0100 (CET) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by mails.dpdk.org (Postfix) with ESMTP id 233374003D; Sun, 21 Mar 2021 23:32:12 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 9571F58044F; Sun, 21 Mar 2021 18:32:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 21 Mar 2021 18:32:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=+qXLoWpzqWJGd SLx31IBUj9sb+PjvH8OY6jh37VM+wg=; b=V1bD8SejHSWDZDtfN5b6AMkObIyh/ 6832h+fdsc5JSUfdbkZ4Lh+PkTO2bKdfIKN/icxNTZ9UsMp5T109Oiha3io2tSrr BPIN7qzDrLCdHmi6v25d13G/Oei2Oz1WHU6/OheHqJZTp+hWHJ1O7SI77QqIEWCo 5jDlN589c4uLdWqW7j3hi0Jw6Ub19ptt5tKn6r0esmpANCXRDEEiICKNRD6XaNZH FtowQPf6s0u+HzhwrlIUCgiETwwnxPAkvEYCSqxJT2n6WmQP8RnnGO4ql3BGMPj/ VZTKGDEvu65Y1PEY7CG9XMcRzAxlR7hBOA6I/9LIymQQiQEAxGR0xHgrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=+qXLoWpzqWJGdSLx31IBUj9sb+PjvH8OY6jh37VM+wg=; b=PtblbLi8 yt3xqYNN0GDUH8MmjjtQzIeEEzE+2ENjJODNW4o8BTfsk3CBPiGtHQtkKIq8w8j0 YejCyl8ITxQNNTERGLUOjqT5xSGN+tVUAUVB2jeN63fwAsVl1qVwVDa9RAQUdHlK Ryz6Jcyezg/5ibX9AZQb/SIy0LVgqHUd8rmw3zNFjMrcSFF/+ab9Be1vrNvriFCS bKsHQdf1Nk8+vi1Mp2KJ0prIu1lUCw0EmMF768kBNqaOjPmtxW02Iu3cAZBOqKPY HA/O9oakSceAU2cIOYvMQH/dPjt8WRNZrGDm0eDzFdfxig+dIx1gbbAY511dRxI6 erypK8RMbsk+Sw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgepuddunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhj rghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 94E5A240356; Sun, 21 Mar 2021 18:32:09 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, stable@dpdk.org, Ajit Khaparde , Bruce Richardson , Andrew Rybchenko , Xiaoyun Li , Ori Kam , Bing Zhao , Bernard Iremonger , Jens Freimann , Kevin Traynor , Stephen Hemminger , Maciej Czekaj , Pablo de Lara Date: Sun, 21 Mar 2021 23:31:15 +0100 Message-Id: <20210321223116.1340974-12-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210321223116.1340974-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210321223116.1340974-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 11/11] app/testpmd: fix usage text 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 Sender: "dev" The options help text was including an incomplete and redundant summary of the options before explaining each. The summary is dropped. The details of the option --hairpin-mode had an extra space, breaking the alignment with the next line. There were some mismatches between options in the usage text sed -rn 's/.*\(" *--([a-z-]*)[=: ].*/\1/p' app/test-pmd/parameters.c and the options declared in lgopts array sed -rn 's/.*\{.*"(.*)",.*,.*,.*},.*/\1/p' app/test-pmd/parameters.c The misses were: --no-numa --enable-scatter --tx-ip --tx-udp --noisy-lkup-num-reads-writes The option --ports was not implemented. Fixes: 01817b10d27c ("app/testpmd: change hairpin queues setup") Fixes: 3c156061b938 ("app/testpmd: add noisy neighbour forwarding mode") Fixes: bf5b2126bf44 ("app/testpmd: add ability to set Tx IP and UDP parameters") Fixes: 0499793854f5 ("app/testpmd: add scatter enabling option") Fixes: 999b2ee0fe45 ("app/testpmd: enable NUMA support by default") Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Ajit Khaparde Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko Acked-by: Xiaoyun Li Reviewed-by: Jens Freimann Reviewed-by: Bing Zhao --- app/test-pmd/parameters.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 156eff7697..4a1d64af89 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -49,29 +49,7 @@ void usage(const char *progname) { - printf("usage: %s [EAL options] -- " -#ifdef RTE_LIB_CMDLINE - "[--interactive|-i] " - "[--cmdline-file=FILENAME] " -#endif - "[--help|-h] | [--auto-start|-a] | [" - "--tx-first | --stats-period=PERIOD | " - "--coremask=COREMASK --portmask=PORTMASK --numa " - "--portlist=PORTLIST " - "--mbuf-size= | --total-num-mbufs= | " - "--nb-cores= | --nb-ports= | " -#ifdef RTE_LIB_CMDLINE - "--eth-peers-configfile= | " - "--eth-peer=X,M:M:M:M:M:M | " - "--tx-ip=SRC,DST | --tx-udp=PORT | " -#endif - "--pkt-filter-mode= |" - "--rss-ip | --rss-udp | --rss-level-inner | --rss-level-outer |" - "--rxpt= | --rxht= | --rxwt= |" - " --rxfreet= | --txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --tx-offloads= | | --rx-offloads= | " - "--vxlan-gpe-port= | --geneve-parsed-port= | " - "--record-core-cycles | --record-burst-stats]\n", + printf("\nUsage: %s [EAL options] -- [testpmd options]\n\n", progname); #ifdef RTE_LIB_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -97,6 +75,7 @@ usage(const char *progname) printf(" --portlist=PORTLIST: list of forwarding ports\n"); printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of " "RX memory buffers (mbufs).\n"); + printf(" --no-numa: disable NUMA-aware allocation.\n"); printf(" --port-numa-config=(port,socket)[,(port,socket)]: " "specify the socket on which the memory pool " "used by the port will be allocated.\n"); @@ -136,6 +115,7 @@ usage(const char *progname) "monitoring on forwarding lcore id N.\n"); #endif printf(" --disable-crc-strip: disable CRC stripping by hardware.\n"); + printf(" --enable-scatter: enable scattered Rx.\n"); printf(" --enable-lro: enable large receive offload.\n"); printf(" --enable-rx-cksum: enable rx hardware checksum offload.\n"); printf(" --enable-rx-timestamp: enable rx hardware timestamp offload.\n"); @@ -184,6 +164,8 @@ usage(const char *progname) printf(" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n"); printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n"); + printf(" --tx-ip=src,dst: IP addresses in Tx-only mode\n"); + printf(" --tx-udp=src[,dst]: UDP ports in Tx-only mode\n"); printf(" --eth-link-speed: force link speed.\n"); printf(" --disable-link-check: disable check on link status when " "starting/stopping ports.\n"); @@ -215,14 +197,14 @@ usage(const char *progname) printf(" --noisy-lkup-memory=N: allocate N MB of VNF memory\n"); printf(" --noisy-lkup-num-writes=N: do N random writes per packet\n"); printf(" --noisy-lkup-num-reads=N: do N random reads per packet\n"); - printf(" --noisy-lkup-num-writes=N: do N random reads and writes per packet\n"); + printf(" --noisy-lkup-num-reads-writes=N: do N random reads and writes per packet\n"); printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. " "valid only with --mp-alloc=anon\n"); printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be " "enabled\n"); printf(" --record-core-cycles: enable measurement of CPU cycles.\n"); printf(" --record-burst-stats: enable display of RX and TX bursts.\n"); - printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n " + printf(" --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n" " 0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n" " 0x01 - hairpin ports loop, 0x00 - hairpin port self\n"); } @@ -549,7 +531,6 @@ launch_args_parse(int argc, char** argv) #endif { "tx-first", 0, 0, 0 }, { "stats-period", 1, 0, 0 }, - { "ports", 1, 0, 0 }, { "nb-cores", 1, 0, 0 }, { "nb-ports", 1, 0, 0 }, { "coremask", 1, 0, 0 }, @@ -557,7 +538,7 @@ launch_args_parse(int argc, char** argv) { "portlist", 1, 0, 0 }, { "numa", 0, 0, 0 }, { "no-numa", 0, 0, 0 }, - { "mp-anon", 0, 0, 0 }, + { "mp-anon", 0, 0, 0 }, /* deprecated */ { "port-numa-config", 1, 0, 0 }, { "ring-numa-config", 1, 0, 0 }, { "socket-num", 1, 0, 0 },