From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id 0DE4037A8 for ; Tue, 2 Apr 2019 09:05:17 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id g127so7136772vsd.6 for ; Tue, 02 Apr 2019 00:05:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=353HtjGE7sUDgaRd5Dn1MVbdJS6lXb5yGhee6EyJKvo=; b=ow4p4P9cwHvi0bdvDKPtBDylF3NeX0vqXH70FPSSc1w5u/XB1X7MopfRofaQi/fYvt CQxaQDiTtEMMg4XR6duyVsU8aWS/pzW4pcoH6Ai6WaZUa+ylDNidy6UXJgjJehVm7sf4 WzaTDhVP+0avxmGR/lJ91M5vW6BMtDEsCaY0cfmcm5Ar/NmE+8vk2cwILJR+hUV00ePP tNG6AfmocwxthKUVWDwsKm0o8t2GWgZisW3jaCT9cH0Se78mGCjJov2JgR93P0jYdpi0 kPTYQn9Lgdmw/Tf5L1ZvMKnOPoPsUs0RZ4bbH9AFYxAxSGU3bLsJBw+wAoAk0MeKNaIx x/7w== X-Gm-Message-State: APjAAAWY0Hf1WmhZC5IjwryIqtch9z9mQrovkDNJn1gY/oYtxoE699HC e3pZ1KxTTY3gEk/4XoIjMPJ8evieB2ktSNUzrHMEUQ== X-Google-Smtp-Source: APXvYqyzv6Sir+BrPjQHBby0R071iSAQzPBX7aWKDnzpsRG7N1X2LsB+HmNacRkoqVG0IWcUeaDUMGLd07mhyTZWNnY= X-Received: by 2002:a67:f607:: with SMTP id k7mr17260233vso.137.1554188716425; Tue, 02 Apr 2019 00:05:16 -0700 (PDT) MIME-Version: 1.0 References: <20190328150406.12051-1-vipin.varghese@intel.com> <20190402043318.20382-1-vipin.varghese@intel.com> <20190402043318.20382-3-vipin.varghese@intel.com> In-Reply-To: <20190402043318.20382-3-vipin.varghese@intel.com> From: David Marchand Date: Tue, 2 Apr 2019 09:05:05 +0200 Message-ID: To: Vipin Varghese Cc: dev , "Kovacevic, Marko" , reshma.pattan@intel.com, "Wiles, Keith" , "Mcnamara, John" , stephen1.byrne@intel.com, amit.tamboli@intel.com, sanjay.padubidri@intel.com, amol.patel@intel.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4 2/2] app/pdump: enhance to support multi-core capture X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2019 07:05:17 -0000 On Tue, Apr 2, 2019 at 6:33 AM Vipin Varghese wrote: > Add option --multi, to enhance the pdump application to allow capture > on unique cores for each --pdump option. If option --multi is ignored > the default capture occurs on a single core for all --pdump options. > > Signed-off-by: Vipin Varghese > --- > app/pdump/main.c | 76 ++++++++++++++++++++++++++++++++------ > doc/guides/tools/pdump.rst | 8 +++- > 2 files changed, 72 insertions(+), 12 deletions(-) > > diff --git a/app/pdump/main.c b/app/pdump/main.c > index c1db2eb8d..997c8942f 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -28,6 +28,7 @@ > #include > > #define CMD_LINE_OPT_PDUMP "pdump" > +#define CMD_LINE_OPT_MULTI "multi" > #define PDUMP_PORT_ARG "port" > #define PDUMP_PCI_ARG "device_id" > #define PDUMP_QUEUE_ARG "queue" > @@ -139,12 +140,14 @@ struct parse_val { > static int num_tuples; > static struct rte_eth_conf port_conf_default; > static volatile uint8_t quit_signal; > +static uint8_t multiple_core_capture; > > /**< display usage */ > static void > pdump_usage(const char *prgname) > { > - printf("usage: %s [EAL options] -- --pdump " > + printf("usage: %s [EAL options] -- [--multi] " > + "--pdump " > "'(port= | device_id= name>)," > "(queue=)," > "(rx-dev= |" > Rather than hardcode the usage, reuse the macro you introduced: CMD_LINE_OPT_MULTI. @@ -376,6 +379,7 @@ launch_args_parse(int argc, char **argv, char *prgname) > int option_index; > static struct option long_option[] = { > {"pdump", 1, 0, 0}, > + {"multi", 0, 0, 0}, > {NULL, 0, 0, 0} > }; > > Idem reuse the macro. Besides look at lib/librte_eal/common/eal_options.h and lib/librte_eal/common/eal_common_options.c. Define an enum for long only options and map "multi" to an integer that has no printable character associated. This way, you can avoid (see below)... @@ -395,6 +399,10 @@ launch_args_parse(int argc, char **argv, char *prgname) > pdump_usage(prgname); > return -1; > } > + } else if (!strncmp(long_option[option_index].name, > + CMD_LINE_OPT_MULTI, > + sizeof(CMD_LINE_OPT_MULTI))) { > + multiple_core_capture = 1; > } > break; > default: > ... this strncmp. getopt_long already matched the input option for you. -- David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 228B2A0679 for ; Tue, 2 Apr 2019 09:05:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ED3704C8D; Tue, 2 Apr 2019 09:05:18 +0200 (CEST) Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id 0DE4037A8 for ; Tue, 2 Apr 2019 09:05:17 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id g127so7136772vsd.6 for ; Tue, 02 Apr 2019 00:05:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=353HtjGE7sUDgaRd5Dn1MVbdJS6lXb5yGhee6EyJKvo=; b=ow4p4P9cwHvi0bdvDKPtBDylF3NeX0vqXH70FPSSc1w5u/XB1X7MopfRofaQi/fYvt CQxaQDiTtEMMg4XR6duyVsU8aWS/pzW4pcoH6Ai6WaZUa+ylDNidy6UXJgjJehVm7sf4 WzaTDhVP+0avxmGR/lJ91M5vW6BMtDEsCaY0cfmcm5Ar/NmE+8vk2cwILJR+hUV00ePP tNG6AfmocwxthKUVWDwsKm0o8t2GWgZisW3jaCT9cH0Se78mGCjJov2JgR93P0jYdpi0 kPTYQn9Lgdmw/Tf5L1ZvMKnOPoPsUs0RZ4bbH9AFYxAxSGU3bLsJBw+wAoAk0MeKNaIx x/7w== X-Gm-Message-State: APjAAAWY0Hf1WmhZC5IjwryIqtch9z9mQrovkDNJn1gY/oYtxoE699HC e3pZ1KxTTY3gEk/4XoIjMPJ8evieB2ktSNUzrHMEUQ== X-Google-Smtp-Source: APXvYqyzv6Sir+BrPjQHBby0R071iSAQzPBX7aWKDnzpsRG7N1X2LsB+HmNacRkoqVG0IWcUeaDUMGLd07mhyTZWNnY= X-Received: by 2002:a67:f607:: with SMTP id k7mr17260233vso.137.1554188716425; Tue, 02 Apr 2019 00:05:16 -0700 (PDT) MIME-Version: 1.0 References: <20190328150406.12051-1-vipin.varghese@intel.com> <20190402043318.20382-1-vipin.varghese@intel.com> <20190402043318.20382-3-vipin.varghese@intel.com> In-Reply-To: <20190402043318.20382-3-vipin.varghese@intel.com> From: David Marchand Date: Tue, 2 Apr 2019 09:05:05 +0200 Message-ID: To: Vipin Varghese Cc: dev , "Kovacevic, Marko" , reshma.pattan@intel.com, "Wiles, Keith" , "Mcnamara, John" , stephen1.byrne@intel.com, amit.tamboli@intel.com, sanjay.padubidri@intel.com, amol.patel@intel.com Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4 2/2] app/pdump: enhance to support multi-core capture X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190402070505.Y4RDKef4GwnkhlL6TbqRq-QzUYnHsFKdhWIgDGEt_7o@z> On Tue, Apr 2, 2019 at 6:33 AM Vipin Varghese wrote: > Add option --multi, to enhance the pdump application to allow capture > on unique cores for each --pdump option. If option --multi is ignored > the default capture occurs on a single core for all --pdump options. > > Signed-off-by: Vipin Varghese > --- > app/pdump/main.c | 76 ++++++++++++++++++++++++++++++++------ > doc/guides/tools/pdump.rst | 8 +++- > 2 files changed, 72 insertions(+), 12 deletions(-) > > diff --git a/app/pdump/main.c b/app/pdump/main.c > index c1db2eb8d..997c8942f 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -28,6 +28,7 @@ > #include > > #define CMD_LINE_OPT_PDUMP "pdump" > +#define CMD_LINE_OPT_MULTI "multi" > #define PDUMP_PORT_ARG "port" > #define PDUMP_PCI_ARG "device_id" > #define PDUMP_QUEUE_ARG "queue" > @@ -139,12 +140,14 @@ struct parse_val { > static int num_tuples; > static struct rte_eth_conf port_conf_default; > static volatile uint8_t quit_signal; > +static uint8_t multiple_core_capture; > > /**< display usage */ > static void > pdump_usage(const char *prgname) > { > - printf("usage: %s [EAL options] -- --pdump " > + printf("usage: %s [EAL options] -- [--multi] " > + "--pdump " > "'(port= | device_id= name>)," > "(queue=)," > "(rx-dev= |" > Rather than hardcode the usage, reuse the macro you introduced: CMD_LINE_OPT_MULTI. @@ -376,6 +379,7 @@ launch_args_parse(int argc, char **argv, char *prgname) > int option_index; > static struct option long_option[] = { > {"pdump", 1, 0, 0}, > + {"multi", 0, 0, 0}, > {NULL, 0, 0, 0} > }; > > Idem reuse the macro. Besides look at lib/librte_eal/common/eal_options.h and lib/librte_eal/common/eal_common_options.c. Define an enum for long only options and map "multi" to an integer that has no printable character associated. This way, you can avoid (see below)... @@ -395,6 +399,10 @@ launch_args_parse(int argc, char **argv, char *prgname) > pdump_usage(prgname); > return -1; > } > + } else if (!strncmp(long_option[option_index].name, > + CMD_LINE_OPT_MULTI, > + sizeof(CMD_LINE_OPT_MULTI))) { > + multiple_core_capture = 1; > } > break; > default: > ... this strncmp. getopt_long already matched the input option for you. -- David Marchand