[dpdk-dev,02/13] mbuf: rte_pktmbuf_free_bulk()
Checks
Commit Message
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
lib/librte_mbuf/rte_mbuf.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On Tue, 13 Dec 2016 02:08:15 +0100 (CET)
Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
>
> ---
> lib/librte_mbuf/rte_mbuf.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ead7c6e..a95d99f 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1248,6 +1248,21 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
> }
>
> /**
> + * Free multiple packet mbufs back into their original mempool(s).
> + *
> + * @param mp
> + * Pointer to array of packet mbufs to be freed.
> + * @param n
> + * Count of packet mbufs to free.
> + */
> +static inline void rte_pktmbuf_free_bulk(struct rte_mbuf **mp, uint32_t n)
> +{
> + uint32_t i;
> + for (i = 0; i < n; ++i)
> + rte_pktmbuf_free(mp[i]);
> +}
Why not do something smarter that uses mempool_put_bulk?
On Tue, Dec 13, 2016 at 01:41:11PM -0800, Stephen Hemminger wrote:
> On Tue, 13 Dec 2016 02:08:15 +0100 (CET)
> Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
>
> > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> >
> > ---
> > lib/librte_mbuf/rte_mbuf.h | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index ead7c6e..a95d99f 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -1248,6 +1248,21 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
> > }
> >
> > /**
> > + * Free multiple packet mbufs back into their original mempool(s).
> > + *
> > + * @param mp
> > + * Pointer to array of packet mbufs to be freed.
> > + * @param n
> > + * Count of packet mbufs to free.
> > + */
> > +static inline void rte_pktmbuf_free_bulk(struct rte_mbuf **mp, uint32_t n)
> > +{
> > + uint32_t i;
> > + for (i = 0; i < n; ++i)
> > + rte_pktmbuf_free(mp[i]);
> > +}
>
> Why not do something smarter that uses mempool_put_bulk?
I haven't noticed there even is something like it implemented. I'll have
a look. It can be implemented in another patch, though.
Best Regards,
Michał Mirosław
@@ -1248,6 +1248,21 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
}
/**
+ * Free multiple packet mbufs back into their original mempool(s).
+ *
+ * @param mp
+ * Pointer to array of packet mbufs to be freed.
+ * @param n
+ * Count of packet mbufs to free.
+ */
+static inline void rte_pktmbuf_free_bulk(struct rte_mbuf **mp, uint32_t n)
+{
+ uint32_t i;
+ for (i = 0; i < n; ++i)
+ rte_pktmbuf_free(mp[i]);
+}
+
+/**
* Creates a "clone" of the given packet mbuf.
*
* Walks through all segments of the given packet mbuf, and for each of them: