Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df13c59b authored by Pieter Jansen van Vuuren's avatar Pieter Jansen van Vuuren Committed by David S. Miller
Browse files

nfp: flower: remove headroom from max MTU calculation



Since commit 29a5dcae ("nfp: flower: offload phys port MTU change") we
take encapsulation headroom into account when calculating the max allowed
MTU.  This is unnecessary as the max MTU advertised by firmware should have
already accounted for encap headroom.

Subtracting headroom twice brings the max MTU below what's necessary for
some deployments.

Fixes: 29a5dcae ("nfp: flower: offload phys port MTU change")
Signed-off-by: default avatarPieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 680a2846
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@

#define NFP_FLOWER_ALLOWED_VER 0x0001000000010000UL

#define NFP_FLOWER_FRAME_HEADROOM	158

static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn)
{
	return "FLOWER";
@@ -559,22 +557,6 @@ static void nfp_flower_clean(struct nfp_app *app)
	app->priv = NULL;
}

static int
nfp_flower_check_mtu(struct nfp_app *app, struct net_device *netdev,
		     int new_mtu)
{
	/* The flower fw reserves NFP_FLOWER_FRAME_HEADROOM bytes of the
	 * supported max MTU to allow for appending tunnel headers. To prevent
	 * unexpected behaviour this needs to be accounted for.
	 */
	if (new_mtu > netdev->max_mtu - NFP_FLOWER_FRAME_HEADROOM) {
		nfp_err(app->cpp, "New MTU (%d) is not valid\n", new_mtu);
		return -EINVAL;
	}

	return 0;
}

static bool nfp_flower_check_ack(struct nfp_flower_priv *app_priv)
{
	bool ret;
@@ -656,7 +638,6 @@ const struct nfp_app_type app_flower = {
	.init		= nfp_flower_init,
	.clean		= nfp_flower_clean,

	.check_mtu	= nfp_flower_check_mtu,
	.repr_change_mtu  = nfp_flower_repr_change_mtu,

	.vnic_alloc	= nfp_flower_vnic_alloc,