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 71049A0C41; Sun, 24 Oct 2021 18:42:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 043044003E; Sun, 24 Oct 2021 18:42:50 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 416834003C for ; Sun, 24 Oct 2021 18:42:48 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id AB12C7F6FA; Sun, 24 Oct 2021 19:42:47 +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 570297F5F5; Sun, 24 Oct 2021 19:42:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 570297F5F5 Authentication-Results: shelob.oktetlabs.ru/570297F5F5; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Xiaoyun Li , Rosen Xu , Ajit Khaparde , Ferruh Yigit , Konstantin Ananyev , Ivan Ilchenko Cc: dev@dpdk.org Date: Sun, 24 Oct 2021 19:42:37 +0300 Message-Id: <20211024164237.2116166-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] app/testpmd: fix MTU configuration before device start 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" There is no point to do rte_eth_dev_mtu_set() before configure since set MTU value is overwritten on configure anyway. So, setting of MTU before configure is rejected now on ethdev level. If testpmd is going to do configure (e.g. just after testpmd start with disabled devices start up or any configuration changes in stopped state which require reconfigure), just save requested MTU in device config to be applied on reconfigure. Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") Fixes: be0433cf953c ("ethdev: forbid MTU set before device configure") Signed-off-by: Andrew Rybchenko --- app/test-pmd/config.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a18871d461..3b97164302 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1241,10 +1241,12 @@ port_mtu_set(portid_t port_id, uint16_t mtu) if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - diag = rte_eth_dev_set_mtu(port_id, mtu); - if (diag != 0) { - fprintf(stderr, "Set MTU failed. diag=%d\n", diag); - return; + if (port->need_reconfig == 0) { + diag = rte_eth_dev_set_mtu(port_id, mtu); + if (diag != 0) { + fprintf(stderr, "Set MTU failed. diag=%d\n", diag); + return; + } } port->dev_conf.rxmode.mtu = mtu; -- 2.30.2