DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Charles (Chas) Williams" <ciwillia@brocade.com>
To: <dev@dpdk.org>
Cc: <linville@tuxdriver.com>,
	"Charles (Chas) Williams" <ciwillia@brocade.com>
Subject: [dpdk-dev] [PATCH 3/3] net/af_packet: fix packet bytes counting
Date: Wed, 17 May 2017 14:03:35 -0400	[thread overview]
Message-ID: <1495044215-16915-3-git-send-email-ciwillia@brocade.com> (raw)
In-Reply-To: <1495044215-16915-1-git-send-email-ciwillia@brocade.com>

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

Signed-off-by: Charles (Chas) Williams <ciwillia@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

  parent reply	other threads:[~2017-05-17 18:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 18:03 [dpdk-dev] [PATCH 1/3] net/af_packet: handle strdup() failures Charles (Chas) Williams
2017-05-17 18:03 ` [dpdk-dev] [PATCH 2/3] net/af_packet: add accessor for iface Charles (Chas) Williams
2017-05-22  9:39   ` Ferruh Yigit
2017-05-22 13:20     ` Charles (Chas) Williams
2017-05-17 18:03 ` Charles (Chas) Williams [this message]
2017-05-23  9:50 ` [dpdk-dev] [PATCH 1/3] net/af_packet: handle strdup() failures Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495044215-16915-3-git-send-email-ciwillia@brocade.com \
    --to=ciwillia@brocade.com \
    --cc=dev@dpdk.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).