Skip to content

Commit

Permalink
net/af_packet: improve Tx statistics accuracy
Browse files Browse the repository at this point in the history
[ upstream commit d4bda0a ]

When sendto call fails and ENOBUFS/EAGAIN 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.

Statistics numbers before this update:

Pktgen:
   Total Rx Pkts:               1360084
         Tx Pkts:               2000000
testpmd:
   RX-packets: 1408346  RX-missed: 0       RX-bytes:  84503418
   TX-packets: 526486   TX-errors: 881851  TX-bytes:  31589724

Statistics numbers after this update:

Pktgen:
   Total Rx Pkts:               1329872
         Tx Pkts:               2000000
testpmd:
   RX-packets: 1389156  RX-missed: 0       RX-bytes:  83349360
   TX-packets: 1389156  TX-errors: 0       TX-bytes:  83349360

Fixes: 74b7fc0 ("net/af_packet: fix packet bytes counting")

Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
Flavia Musatescu authored and kevintraynor committed Dec 9, 2019
1 parent 3c53ea1 commit f888eb7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/af_packet/rte_eth_af_packet.c
Expand Up @@ -239,8 +239,14 @@ 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 && errno != EAGAIN) {
/*
* In case of a ENOBUFS/EAGAIN error all of the enqueued
* packets will be considered successful even though only some
* are sent.
*/

num_tx = 0;
num_tx_bytes = 0;
}
Expand Down

0 comments on commit f888eb7

Please sign in to comment.