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 EF6D141CEC for ; Mon, 20 Feb 2023 17:41:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD313430A2; Mon, 20 Feb 2023 17:41:37 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id AF2D5430A4 for ; Mon, 20 Feb 2023 17:41:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676911295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8dB3xH8Qd5agJ39G43KCX+LIjqoP3+D7AAGDzIFSo7g=; b=SqgurATZSyoR+q43tVyd7v/6HiLBBIabmBGOiDXr8LQGlEJ7prdOjOerj0We8v6XHDDqVR cL8O2hCd/v5vefbb0992IDE/KDJCMorvDFvQNztaPaczN5toXLMPt1vKyrgUGR4NZxJku0 sCKLinO9pWNCEpFPBpwcuES/SeVi5ew= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-S9bFMvmLOeqSS4LZjtObhQ-1; Mon, 20 Feb 2023 11:41:34 -0500 X-MC-Unique: S9bFMvmLOeqSS4LZjtObhQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4861299E743; Mon, 20 Feb 2023 16:41:33 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34F5E40C83B6; Mon, 20 Feb 2023 16:41:32 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ferruh Yigit , Aman Singh , Yuying Zhang , Robin Jarry , stable@dpdk.org, Tomasz Kulasek , Konstantin Ananyev Subject: [PATCH v2 1/9] app/testpmd: fix Tx preparation in checksum engine Date: Mon, 20 Feb 2023 17:40:55 +0100 Message-Id: <20230220164103.3041538-2-david.marchand@redhat.com> In-Reply-To: <20230220164103.3041538-1-david.marchand@redhat.com> References: <20230124104742.1265439-1-david.marchand@redhat.com> <20230220164103.3041538-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org "unprepared" packets could get to the wire in the retry loop. Split packets freeing in two stages: one for preparation failure, and one for transmission failure. Adjust dropped counter update accordingly. Fixes: 6b520d54ebfe ("app/testpmd: use Tx preparation in checksum engine") Cc: stable@dpdk.org Signed-off-by: David Marchand Reviewed-by: Ferruh Yigit --- app/test-pmd/csumonly.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 1c24598515..90a59e0aa5 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -1168,10 +1168,13 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) nb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue, tx_pkts_burst, nb_rx); - if (nb_prep != nb_rx) + if (nb_prep != nb_rx) { fprintf(stderr, "Preparing packet burst to transmit failed: %s\n", rte_strerror(rte_errno)); + fs->fwd_dropped += (nb_rx - nb_prep); + rte_pktmbuf_free_bulk(&tx_pkts_burst[nb_prep], nb_rx - nb_prep); + } nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, tx_pkts_burst, nb_prep); @@ -1179,12 +1182,12 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* * Retry if necessary */ - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { + if (unlikely(nb_tx < nb_prep) && fs->retry_enabled) { retry = 0; - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { + while (nb_tx < nb_prep && retry++ < burst_tx_retry_num) { rte_delay_us(burst_tx_delay_time); nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, - &tx_pkts_burst[nb_tx], nb_rx - nb_tx); + &tx_pkts_burst[nb_tx], nb_prep - nb_tx); } } fs->tx_packets += nb_tx; @@ -1194,11 +1197,11 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) fs->rx_bad_outer_ip_csum += rx_bad_outer_ip_csum; inc_tx_burst_stats(fs, nb_tx); - if (unlikely(nb_tx < nb_rx)) { - fs->fwd_dropped += (nb_rx - nb_tx); + if (unlikely(nb_tx < nb_prep)) { + fs->fwd_dropped += (nb_prep - nb_tx); do { rte_pktmbuf_free(tx_pkts_burst[nb_tx]); - } while (++nb_tx < nb_rx); + } while (++nb_tx < nb_prep); } get_end_cycles(fs, start_tsc); -- 2.39.2