net/tap: remove redundant syscall on Tx
Polling the Tx queue file descriptor before writing to it is not mandatory since it is configured as non-blocking. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Pascal Mazon <pascal.mazon@6wind.com> Acked-by: Keith Wiles <keith.wiles@intel.com>
This commit is contained in:
parent
34c2e7026f
commit
d3668acb7b
@ -43,7 +43,6 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
@ -242,7 +241,6 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
|
|||||||
{
|
{
|
||||||
struct rte_mbuf *mbuf;
|
struct rte_mbuf *mbuf;
|
||||||
struct tx_queue *txq = queue;
|
struct tx_queue *txq = queue;
|
||||||
struct pollfd pfd;
|
|
||||||
uint16_t num_tx = 0;
|
uint16_t num_tx = 0;
|
||||||
unsigned long num_tx_bytes = 0;
|
unsigned long num_tx_bytes = 0;
|
||||||
int i, n;
|
int i, n;
|
||||||
@ -250,18 +248,11 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
|
|||||||
if (unlikely(nb_pkts == 0))
|
if (unlikely(nb_pkts == 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pfd.events = POLLOUT;
|
|
||||||
pfd.fd = txq->fd;
|
|
||||||
for (i = 0; i < nb_pkts; i++) {
|
for (i = 0; i < nb_pkts; i++) {
|
||||||
n = poll(&pfd, 1, 0);
|
|
||||||
|
|
||||||
if (n <= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (pfd.revents & POLLOUT) {
|
|
||||||
/* copy the tx frame data */
|
/* copy the tx frame data */
|
||||||
mbuf = bufs[num_tx];
|
mbuf = bufs[num_tx];
|
||||||
n = write(pfd.fd, rte_pktmbuf_mtod(mbuf, void*),
|
n = write(txq->fd,
|
||||||
|
rte_pktmbuf_mtod(mbuf, void *),
|
||||||
rte_pktmbuf_pkt_len(mbuf));
|
rte_pktmbuf_pkt_len(mbuf));
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
break;
|
break;
|
||||||
@ -270,7 +261,6 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
|
|||||||
num_tx_bytes += mbuf->pkt_len;
|
num_tx_bytes += mbuf->pkt_len;
|
||||||
rte_pktmbuf_free(mbuf);
|
rte_pktmbuf_free(mbuf);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
txq->stats.opackets += num_tx;
|
txq->stats.opackets += num_tx;
|
||||||
txq->stats.errs += nb_pkts - num_tx;
|
txq->stats.errs += nb_pkts - num_tx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user