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 C1F51A04E7; Mon, 2 Nov 2020 09:54:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66CA1BBB4; Mon, 2 Nov 2020 09:54:09 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id CEBF7BBA4 for ; Mon, 2 Nov 2020 09:54:06 +0100 (CET) IronPort-SDR: B+pUcTsX2Jxxs2uqP8+cj0EXVVLpZydxx/shPwtlfpOx16+vLj2iGEd8wOybJorwUSe8Yjci5M Z/3PmoQiKtkA== X-IronPort-AV: E=McAfee;i="6000,8403,9792"; a="253562017" X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="253562017" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 00:54:06 -0800 IronPort-SDR: ETc+/n8yy2utQ4CYRfH+c0Y3ajKr2OB+LWZ2RRsjz71p95/pIZLfCc7V6SuITxet20/YFrHMXR YkHpBQ8ddD5A== X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="537939364" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 00:54:02 -0800 From: SteveX Yang To: dev@dpdk.org Cc: ferruh.yigit@intel.com, konstantin.ananyev@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com, bernard.iremonger@intel.com, qiming.yang@intel.com, mdr@ashroe.eu, nhorman@tuxdriver.com, SteveX Yang Date: Mon, 2 Nov 2020 08:52:33 +0000 Message-Id: <20201102085234.72779-2-stevex.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102085234.72779-1-stevex.yang@intel.com> References: <20201028030334.30300-1-stevex.yang@intel.com> <20201102085234.72779-1-stevex.yang@intel.com> Subject: [dpdk-dev] [PATCH v8 1/2] app/testpmd: fix max rx packet length for VLAN packets 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" When the max rx packet length is smaller than the sum of mtu size and ether overhead size, it should be enlarged, otherwise the VLAN packets will be dropped. Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines") Signed-off-by: SteveX Yang --- app/test-pmd/testpmd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 33fc0fddf..c263121a9 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1421,6 +1421,7 @@ init_config(void) struct rte_gro_param gro_param; uint32_t gso_types; uint16_t data_size; + uint16_t overhead_len; bool warning = 0; int k; int ret; @@ -1457,6 +1458,28 @@ init_config(void) rte_exit(EXIT_FAILURE, "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) + overhead_len = port->dev_info.max_rx_pktlen - + port->dev_info.max_mtu; + else + overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; + + port->dev_conf.rxmode.max_rx_pkt_len = + RTE_ETHER_MTU + overhead_len; + + /* + * This is workaround to avoid resize max rx packet len. + * Ethdev assumes jumbo frame size must be greater than + * RTE_ETHER_MAX_LEN, and will resize 'max_rx_pkt_len' to + * default value when it is greater than RTE_ETHER_MAX_LEN + * for normal frame. + */ + if (port->dev_conf.rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) { + port->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + } + if (!(port->dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)) port->dev_conf.txmode.offloads &= -- 2.17.1