Skip to content

Commit 7b1b62b

Browse files
elkablodavem330
authored andcommitted
net: marvell: mvpp2: increase MTU limit when XDP enabled
Currently mvpp2_xdp_setup won't allow attaching XDP program if mtu > ETH_DATA_LEN (1500). The mvpp2_change_mtu on the other hand checks whether MVPP2_RX_PKT_SIZE(mtu) > MVPP2_BM_LONG_PKT_SIZE. These two checks are semantically different. Moreover this limit can be increased to MVPP2_MAX_RX_BUF_SIZE, since in mvpp2_rx we have xdp.data = data + MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM; xdp.frame_sz = PAGE_SIZE; Change the checks to check whether mtu > MVPP2_MAX_RX_BUF_SIZE Fixes: 07dd0a7 ("mvpp2: add basic XDP support") Signed-off-by: Marek Behún <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e4e9bfb commit 7b1b62b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5017,11 +5017,13 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu)
50175017
mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8);
50185018
}
50195019

5020+
if (port->xdp_prog && mtu > MVPP2_MAX_RX_BUF_SIZE) {
5021+
netdev_err(dev, "Illegal MTU value %d (> %d) for XDP mode\n",
5022+
mtu, (int)MVPP2_MAX_RX_BUF_SIZE);
5023+
return -EINVAL;
5024+
}
5025+
50205026
if (MVPP2_RX_PKT_SIZE(mtu) > MVPP2_BM_LONG_PKT_SIZE) {
5021-
if (port->xdp_prog) {
5022-
netdev_err(dev, "Jumbo frames are not supported with XDP\n");
5023-
return -EINVAL;
5024-
}
50255027
if (priv->percpu_pools) {
50265028
netdev_warn(dev, "mtu %d too high, switching to shared buffers", mtu);
50275029
mvpp2_bm_switch_buffers(priv, false);
@@ -5307,8 +5309,8 @@ static int mvpp2_xdp_setup(struct mvpp2_port *port, struct netdev_bpf *bpf)
53075309
bool running = netif_running(port->dev);
53085310
bool reset = !prog != !port->xdp_prog;
53095311

5310-
if (port->dev->mtu > ETH_DATA_LEN) {
5311-
NL_SET_ERR_MSG_MOD(bpf->extack, "XDP is not supported with jumbo frames enabled");
5312+
if (port->dev->mtu > MVPP2_MAX_RX_BUF_SIZE) {
5313+
NL_SET_ERR_MSG_MOD(bpf->extack, "MTU too large for XDP");
53125314
return -EOPNOTSUPP;
53135315
}
53145316

0 commit comments

Comments
 (0)