From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11F0EA04DD; Mon, 16 Nov 2020 19:50:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E1BC323E; Mon, 16 Nov 2020 19:50:27 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5CC7C31FC for ; Mon, 16 Nov 2020 19:50:26 +0100 (CET) IronPort-SDR: 8r2c8ZpIoPI7wYRfBtZrzVz5MlpvhsUUJEDx5bCvDdJic1G4yjyKewTLzRq6S7WwcqiXeR2r0Q ruKjC6JBe5kQ== X-IronPort-AV: E=McAfee;i="6000,8403,9807"; a="188844151" X-IronPort-AV: E=Sophos;i="5.77,483,1596524400"; d="scan'208";a="188844151" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2020 10:50:19 -0800 IronPort-SDR: Clk9cc+DxZsblQ7YW+AGAh3fKFn11UvrZPgeJLsFm3XTPEKAZoR353vF/A0WpQBO+almwJegek tmZTQGDLDmPQ== X-IronPort-AV: E=Sophos;i="5.77,483,1596524400"; d="scan'208";a="475630589" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.227.57]) ([10.213.227.57]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2020 10:50:15 -0800 To: Wenzhuo Lu , Beilei Xing , Bernard Iremonger Cc: dev@dpdk.org, Qi Zhang , Steve Yang , Thomas Monjalon , Andrew Rybchenko , Konstantin Ananyev , Olivier Matz , Lance Richardson , David Marchand References: <20201105180942.2938152-1-ferruh.yigit@intel.com> <20201113114400.3356527-1-ferruh.yigit@intel.com> From: Ferruh Yigit Message-ID: <93c1f68a-75aa-c7f4-b245-7bd477006a07@intel.com> Date: Mon, 16 Nov 2020 18:50:11 +0000 MIME-Version: 1.0 In-Reply-To: <20201113114400.3356527-1-ferruh.yigit@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix MTU after device configure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On 11/13/2020 11:44 AM, Ferruh Yigit wrote: > In 'rte_eth_dev_configure()', if 'DEV_RX_OFFLOAD_JUMBO_FRAME' is not set > the max frame size is limited to 'RTE_ETHER_MAX_LEN' (1518). > This is mistake because for the PMDs that has frame size bigger than > "RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN" (18 bytes), the MTU becomes > less than 1500, causing a valid frame with 1500 bytes payload to be > dropped. > > Since 'rte_eth_dev_set_mtu()' works as expected, it is called after > 'rte_eth_dev_configure()' to fix the MTU. > It may look redundant to set MTU after 'rte_eth_dev_configure()', both > with default values, but it is not, the resulting MTU config can be > different in the device based on frame overhead of the PMD. > > And instead of setting the MTU to default value, it is first get via > 'rte_eth_dev_get_mtu()' and set again, this is to cover cases MTU > changed from testpmd command line. > > 'rte_eth_dev_set_mtu()', '-ENOTSUP' error is ignored to prevent > irrelevant warning messages for the virtual PMDs. > > Signed-off-by: Ferruh Yigit > Reviewed-by: Qi Zhang > --- > Cc: Steve Yang > Cc: Thomas Monjalon > Cc: Andrew Rybchenko > Cc: Konstantin Ananyev > Cc: Olivier Matz > Cc: Lance Richardson > --- > app/test-pmd/testpmd.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 33fc0fddf5..48e9647fc7 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2537,6 +2537,8 @@ start_port(portid_t pid) > } > > if (port->need_reconfig > 0) { > + uint16_t mtu = RTE_ETHER_MTU; > + > port->need_reconfig = 0; > > if (flow_isolate_all) { > @@ -2570,6 +2572,23 @@ start_port(portid_t pid) > port->need_reconfig = 1; > return -1; > } > + > + /* > + * Workaround for rte_eth_dev_configure(), max_rx_pkt_len > + * set MTU wrong for the PMDs that have frame overhead > + * bigger than RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN. > + * For a PMD that has 26 bytes overhead, rte_eth_dev_configure() > + * can set MTU to max 1492, not to expected 1500 bytes. > + * Using rte_eth_dev_set_mtu() to be able to set MTU correctly, > + * default MTU value is 1500. > + */ > + diag = rte_eth_dev_get_mtu(pi, &mtu); > + if (diag) > + printf("Failed to get MTU for port %d\n", pi); > + diag = rte_eth_dev_set_mtu(pi, mtu); > + if (diag != 0 && diag != -ENOTSUP) > + printf("Failed to set MTU to %u for port %d\n", > + mtu, pi); > } > if (port->need_reconfig_queues > 0) { > port->need_reconfig_queues = 0; > @David highlighted that 'scatter' tests are failing in the lab with this commit, https://lab.dpdk.org/results/dashboard/patchsets/14492/ With above commit only 'mtu' is taken into account, so in testpmd both "--max-pkt-len=N" parameter and "port config all max-pkt-len #" command are no more working as expected. This seems the reason of the failure. Technically it is possible to fix dts testcase by adding following commands: port stop all port config mtu 0 9000 port start all But, there may be other side affects from "max-pkt-len" is not working in testpmd as expected. Reverting this one too can be safest option. For now we need to live with the issue this patch is fixing, hopefully we can fix it in next release with fixing all testpmd, ethdev and drivers, there is a question about ethdev change if it will be an ABI break or not, we will see it. And there is a longer term target to deprecate 'max_rx_pkt_len' and 'mtu' to unify them: https://patches.dpdk.org/patch/81591/