大家有了解过DPDK么,DPDK采用的分配DMA地址的方式貌似可以分配很大的物理空间。具体的方式是设置大页内存。我测试过,这种方式进行DMA操作是可行的,也就是说申请的物理内存是连续的。接口如下,其中65535*4096就可以当作是进行DMA操作的内存空间,当然这2个值是可改的,上限就是你的大页内存分配的大小。
memory_pool = rte_mempool_create(name_str,
65535,
4096,
MBUF_CACHE_SIZE,
sizeof(struct rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL,
rte_pktmbuf_init, NULL,
rte_eth_dev_socket_id(port), // allocate the memory on the NUMA node to which the NIC is connected to
0);