mirror of https://github.com/F-Stack/f-stack.git
fix KNI: Out of memory
This commit is contained in:
parent
488adaba23
commit
bed8feab33
|
@ -89,6 +89,9 @@
|
||||||
|
|
||||||
#define BITS_PER_HEX 4
|
#define BITS_PER_HEX 4
|
||||||
|
|
||||||
|
#define KNI_MBUF_MAX 2048
|
||||||
|
#define KNI_QUEUE_SIZE 2048
|
||||||
|
|
||||||
static int enable_kni;
|
static int enable_kni;
|
||||||
static int kni_accept;
|
static int kni_accept;
|
||||||
|
|
||||||
|
@ -411,7 +414,10 @@ init_mem_pool(void)
|
||||||
(nb_rx_queue*RX_QUEUE_SIZE +
|
(nb_rx_queue*RX_QUEUE_SIZE +
|
||||||
nb_ports*nb_lcores*MAX_PKT_BURST +
|
nb_ports*nb_lcores*MAX_PKT_BURST +
|
||||||
nb_ports*nb_tx_queue*TX_QUEUE_SIZE +
|
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)8192);
|
||||||
|
|
||||||
unsigned socketid = 0;
|
unsigned socketid = 0;
|
||||||
|
@ -591,7 +597,7 @@ init_kni(void)
|
||||||
int i, ret;
|
int i, ret;
|
||||||
for (i = 0; i < nb_ports; i++) {
|
for (i = 0; i < nb_ports; i++) {
|
||||||
uint8_t port_id = ff_global_cfg.dpdk.port_cfgs[i].port_id;
|
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;
|
return 0;
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
#include "ff_dpdk_kni.h"
|
#include "ff_dpdk_kni.h"
|
||||||
#include "ff_config.h"
|
#include "ff_config.h"
|
||||||
|
|
||||||
#define KNI_QUEUE_SIZE 8192
|
|
||||||
|
|
||||||
/* Callback for request of changing MTU */
|
/* Callback for request of changing MTU */
|
||||||
/* Total octets in ethernet header */
|
/* Total octets in ethernet header */
|
||||||
#define KNI_ENET_HEADER_SIZE 14
|
#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
|
void
|
||||||
ff_kni_alloc(uint8_t port_id, unsigned socket_id,
|
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) {
|
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
|
||||||
struct rte_kni_conf conf;
|
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);
|
snprintf((char*)ring_name, RTE_KNI_NAMESIZE, "kni_ring_%u", port_id);
|
||||||
|
|
||||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
|
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);
|
socket_id, RING_F_SC_DEQ);
|
||||||
|
|
||||||
if (rte_ring_lookup(ring_name) != kni_rp[port_id])
|
if (rte_ring_lookup(ring_name) != kni_rp[port_id])
|
||||||
|
|
|
@ -41,7 +41,7 @@ void ff_kni_init(uint16_t nb_ports, const char *tcp_ports,
|
||||||
const char *udp_ports);
|
const char *udp_ports);
|
||||||
|
|
||||||
void ff_kni_alloc(uint8_t port_id, unsigned socket_id,
|
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,
|
void ff_kni_process(uint8_t port_id, uint16_t queue_id,
|
||||||
struct rte_mbuf **pkts_burst, unsigned count);
|
struct rte_mbuf **pkts_burst, unsigned count);
|
||||||
|
|
Loading…
Reference in New Issue