//主进程创建struct rte_memzone,从进程只需要attach if (rte_eal_process_type() == RTE_PROC_PRIMARY && rte_fbarray_init(&mcfg->memzones, "memzone", RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) { RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n"); ret = -1; } else if (rte_ea...
*/ RTE_LOG(ERR, EAL, "Cannot allocate VA space for memseg list, retrying with different page size\n"); /* deallocate memseg list */ if (memseg_list_free(msl)) return -1; break; } total_segs += msl->memseg_arr.len; cur_pagesz_mem = total_segs * hugepage_sz; type_msl_id...
而这个数据正式来自于shared memory中的struct rte_eth_dev_data结构,并且经过前面对rte_eth_dev_pci_allocate函数的分析我们知道无论是secondary进程还是primary进程,都会进入rte_eth_dev_pci_copy_info函数中,那么就会出现这种情况:
unsigned num) { unsigned ret = kni_fifo_get(kni->tx_q, (void **)mbufs, num); /* If buffers removed, allocate mbufs and then put them into alloc_q */ if (ret) kni_allocate_mbufs(kni); return ret; }
c. memzone: 用来申请整块内存d. tailq_head: 共享队列实现,主从进程可以同时访问。 内存初始化流程如下,后面会详细看每个函数的实现。 rte_eal_init //internal_config为本进程全局变量,用来保存参数等信息 eal_reset_internal_config(&internal_config); //解析参数,保存到 internal_config eal_parse_args(argc,...
都会执行rte_memzone_reserve操作 285 rte_memzone_reserve 从memseg中分配一块内存出来 286 */ 287 if (rte_eal_memzone_init() < 0) { 288 rte_eal_init_alert("Cannot init memzone"); 289 rte_errno = ENODEV; 290 return -1; 291 } 292 293 /* 294 1.获取所有预留hugepage的物理地址并按物理...
/*try to allocate tailq entry*/te= rte_zmalloc("MEMPOOL_TAILQ_ENTRY",sizeof(*te),0);if(te ==NULL) { RTE_LOG(ERR, MEMPOOL,"Cannot allocate tailq entry!\n");gotoexit_unlock; } 接下来,就是计算整个mempool头结构多大。 mempool_size =MEMPOOL_HEADER_SIZE(mp, cache_size); ...
/* try to allocate tailq entry */te = rte_zmalloc("MEMPOOL_TAILQ_ENTRY", sizeof(*te), 0);if (te == NULL) {RTE_LOG(ERR, MEMPOOL, "Cannot allocate tailq entry!\n");goto exit_unlock;} 接下来,就是计算整个mempool头结构多大。
rte_panic("Cannot init IVSHMEM\n");#endif/*初始化rte_config->mem_config,并映射hugepage到挂载目录下的文件rte_map**/if(rte_eal_memory_init() <0) rte_panic("Cannot init memory\n");/*the directories are locked during eal_hugepage_info_init*/eal_hugedirs_unlock();/*memzone可用内存初始...
r->memzone = mz; //将链表entry插入链表ring_list TAILQ_INSERT_TAIL(ring_list, te, next); } else { r = NULL; RTE_LOG(ERR, RING, "Cannot reserve memory\n"); rte_free(te); } rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); return r;}intrte_ring_init(struct rte_ring *r, const...