From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles (Chas) Williams" Subject: [PATCH 3/3] net/af_packet: fix packet bytes counting Date: Wed, 17 May 2017 14:03:35 -0400 Message-ID: <1495044215-16915-3-git-send-email-ciwillia@brocade.com> References: <1495044215-16915-1-git-send-email-ciwillia@brocade.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , "Charles (Chas) Williams" To: Return-path: Received: from mx0a-000f0801.pphosted.com (mx0a-000f0801.pphosted.com [67.231.144.122]) by dpdk.org (Postfix) with ESMTP id 99D543256 for ; Wed, 17 May 2017 20:03:52 +0200 (CEST) In-Reply-To: <1495044215-16915-1-git-send-email-ciwillia@brocade.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On error, we also need to zero the bytes transmitted. Signed-off-by: Charles (Chas) Williams --- 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