v1: * Replaced 'unsigned' with 'unsigned int' Replacing the check for lcore_id & mastercore_id with the check for a flag.
Signed-off-by: Anoob Joseph <anoob.jos...@caviumnetworks.com> --- examples/l2fwd/l2fwd_worker.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/l2fwd/l2fwd_worker.c b/examples/l2fwd/l2fwd_worker.c index dfa78ed..f847832 100644 --- a/examples/l2fwd/l2fwd_worker.c +++ b/examples/l2fwd/l2fwd_worker.c @@ -135,12 +135,12 @@ l2fwd_main_loop(void) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *m; unsigned int lcore_id; - unsigned int master_core_id; uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc; unsigned int i, j, portid, nb_rx; struct lcore_queue_conf *qconf; const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; + int is_master_core; prev_tsc = 0; timer_tsc = 0; @@ -162,8 +162,8 @@ l2fwd_main_loop(void) portid); } - - master_core_id = rte_get_master_lcore(); + /* Set the flag if master core */ + is_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0; while (!force_quit) { @@ -188,7 +188,7 @@ l2fwd_main_loop(void) if (unlikely(timer_tsc >= timer_period)) { /* do this only on master core */ - if (lcore_id == master_core_id) { + if (is_master_core) { print_stats(); /* reset the timer */ timer_tsc = 0; -- 2.7.4