Skip to content

Commit

Permalink
xsk: do not return EMSGSIZE in copy mode for packets larger than MTU
Browse files Browse the repository at this point in the history
This patch stops returning EMSGSIZE from sendmsg in copy mode when the
size of the packet is larger than the MTU. Just send it to the device
so that it will drop it as in zero-copy mode. This makes the error
reporting 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 6efb443 commit 09210c4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,10 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
if (xskq_reserve_addr(xs->umem->cq))
goto out;

len = desc.len;
if (unlikely(len > xs->dev->mtu)) {
err = -EMSGSIZE;
goto out;
}

if (xs->queue_id >= xs->dev->real_num_tx_queues)
goto out;

len = desc.len;
skb = sock_alloc_send_skb(sk, len, 1, &err);
if (unlikely(!skb)) {
err = -EAGAIN;
Expand Down

0 comments on commit 09210c4

Please sign in to comment.