From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7CE3F1DB1 for ; Wed, 2 Dec 2015 18:40:34 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 02 Dec 2015 09:40:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,374,1444719600"; d="scan'208";a="863196610" Received: from dwdohert-dpdk.ir.intel.com (HELO [163.33.213.167]) ([163.33.213.167]) by orsmga002.jf.intel.com with ESMTP; 02 Dec 2015 09:40:32 -0800 To: dev@dpdk.org References: <1449076604-26628-1-git-send-email-declan.doherty@intel.com> From: Declan Doherty Message-ID: <565F2CD5.1020308@intel.com> Date: Wed, 2 Dec 2015 17:39:33 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1449076604-26628-1-git-send-email-declan.doherty@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] l2fwd-crypto: fix behaviour of -t option X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2015 17:40:35 -0000 On 02/12/15 17:16, Declan Doherty wrote: > passing -t 0 as a command line argument causes the application > to exit with an "invalid refresh period specified" error which is > contrary to applications help text. > > This patch removes the unnecessary option "--no-stats" and fixes the > behaviour of the -t parameter. > > Reported-by: Min Cao > Signed-off-by: Declan Doherty > --- > examples/l2fwd-crypto/main.c | 29 ++++++++++------------------- > 1 file changed, 10 insertions(+), 19 deletions(-) > > diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c > index 0b4414b..d70fc9a 100644 > --- a/examples/l2fwd-crypto/main.c > +++ b/examples/l2fwd-crypto/main.c > @@ -118,7 +118,6 @@ struct l2fwd_crypto_options { > unsigned nb_ports_per_lcore; > unsigned refresh_period; > unsigned single_lcore:1; > - unsigned no_stats_printing:1; > > enum rte_cryptodev_type cdev_type; > unsigned sessionless:1; > @@ -575,10 +574,9 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) > (uint64_t)timer_period)) { > > /* do this only on master core */ > - if (lcore_id == rte_get_master_lcore() && > - !options->no_stats_printing) { > + if (lcore_id == rte_get_master_lcore() > + && options->refresh_period) { > print_stats(); > - /* reset the timer */ > timer_tsc = 0; > } > } > @@ -802,11 +800,6 @@ static int > l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, > struct option *lgopts, int option_index) > { > - if (strcmp(lgopts[option_index].name, "no_stats") == 0) { > - options->no_stats_printing = 1; > - return 0; > - } > - > if (strcmp(lgopts[option_index].name, "cdev_type") == 0) > return parse_cryptodev_type(&options->cdev_type, optarg); > > @@ -903,21 +896,21 @@ l2fwd_crypto_parse_timer_period(struct l2fwd_crypto_options *options, > const char *q_arg) > { > char *end = NULL; > - int n; > + long int n; > > /* parse number string */ > n = strtol(q_arg, &end, 10); > if ((q_arg[0] == '\0') || (end == NULL) || (*end != '\0')) > n = 0; > > - if (n >= MAX_TIMER_PERIOD) > - n = 0; > + if (n >= MAX_TIMER_PERIOD) { > + printf("Warning refresh period specified %ld is greater than " > + "max value %d! using max value", > + n, MAX_TIMER_PERIOD); > + n = MAX_TIMER_PERIOD; > + } > > options->refresh_period = n * 1000 * TIMER_MILLISECOND; > - if (options->refresh_period == 0) { > - printf("invalid refresh period specified\n"); > - return -1; > - } > > return 0; > } > @@ -932,7 +925,6 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options) > options->nb_ports_per_lcore = 1; > options->refresh_period = 10000; > options->single_lcore = 0; > - options->no_stats_printing = 0; > > options->cdev_type = RTE_CRYPTODEV_AESNI_MB_PMD; > options->sessionless = 0; > @@ -979,7 +971,7 @@ l2fwd_crypto_options_print(struct l2fwd_crypto_options *options) > printf("single lcore mode: %s\n", > options->single_lcore ? "enabled" : "disabled"); > printf("stats_printing: %s\n", > - options->no_stats_printing ? "disabled" : "enabled"); > + options->refresh_period == 0 ? "disabled" : "enabled"); > > switch (options->cdev_type) { > case RTE_CRYPTODEV_AESNI_MB_PMD: > @@ -1036,7 +1028,6 @@ l2fwd_crypto_parse_args(struct l2fwd_crypto_options *options, > char **argvopt = argv, *prgname = argv[0]; > > static struct option lgopts[] = { > - { "no_stats", no_argument, 0, 0 }, > { "sessionless", no_argument, 0, 0 }, > > { "cdev_type", required_argument, 0, 0 }, > I forgot to specify the commit this patch fixes in the commit message. "fixes: 387259bd6c6733ec0ff8dfead0b555dc57402aa1"