X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fl2fwd-crypto%2Fmain.c;h=b1e2613ccfd0bdad9450f034e661fad9fcdfb1d9;hb=af676be9e6671b25c69af2aa5fc2d40d562137f6;hp=04a3bdace20c833c92993cc9a03cfff00f101a66;hpb=295968d1740760337e16b0d7914875c5cac52850;p=dpdk.git diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 04a3bdace2..b1e2613ccf 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -252,11 +252,9 @@ struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; /* A tsc-based timer responsible for triggering statistics printout */ -#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */ +#define TIMER_MILLISECOND (rte_get_tsc_hz() / 1000) #define MAX_TIMER_PERIOD 86400UL /* 1 day max */ - -/* default period is 10 seconds */ -static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; +#define DEFAULT_TIMER_PERIOD 10UL /* Print out statistics on packets dropped */ static void @@ -894,18 +892,17 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) } /* if timer is enabled */ - if (timer_period > 0) { + if (options->refresh_period > 0) { /* advance the timer */ timer_tsc += diff_tsc; /* if timer has reached its timeout */ if (unlikely(timer_tsc >= - (uint64_t)timer_period)) { + options->refresh_period)) { /* do this only on main core */ - if (lcore_id == rte_get_main_lcore() - && options->refresh_period) { + if (lcore_id == rte_get_main_lcore()) { print_stats(); timer_tsc = 0; } @@ -1481,7 +1478,8 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options) { options->portmask = 0xffffffff; options->nb_ports_per_lcore = 1; - options->refresh_period = 10000; + options->refresh_period = DEFAULT_TIMER_PERIOD * + TIMER_MILLISECOND * 1000; options->single_lcore = 0; options->sessionless = 0; @@ -2218,6 +2216,11 @@ check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id) RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_4096_BYTES)) ret = -1; break; + case 1048576: + if (!(cap->sym.cipher.dataunit_set & + RTE_CRYPTO_CIPHER_DATA_UNIT_LEN_1_MEGABYTES)) + ret = -1; + break; default: ret = -1; } @@ -2714,7 +2717,7 @@ initialize_ports(struct l2fwd_crypto_options *options) last_portid = portid; } - l2fwd_enabled_port_mask |= (1 << portid); + l2fwd_enabled_port_mask |= (1ULL << portid); enabled_portcount++; }