net/af_packet: improve Tx statistics accuracy
[dpdk.git] / drivers / net / af_packet / rte_eth_af_packet.c
index dce76b0..5b71db7 100644 (file)
@@ -244,8 +244,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;
        }