X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Faf_packet%2Frte_eth_af_packet.c;h=1396f32c3dccd800d2276245829ff49ad88271e6;hb=891f8260dd49d4bc683cffaca79b7f7d5247b968;hp=cea7091c063973f8ccfe9b750b72aaeb43472fcb;hpb=4e8a910719df270770fe35199146847bd55a7b85;p=dpdk.git diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index cea7091c06..1396f32c3d 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -237,8 +237,30 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } /* point at the next incoming frame */ - if (!tx_ring_status_available(ppd->tp_status) && - poll(&pfd, 1, -1) < 0) + if (!tx_ring_status_available(ppd->tp_status)) { + if (poll(&pfd, 1, -1) < 0) + break; + + /* poll() can return POLLERR if the interface is down */ + if (pfd.revents & POLLERR) + break; + } + + /* + * poll() will almost always return POLLOUT, even if there + * are no extra buffers available + * + * This happens, because packet_poll() calls datagram_poll() + * which checks the space left in the socket buffer and, + * in the case of packet_mmap, the default socket buffer length + * doesn't match the requested size for the tx_ring. + * As such, there is almost always space left in socket buffer, + * which doesn't seem to be correlated to the requested size + * for the tx_ring in packet_mmap. + * + * This results in poll() returning POLLOUT. + */ + if (!tx_ring_status_available(ppd->tp_status)) break; /* copy the tx frame data */