Skip to content

Commit

Permalink
xsk: always return ENOBUFS from sendmsg if there is no TX queue
Browse files Browse the repository at this point in the history
This patch makes sure ENOBUFS is always returned from sendmsg if there
is no TX queue configured. This was not the case for zero-copy
mode. With this patch this error reporting is consistent between copy
mode and zero-copy mode.

Fixes: ac98d8a ("xsk: wire upp Tx zero-copy functions")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Magnus Karlsson authored and Daniel Borkmann committed Jul 13, 2018
1 parent 9684f5e commit 6efb443
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
@@ -218,9 +218,6 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
struct sk_buff *skb;
int err = 0;

if (unlikely(!xs->tx))
return -ENOBUFS;

mutex_lock(&xs->mutex);

while (xskq_peek_desc(xs->tx, &desc)) {
@@ -296,6 +293,8 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
return -ENXIO;
if (unlikely(!(xs->dev->flags & IFF_UP)))
return -ENETDOWN;
if (unlikely(!xs->tx))
return -ENOBUFS;
if (need_wait)
return -EOPNOTSUPP;

0 comments on commit 6efb443

Please sign in to comment.