DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy
@ 2019-10-09 15:29 Flavia Musatescu
  2019-10-09 17:26 ` Stephen Hemminger
  2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
  0 siblings, 2 replies; 9+ messages in thread
From: Flavia Musatescu @ 2019-10-09 15:29 UTC (permalink / raw)
  To: dev, John W. Linville; +Cc: stable, Flavia Musatescu, ciwillia

When sendto call fails and ENOBUFS error is being set some of the
packets are actually successfully transmitted. There is no available
count of those packets, so in order to make the statistics more
accurate, all the previously enqueued packets will be considered
successful, even though this is not entirely correct.

Before:
   testpmd Tx statistics:
      TX-packets: 7529062   TX-errors: 3702150  TX-bytes:  451743720
   pktgen Rx statistics:
      Total Rx Pkts: 10700700

After:
   testpmd TX statistics:
      TX-packets: 11510625  TX-errors: 0        TX-bytes:  690637500
   pktgen Rx statistics:
      Total Rx Pkts: 10974307

Fixes: 74b7fc0a0ff1 ("net/af_packet: fix packet bytes counting")
Cc: ciwillia@brocade.com
Cc: stable@dpdk.org

Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++++++--
 1 file changed, 10 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 6df09f2..330fa75 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -244,8 +244,16 @@ 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) {
-		/* error sending -- no packets transmitted */
+	if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1 &&
+			errno != ENOBUFS) {
+		/* Error sending.
+		 * When sendto call fails and ENOBUFS error is being set
+		 * some of the packets are actually successfully transmitted.
+		 * There is no available count of those packets, so in order
+		 * to make the statistics more accurate, all of the previously
+		 * enqueued packets will be considered successful, even though
+		 * this is not entirely correct.
+		 */
 		num_tx = 0;
 		num_tx_bytes = 0;
 	}
-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 15:29 [dpdk-dev] [PATCH] net/af_packet: improve Tx statistics accuracy Flavia Musatescu
2019-10-09 17:26 ` Stephen Hemminger
2019-10-10 17:34 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
2019-10-10 18:35   ` Stephen Hemminger
2019-10-11 17:13     ` Musatescu, Flavia
2019-10-17 11:51   ` [dpdk-dev] [PATCH v3] " Flavia Musatescu
2019-10-18 14:24     ` [dpdk-dev] [PATCH v4] " Flavia Musatescu
2019-10-18 15:15       ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-10-21 18:15         ` Ferruh Yigit

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git