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 E421643802; Wed, 3 Jan 2024 03:08:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FEEE402BC; Wed, 3 Jan 2024 03:08:36 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id A4C94402A3; Wed, 3 Jan 2024 03:08:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704247715; x=1735783715; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=iPD/eDbyp1cnjfur47n6Ib32uEaTHMr4KGWIis22NkA=; b=BiBziJuDtAQLZPpHhIW1AUDxKHjSHvTeooFvmqAm7CvOQ7F0xyb9qq4q VqrqkrO5geW2dDTTTj8GX2jyNWuQd4QpjOyo3GPfaB3R9gAVhWnf43baY 7rHxdS9eSU9nZEq7GQ3PEY73VEg2x0uDcnAcS1ifAQifE3sLSQyaOo0W2 KhH5BcNLTAg3H3Mg8n+AAQwU+Su5//1PVwEUdFXHZBDo4iurPj1d0iZua yv07eLFR6K+5IJqruTSrQeWwvOCo/BGNiwM8N6+Caflmijvmqq3/Ll8U3 mLMblHRWmUtiLJjwwheB9aXa9fJt5CuIgnvWAM0cn9+fWtacZpDeqnY9g w==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="463348166" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="463348166" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 18:08:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="898728706" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="898728706" Received: from shwdenpg561.ccr.corp.intel.com (HELO dpdk..) ([10.239.252.3]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 18:08:10 -0800 From: Kaiwen Deng To: dev@dpdk.org Cc: stable@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, Kaiwen Deng , Aman Singh , Yuying Zhang , David Marchand , Ferruh Yigit Subject: [PATCH v1] app/testpmd: use Tx preparation in txonly engine Date: Wed, 3 Jan 2024 09:29:12 +0800 Message-Id: <20240103012912.4334-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Txonly forwarding engine does not call the Tx preparation API before transmitting packets. This may cause some problems. TSO breaks when MSS spans more than 8 data fragments. Those packets will be dropped by Tx preparation API, but it will cause MDD event if txonly forwarding engine does not call the Tx preparation API before transmitting packets. We can reproduce this issue by these steps list blow on ICE and I40e. ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -- -i --tx-offloads=0x00008000 testpmd>set txpkts 64,128,256,512,64,128,256,512,512 testpmd>set burst 1 testpmd>start tx_first 1 This commit will use Tx preparation API in txonly forwarding engine. Fixes: 655131ccf727 ("app/testpmd: factorize fwd engines Tx") Cc: stable@dpdk.org Signed-off-by: Kaiwen Deng --- app/test-pmd/txonly.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index c2b88764be..60d69be3f6 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -339,6 +339,7 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_ether_hdr eth_hdr; uint16_t nb_tx; uint16_t nb_pkt; + uint16_t nb_prep; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; uint64_t tx_offloads; @@ -396,7 +397,17 @@ pkt_burst_transmit(struct fwd_stream *fs) if (nb_pkt == 0) return false; - nb_tx = common_fwd_stream_transmit(fs, pkts_burst, nb_pkt); + nb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue, + pkts_burst, nb_pkt); + if (unlikely(nb_prep != nb_pkt)) { + fprintf(stderr, + "Preparing packet burst to transmit failed: %s\n", + rte_strerror(rte_errno)); + fs->fwd_dropped += (nb_pkt - nb_prep); + rte_pktmbuf_free_bulk(&pkts_burst[nb_prep], nb_pkt - nb_prep); + } + + nb_tx = common_fwd_stream_transmit(fs, pkts_burst, nb_prep); if (txonly_multi_flow) RTE_PER_LCORE(_src_port_var) -= nb_pkt - nb_tx; -- 2.34.1