> -----Original Message----- > From: dev <[email protected]> On Behalf Of Andrew Rybchenko > Sent: Friday, October 22, 2021 6:18 PM > To: Thomas Monjalon <[email protected]>; Yigit, Ferruh > <[email protected]>; Ajit Khaparde <[email protected]>; > Huisong Li <[email protected]>; Ananyev, Konstantin > <[email protected]>; Xu, Rosen <[email protected]> > Cc: [email protected]; Ivan Ilchenko <[email protected]> > Subject: [dpdk-dev] [PATCH] ethdev: forbid MTU set before device > configure > > From: Ivan Ilchenko <[email protected]> > > 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 <[email protected]> > Signed-off-by: Andrew Rybchenko <[email protected]> > --- > lib/ethdev/rte_ethdev.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > 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; > -- > 2.30.2 Hi Ivan,
We meet an issue based on this patch when test dpdk21.11-rc1. BugID: https://bugs.dpdk.org/show_bug.cgi?id=864, could you pls have a look?

