Skip to content

Commit e121d27

Browse files
LorenzoBianconiAlexei Starovoitov
authored andcommitted
net: mvneta: enable jumbo frames if the loaded XDP program support frags
Enable the capability to receive jumbo frames even if the interface is running in XDP mode if the loaded program declare to properly support xdp frags. At same time reject a xdp program not supporting xdp frags if the driver is running in xdp frags mode. Acked-by: Toke Hoiland-Jorgensen <[email protected]> Acked-by: John Fastabend <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Link: https://lore.kernel.org/r/6909f81a3cbb8fb6b88e914752c26395771b882a.1642758637.git.lorenzo@kernel.org Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent c2f2cdb commit e121d27

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3778,6 +3778,7 @@ static void mvneta_percpu_disable(void *arg)
37783778
static int mvneta_change_mtu(struct net_device *dev, int mtu)
37793779
{
37803780
struct mvneta_port *pp = netdev_priv(dev);
3781+
struct bpf_prog *prog = pp->xdp_prog;
37813782
int ret;
37823783

37833784
if (!IS_ALIGNED(MVNETA_RX_PKT_SIZE(mtu), 8)) {
@@ -3786,8 +3787,11 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
37863787
mtu = ALIGN(MVNETA_RX_PKT_SIZE(mtu), 8);
37873788
}
37883789

3789-
if (pp->xdp_prog && mtu > MVNETA_MAX_RX_BUF_SIZE) {
3790-
netdev_info(dev, "Illegal MTU value %d for XDP mode\n", mtu);
3790+
if (prog && !prog->aux->xdp_has_frags &&
3791+
mtu > MVNETA_MAX_RX_BUF_SIZE) {
3792+
netdev_info(dev, "Illegal MTU %d for XDP prog without frags\n",
3793+
mtu);
3794+
37913795
return -EINVAL;
37923796
}
37933797

@@ -4528,8 +4532,9 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
45284532
struct mvneta_port *pp = netdev_priv(dev);
45294533
struct bpf_prog *old_prog;
45304534

4531-
if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
4532-
NL_SET_ERR_MSG_MOD(extack, "MTU too large for XDP");
4535+
if (prog && !prog->aux->xdp_has_frags &&
4536+
dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
4537+
NL_SET_ERR_MSG_MOD(extack, "prog does not support XDP frags");
45334538
return -EOPNOTSUPP;
45344539
}
45354540

0 commit comments

Comments
 (0)