diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c index 34e98aa6b95623b354e99d4235962cabec59d700..752c45763ed90c7aa55836d662fc5da9218c6e0e 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/main.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c @@ -221,7 +221,7 @@ static int nfp_bpf_setup_tc(struct nfp_app *app, struct net_device *netdev, } static int -nfp_bpf_change_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) +nfp_bpf_check_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) { struct nfp_net *nn = netdev_priv(netdev); unsigned int max_mtu; @@ -413,7 +413,7 @@ const struct nfp_app_type app_bpf = { .init = nfp_bpf_init, .clean = nfp_bpf_clean, - .change_mtu = nfp_bpf_change_mtu, + .check_mtu = nfp_bpf_check_mtu, .extra_cap = nfp_bpf_extra_cap, diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app.h b/drivers/net/ethernet/netronome/nfp/nfp_app.h index 20546ae67909027c641a1df46e95e18fa979f456..2d9cb2528fc7fb7bae771f13fbc5a4b1e65e13bb 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_app.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_app.h @@ -86,8 +86,8 @@ extern const struct nfp_app_type app_flower; * @repr_clean: representor about to be unregistered * @repr_open: representor netdev open callback * @repr_stop: representor netdev stop callback - * @change_mtu: MTU change on a netdev has been requested (veto-only, change - * is not guaranteed to be committed) + * @check_mtu: MTU change request on a netdev (verify it is valid) + * @repr_change_mtu: MTU change request on repr (make and verify change) * @start: start application logic * @stop: stop application logic * @ctrl_msg_rx: control message handler @@ -124,8 +124,10 @@ struct nfp_app_type { int (*repr_open)(struct nfp_app *app, struct nfp_repr *repr); int (*repr_stop)(struct nfp_app *app, struct nfp_repr *repr); - int (*change_mtu)(struct nfp_app *app, struct net_device *netdev, - int new_mtu); + int (*check_mtu)(struct nfp_app *app, struct net_device *netdev, + int new_mtu); + int (*repr_change_mtu)(struct nfp_app *app, struct net_device *netdev, + int new_mtu); int (*start)(struct nfp_app *app); void (*stop)(struct nfp_app *app); @@ -247,11 +249,20 @@ nfp_app_repr_clean(struct nfp_app *app, struct net_device *netdev) } static inline int -nfp_app_change_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) +nfp_app_check_mtu(struct nfp_app *app, struct net_device *netdev, int new_mtu) { - if (!app || !app->type->change_mtu) + if (!app || !app->type->check_mtu) return 0; - return app->type->change_mtu(app, netdev, new_mtu); + return app->type->check_mtu(app, netdev, new_mtu); +} + +static inline int +nfp_app_repr_change_mtu(struct nfp_app *app, struct net_device *netdev, + int new_mtu) +{ + if (!app || !app->type->repr_change_mtu) + return 0; + return app->type->repr_change_mtu(app, netdev, new_mtu); } static inline int nfp_app_start(struct nfp_app *app, struct nfp_net *ctrl) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index a05be0ab27134d7cfaf16f8ef196b5355f02eadd..43a9c207a04959c8eb4c61cc417abe2bb8f8f3ca 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -3066,7 +3066,7 @@ static int nfp_net_change_mtu(struct net_device *netdev, int new_mtu) struct nfp_net_dp *dp; int err; - err = nfp_app_change_mtu(nn->app, netdev, new_mtu); + err = nfp_app_check_mtu(nn->app, netdev, new_mtu); if (err) return err; diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 619570524d2a4989fc0c91c25c42289f90ecd9c7..0cd077addb26a5bd666a15d3d1c361186d8f8678 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -196,8 +196,19 @@ nfp_repr_get_offload_stats(int attr_id, const struct net_device *dev, static int nfp_repr_change_mtu(struct net_device *netdev, int new_mtu) { struct nfp_repr *repr = netdev_priv(netdev); + int err; - return nfp_app_change_mtu(repr->app, netdev, new_mtu); + err = nfp_app_check_mtu(repr->app, netdev, new_mtu); + if (err) + return err; + + err = nfp_app_repr_change_mtu(repr->app, netdev, new_mtu); + if (err) + return err; + + netdev->mtu = new_mtu; + + return 0; } static netdev_tx_t nfp_repr_xmit(struct sk_buff *skb, struct net_device *netdev)