Commit e121d270 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Alexei Starovoitov

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: default avatarToke Hoiland-Jorgensen <toke@redhat.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/6909f81a3cbb8fb6b88e914752c26395771b882a.1642758637.git.lorenzo@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent c2f2cdbe
...@@ -3778,6 +3778,7 @@ static void mvneta_percpu_disable(void *arg) ...@@ -3778,6 +3778,7 @@ static void mvneta_percpu_disable(void *arg)
static int mvneta_change_mtu(struct net_device *dev, int mtu) static int mvneta_change_mtu(struct net_device *dev, int mtu)
{ {
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
struct bpf_prog *prog = pp->xdp_prog;
int ret; int ret;
if (!IS_ALIGNED(MVNETA_RX_PKT_SIZE(mtu), 8)) { if (!IS_ALIGNED(MVNETA_RX_PKT_SIZE(mtu), 8)) {
...@@ -3786,8 +3787,11 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu) ...@@ -3786,8 +3787,11 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
mtu = ALIGN(MVNETA_RX_PKT_SIZE(mtu), 8); mtu = ALIGN(MVNETA_RX_PKT_SIZE(mtu), 8);
} }
if (pp->xdp_prog && mtu > MVNETA_MAX_RX_BUF_SIZE) { if (prog && !prog->aux->xdp_has_frags &&
netdev_info(dev, "Illegal MTU value %d for XDP mode\n", mtu); mtu > MVNETA_MAX_RX_BUF_SIZE) {
netdev_info(dev, "Illegal MTU %d for XDP prog without frags\n",
mtu);
return -EINVAL; return -EINVAL;
} }
...@@ -4528,8 +4532,9 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog, ...@@ -4528,8 +4532,9 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
struct bpf_prog *old_prog; struct bpf_prog *old_prog;
if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) { if (prog && !prog->aux->xdp_has_frags &&
NL_SET_ERR_MSG_MOD(extack, "MTU too large for XDP"); dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
NL_SET_ERR_MSG_MOD(extack, "prog does not support XDP frags");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment