From patchwork Mon Feb 20 16:40:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 124191 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 32C3541CEC; Mon, 20 Feb 2023 17:41:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35978430A9; Mon, 20 Feb 2023 17:41:42 +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 ACB53430A1 for ; Mon, 20 Feb 2023 17:41:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676911299; 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=ffreHUI2KHU4zA/xbCcobx0D7TrWDhGcjU4LN3iil45JxfWKZvpPJr7bu5pK6Xhhcr/Z6f Yo7QRSj6VzJMA5PKtum/fZK/e+J9wG6IuaeCtk8mxcRNNc+WcAhdUa04WZ+wTbHcNdUbFN mrW+axXXfIpOlDfa+03lqNUdAX+NY+o= 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 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 "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);