Skip to content

Commit aa17d86

Browse files
LorenzoBianconiNobody
authored and
Nobody
committed
veth: allow jumbo frames in xdp mode
Allow increasing the MTU over page boundaries on veth devices if the attached xdp program declares to support xdp fragments. Signed-off-by: Lorenzo Bianconi <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Acked-by: John Fastabend <[email protected]>
1 parent 926bb8e commit aa17d86

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/net/veth.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,9 +1528,14 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
15281528
goto err;
15291529
}
15301530

1531-
max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
1532-
peer->hard_header_len -
1533-
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
1531+
max_mtu = SKB_WITH_OVERHEAD(PAGE_SIZE - VETH_XDP_HEADROOM) -
1532+
peer->hard_header_len;
1533+
/* Allow increasing the max_mtu if the program supports
1534+
* XDP fragments.
1535+
*/
1536+
if (prog->aux->xdp_has_frags)
1537+
max_mtu += PAGE_SIZE * MAX_SKB_FRAGS;
1538+
15341539
if (peer->mtu > max_mtu) {
15351540
NL_SET_ERR_MSG_MOD(extack, "Peer MTU is too large to set XDP");
15361541
err = -ERANGE;

0 commit comments

Comments
 (0)