diff options
author | David S. Miller | 2020-10-05 17:33:26 -0700 |
---|---|---|
committer | David S. Miller | 2020-10-05 18:40:01 -0700 |
commit | 8b0308fe319b8002753ea66f8f940fb393792ddd (patch) | |
tree | 4c5a80346308db8cac9ff0951bb10e892c2387ad /net/xdp/xsk.c | |
parent | f4f9dcc3f4c5f576ee195bdf0fd1682da7a3a73a (diff) | |
parent | 7575fdda569b2a2e8be32c1a64ecb05d6f96a500 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Rejecting non-native endian BTF overlapped with the addition
of support for it.
The rest were more simple overlapping changes, except the
renesas ravb binding update, which had to follow a file
move as well as a YAML conversion.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xdp/xsk.c')
-rw-r--r-- | net/xdp/xsk.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index ba4dfb17c666..b71a32eeae65 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -411,15 +411,30 @@ static int xsk_generic_xmit(struct sock *sk) skb_shinfo(skb)->destructor_arg = (void *)(long)desc.addr; skb->destructor = xsk_destruct_skb; + /* Hinder dev_direct_xmit from freeing the packet and + * therefore completing it in the destructor + */ + refcount_inc(&skb->users); err = dev_direct_xmit(skb, xs->queue_id); + if (err == NETDEV_TX_BUSY) { + /* Tell user-space to retry the send */ + skb->destructor = sock_wfree; + /* Free skb without triggering the perf drop trace */ + consume_skb(skb); + err = -EAGAIN; + goto out; + } + xskq_cons_release(xs->tx); /* Ignore NET_XMIT_CN as packet might have been sent */ - if (err == NET_XMIT_DROP || err == NETDEV_TX_BUSY) { + if (err == NET_XMIT_DROP) { /* SKB completed but not sent */ + kfree_skb(skb); err = -EBUSY; goto out; } + consume_skb(skb); sent_frame = true; } |