DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: forbid MTU set before device configure
@ 2021-10-22 10:18 Andrew Rybchenko
  2021-10-22 13:21 ` Ferruh Yigit
  2021-10-29  5:58 ` Jiang, YuX
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Rybchenko @ 2021-10-22 10:18 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, Ajit Khaparde, Huisong Li,
	Konstantin Ananyev, Rosen Xu
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <ivan.ilchenko@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.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-01  9:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 10:18 [dpdk-dev] [PATCH] ethdev: forbid MTU set before device configure Andrew Rybchenko
2021-10-22 13:21 ` Ferruh Yigit
2021-10-22 13:27   ` Ferruh Yigit
2021-10-29  5:58 ` Jiang, YuX
2021-10-29  6:19   ` Andrew Rybchenko
2021-10-29  9:22     ` Ferruh Yigit
2021-11-01  9:39       ` Jiang, YuX
2021-11-01  9:42         ` Andrew Rybchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).