void*const*obj_table,unsignedintn,structrte_mempool_cache*cache){void**cache_objs;/* No cache provided */// 没有local cache直接入rte_ringif(unlikely(cache==NULL))gotodriver_enqueue;/* increment stat now, adding in mempool always success */RTE_MEMPOOL_CACHE_STAT_ADD(cache,put_bulk,1);RT...
void rte_mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table, unsigned int n) 直接将多个mbuf批量释放到指定内存池,依赖使用者确保被释放的mbuf都是来自该内存池。释放的mbuf必须时direct mbuf,如果释放indirect mbuf可能会导致业务异常。mbuf必须是单个mbuf。 mbuf拷贝和克隆 mbuf克隆属于浅度拷...
当mbuf不在使用了,那就需要释放他所占用的内存空间,rte_pktmbuf_free接口用于释放一个mbuf空间,内部最终调用rte_mempool_put将已经申请的空间放回到内存池中,相当于回收以便这个空间后续可以被使用。 void rte_pktmbuf_free(struct rte_mbuf *m) { //内存回收,将不再使用的对象重新放回到内存池 rte_mempool_put...
rte_mempool_ops_dequeue_bulk rte_mempool_ops_dequeue_bulk(structrte_mempool *mp,void**obj_table, unsigned n) {structrte_mempool_ops *ops; ops= rte_mempool_get_ops(mp->ops_index);returnops->dequeue(mp, obj_table, n); }staticinlinestructrte_mempool_ops *rte_mempool_get_ops(intops_index...
rte_mempool_ops_dequeue_bulk(structrte_mempool *mp,void**obj_table, unsigned n) {structrte_mempool_ops *ops; ops= rte_mempool_get_ops(mp->ops_index);returnops->dequeue(mp, obj_table, n); }staticinlinestructrte_mempool_ops *rte_mempool_get_ops(intops_index) ...
应用程序可以调用rte_mempool_create创建一个内存池; 调用rte_mempool_get从内存池中获取内存空间; 调用rte_mempool_put将不再使用的内存空间放回到内存池中。 以一个例子来说明: l2fwd二层转发时,通过rte_mempool_create创建了一个内存池,内存池中有NB_MBUF个元素。内存池创建好后,都会调用rte_pktmbuf_init初始...
使用时,rte_mempool_get从mempool中获取一个对象,然后使用rte_ring_enqueue入队列,另一个进程通过rte_ring_dequeue来出队列,使用完成后需要rte_mempool_put将对象放回mempool: send: static void cmd_send_parsed(void *parsed_result, __attribute__((unused)) struct cmdline *cl, ...
static__rte_always_inlinevoidrte_mbuf_raw_free(structrte_mbuf *m) {RTE_ASSERT(RTE_MBUF_DIRECT(m)); RTE_ASSERT(rte_mbuf_refcnt_read(m)==1); RTE_ASSERT(m->next ==NULL); RTE_ASSERT(m->nb_segs ==1);__rte_mbuf_sanity_check(m,0);rte_mempool_put(m->pool, m);}...