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 933B545E1E; Tue, 3 Dec 2024 19:35:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03BCA40676; Tue, 3 Dec 2024 19:35:42 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id F388D40261 for ; Tue, 3 Dec 2024 19:35:40 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-724f1004c79so4087745b3a.2 for ; Tue, 03 Dec 2024 10:35:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733250940; x=1733855740; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ZDrzO+/glvONeepsX+B3qm/Duyatec0i5FbbMXXZVq4=; b=Aiaq44ck/K2SPipjXPkbtzAihzlX2VeJ++1HPiygs8dKuzWk3n4pGHGE0Xp6ONSxqm VZYOc51pWqROF/G1hYja/pzf6ixYP6X3eY0g1KSHd65YG7cyC9qipQiAQX+Bu65+Qp/J Gexurbj9HB1oWo5gPrIYCVvjAvTibjV9eyN/Od11NJwo7KZpAVYz0ME8OMUwvarcIogE CeCBgT4rkUE44+RDyd8vLYkktWw6y2G+lFWJXZpyVE35V/wnzcRniCMl1n5iLDi+yb2J eL7aB/7DfWa7kY4fe+xVCXd+E/xV/Flkt89mkeS3FTMuonpbjMaWWjw3u1P67o/s/9aW oNcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733250940; x=1733855740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZDrzO+/glvONeepsX+B3qm/Duyatec0i5FbbMXXZVq4=; b=vU0h6xN9Y0khReIsI1fLAyVuwjmOobEafW8+l+K980+Qfr0b1t/qhkoF4mQFSCTubS Qotl9V5IxYyeMwtAf5BSunDdWKwp8W//63tru/sZ4TpXjL/J4piG43JS4PlUdhQ0FAKQ wvj7IpUBOJ/Qk1gOC7SJMxjkORq/OUfmUvFWu2hb6fj6Gfz87isk9sREAwnehm/NbnrT foEcxa5OfoU5uFSf1ATt4x7pmt2AaId168Bp5q8KOJrgVQ39fan9KsN2hexYVqTObuBl TvXe7TjNlx+88GxP/kY36coWqRPAE0/pSjgCDZv7FdC9BCvmn3vNhnYXBoUD2gGagEao Y4mQ== X-Gm-Message-State: AOJu0YxCqTy5ny1QDKOZ4be7I4XXoy/plQdISllkOumK+y2UglcLcZ6l Vwglh4Yf+7O5a7xFGtmbrbxx7bnIW/T1wAovKwGg0TPOUiVgyKnnfPKYqREizJA= X-Gm-Gg: ASbGncueAbSkKyucHPRcSa143bxZzJZGQrToETsP0E7Deu/j67Y90YDATwuvqiVZBM3 gfnXGwtxEgkrBih4GvXo9AsD1NwMk86aH7Df/iatqyZA7UlLMT9oid2XUUZ2zgY2NlYE1lNwvZW +U1BFHpzFzTrvE92wEX9VlPppv0uvl2kWe5U1qmVWnwrlWwReTLIJB+DZSHUYW3y6KrHhgacGrk 11YbQEUIKD35YRueU09p6nDqfWWD3AY5qOtdwzo6aPtfvHIAklYRtL2+j7qsdi+L01sM7AxxjBq kF/nbwOcw3YJfFZbc5OZKWGay2M= X-Google-Smtp-Source: AGHT+IH7xMAdyaMqAY2nMaTaR/1l0E4xGsrYu3zrukSaOn8uSRFJXw1vPvLvMIDiDF0iTwLk8ULcNQ== X-Received: by 2002:a05:6a00:13a7:b0:725:30f3:67d8 with SMTP id d2e1a72fcca58-7257f976c14mr4407875b3a.0.1733250939863; Tue, 03 Dec 2024 10:35:39 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72541761316sm10818050b3a.18.2024.12.03.10.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 10:35:39 -0800 (PST) Date: Tue, 3 Dec 2024 10:35:37 -0800 From: Stephen Hemminger To: Kaiwen Deng Cc: dev@dpdk.org, stable@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, Aman Singh , Yuying Zhang , David Marchand , Ferruh Yigit Subject: Re: [PATCH v1] app/testpmd: use Tx preparation in txonly engine Message-ID: <20241203103537.08712b3b@hermes.local> In-Reply-To: <20240103012912.4334-1-kaiwenx.deng@intel.com> References: <20240103012912.4334-1-kaiwenx.deng@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Wed, 3 Jan 2024 09:29:12 +0800 Kaiwen Deng wrote: > 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); The comment section on this patch raises lots of good points. 1. Testpmd and example applications are not calling tx_prepare. 2. Testpmd and examples are not checking descriptor limits. 3. It is not clear from documentation when tx_prepare is required. On a practical level, if testpmd was being used in txonly mode, if the condition ever triggered, you really really don't want to print a message there since it would likely be endless stream of messages. Please consider the comments and come back with a better solution in v2.