From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88A26A0C43; Fri, 22 Oct 2021 12:18:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 619B94114A; Fri, 22 Oct 2021 12:18:42 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 9C78A41149 for ; Fri, 22 Oct 2021 12:18:41 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 15C007F6F8; Fri, 22 Oct 2021 13:18:41 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id A240D7F5FD; Fri, 22 Oct 2021 13:18:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru A240D7F5FD Authentication-Results: shelob.oktetlabs.ru/A240D7F5FD; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Thomas Monjalon , Ferruh Yigit , Ajit Khaparde , Huisong Li , Konstantin Ananyev , Rosen Xu Cc: dev@dpdk.org, Ivan Ilchenko Date: Fri, 22 Oct 2021 13:18:28 +0300 Message-Id: <20211022101828.649441-1-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] ethdev: forbid MTU set before device configure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ivan Ilchenko 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 --- 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