http://www.cnblogs.com/chanwai1219/p/3637487.html
helloworld中主要分析了hugepage的使用,这回在l2fwd中主要分析一下uio和PMD的实现
main函数中首先调用了rte_eal_init初始化eal环境,其中主要是hugepage的初始化
549 /* init EAL */
550 ret = rte_eal_init(argc, argv);
551 if (ret < 0)
552 rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
接着创建了mbuf pool
/* create the mbuf pool */
562 l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
563 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
/*
* Read packet from RX queues
*/
for (i = 0; i < qconf->n_rx_port; i++) {
portid = qconf->rx_port_list[i];
nb_rx = rte_eth_rx_burst((uint8_t) portid, 0,
pkts_burst, MAX_PKT_BURST);
port_statistics[portid].rx += nb_rx;
for (j = 0; j < nb_rx; j++) {
m = pkts_burst[j];
rte_prefetch0(rte_pktmbuf_mtod(m, void *));
l2fwd_simple_forward(m, portid);
}
}