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 833B0A04B1; Thu, 5 Nov 2020 10:53:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF284BC5E; Thu, 5 Nov 2020 10:53:19 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id AE6AFBBB4 for ; Thu, 5 Nov 2020 10:53:17 +0100 (CET) IronPort-SDR: AODf/5rAxj3tHbY698zrrbxWdLUb6wOkTCpk7g4cYxa0rscCkMUVVgZhQHXE7Icb7TI+gp65P+ +/OnPEsnnamA== X-IronPort-AV: E=McAfee;i="6000,8403,9795"; a="156347583" X-IronPort-AV: E=Sophos;i="5.77,453,1596524400"; d="scan'208";a="156347583" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 01:53:15 -0800 IronPort-SDR: F0ZyvRqyQxs2UtZRkUaHzUbSlcEIQtaVk4KIv82Ir7eGddpqCbzfOplBHFnJOeQ3feJtd6yNQk CH7p+KVoNzjA== X-IronPort-AV: E=Sophos;i="5.77,453,1596524400"; d="scan'208";a="529355504" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 01:53:12 -0800 From: Steve Yang To: dev@dpdk.org Cc: ferruh.yigit@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com, bernard.iremonger@intel.com, qiming.yang@intel.com, mdr@ashroe.eu, nhorman@tuxdriver.com, andrew.rybchenko@oktetlabs.ru, Steve Yang Date: Thu, 5 Nov 2020 09:51:51 +0000 Message-Id: <20201105095151.61052-1-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] app/testpmd: fix the overhead overflow issue 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" If "dev_info.max_mtu" isn't set by driver, the rte_ethdev will set default value "UINT16_MAX", that will cause the overhead value overflow. Add more strict condition to ensure the overhead valid. Fixes: bed05536c8f8 ("app/testpmd: fix max Rx packet length for VLAN packets") Signed-off-by: Steve Yang --- app/test-pmd/testpmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c263121a9a..b34eaf2016 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1459,7 +1459,10 @@ init_config(void) "rte_eth_dev_info_get() failed\n"); /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */ - if (port->dev_info.max_rx_pktlen && port->dev_info.max_mtu) + if (port->dev_info.max_mtu && + port->dev_info.max_mtu != UINT16_MAX && + port->dev_info.max_rx_pktlen && + port->dev_info.max_rx_pktlen > port->dev_info.max_mtu) overhead_len = port->dev_info.max_rx_pktlen - port->dev_info.max_mtu; else -- 2.17.1