From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D09FCA09FF; Tue, 29 Dec 2020 21:09:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 91AA12BB8; Tue, 29 Dec 2020 21:09:20 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by dpdk.org (Postfix) with ESMTP id 9014C2B8E for ; Tue, 29 Dec 2020 21:09:18 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id be12so7630812plb.4 for ; Tue, 29 Dec 2020 12:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+wz0cuFsr/Sdgpfo0HmuQYmPhRYvVLn8AMgzq82kvaM=; b=kIyf/NTMwBt0o5pcc2nA033OFonxvYKcmVypMZgTt/wyiqZ+m9jai++/OpaAxjmNpX r8EeA1tx5Es07HMMHRDqeTHyZ20ogEQpcSgKySyabrJbFatk5mM4RzqN/kXSWgeSc0TZ NI2e3P5UsXdCROpRp6HtJiljGpp44IWL2emjw7MRv80hlBzkhuHNDwweBI0SDqaJdiJn F6NbUCjsmouDQbsmxfA/l2Rk8M3DuaixoerCLrNmI8I8ohIhRT18dszEPTrrIEmgkRyq MbukCNn/DCKrS4hTODObhG2NXlK4keynRDjeBIULZsXcLLltrcNcFdgXPSp5LSi4gDND 2dpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+wz0cuFsr/Sdgpfo0HmuQYmPhRYvVLn8AMgzq82kvaM=; b=MCSHo9S8JCrHcH4Ek9FNvBsynTsrFLEIDfCaHVY3784R1DK5FoiL+6zB7M39S+toZ1 bpK3QR047n2yYCkwtapNhd6eimqbpjSsJa8trRDyXx1NIWQ583pMwrWHZCEl9AdRHnD/ Lk2D2VaxrNIa3JtMk685v6hlw6VBrpzx4OfdBSTT/6LTpWHJyGQzODCUop0AONqeU4ay G0o+okMqEe3gRd77Y68s/wClGu52+6WT5vxAvjZM19rJcCzi3+gH+wJtnS6noW06QyXd 676WlLW1/QamC936O12QIyKCA+NE/YEbdZKo/BhRK0rKwuX5lPTcTlbN9vJG0QOSr0ss xTOw== X-Gm-Message-State: AOAM532I4Na1D3zZ24e4PAutwC9asUKgaZ+Z64Z6I+znX/0udjyvkxTJ +mWbDQWEcf748vkOqGAc/AAhWsjB/n5IRQ== X-Google-Smtp-Source: ABdhPJzDQ5gWlLe3arP9XExM7lhFg//68ixJJaWNgVrOu/nMKTv+jIQ4XzUeuz7MuvCt4GS9Z3jJwA== X-Received: by 2002:a17:90a:a781:: with SMTP id f1mr5423056pjq.111.1609272556444; Tue, 29 Dec 2020 12:09:16 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id r14sm37763237pgi.27.2020.12.29.12.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Dec 2020 12:09:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 29 Dec 2020 12:08:59 -0800 Message-Id: <20201229200901.101171-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201229200901.101171-1-stephen@networkplumber.org> References: <20201227033335.85145-1-stephen@networkplumber.org> <20201229200901.101171-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/3] pdump: use rte_pktmbuf_free bulk X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use rte_pktmbuf_free_bulk instead of loop when freeing packets. Signed-off-by: Stephen Hemminger --- app/pdump/main.c | 8 ++++---- lib/librte_pdump/rte_pdump.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index b34bf335317b..63bbe65cd843 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -477,10 +477,10 @@ pdump_rxtx(struct rte_ring *ring, uint16_t vdev_id, struct pdump_stats *stats) stats->tx_pkts += nb_in_txd; if (unlikely(nb_in_txd < nb_in_deq)) { - do { - rte_pktmbuf_free(rxtx_bufs[nb_in_txd]); - stats->freed_pkts++; - } while (++nb_in_txd < nb_in_deq); + unsigned int drops = nb_in_deq - nb_in_txd; + + rte_pktmbuf_free_bulk(&rxtx_bufs[nb_in_txd], drops); + stats->freed_pkts += drops; } } } diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index b3c8d5ce4384..3c11bd795bc1 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -93,11 +93,11 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL); if (unlikely(ring_enq < d_pkts)) { + unsigned int drops = d_pkts - ring_enq; + PDUMP_LOG(DEBUG, "only %d of packets enqueued to ring\n", ring_enq); - do { - rte_pktmbuf_free(dup_bufs[ring_enq]); - } while (++ring_enq < d_pkts); + rte_pktmbuf_free_bulk(&dup_bufs[ring_enq], drops); } } -- 2.29.2