]> git.droids-corp.org - dpdk.git/blobdiff - drivers/net/af_packet/rte_eth_af_packet.c
net/af_packet: improve Tx statistics accuracy
[dpdk.git] / drivers / net / af_packet / rte_eth_af_packet.c
index dce76b04e553d3805819a193da84564983a1ca09..5b71db707822e5ba5ffc8171d6ed810cad6eec68 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;
        }