fix KNI: Out of memory

This commit is contained in:
root 2017-06-12 16:12:22 +08:00
parent 488adaba23
commit bed8feab33
3 changed files with 11 additions and 7 deletions

View File

@ -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;

View File

@ -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])

View File

@ -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);