From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 1/6] spp_pcap: refactor app options
Date: Thu, 14 Feb 2019 11:47:21 +0900 [thread overview]
Message-ID: <20190214024726.40861-2-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20190214024726.40861-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Some of app options of spp_pcap are not user friendly or violating
naming rule. This patch is to modify options, logs and help messages.
* `-i` is changed to `-c` because `-i` is ambiguous for the purpose.
* `--output` is changed to `--out-dir` because it is directory.
* `--limit_file_size` is changed to `--fsize` because it should be used
`-` instead of `_` and simpler name is enough.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/pcap/spp_pcap.c | 48 ++++++++++++++++++++++-----------------------
src/pcap/spp_proc.h | 6 +++---
2 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index 2716c01..c69207b 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -167,17 +167,15 @@ usage(const char *progname)
{
RTE_LOG(INFO, SPP_PCAP, "Usage: %s [EAL args] --"
" --client-id CLIENT_ID"
- " -s SERVER_IP:SERVER_PORT"
- " -i INPUT_PORT"
- " [--output FILE_OUT_PUT_PATH]"
- " [--limit_file_size LIMIT_FILE_SIZE]\n"
- " --client-id CLIENT_ID : My client ID\n"
- " -s SERVER_IP:SERVER_PORT : "
- "Access information to the server\n"
- " -i : capture port(phy,ring)\n"
- " --output : file path(default:/tmp)\n"
- " --limit_file_size : "
- "file limit size(default:1073741824 Byte)\n"
+ " -s IPADDR:PORT"
+ " -c CAP_PORT"
+ " [--out-dir DIR_OUTPUT]"
+ " [--fsize MAX_FILE_SIZE]\n"
+ " --client-id CLIENT_ID: My client ID\n"
+ " -s IPADDR:PORT: IP addr and sec port for spp-ctl\n"
+ " -c: Captured port (e.g. 'phy:0' or 'ring:1')\n"
+ " --out-dir: Output dir (Default is /tmp)\n"
+ " --fsize: Maximum captured file size (Default is 1GiB)\n"
, progname);
}
@@ -305,13 +303,13 @@ parse_args(int argc, char *argv[])
const char *progname = argv[0];
char port_str[PORT_STR_SIZE];
static struct option lgopts[] = {
- { "client-id", required_argument, NULL,
- SPP_LONGOPT_RETVAL_CLIENT_ID },
- { "output", required_argument, NULL,
- SPP_LONGOPT_RETVAL_OUTPUT },
- { "limit_file_size", required_argument, NULL,
- SPP_LONGOPT_RETVAL_LIMIT_FILE_SIZE},
- { 0 },
+ { "client-id", required_argument, NULL,
+ SPP_LONGOPT_RETVAL_CLIENT_ID },
+ { "out-dir", required_argument, NULL,
+ SPP_LONGOPT_RETVAL_OUT_DIR },
+ { "fsize", required_argument, NULL,
+ SPP_LONGOPT_RETVAL_FILE_SIZE},
+ { 0 },
};
/**
* Save argv to argvopt to avoid losing the order of options
@@ -331,7 +329,7 @@ parse_args(int argc, char *argv[])
/* Check options of application */
optind = 0;
opterr = 0;
- while ((opt = getopt_long(argc, argvopt, "i:s:", lgopts,
+ while ((opt = getopt_long(argc, argvopt, "c:s:", lgopts,
&option_index)) != EOF) {
switch (opt) {
case SPP_LONGOPT_RETVAL_CLIENT_ID:
@@ -343,7 +341,7 @@ parse_args(int argc, char *argv[])
}
proc_flg = 1;
break;
- case SPP_LONGOPT_RETVAL_OUTPUT:
+ case SPP_LONGOPT_RETVAL_OUT_DIR:
strcpy(g_pcap_option.compress_file_path, optarg);
struct stat statBuf;
if (g_pcap_option.compress_file_path[0] == '\0' ||
@@ -352,7 +350,7 @@ parse_args(int argc, char *argv[])
return SPP_RET_NG;
}
break;
- case SPP_LONGOPT_RETVAL_LIMIT_FILE_SIZE:
+ case SPP_LONGOPT_RETVAL_FILE_SIZE:
if (decode_limit_file_size(optarg,
&g_pcap_option.file_limit) !=
SPP_RET_OK) {
@@ -360,7 +358,7 @@ parse_args(int argc, char *argv[])
return SPP_RET_NG;
}
break;
- case 'i':
+ case 'c': /* captured port */
strcpy(port_str, optarg);
if (decode_capture_port(optarg,
&g_pcap_option.port_cap.iface_type,
@@ -371,7 +369,7 @@ parse_args(int argc, char *argv[])
}
port_flg = 1;
break;
- case 's':
+ case 's': /* server addr */
if (parse_server_ip(optarg, g_startup_param.server_ip,
&g_startup_param.server_port) !=
SPP_RET_OK) {
@@ -393,8 +391,8 @@ parse_args(int argc, char *argv[])
}
RTE_LOG(INFO, SPP_PCAP,
- "app opts (client_id=%d,server=%s:%d,"
- "port=%s,output=%s,limit_file_size=%ld)\n",
+ "App opts: '--client-id %d', '-s %s:%d', "
+ "'-c %s', '--out-dir %s', '--fsize %ld'\n",
g_startup_param.client_id,
g_startup_param.server_ip,
g_startup_param.server_port,
diff --git a/src/pcap/spp_proc.h b/src/pcap/spp_proc.h
index 6da5c5e..2265b21 100644
--- a/src/pcap/spp_proc.h
+++ b/src/pcap/spp_proc.h
@@ -90,9 +90,9 @@ enum SPP_LONGOPT_RETVAL {
* Return value definition for getopt_long()
* Only for long option
*/
- SPP_LONGOPT_RETVAL_CLIENT_ID, /* --client-id */
- SPP_LONGOPT_RETVAL_OUTPUT, /* --output */
- SPP_LONGOPT_RETVAL_LIMIT_FILE_SIZE /* --limit_file_size */
+ SPP_LONGOPT_RETVAL_CLIENT_ID, /* --client-id */
+ SPP_LONGOPT_RETVAL_OUT_DIR, /* --out-dir */
+ SPP_LONGOPT_RETVAL_FILE_SIZE /* --fsize */
};
/* Interface information structure */
--
2.17.1
next prev parent reply other threads:[~2019-02-14 2:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 2:47 [spp] [PATCH 0/6] Update for spp_pcap ogawa.yasufumi
2019-02-14 2:47 ` ogawa.yasufumi [this message]
2019-02-14 2:47 ` [spp] [PATCH 2/6] spp-ctl: update spp_pcap opts for validation ogawa.yasufumi
2019-02-14 2:47 ` [spp] [PATCH 3/6] controller: remove local default config ogawa.yasufumi
2019-02-14 2:47 ` [spp] [PATCH 4/6] controller: add pcap support for pri completion ogawa.yasufumi
2019-02-14 2:47 ` [spp] [PATCH 5/6] spp_pcap: refactor name of funcs and vars ogawa.yasufumi
2019-02-14 2:47 ` [spp] [PATCH 6/6] makefile: update dist-clean task ogawa.yasufumi
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=20190214024726.40861-2-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.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).