Skip to content

Commit 5984bde

Browse files
committed
netmap: send pending packets in tx ring after calling poll
1 parent 490c483 commit 5984bde

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/netmap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ init_netmap(char *ifname)
6060
nm_tcp_conn_list = list_new();
6161
}
6262

63+
static inline
64+
void
65+
nm_sync_pending_tx() {
66+
while (nm_tx_pending(NETMAP_TXRING(netmap->nifp, 0))) {
67+
ioctl(NETMAP_FD(netmap), NIOCTXSYNC);
68+
}
69+
}
70+
6371
static inline
6472
void
6573
process_packet(char *buf, size_t len)
@@ -151,6 +159,8 @@ nm_sync_rx_tx_ring(void)
151159
}
152160

153161
poll(&nm_fds, 1, timeout);
162+
163+
nm_sync_pending_tx();
154164
}
155165

156166
static inline

0 commit comments

Comments
 (0)