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 7D235A052A; Sun, 27 Dec 2020 04:34:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EDF8C9A4; Sun, 27 Dec 2020 04:33:49 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by dpdk.org (Postfix) with ESMTP id 438685323 for ; Sun, 27 Dec 2020 04:33:46 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id b5so4616869pjk.2 for ; Sat, 26 Dec 2020 19:33:46 -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=/WyO9locHceI92Htsvz2ur8kSND8EVOz/eXXEEe1Moc=; b=GxafI8SFUj/NDnkUs9v361QoiI+pssDN6Vk63eDIgWOJLi2zRcSOiPwqQ53U9bN9k7 vSyDBwAKmogigzJkTxUsaZPC5ouax7Z8FOfn+mNf4IF/RuwHZT4PqXka71tMFcHZMgUW BOPIwYMn7ZRlzWYCN0x4X+CJ7c17LCP8Z7fLygUlNRI4jEsEIHCd/LuWTkCGlClO7JcP xa6+Sw1/dbbhBJPMf4wQZW10XAVUDPsTwHYoxX6FjZa6rHRxySWo5JhKv2Wha392A+ZX nzHZF7KKb8EVxY7fZnwmn26La8VltAIi/i8n/mucl5TgrlmTWUkOVqKtn4GBP+THSCqf IXEA== 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=/WyO9locHceI92Htsvz2ur8kSND8EVOz/eXXEEe1Moc=; b=FKFglx8262VtXiu6SXrl4s2zdbgD+qFqXpoP+HA1vw9FVlEErkpmIC86gyNHoTJnO+ 0nFHfAz4fAECtHKhqeyl3AsgA+/WsiWZsTGiNeSE2CrcfEZGfyPNk4Pyc7GtpDQKQKpq Ouaos8nxeQqHJpOnrc+8FGtTPYE8bqosaXgtZAP/l5//3E+xjKmTkmnaK0PzN/BdU2CJ k2/ZcMiZdw9LGqyMPoLNWkrbEWj7CqRM/oCPY6nX/1YA1FHZhI1U1ZMfamolrPaKWeIe Q+ZsSblYq5rxzJwL4FjGoduMIZKpytGBr0sAZzqeEKJx9hdRr5moMRoqlNvcNThoL2X/ BBTw== X-Gm-Message-State: AOAM5323ZLoUAdWWOymlU4vMhFjaGEGrtb+ZqCXzURLgySF3sunc6AeE ViTWfROLTrWwAtN+Kqyf3RiNYHcWyFGkuA== X-Google-Smtp-Source: ABdhPJwZU45FElSbMz5lfcoE9lAUWtofsUf8d95o42j00nsLY5SFO+9OG5eeOWKG5wEMSzkRCV4Ipg== X-Received: by 2002:a17:902:6947:b029:db:c7fd:9db3 with SMTP id k7-20020a1709026947b02900dbc7fd9db3mr39190925plt.56.1609040024116; Sat, 26 Dec 2020 19:33:44 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m10sm9377462pjn.53.2020.12.26.19.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Dec 2020 19:33:43 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan Date: Sat, 26 Dec 2020 19:33:34 -0800 Message-Id: <20201227033335.85145-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201227033335.85145-1-stephen@networkplumber.org> References: <20201227033335.85145-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/2] 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..f986c7e9d67e 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