DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Kaur, Arshdeep" <arshdeep.kaur@intel.com>
To: "Kaur, Arshdeep" <arshdeep.kaur@intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Chintalapalle, Balaji" <balaji.chintalapalle@intel.com>,
	"Beadle, Michael" <michael.beadle@intel.com>
Subject: RE: [RFT] dumpcap: add file-prefix option
Date: Fri, 23 Sep 2022 11:46:15 +0000	[thread overview]
Message-ID: <DM6PR11MB3737CF1FAB7E2D20A36EB9E8F0519@DM6PR11MB3737.namprd11.prod.outlook.com> (raw)
In-Reply-To: <DM6PR11MB3737C328BD21A4D9BE1E9234F0489@DM6PR11MB3737.namprd11.prod.outlook.com>

++ Balaji and Mike.

> -----Original Message-----
> From: Kaur, Arshdeep <arshdeep.kaur@intel.com>
> Sent: Friday, September 16, 2022 1:49 PM
> To: Stephen Hemminger <stephen@networkplumber.org>; dev@dpdk.org
> Subject: RE: [RFT] dumpcap: add file-prefix option
> 
> 
> 
> > -----Original Message-----
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Sent: Tuesday, September 13, 2022 12:34 AM
> > To: dev@dpdk.org
> > Cc: Stephen Hemminger <stephen@networkplumber.org>; Kaur,
> Arshdeep
> > <arshdeep.kaur@intel.com>
> > Subject: [RFT] dumpcap: add file-prefix option
> >
> > When using dumpcap in container environment or with multiple DPDK
> > processes, it is useful to be able to specify file prefix.
> >
> > This version only accepts the long format option used by other
> commands.
> > If no prefix is specified then the default is used.
> >
> > Suggested-by: Arshdeep Kaur <arshdeep.kaur@intel.com>
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> > Did basic command line test, but still needs testing with a prefix
> > being used (ie multiple apps).
> >
> >  app/dumpcap/main.c | 24 ++++++++++++++++++------
> >  1 file changed, 18 insertions(+), 6 deletions(-)
> >
> > diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index
> > a6041d4ff495..bdeef96d9c0b 100644
> > --- a/app/dumpcap/main.c
> > +++ b/app/dumpcap/main.c
> > @@ -61,6 +61,7 @@ static char *output_name;  static const char
> > *filter_str;  static unsigned int ring_size = 2048;  static const char
> > *capture_comment;
> > +static const char *file_prefix;
> >  static uint32_t snaplen = RTE_MBUF_DEFAULT_BUF_SIZE;  static bool
> > dump_bpf;  static struct { @@ -122,6 +123,7 @@ static void usage(void)
> >  	       "                           add a capture comment to the output file\n"
> >  	       "\n"
> >  	       "Miscellaneous:\n"
> > +	       "  --file-prefix=<prefix>   prefix to use for multi-process\n"
> >  	       "  -q                       don't report packet capture counts\n"
> >  	       "  -v, --version            print version information and exit\n"
> >  	       "  -h, --help               display this help and exit\n"
> > @@ -310,6 +312,7 @@ static void parse_opts(int argc, char **argv)
> >  	static const struct option long_options[] = {
> >  		{ "autostop",        required_argument, NULL, 'a' },
> >  		{ "capture-comment", required_argument, NULL, 0 },
> > +		{ "file-prefix",     required_argument, NULL, 0 },
> >  		{ "help",            no_argument,       NULL, 'h' },
> >  		{ "interface",       required_argument, NULL, 'i' },
> >  		{ "list-interfaces", no_argument,       NULL, 'D' },
> > @@ -330,11 +333,13 @@ static void parse_opts(int argc, char **argv)
> >
> >  		switch (c) {
> >  		case 0:
> > -			switch (option_index) {
> > -			case 0:
> > +			if (!strcmp(long_options[option_index].name,
> > +				    "capture-comment")) {
> >  				capture_comment = optarg;
> > -				break;
> > -			default:
> > +			} else if (!strcmp(long_options[option_index].name,
> > +					   "file-prefix")) {
> > +				file_prefix = optarg;
> > +			} else {
> >  				usage();
> >  				exit(1);
> >  			}
> 
> parse_opts() is called after dpdk_init(). So whatever file-prefix we provide,
> for eal init, it remains NULL.
> Please let me know your thoughts about it.
> 
> > @@ -512,12 +517,14 @@ static void dpdk_init(void)
> >  	static const char * const args[] = {
> >  		"dumpcap", "--proc-type", "secondary",
> >  		"--log-level", "notice"
> > -
> >  	};
> > -	const int eal_argc = RTE_DIM(args);
> > +	int eal_argc = RTE_DIM(args);
> >  	char **eal_argv;
> >  	unsigned int i;
> >
> > +	if (file_prefix != NULL)
> > +		eal_argc += 2;
> > +
> >  	/* DPDK API requires mutable versions of command line arguments.
> > */
> >  	eal_argv = calloc(eal_argc + 1, sizeof(char *));
> >  	if (eal_argv == NULL)
> > @@ -527,6 +534,11 @@ static void dpdk_init(void)
> >  	for (i = 1; i < RTE_DIM(args); i++)
> >  		eal_argv[i] = strdup(args[i]);
> >
> > +	if (file_prefix != NULL) {
> > +		eal_argv[i++] = strdup("--file-prefix");
> > +		eal_argv[i++] = strdup(file_prefix);
> > +	}
> > +
> >  	if (rte_eal_init(eal_argc, eal_argv) < 0)
> >  		rte_exit(EXIT_FAILURE, "EAL init failed: is primary process
> > running?\n");
> >
> > --
> > 2.35.1


  parent reply	other threads:[~2022-09-23 11:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220829074821.283063-1-arshdeep.kaur@intel.com>
2022-09-06 16:31 ` [PATCH] SCSY-192443 Fix DPDK-dumpcap for XRAN Library Pattan, Reshma
     [not found] ` <20220907162659.260812-1-arshdeep.kaur@intel.com>
2022-09-12  8:54   ` [PATCH v2] dumpcap: add the mutiprocess fileprefix support Kaur, Arshdeep
2022-09-12 12:43 ` Arshdeep Kaur
2022-09-12 14:50   ` Stephen Hemminger
2022-09-12 19:03   ` [RFT] dumpcap: add file-prefix option Stephen Hemminger
2022-09-16  8:19     ` Kaur, Arshdeep
2022-09-16 12:51       ` Ben Magistro
2022-09-16 15:35         ` Stephen Hemminger
2022-09-19 11:19           ` Kaur, Arshdeep
2022-09-23 11:46       ` Kaur, Arshdeep [this message]
2022-10-17  5:08     ` Kaur, Arshdeep
2022-10-20 10:43       ` Kaur, Arshdeep
2022-10-20 15:40         ` Stephen Hemminger
2022-10-20 11:55     ` Kaur, Arshdeep
2022-10-21 13:07       ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR11MB3737CF1FAB7E2D20A36EB9E8F0519@DM6PR11MB3737.namprd11.prod.outlook.com \
    --to=arshdeep.kaur@intel.com \
    --cc=balaji.chintalapalle@intel.com \
    --cc=dev@dpdk.org \
    --cc=michael.beadle@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).