Separated receive and transmit drop counters to help debugging the cause of dropped packets.
Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com> --- test/performance/odp_l2fwd.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index f733440..617e1b2 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -81,8 +81,12 @@ static int exit_threads; /**< Break workers loop if set to 1 */ */ typedef union { struct { - uint64_t packets; /**< Number of forwarded packets. */ - uint64_t drops; /**< Number of dropped packets. */ + /** Number of forwarded packets */ + uint64_t packets; + /** Packets dropped due to receive error */ + uint64_t rx_drops; + /** Packets dropped due to transmit error */ + uint64_t tx_drops; } s; uint8_t padding[ODP_CACHE_LINE_SIZE]; @@ -163,7 +167,6 @@ static void *pktio_queue_thread(void *arg) while (!exit_threads) { int sent, i; unsigned tx_drops; - int rx_drops = 0; pkts = odp_schedule_multi(NULL, wait, ev_tbl, MAX_PKT_BURST); @@ -174,14 +177,16 @@ static void *pktio_queue_thread(void *arg) pkt_tbl[i] = odp_packet_from_event(ev_tbl[i]); if (gbl_args->appl.error_check) { + int rx_drops; + /* Drop packets with errors */ rx_drops = drop_err_pkts(pkt_tbl, pkts); if (odp_unlikely(rx_drops)) { - if (pkts == rx_drops) { - stats->s.drops += rx_drops; + stats->s.rx_drops += rx_drops; + if (pkts == rx_drops) continue; - } + pkts -= rx_drops; } } @@ -194,12 +199,13 @@ static void *pktio_queue_thread(void *arg) tx_drops = pkts - sent; if (odp_unlikely(tx_drops)) { + stats->s.tx_drops += tx_drops; + /* Drop rejected packets */ for (i = sent; i < pkts; i++) odp_packet_free(pkt_tbl[i]); } - stats->s.drops += rx_drops + tx_drops; stats->s.packets += pkts; } @@ -283,21 +289,22 @@ static void *pktio_direct_recv_thread(void *arg) while (!exit_threads) { int sent, i; unsigned tx_drops; - int rx_drops = 0; pkts = odp_pktio_recv(pktio_src, pkt_tbl, MAX_PKT_BURST); if (odp_unlikely(pkts <= 0)) continue; if (gbl_args->appl.error_check) { + int rx_drops; + /* Drop packets with errors */ rx_drops = drop_err_pkts(pkt_tbl, pkts); if (odp_unlikely(rx_drops)) { - if (pkts == rx_drops) { - stats->s.drops += rx_drops; + stats->s.rx_drops += rx_drops; + if (pkts == rx_drops) continue; - } + pkts -= rx_drops; } } @@ -310,12 +317,13 @@ static void *pktio_direct_recv_thread(void *arg) tx_drops = pkts - sent; if (odp_unlikely(tx_drops)) { + stats->s.tx_drops += tx_drops; + /* Drop rejected packets */ for (i = sent; i < pkts; i++) odp_packet_free(pkt_tbl[i]); } - stats->s.drops += rx_drops + tx_drops; stats->s.packets += pkts; } @@ -409,7 +417,7 @@ static int print_speed_stats(int num_workers, stats_t *thr_stats, uint64_t pkts = 0; uint64_t pkts_prev = 0; uint64_t pps; - uint64_t drops; + uint64_t rx_drops, tx_drops; uint64_t maximum_pps = 0; int i; int elapsed = 0; @@ -425,13 +433,15 @@ static int print_speed_stats(int num_workers, stats_t *thr_stats, do { pkts = 0; - drops = 0; + rx_drops = 0; + tx_drops = 0; sleep(timeout); for (i = 0; i < num_workers; i++) { pkts += thr_stats[i].s.packets; - drops += thr_stats[i].s.drops; + rx_drops += thr_stats[i].s.rx_drops; + tx_drops += thr_stats[i].s.tx_drops; } if (stats_enabled) { pps = (pkts - pkts_prev) / timeout; @@ -440,7 +450,8 @@ static int print_speed_stats(int num_workers, stats_t *thr_stats, printf("%" PRIu64 " pps, %" PRIu64 " max pps, ", pps, maximum_pps); - printf(" %" PRIu64 " total drops\n", drops); + printf(" %" PRIu64 " rx drops, %" PRIu64 " tx drops\n", + rx_drops, tx_drops); pkts_prev = pkts; } -- 2.6.2 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp