xdp: Fix xsk_generic_xmit errno

Propagate sock_alloc_send_skb error code, not set it to
EAGAIN unconditionally, when fail to allocate skb, which
might cause that user space unnecessary loops.

Fixes: 35fcde7f8d ("xsk: support for Tx")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1591852266-24017-1-git-send-email-lirongqing@baidu.com
This commit is contained in:
Li RongQing 2020-06-11 13:11:06 +08:00 committed by Daniel Borkmann
parent d4060ac969
commit aa2cad0600

View File

@ -352,10 +352,8 @@ static int xsk_generic_xmit(struct sock *sk)
len = desc.len; len = desc.len;
skb = sock_alloc_send_skb(sk, len, 1, &err); skb = sock_alloc_send_skb(sk, len, 1, &err);
if (unlikely(!skb)) { if (unlikely(!skb))
err = -EAGAIN;
goto out; goto out;
}
skb_put(skb, len); skb_put(skb, len);
addr = desc.addr; addr = desc.addr;