#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
-#define NB_MBUF 8192
+#define NB_MBUF_PER_PORT 3000
#define MAX_PKT_BURST 32
#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
uint16_t portid, last_port;
unsigned lcore_id, rx_lcore_id;
unsigned nb_ports_in_mask = 0;
+ unsigned int total_nb_mbufs;
struct sigaction signal_handler;
struct rte_keepalive_shm *ka_shm;
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n");
- /* create the mbuf pool */
- l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32,
- 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
- if (l2fwd_pktmbuf_pool == NULL)
- rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
-
nb_ports = rte_eth_dev_count_avail();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+ /* create the mbuf pool */
+ total_nb_mbufs = NB_MBUF_PER_PORT * nb_ports;
+
+ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool",
+ total_nb_mbufs, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
+ rte_socket_id());
+ if (l2fwd_pktmbuf_pool == NULL)
+ rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
+
/* reset l2fwd_dst_ports */
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
l2fwd_dst_ports[portid] = 0;