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 B6C8E4388D; Thu, 11 Jan 2024 07:34:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E6C8402DC; Thu, 11 Jan 2024 07:34:40 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 6C0A940042; Thu, 11 Jan 2024 07:34:38 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4T9ZdR57pdz1wn6X; Thu, 11 Jan 2024 14:34:19 +0800 (CST) Received: from kwepemm600004.china.huawei.com (unknown [7.193.23.242]) by mail.maildlp.com (Postfix) with ESMTPS id 1C67E14025A; Thu, 11 Jan 2024 14:34:36 +0800 (CST) Received: from [10.67.121.59] (10.67.121.59) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 11 Jan 2024 14:34:35 +0800 Message-ID: Date: Thu, 11 Jan 2024 14:34:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2] app/testpmd: use Tx preparation in txonly engine To: Kaiwen Deng , CC: , , , Aman Singh , Yuying Zhang , Ferruh Yigit , David Marchand References: <20240103012912.4334-1-kaiwenx.deng@intel.com> <20240111052555.35930-1-kaiwenx.deng@intel.com> From: "lihuisong (C)" In-Reply-To: <20240111052555.35930-1-kaiwenx.deng@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.59] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) 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 lgtm, Acked-by: Huisong Li 在 2024/1/11 13:25, Kaiwen Deng 写道: > 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;