[dpdk-dev] [PATCH 3/3] net/af_packet: fix packet bytes counting

Charles (Chas) Williams ciwillia at brocade.com
Wed May 17 20:03:35 CEST 2017


On error, we also need to zero the bytes transmitted.

Signed-off-by: Charles (Chas) Williams <ciwillia at brocade.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 6927f70..e456836 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -269,8 +269,11 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	}
 
 	/* kick-off transmits */
-	if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1)
-		num_tx = 0; /* error sending -- no packets transmitted */
+	if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1) {
+		/* error sending -- no packets transmitted */
+		num_tx = 0;
+		num_tx_bytes = 0;
+	}
 
 	pkt_q->framenum = framenum;
 	pkt_q->tx_pkts += num_tx;
-- 
2.1.4



More information about the dev mailing list