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 04E5041CEC; Mon, 20 Feb 2023 17:42:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCDC9430BE; Mon, 20 Feb 2023 17:41:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 72692430BB for ; Mon, 20 Feb 2023 17:41:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676911311; 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=bGQSfsn1WU1PHwBwC981l2ri/gxPePjzW3KGikx6eYQ=; b=cuWI/8bhEC+c7le+0b6BdYI6++NhoMeLBcWdzyvYfxWkRiiJ838NB7OGd55F3A/WaFK0Le /ffp10ytfwWXVD2rwuMZ+9VC8i6vtSoEgsM4VBrjUii75XJ6iwdfvd3Wgkh+TbUgB0liQ9 96+qCam/o1AtyOYujorCbkCbTVChk6M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-235-6kbQZkP_Otqef8_F0DwhTw-1; Mon, 20 Feb 2023 11:41:47 -0500 X-MC-Unique: 6kbQZkP_Otqef8_F0DwhTw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E066101A521; Mon, 20 Feb 2023 16:41:46 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84EEDC15BAD; Mon, 20 Feb 2023 16:41:45 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Ferruh Yigit , Aman Singh , Yuying Zhang , Robin Jarry Subject: [PATCH v2 5/9] app/testpmd: bulk free mbufs Date: Mon, 20 Feb 2023 17:40:59 +0100 Message-Id: <20230220164103.3041538-6-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.8 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: 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 Use the bulk free helper. Signed-off-by: David Marchand Reviewed-by: Ferruh Yigit --- app/test-pmd/5tswap.c | 4 +--- app/test-pmd/csumonly.c | 4 +--- app/test-pmd/flowgen.c | 8 ++------ app/test-pmd/icmpecho.c | 4 +--- app/test-pmd/iofwd.c | 4 +--- app/test-pmd/macfwd.c | 4 +--- app/test-pmd/macswap.c | 4 +--- app/test-pmd/noisy_vnf.c | 7 ++----- app/test-pmd/rxonly.c | 4 +--- app/test-pmd/shared_rxq_fwd.c | 3 +-- app/test-pmd/testpmd.c | 4 +--- app/test-pmd/txonly.c | 4 +--- 12 files changed, 14 insertions(+), 40 deletions(-) diff --git a/app/test-pmd/5tswap.c b/app/test-pmd/5tswap.c index f041a5e1d5..c45a811f59 100644 --- a/app/test-pmd/5tswap.c +++ b/app/test-pmd/5tswap.c @@ -178,9 +178,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_rx)) { fs->fwd_dropped += (nb_rx - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_rx); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); } get_end_cycles(fs, start_tsc); } diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 90a59e0aa5..0b2d4c0593 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -1199,9 +1199,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) inc_tx_burst_stats(fs, 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_prep); + rte_pktmbuf_free_bulk(&tx_pkts_burst[nb_tx], nb_prep - nb_tx); } get_end_cycles(fs, start_tsc); diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index fd6abc0f41..bc3d684496 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -75,7 +75,6 @@ pkt_burst_flow_gen(struct fwd_stream *fs) uint16_t nb_dropped; uint16_t nb_pkt; uint16_t nb_clones = nb_pkt_flowgen_clones; - uint16_t i; uint32_t retry; uint64_t tx_offloads; uint64_t start_tsc = 0; @@ -89,8 +88,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) inc_rx_burst_stats(fs, nb_rx); fs->rx_packets += nb_rx; - for (i = 0; i < nb_rx; i++) - rte_pktmbuf_free(pkts_burst[i]); + rte_pktmbuf_free_bulk(pkts_burst, nb_rx); mbp = current_fwd_lcore()->mbp; vlan_tci = ports[fs->tx_port].tx_vlan_id; @@ -189,9 +187,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) next_flow += nb_flows_flowgen; fs->fwd_dropped += nb_dropped; - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_pkt); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx); } RTE_PER_LCORE(_next_flow) = next_flow; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 066f2a3ab7..5a779fca3c 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -503,9 +503,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_replies)) { fs->fwd_dropped += (nb_replies - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_replies); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_replies - nb_tx); } } diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c index 8fafdec548..2bcdf15728 100644 --- a/app/test-pmd/iofwd.c +++ b/app/test-pmd/iofwd.c @@ -79,9 +79,7 @@ pkt_burst_io_forward(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_rx)) { fs->fwd_dropped += (nb_rx - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_rx); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); } get_end_cycles(fs, start_tsc); diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index beb220fbb4..ba08b8f323 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -110,9 +110,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_rx)) { fs->fwd_dropped += (nb_rx - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_rx); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); } get_end_cycles(fs, start_tsc); diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 4f8deb3382..9f0933bbff 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -89,9 +89,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); if (unlikely(nb_tx < nb_rx)) { fs->fwd_dropped += (nb_rx - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_rx); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx); } get_end_cycles(fs, start_tsc); } diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index 0e72dc034f..055a80a62c 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -111,11 +111,8 @@ do_retry(uint16_t nb_rx, uint16_t nb_tx, struct rte_mbuf **pkts, static uint32_t drop_pkts(struct rte_mbuf **pkts, uint16_t nb_rx, uint16_t nb_tx) { - if (nb_tx < nb_rx) { - do { - rte_pktmbuf_free(pkts[nb_tx]); - } while (++nb_tx < nb_rx); - } + if (nb_tx < nb_rx) + rte_pktmbuf_free_bulk(&pkts[nb_tx], nb_rx - nb_tx); return nb_rx - nb_tx; } diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index d528d4f34e..8fa5e95ad4 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -46,7 +46,6 @@ pkt_burst_receive(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; uint16_t nb_rx; - uint16_t i; uint64_t start_tsc = 0; get_start_cycles(&start_tsc); @@ -61,8 +60,7 @@ pkt_burst_receive(struct fwd_stream *fs) return; fs->rx_packets += nb_rx; - for (i = 0; i < nb_rx; i++) - rte_pktmbuf_free(pkts_burst[i]); + rte_pktmbuf_free_bulk(pkts_burst, nb_rx); get_end_cycles(fs, start_tsc); } diff --git a/app/test-pmd/shared_rxq_fwd.c b/app/test-pmd/shared_rxq_fwd.c index 2e9047804b..05f90185df 100644 --- a/app/test-pmd/shared_rxq_fwd.c +++ b/app/test-pmd/shared_rxq_fwd.c @@ -53,8 +53,7 @@ forward_sub_burst(struct fwd_stream *src_fs, uint16_t port, uint16_t nb_rx, } else { /* Source stream not found, drop all packets. */ src_fs->fwd_dropped += nb_rx; - while (nb_rx > 0) - rte_pktmbuf_free(pkts[--nb_rx]); + rte_pktmbuf_free_bulk(pkts, nb_rx); } } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0c14325b8d..964cd0ce2b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2204,7 +2204,6 @@ flush_fwd_rx_queues(void) portid_t port_id; queueid_t rxq; uint16_t nb_rx; - uint16_t i; uint8_t j; uint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0; uint64_t timer_period; @@ -2237,8 +2236,7 @@ flush_fwd_rx_queues(void) do { nb_rx = rte_eth_rx_burst(port_id, rxq, pkts_burst, MAX_PKT_BURST); - for (i = 0; i < nb_rx; i++) - rte_pktmbuf_free(pkts_burst[i]); + rte_pktmbuf_free_bulk(pkts_burst, nb_rx); cur_tsc = rte_rdtsc(); diff_tsc = cur_tsc - prev_tsc; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 021624952d..076cdb86d5 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -421,9 +421,7 @@ pkt_burst_transmit(struct fwd_stream *fs) (unsigned) nb_pkt, (unsigned) nb_tx, (unsigned) (nb_pkt - nb_tx)); fs->fwd_dropped += (nb_pkt - nb_tx); - do { - rte_pktmbuf_free(pkts_burst[nb_tx]); - } while (++nb_tx < nb_pkt); + rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx); } get_end_cycles(fs, start_tsc); -- 2.39.2