> -----Original Message----- > From: dev <dev-boun...@dpdk.org> On Behalf Of Andrew Rybchenko > Sent: Friday, October 22, 2021 6:18 PM > To: Thomas Monjalon <tho...@monjalon.net>; Yigit, Ferruh > <ferruh.yi...@intel.com>; Ajit Khaparde <ajit.khapa...@broadcom.com>; > Huisong Li <lihuis...@huawei.com>; Ananyev, Konstantin > <konstantin.anan...@intel.com>; Xu, Rosen <rosen...@intel.com> > Cc: dev@dpdk.org; Ivan Ilchenko <ivan.ilche...@oktetlabs.ru> > Subject: [dpdk-dev] [PATCH] ethdev: forbid MTU set before device > configure > > From: Ivan Ilchenko <ivan.ilche...@oktetlabs.ru> > > 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 <ivan.ilche...@oktetlabs.ru> > Signed-off-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> > --- > 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?