Skip to content

Commit

Permalink
ethdev: forbid MTU set before device configure
Browse files Browse the repository at this point in the history
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: 1bb4a52 ("ethdev: fix max Rx packet length")

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
ol-vanyaio authored and Ferruh Yigit committed Oct 22, 2021
1 parent 9ce1717 commit b26bee1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ethdev/rte_ethdev.c
Expand Up @@ -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;
Expand Down

0 comments on commit b26bee1

Please sign in to comment.