dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues", sizeof(dev->data->rx_queues[0]) * nb_queues, RTE_CACHE_LINE_SIZE); } 4、网卡发送队列二级指针空间开辟 网卡不管是支持一个发送队列,还是支持多个发送队列,都需要为这个发送队列开辟二级指针空间,保存到网卡数据空间的tx_queues中,每一个元...
heap_alloc(struct malloc_heap *heap, const char *type __rte_unused, size_t size, unsigned int flags, size_t align, size_t bound, bool contig) { struct malloc_elem *elem; size = RTE_CACHE_LINE_ROUNDUP(size); align = RTE_CACHE_LINE_ROUNDUP(align); //size参数和align参数做对齐操作,...
- malloc_heap_alloc():将传入的需要malloc的空间大小和align按照CACHE_LINE_SIZE做了对齐。 size = CACHE_LINE_ROUNDUP(size); align = CACHE_LINE_ROUNDUP(align); 1. 2. 在rte_config.mem_config->malloc_heaps[]数组里,此socket对应的堆中,进行匹配,查找是否有合适内存可以分配。find_suitable_element()...
staticvoid*malloc_socket(constchar*type, size_t size, unsignedintalign,intsocket_arg,constbooltrace_ena) {void*ptr;/*return NULL if size is 0 or alignment is not power-of-2 如果申请的内存size为0或者align对齐参数为0或者align不是2的整数倍,直接返回NULL*/if(size ==0|| (align && !rte_i...
if (private_data_size) { eth_dev->data->dev_private = rte_zmalloc_socket(name, private_data_size, RTE_CACHE_LINE_SIZE, dev->device.numa_node); if (!eth_dev->data->dev_private) { rte_eth_dev_release_port(eth_dev); return NULL; ...
{returnrte_pktmbuf_pool_create_by_ops(name, n, cache_size, priv_size, data_room_size, socket_id, NULL); } data_room_size标识每一个mbuf的数据报文的最大值,一般会设置大于一个mtu+128B的头部预留空间 dpdk提供一个默认宏定义: #define RTE_PKTMBUF_HEADROOM 128 ...
#if RTE_CACHE_LINE_SIZE == 64 rte_prefetch0(RTE_PTR_ADD(m, RTE_CACHE_LINE_MIN_SIZE)); #else RTE_SET_USED(m); #endif } static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp); /** * Get the IOVA address of the mbuf data buffer....
recv_ring = rte_ring_create(_SEC_2_PRI, ring_size, rte_socket_id(), flags); send_ring_third = rte_ring_create(_PRI_2_THI, ring_size, rte_socket_id(), flags); message_pool = rte_mempool_create(_MSG_POOL, pool_size, elt_size, pool_cache, priv_data_sz, ...
(_MSG_POOL, pool_size,elt_size, pool_cache, priv_data_sz,NULL,NULL,NULL,NULL,rte_socket_id(), flags);if(send_ring ==NULL)rte_exit(EXIT_FAILURE,"Problem getting sending ring\n");if(recv_ring ==NULL)rte_exit(EXIT_FAILURE,"Problem getting receiving ring\n");if(send_ring_third ==...
8-bytes, so as to ensure we have the exact * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes * working on vector drivers easier. */ RTE_STD_C11 union { rte_iova_t buf_iova; rte_iova_t buf_physaddr; /**< deprecated */ } __rte_aligned(sizeof(rte_iova_t));...