From 0a4dae10f2624006a3ed7ac5deb084a69e378728 Mon Sep 17 00:00:00 2001 From: "jin.hao1" Date: Fri, 15 Mar 2019 16:18:17 +0800 Subject: [PATCH] ff_traffic.tx info should save the sent packets send_burst() send several pkts which maybe composed by several mbufs, use rte_pktmbuf_pkt_len() to get actual length. --- lib/ff_dpdk_if.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ff_dpdk_if.c b/lib/ff_dpdk_if.c index 21e130741..6817fbe85 100644 --- a/lib/ff_dpdk_if.c +++ b/lib/ff_dpdk_if.c @@ -1277,19 +1277,19 @@ send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port) ff_dump_packets(qconf->pcap[port], m_table[i]); } } - - ff_traffic.tx_packets += n; - uint16_t i; - for (i = 0; i < n; i++) { - ff_traffic.tx_bytes += rte_pktmbuf_data_len(m_table[i]); - } - + ret = rte_eth_tx_burst(port, queueid, m_table, n); if (unlikely(ret < n)) { do { rte_pktmbuf_free(m_table[ret]); } while (++ret < n); } + + ff_traffic.tx_packets += ret; + uint16_t i; + for (i = 0; i < ret; i++) { + ff_traffic.tx_bytes += rte_pktmbuf_pkt_len(m_table[i]); + } return 0; }