aboutsummaryrefslogtreecommitdiffstats
path: root/net/xdp
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2018-07-11 04:12:51 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-07-13 09:34:31 -0400
commit6efb4436f7fcc50cc3fb9a113d0f16e3968172b1 (patch)
tree79fec6084ce553c60448bb6c72dd7c7a9d2be674 /net/xdp
parent9684f5e7c8cdf076aeec81344d4893a30f7aa6a1 (diff)
xsk: always return ENOBUFS from sendmsg if there is no TX queue
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: ac98d8aab61b ("xsk: wire upp Tx zero-copy functions") Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/xdp')
-rw-r--r--net/xdp/xsk.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 87567232d0f8..9c784307f7b0 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -218,9 +218,6 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
218 struct sk_buff *skb; 218 struct sk_buff *skb;
219 int err = 0; 219 int err = 0;
220 220
221 if (unlikely(!xs->tx))
222 return -ENOBUFS;
223
224 mutex_lock(&xs->mutex); 221 mutex_lock(&xs->mutex);
225 222
226 while (xskq_peek_desc(xs->tx, &desc)) { 223 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)
296 return -ENXIO; 293 return -ENXIO;
297 if (unlikely(!(xs->dev->flags & IFF_UP))) 294 if (unlikely(!(xs->dev->flags & IFF_UP)))
298 return -ENETDOWN; 295 return -ENETDOWN;
296 if (unlikely(!xs->tx))
297 return -ENOBUFS;
299 if (need_wait) 298 if (need_wait)
300 return -EOPNOTSUPP; 299 return -EOPNOTSUPP;
301 300