On Mon, Jan 20, 2020 at 05:23:21PM +0000, Viacheslav Ovsiienko wrote: > The dedicated routine rte_pktmbuf_pool_create_extbuf() is > provided to create mbuf pool with data buffers located in > the pinned external memory. The application provides the > external memory description and routine initializes each > mbuf with appropriate virtual and physical buffer address. > It is entirely application responsibility to register > external memory with rte_extmem_register() API, map this > memory, etc. > > The new introduced flag RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF > is set in private pool structure, specifying the new special > pool type. The allocated mbufs from pool of this kind will > have the EXT_ATTACHED_MBUF flag set and initialiazed shared > info structure, allowing cloning with regular mbufs (without > attached external buffers of any kind). > > Signed-off-by: Viacheslav Ovsiienko <viachesl...@mellanox.com>
[...] > @@ -247,7 +439,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int > is_header, > return 0; > } > > -/** > +/* > * @internal helper function for freeing a bulk of packet mbuf segments > * via an array holding the packet mbuf segments from the same mempool > * pending to be freed. It could be removed. [...] > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > index 7a41aad..eaeda04 100644 > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -637,6 +637,13 @@ static inline struct rte_mbuf *rte_mbuf_raw_alloc(struct > rte_mempool *mp) > void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg, > void *m, unsigned i); > > +/** The context to initialize the mbufs with pinned external buffers. */ > +struct rte_pktmbuf_extmem_init_ctx { > + const struct rte_pktmbuf_extmem *ext_mem; /* descriptor array. */ > + unsigned int ext_num; /* number of descriptors in array. */ > + unsigned int ext; /* loop descriptor index. */ > + size_t off; /* loop buffer offset. */ > +}; Can this definition be private in the .c ? Apart from this, Acked-by: Olivier Matz <olivier.m...@6wind.com>