Skip to content

Commit

Permalink
xsk: do not return EAGAIN from sendmsg when completion queue is full
Browse files Browse the repository at this point in the history
This patch stops returning EAGAIN in TX copy mode when the completion
queue is full as zero-copy does not do this. Instead this situation
can be detected by comparing the head and tail pointers of the
completion queue in both modes. In any case, EAGAIN was not the
correct error code here since no amount of calling sendmsg will solve
the problem. Only consuming one or more messages on the completion
queue will fix this.

With this patch, the error reporting becomes consistent between copy
mode and zero-copy mode.

Fixes: 35fcde7 ("xsk: support for Tx")
Signed-off-by: Magnus Karlsson <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
magnus-karlsson authored and borkmann committed Jul 13, 2018
1 parent 509d764 commit 9684f5e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,8 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
goto out;
}

if (xskq_reserve_addr(xs->umem->cq)) {
err = -EAGAIN;
if (xskq_reserve_addr(xs->umem->cq))
goto out;
}

len = desc.len;
if (unlikely(len > xs->dev->mtu)) {
Expand Down

0 comments on commit 9684f5e

Please sign in to comment.