DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: add bulk free function
@ 2019-09-11  9:19 Morten Brørup
  2019-09-11 11:18 ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Morten Brørup @ 2019-09-11  9:19 UTC (permalink / raw)
  To: olivier.matz; +Cc: dev, Morten Brørup

Add function for freeing a bulk of mbufs.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 98225ec80..f2e174da1 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1907,6 +1907,23 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
 	}
 }
 
+/**
+ * Free a bulk of mbufs back into their original mempool.
+ *
+ *  @param mbufs
+ *    Array of pointers to mbufs
+ *  @param count
+ *    Array size
+ */
+static inline void
+rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned count)
+{
+	unsigned idx = 0;
+
+	for (idx = 0; idx < count; idx++)
+		rte_pktmbuf_free(mbufs[idx]);
+}
+
 /**
  * Creates a "clone" of the given packet mbuf.
  *
-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-15  9:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  9:19 [dpdk-dev] [PATCH] mbuf: add bulk free function Morten Brørup
2019-09-11 11:18 ` Stephen Hemminger
2019-09-11 11:29   ` Van Haaren, Harry
2019-09-11 11:41     ` Ananyev, Konstantin
2019-09-15  9:07       ` Morten Brørup
2019-09-15  9:24       ` Morten Brørup
2019-09-11 11:33   ` Olivier Matz
2019-09-11 11:39     ` Stephen Hemminger
2019-09-11 12:14     ` Morten Brørup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).