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 D2D6A4388D; Thu, 11 Jan 2024 07:06:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CE8740266; Thu, 11 Jan 2024 07:06:07 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 04E0240042; Thu, 11 Jan 2024 07:06:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704953165; x=1736489165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6aOeNqv8ERFT+i5TKzt/Did5WDOajblaDGaqJJoqWj0=; b=Ydeot6ecJqoUCfGGgAqXjHJhz3B/TJann08DGjWYbohBp7eLboAc4Dg0 vFY+rY9+3rMT0G9rXjmA71qPAxsie2YHglV2nP2l8BtaHNmRUMA87WkRk +PFAm3GJmpiy/ZE/8S31FP3HXhjah+U4efhOhsRZ02q7VA7o8aNFrowYo HgesHcimjsKUfVIWi4ApRvX+Md16tlhZUyF4+TB6vmq1YI38hM6UJ902c XcSkjQyO1fRuGQjZ6eAlFWRSU7Ni3/DU/87S2+4No7JRLQjp9toTH0W/7 +afGFUyK3uHJHxgbgPEuv1SQinTv445VDD7Q62eLN/2m5XXw7/l7dgdlR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="463038882" X-IronPort-AV: E=Sophos;i="6.04,185,1695711600"; d="scan'208";a="463038882" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 22:06:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="905829625" X-IronPort-AV: E=Sophos;i="6.04,185,1695711600"; d="scan'208";a="905829625" Received: from shwdenpg561.ccr.corp.intel.com (HELO dpdk..) ([10.239.252.3]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 22:06:00 -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 , Ferruh Yigit , David Marchand Subject: [PATCH v2] app/testpmd: use Tx preparation in txonly engine Date: Thu, 11 Jan 2024 13:25:55 +0800 Message-Id: <20240111052555.35930-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103012912.4334-1-kaiwenx.deng@intel.com> References: <20240103012912.4334-1-kaiwenx.deng@intel.com> 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 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index c2b88764be..9dc53553a7 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -335,13 +335,16 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *pkt; + struct rte_mbuf *mb; struct rte_mempool *mbp; 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; + char buf[256]; mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; @@ -396,7 +399,19 @@ 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)) { + mb = pkts_burst[nb_prep]; + rte_get_tx_ol_flag_list(mb->ol_flags, buf, sizeof(buf)); + fprintf(stderr, + "Preparing packet burst to transmit failed: %s ol_flags: %s\n", + rte_strerror(rte_errno), buf); + 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