mirror of https://github.com/F-Stack/f-stack.git
Sync to github
This commit is contained in:
parent
c506e4369e
commit
79f0ade329
45
config.ini
45
config.ini
|
@ -1,12 +1,21 @@
|
|||
[dpdk]
|
||||
## Hexadecimal bitmask of cores to run on.
|
||||
# Hexadecimal bitmask of cores to run on.
|
||||
lcore_mask=1
|
||||
|
||||
# Number of memory channels.
|
||||
channel=4
|
||||
|
||||
# Specify base virtual address to map.
|
||||
#base_virtaddr=0x7f0000000000
|
||||
|
||||
# Promiscuous mode of nic, defualt: enabled.
|
||||
promiscuous=1
|
||||
numa_on=1
|
||||
## TCP segment offload, default: disabled.
|
||||
|
||||
# TCP segment offload, default: disabled.
|
||||
tso=0
|
||||
## HW vlan strip, default: enabled.
|
||||
|
||||
# HW vlan strip, default: enabled.
|
||||
vlan_strip=1
|
||||
|
||||
# sleep when no pkts incomming
|
||||
|
@ -27,40 +36,40 @@ idle_sleep=100
|
|||
# 1-3,4,7 ports 1,2,3,4,7 are enabled
|
||||
port_list=0
|
||||
|
||||
## Port config section
|
||||
## Correspond to dpdk.port_list's index: port0, port1...
|
||||
# Port config section
|
||||
# Correspond to dpdk.port_list's index: port0, port1...
|
||||
[port0]
|
||||
addr=192.168.1.2
|
||||
netmask=255.255.255.0
|
||||
broadcast=192.168.1.255
|
||||
gateway=192.168.1.1
|
||||
|
||||
## lcore list used to handle this port
|
||||
## the format is same as port_list
|
||||
# lcore list used to handle this port
|
||||
# the format is same as port_list
|
||||
# lcore_list= 0
|
||||
|
||||
## Packet capture path, this will hurt performance
|
||||
# Packet capture path, this will hurt performance
|
||||
#pcap=./a.pcap
|
||||
|
||||
## Kni config: if enabled and method=reject,
|
||||
## all packets that do not belong to the following tcp_port and udp_port
|
||||
## will transmit to kernel; if method=accept, all packets that belong to
|
||||
## the following tcp_port and udp_port will transmit to kernel.
|
||||
# Kni config: if enabled and method=reject,
|
||||
# all packets that do not belong to the following tcp_port and udp_port
|
||||
# will transmit to kernel; if method=accept, all packets that belong to
|
||||
# the following tcp_port and udp_port will transmit to kernel.
|
||||
#[kni]
|
||||
#enable=1
|
||||
#method=reject
|
||||
## The format is same as port_list
|
||||
# The format is same as port_list
|
||||
#tcp_port=80,443
|
||||
#udp_port=53
|
||||
|
||||
## FreeBSD network performance tuning configurations.
|
||||
## Most native FreeBSD configurations are supported.
|
||||
# FreeBSD network performance tuning configurations.
|
||||
# Most native FreeBSD configurations are supported.
|
||||
[freebsd.boot]
|
||||
hz=100
|
||||
|
||||
## Block out a range of descriptors to avoid overlap
|
||||
## with the kernel's descriptor space.
|
||||
## You can increase this value according to your app.
|
||||
# Block out a range of descriptors to avoid overlap
|
||||
# with the kernel's descriptor space.
|
||||
# You can increase this value according to your app.
|
||||
fd_reserve=1024
|
||||
|
||||
kern.ipc.maxsockets=262144
|
||||
|
|
|
@ -420,6 +420,8 @@ ini_parse_handler(void* user, const char* section, const char* name,
|
|||
} else if (MATCH("dpdk", "lcore_mask")) {
|
||||
pconfig->dpdk.lcore_mask = strdup(value);
|
||||
return parse_lcore_mask(pconfig, pconfig->dpdk.lcore_mask);
|
||||
} else if (MATCH("dpdk", "base_virtaddr")) {
|
||||
pconfig->dpdk.base_virtaddr= strdup(value);
|
||||
} else if (MATCH("dpdk", "port_list")) {
|
||||
return parse_port_list(pconfig, value);
|
||||
} else if (MATCH("dpdk", "promiscuous")) {
|
||||
|
@ -485,6 +487,10 @@ dpdk_args_setup(struct ff_config *cfg)
|
|||
sprintf(temp, "--proc-type=%s", cfg->dpdk.proc_type);
|
||||
dpdk_argv[n++] = strdup(temp);
|
||||
}
|
||||
if (cfg->dpdk.base_virtaddr) {
|
||||
sprintf(temp, "--base-virtaddr=%s", cfg->dpdk.base_virtaddr);
|
||||
dpdk_argv[n++] = strdup(temp);
|
||||
}
|
||||
|
||||
dpdk_argc = n;
|
||||
|
||||
|
@ -520,7 +526,7 @@ ff_parse_args(struct ff_config *cfg, int argc, char *const argv[])
|
|||
if (strcmp(cfg->dpdk.proc_type, "primary") &&
|
||||
strcmp(cfg->dpdk.proc_type, "secondary") &&
|
||||
strcmp(cfg->dpdk.proc_type, "auto")) {
|
||||
printf("invalid proc-type\n");
|
||||
printf("invalid proc-type:%s\n", cfg->dpdk.proc_type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,9 @@ struct ff_config {
|
|||
/* mask of current proc on all lcores */
|
||||
char *proc_mask;
|
||||
|
||||
/* specify base virtual address to map. */
|
||||
char *base_virtaddr;
|
||||
|
||||
int nb_channel;
|
||||
int memory;
|
||||
int no_huge;
|
||||
|
|
|
@ -419,18 +419,21 @@ create_ring(const char *name, unsigned count, int socket_id, unsigned flags)
|
|||
{
|
||||
struct rte_ring *ring;
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
/* If already create, just attached it */
|
||||
if (likely((ring = rte_ring_lookup(name)) != NULL))
|
||||
return ring;
|
||||
if (name == NULL) {
|
||||
rte_exit(EXIT_FAILURE, "create ring failed, no name!\n");
|
||||
}
|
||||
|
||||
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
|
||||
return rte_ring_create(name, count, socket_id, flags);
|
||||
ring = rte_ring_create(name, count, socket_id, flags);
|
||||
} else {
|
||||
return rte_ring_lookup(name);
|
||||
ring = rte_ring_lookup(name);
|
||||
}
|
||||
|
||||
if (ring == NULL) {
|
||||
rte_exit(EXIT_FAILURE, "create ring:%s failed!\n", name);
|
||||
}
|
||||
|
||||
return ring;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue