Skip to content

Commit fcba847

Browse files
magnus-karlssonkernel-patches-bot
authored andcommitted
From: Magnus Karlsson <magnus.karlsson@intel.com>
Fix a possible deadlock in the l2fwd application in xdpsock that can occur when there is no space in the Tx ring. There are two ways to get the kernel to consume entries in the Tx ring: calling sendto() to make it send packets and freeing entries from the completion ring, as the kernel will not send a packet if there is no space for it to add a completion entry in the completion ring. The Tx loop in l2fwd only used to call sendto(). This patches adds cleaning the completion ring in that loop. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> --- samples/bpf/xdpsock_user.c | 1 + 1 file changed, 1 insertion(+)
1 parent df01eaa commit fcba847

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

samples/bpf/xdpsock_user.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ static void l2fwd(struct xsk_socket_info *xsk, struct pollfd *fds)
11251125
while (ret != rcvd) {
11261126
if (ret < 0)
11271127
exit_with_error(-ret);
1128+
complete_tx_l2fwd(xsk, fds);
11281129
if (xsk_ring_prod__needs_wakeup(&xsk->tx))
11291130
kick_tx(xsk);
11301131
ret = xsk_ring_prod__reserve(&xsk->tx, rcvd, &idx_tx);

0 commit comments

Comments
 (0)