Drop packets counts both packets dropped by calls to pktio_send() and packet which were flagged with errors during parsing.
Add an extra counter to differ these two types of packets. Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu> --- v2: Rebased on latest master test/performance/odp_l2fwd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 0844f00..f6890d8 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -81,6 +81,7 @@ static int exit_threads; /**< Break workers loop if set to 1 */ typedef struct { uint64_t packets; /**< Number of forwarded packets. */ uint64_t drops; /**< Number of dropped packets. */ + uint64_t errs; /**< Number of bad packets received. */ } stats_t; /** @@ -160,7 +161,7 @@ static void *pktio_queue_thread(void *arg) /* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) { - stats->drops += 1; + stats->errs += 1; continue; } @@ -172,6 +173,7 @@ static void *pktio_queue_thread(void *arg) outq_def = gbl_args->outq_def[dst_port]; if (odp_queue_enq(outq_def, ev)) { printf(" [%i] Queue enqueue failed.\n", thr); + stats->drops += 1; odp_packet_free(pkt); continue; } @@ -279,7 +281,7 @@ static void *pktio_direct_recv_thread(void *arg) } if (odp_unlikely(pkts_ok != pkts)) - stats->drops += pkts - pkts_ok; + stats->errs += pkts - pkts_ok; if (pkts_ok == 0) continue; @@ -376,6 +378,7 @@ static int print_speed_stats(int num_workers, stats_t **thr_stats, uint64_t pkts_prev = 0; uint64_t pps; uint64_t drops; + uint64_t errs; uint64_t maximum_pps = 0; int i; int elapsed = 0; @@ -392,21 +395,23 @@ static int print_speed_stats(int num_workers, stats_t **thr_stats, do { pkts = 0; drops = 0; + errs = 0; sleep(timeout); for (i = 0; i < num_workers; i++) { pkts += thr_stats[i]->packets; drops += thr_stats[i]->drops; + errs += thr_stats[i]->errs; } if (stats_enabled) { pps = (pkts - pkts_prev) / timeout; if (pps > maximum_pps) maximum_pps = pps; - printf("%" PRIu64 " pps, %" PRIu64 " max pps, ", pps, - maximum_pps); - - printf(" %" PRIu64 " total drops\n", drops); + printf("%" PRIu64 " pps, %" PRIu64 " max pps, " + "%" PRIu64 " total drops, " + "%" PRIu64 " total errors\n", + pps, maximum_pps, drops, errs); pkts_prev = pkts; } _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp