From: Ivan Ilchenko Date: Fri, 22 Oct 2021 10:18:28 +0000 (+0300) Subject: ethdev: forbid MTU set before device configure X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=b26bee10ee37ac2e54011f7bd57ca806bd9f8f6c ethdev: forbid MTU set before device configure rte_eth_dev_configure() always sets MTU to either dev_conf.rxmode.mtu or RTE_ETHER_MTU if application doesn't provide the value. So, there is no point to allow rte_eth_dev_set_mtu() before since set value will be overwritten on configure anyway. Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Ferruh Yigit --- diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 4ea5a657e0..0d7dd68dc1 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -3728,6 +3728,13 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu) return ret; } + if (dev->data->dev_configured == 0) { + RTE_ETHDEV_LOG(ERR, + "Port %u must be configured before MTU set\n", + port_id); + return -EINVAL; + } + ret = (*dev->dev_ops->mtu_set)(dev, mtu); if (ret == 0) dev->data->mtu = mtu;