[PATCH] net/nfp: add the restrict of setting the mtu

Stephen Hemminger stephen at networkplumber.org
Thu Mar 17 19:29:54 CET 2022


On Thu, 17 Mar 2022 16:39:17 +0200
Peng Zhang <peng.zhang at corigine.com> wrote:

> +	/* the setting mtu is in the range */
> +	if (mtu < 68 || mtu > hw->max_mtu) {
> +		PMD_DRV_LOG(ERR, "the setting mtu cannot be less than 68 or more than %d",
> +			    hw->max_mtu);
> +		return -ERANGE;
> +	}
> +
> +	/* the setting mtu is lower than flbufsz */
> +	if (mtu > hw->flbufsz) {
> +		PMD_DRV_LOG(ERR, "the setting mtu must be lower than current mbufsize of %d",
> +			    hw->flbufsz);
> +		return -ERANGE;

The ethdev layer already has min/max mtu checks, why is it needed inside common code?

It looks like nfp_net_infos_get() does not set these values.
Please fix it there instead.

PS: 68 is RTE_ETHER_MIN_MTU so please use that.


More information about the dev mailing list