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