29/09/2021 16:52, dkozl...@oss.nvidia.com: > From: Dmitry Kozlyuk <dkozl...@oss.nvidia.com> > > Performance of MLX5 PMD of different classes can benefit if PMD knows > which memory it will need to handle in advance, before the first mbuf > is sent to the PMD. It is impractical, however, to consider > all allocated memory for this purpose. Most often mbuf memory comes > from mempools that can come and go. PMD can enumerate existing mempools > on device start, but it also needs to track creation and destruction > of mempools after the forwarding starts but before an mbuf from the new > mempool is sent to the device.
I'm not sure this introduction about mlx5 is appropriate. > Add an internal API to register callback for mempool lify cycle events, lify -> life > currently RTE_MEMPOOL_EVENT_READY (after populating) > and RTE_MEMPOOL_EVENT_DESTROY (before freeing): > * rte_mempool_event_callback_register() > * rte_mempool_event_callback_unregister() > Provide a unit test for the new API. [...] > -rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, > - unsigned cache_size, unsigned private_data_size, > - int socket_id, unsigned flags) > +rte_mempool_create_empty(const char *name, unsigned int n, > + unsigned int elt_size, unsigned int cache_size, > + unsigned int private_data_size, int socket_id, unsigned int flags) This change looks unrelated. > +enum rte_mempool_event { > + /** Occurs after a mempool is successfully populated. */ > + RTE_MEMPOOL_EVENT_READY = 0, > + /** Occurs before destruction of a mempool begins. */ > + RTE_MEMPOOL_EVENT_DESTROY = 1, > +}; These events look OK. > +typedef void (rte_mempool_event_callback)( > + enum rte_mempool_event event, > + struct rte_mempool *mp, > + void *arg); Instead of "arg", I prefer the name "user_data".