socket_arg = SOCKET_ID_ANY; /*如果传入的socket参数为SOCKET_ID_ANY ,则会先尝试在当前socket上分配内存*/ if (socket_arg == SOCKET_ID_ANY) socket = malloc_get_numa_socket(); /*获取当前socket_id*/ else socket = socket_arg; /* Check socket parameter */ if (socket >= RTE_MAX_NUMA_N...
(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0); it->m_req_q = mz; /* 开辟响应队列空间 */ snprintf(obj_name, OBJNAMSIZ, "kni_resp_%d", i); mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0); it->m_resp_q = mz; //构成一个数组链表 it->next = &kni...
EAL: PCI device 0000:7d:00.0 on NUMA socket 0EAL: probe driver: 19e5:a222 net_hns3EAL: PCI device 0000:7d:00.1 on NUMA socket 0EAL: probe driver: 19e5:a221 net_hns3EAL: PCI device 0000:7d:00.2 on NUMA socket 0EAL: probe driver: 19e5:a222 net_hns3EAL: PCI device 0000:7d:...
socket_id The socket identifierwherethe memory should be allocated. Thevaluecan be SOCKET_ID_ANYifthereisno NUMA constraintforthe reserved zone. 内存应该在那个socket上申请,这里就是前面知识介绍的CPU的socket,也可以说在那个numa的node上申请。代码中设置的是rte_socket_id(),获取当前程序运行的socket id。
socket_id:ring位于的socket flags:指定创建的ring的属性:单/多生产者、单/多消费者两者之间的组合;0表示使用默认属性(多生产者、多消费者),不同的属性出入队的操作会有所不同 例如: struct rte_ring *r = rte_ring_create(“MY_RING”,1024,rte_socket_id,0); ...
(obj_name, KNI_FIFO_SIZE, 103 SOCKET_ID_ANY, 0); 104 KNI_MEM_CHECK(mz == NULL); 105 it->m_sync_addr = mz; 106 107 if ((i+1) == max_kni_ifaces) { 108 it->next = NULL; 109 kni_memzone_pool.free_tail = it; 110 } else 111 it->next = &kni_memzone_pool.slots[i+...
pthread_t thread_id;static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);struct shared_driver *solib = NULL;const char *logid;/* 只允许运⾏⼀次 */ if (!rte_atomic32_test_and_set(&run_once))return -1;logid = strrchr(argv[0], '/');logid = strdup(logid ? logid + 1...
rte_eth_tx_queue_setup(portid, 0, nb_txd, rte_eth_dev_socket_id(portid), NULL); //启动网卡,设置网卡寄存器,将网卡和系统内存关联起来 rte_eth_dev_start(portid); while (1) { //接收报文 rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); ...
=NULL||socket_arg!=SOCKET_ID_ANY)94returnret;96/* try other heaps */97for(i=0;i<RTE_MAX_NUMA_NODES;i++){98/* we already tried this one */99if(i==socket)100continue;101102ret=malloc_heap_alloc(&mcfg->malloc_heaps[i],type,103size,0,align==0?1:align,0);104if(ret!=NULL)...