diff options
author | Heng Qi <hengqi@linux.alibaba.com> | 2023-01-14 16:22:22 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-01-16 11:15:48 +0000 |
commit | 8d9bc36de5fc7b64bbce7b479dbe0ffdcb31b3b5 (patch) | |
tree | 42b3e40f5fe0dcb3d98d200bcc29b8d761b81db9 /drivers/net/virtio_net.c | |
parent | e814b958ad8857d6f7354d3a189776eb604d86dd (diff) | |
download | lwn-8d9bc36de5fc7b64bbce7b479dbe0ffdcb31b3b5.tar.gz lwn-8d9bc36de5fc7b64bbce7b479dbe0ffdcb31b3b5.zip |
virtio-net: set up xdp for multi buffer packets
When the xdp program sets xdp.frags, which means it can process
multi-buffer packets over larger MTU, so we continue to support xdp.
Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 81d92978cc92..ba4d5e66a4d7 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3106,9 +3106,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, return -EINVAL; } - if (dev->mtu > max_sz) { - NL_SET_ERR_MSG_MOD(extack, "MTU too large to enable XDP"); - netdev_warn(dev, "XDP requires MTU less than %u\n", max_sz); + if (prog && !prog->aux->xdp_has_frags && dev->mtu > max_sz) { + NL_SET_ERR_MSG_MOD(extack, "MTU too large to enable XDP without frags"); + netdev_warn(dev, "single-buffer XDP requires MTU less than %u\n", max_sz); return -EINVAL; } |