From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40B6B439B6; Wed, 24 Jan 2024 14:26:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2FE0E42830; Wed, 24 Jan 2024 14:26:46 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 0D28E40294 for ; Wed, 24 Jan 2024 14:26:44 +0100 (CET) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9F53E5C0105; Wed, 24 Jan 2024 08:26:43 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 24 Jan 2024 08:26:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1706102803; x=1706189203; bh=RIuKoKFzzbTW54hLc/jnJSKTU1QL66YMZn6bIjm1noc=; b= AQk9b6qhU7+nfkiWh2mBEGN9Ae/0CcYUslBmALpoSYlAzwgkw05pd1qZjvVXZmT1 lv6j/ODn9ja6d25T8YEba4ea0Twh/ys9XW4uOKll4D33HPv5R/5ad9iVyRabHOks 90T+EhEViCTHjihnhT2l1ALGrEiI0skh15LsX1clEF7l5rgrFnHIGNpViY3HCYzY tuMRvzQBgkahEEQP1nV/FpXrAfcctA3PJIRahgNE0fN5Psj7ShmKNMbCqSqRGSP0 GgxESAXxhxEswMHeAX2/LzslRQA5f1r26RWWbhne7zmC2HmGtjlmuPgVwpTG7gac qYdQOzHlOpvlYJyuiXzzgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706102803; x= 1706189203; bh=RIuKoKFzzbTW54hLc/jnJSKTU1QL66YMZn6bIjm1noc=; b=R 6PUuZAVNitDOMX1fFWnku0HeV/haHAYVl4t7rIteNrRcXtVXNTbImNZCbJF3Uy4J x/qumRBO7WYZqdM06Puem3R7n7dUla5G6uEhf3+j5w7NbOCulcfiaS3rUBDLZDZl M/VhWYpzwa3CQooZ6+Xz4O7jPATqcYeJu/GM/y0iKXVmJJ8/J9I6PyhXSv2KyYWj sdEb6JdU4BMdK4M3OlcwsI+i0QBEJz4aeOOA19CR2+7FsQziMpf1FcRkewjGn0Gw CagWh4LppMsnWVEy2C7V+a6dSjY8GLKcldEwOW814Q6NYjqsy94aki1QC2B8zCXt WqR0/CteYkljjmUTlZxNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeluddggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Jan 2024 08:26:42 -0500 (EST) From: Thomas Monjalon To: Chengwen Feng Cc: dev@dpdk.org, ferruh.yigit@amd.com, stephen@networkplumber.org, tangkunshan@huawei.com Subject: Re: [PATCH 12/12] examples/dma: replace getopt with argparse Date: Wed, 24 Jan 2024 14:26:41 +0100 Message-ID: <4657838.CvnuH1ECHv@thomas> In-Reply-To: <20240122035802.31491-13-fengchengwen@huawei.com> References: <20231121122651.7078-1-fengchengwen@huawei.com> <20240122035802.31491-1-fengchengwen@huawei.com> <20240122035802.31491-13-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 22/01/2024 04:58, Chengwen Feng: > -#define CMD_LINE_OPT_MAC_UPDATING "mac-updating" > -#define CMD_LINE_OPT_NO_MAC_UPDATING "no-mac-updating" > -#define CMD_LINE_OPT_PORTMASK "portmask" > -#define CMD_LINE_OPT_NB_QUEUE "nb-queue" > -#define CMD_LINE_OPT_COPY_TYPE "copy-type" > -#define CMD_LINE_OPT_RING_SIZE "ring-size" > -#define CMD_LINE_OPT_BATCH_SIZE "dma-batch-size" > -#define CMD_LINE_OPT_FRAME_SIZE "max-frame-size" > -#define CMD_LINE_OPT_FORCE_COPY_SIZE "force-min-copy-size" > -#define CMD_LINE_OPT_STATS_INTERVAL "stats-interval" > +#define CMD_LINE_OPT_MAC_UPDATING "--mac-updating" > +#define CMD_LINE_OPT_NO_MAC_UPDATING "--no-mac-updating" > +#define CMD_LINE_OPT_PORTMASK "--portmask" > +#define CMD_LINE_OPT_PORTMASK_INDEX 1 > +#define CMD_LINE_OPT_NB_QUEUE "--nb-queue" > +#define CMD_LINE_OPT_COPY_TYPE "--copy-type" > +#define CMD_LINE_OPT_COPY_TYPE_INDEX 2 > +#define CMD_LINE_OPT_RING_SIZE "--ring-size" > +#define CMD_LINE_OPT_BATCH_SIZE "--dma-batch-size" > +#define CMD_LINE_OPT_FRAME_SIZE "--max-frame-size" > +#define CMD_LINE_OPT_FORCE_COPY_SIZE "--force-min-copy-size" > +#define CMD_LINE_OPT_STATS_INTERVAL "--stats-interval" I would completely drop these defines. It would be easier to read the string directly in .args below: [...] > + .args = { > + { CMD_LINE_OPT_MAC_UPDATING, NULL, "Enable MAC addresses updating", > + &mac_updating, (void *)1, > + RTE_ARGPARSE_ARG_NO_VALUE | RTE_ARGPARSE_ARG_VALUE_INT, > + }, > + { CMD_LINE_OPT_NO_MAC_UPDATING, NULL, "Disable MAC addresses updating", > + &mac_updating, (void *)0, > + RTE_ARGPARSE_ARG_NO_VALUE | RTE_ARGPARSE_ARG_VALUE_INT, > + }, > + { CMD_LINE_OPT_PORTMASK, "-p", "hexadecimal bitmask of ports to configure", > + NULL, (void *)CMD_LINE_OPT_PORTMASK_INDEX, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE, > + }, > + { CMD_LINE_OPT_NB_QUEUE, "-q", "number of RX queues per port (default is 1)", > + &nb_queues, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U16, > + }, > + { CMD_LINE_OPT_COPY_TYPE, "-c", "type of copy: sw|hw", > + NULL, (void *)CMD_LINE_OPT_COPY_TYPE_INDEX, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE, > + }, > + { CMD_LINE_OPT_RING_SIZE, "-s", "size of dmadev descriptor ring for hardware copy mode or rte_ring for software copy mode", > + &ring_size, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U16, > + }, > + { CMD_LINE_OPT_BATCH_SIZE, "-b", "number of requests per DMA batch", > + &dma_batch_sz, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U32, > + }, > + { CMD_LINE_OPT_FRAME_SIZE, "-f", "max frame size", > + &max_frame_size, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U32, > + }, > + { CMD_LINE_OPT_FORCE_COPY_SIZE, "-m", "force a minimum copy length, even for smaller packets", > + &force_min_copy_size, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U32, > + }, > + { CMD_LINE_OPT_STATS_INTERVAL, "-i", "interval, in seconds, between stats prints (default is 1)", > + &stats_interval, NULL, > + RTE_ARGPARSE_ARG_REQUIRED_VALUE | RTE_ARGPARSE_ARG_VALUE_U16, > + }, > + ARGPARSE_ARG_END(),