diff --git a/lib/ff_dpdk_if.c b/lib/ff_dpdk_if.c index 9a60f88af..d2a827924 100644 --- a/lib/ff_dpdk_if.c +++ b/lib/ff_dpdk_if.c @@ -89,6 +89,9 @@ #define BITS_PER_HEX 4 +#define KNI_MBUF_MAX 2048 +#define KNI_QUEUE_SIZE 2048 + static int enable_kni; static int kni_accept; @@ -411,7 +414,10 @@ init_mem_pool(void) (nb_rx_queue*RX_QUEUE_SIZE + nb_ports*nb_lcores*MAX_PKT_BURST + nb_ports*nb_tx_queue*TX_QUEUE_SIZE + - nb_lcores*MEMPOOL_CACHE_SIZE), + nb_lcores*MEMPOOL_CACHE_SIZE + + nb_ports*KNI_MBUF_MAX + + nb_ports*KNI_QUEUE_SIZE + + nb_lcores*nb_ports*ARP_RING_SIZE), (unsigned)8192); unsigned socketid = 0; @@ -591,7 +597,7 @@ init_kni(void) int i, ret; for (i = 0; i < nb_ports; i++) { uint8_t port_id = ff_global_cfg.dpdk.port_cfgs[i].port_id; - ff_kni_alloc(port_id, socket_id, mbuf_pool); + ff_kni_alloc(port_id, socket_id, mbuf_pool, KNI_QUEUE_SIZE); } return 0; diff --git a/lib/ff_dpdk_kni.c b/lib/ff_dpdk_kni.c index 739d745a7..7a5238313 100644 --- a/lib/ff_dpdk_kni.c +++ b/lib/ff_dpdk_kni.c @@ -40,8 +40,6 @@ #include "ff_dpdk_kni.h" #include "ff_config.h" -#define KNI_QUEUE_SIZE 8192 - /* Callback for request of changing MTU */ /* Total octets in ethernet header */ #define KNI_ENET_HEADER_SIZE 14 @@ -330,7 +328,7 @@ ff_kni_init(uint16_t nb_ports, const char *tcp_ports, const char *udp_ports) void ff_kni_alloc(uint8_t port_id, unsigned socket_id, - struct rte_mempool *mbuf_pool) + struct rte_mempool *mbuf_pool, unsigned ring_queue_size) { if (rte_eal_process_type() == RTE_PROC_PRIMARY) { struct rte_kni_conf conf; @@ -381,7 +379,7 @@ ff_kni_alloc(uint8_t port_id, unsigned socket_id, snprintf((char*)ring_name, RTE_KNI_NAMESIZE, "kni_ring_%u", port_id); if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - kni_rp[port_id] = rte_ring_create(ring_name, KNI_QUEUE_SIZE, + kni_rp[port_id] = rte_ring_create(ring_name, ring_queue_size, socket_id, RING_F_SC_DEQ); if (rte_ring_lookup(ring_name) != kni_rp[port_id]) diff --git a/lib/ff_dpdk_kni.h b/lib/ff_dpdk_kni.h index 23dbfdc37..775f62f54 100644 --- a/lib/ff_dpdk_kni.h +++ b/lib/ff_dpdk_kni.h @@ -41,7 +41,7 @@ void ff_kni_init(uint16_t nb_ports, const char *tcp_ports, const char *udp_ports); void ff_kni_alloc(uint8_t port_id, unsigned socket_id, - struct rte_mempool *mbuf_pool); + struct rte_mempool *mbuf_pool, unsigned ring_queue_size); void ff_kni_process(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **pkts_burst, unsigned count);