提交 9de22b99 编写于 作者: M Matteo Croce 提交者: Greg Kroah-Hartman

net: thunderx: raise XDP MTU to 1508

[ Upstream commit 5ee15c101f29e0093ffb5448773ccbc786eb313b ]

The thunderx driver splits frames bigger than 1530 bytes to multiple
pages, making impossible to run an eBPF program on it.
This leads to a maximum MTU of 1508 if QinQ is in use.

The thunderx driver forbids to load an eBPF program if the MTU is higher
than 1500 bytes. Raise the limit to 1508 so it is possible to use L2
protocols which need some more headroom.

Fixes: 05c773f5 ("net: thunderx: Add basic XDP support")
Signed-off-by: NMatteo Croce <mcroce@redhat.com>
Acked-by: NJesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7ba5ec69
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
#define DRV_NAME "nicvf" #define DRV_NAME "nicvf"
#define DRV_VERSION "1.0" #define DRV_VERSION "1.0"
/* NOTE: Packets bigger than 1530 are split across multiple pages and XDP needs
* the buffer to be contiguous. Allow XDP to be set up only if we don't exceed
* this value, keeping headroom for the 14 byte Ethernet header and two
* VLAN tags (for QinQ)
*/
#define MAX_XDP_MTU (1530 - ETH_HLEN - VLAN_HLEN * 2)
/* Supported devices */ /* Supported devices */
static const struct pci_device_id nicvf_id_table[] = { static const struct pci_device_id nicvf_id_table[] = {
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM, { PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM,
...@@ -1795,8 +1802,10 @@ static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog) ...@@ -1795,8 +1802,10 @@ static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog)
bool bpf_attached = false; bool bpf_attached = false;
int ret = 0; int ret = 0;
/* For now just support only the usual MTU sized frames */ /* For now just support only the usual MTU sized frames,
if (prog && (dev->mtu > 1500)) { * plus some headroom for VLAN, QinQ.
*/
if (prog && dev->mtu > MAX_XDP_MTU) {
netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
dev->mtu); dev->mtu);
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册