mirror of https://github.com/F-Stack/f-stack.git
Support VLAN Strip.
In some cases such as AWS EC2, we must strip vlan tag. Edit the config.ini, set port.vlanstrip = 1.
This commit is contained in:
parent
5f3825effd
commit
627097dc92
|
@ -48,6 +48,9 @@ Currently, besides authorized DNS server of DNSPod, there are various products i
|
|||
mkdir /mnt/huge
|
||||
mount -t hugetlbfs nodev /mnt/huge
|
||||
|
||||
# close ASLR; it is necessary in multiple porcess
|
||||
echo 0 > /proc/sys/kernel/randomize_va_space
|
||||
|
||||
# offload NIC
|
||||
modprobe uio
|
||||
insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/build/kmod/igb_uio.ko
|
||||
|
|
12
config.ini
12
config.ini
|
@ -1,13 +1,17 @@
|
|||
[dpdk]
|
||||
## Hexadecimal bitmask of cores to run on.
|
||||
lcore_mask=3
|
||||
## Port mask, enable and disable ports.
|
||||
## Default: all ports are enabled.
|
||||
#port_mask=1
|
||||
channel=4
|
||||
## Number of ports.
|
||||
nb_ports=1
|
||||
promiscuous=1
|
||||
numa_on=1
|
||||
|
||||
## Port config section
|
||||
## According to dpdk.nb_ports: port0, port1...
|
||||
[port0]
|
||||
addr=192.168.1.2
|
||||
netmask=255.255.255.0
|
||||
|
@ -15,6 +19,8 @@ broadcast=192.168.1.255
|
|||
gateway=192.168.1.1
|
||||
## Packet capture path, this will hurt performance
|
||||
#pcap=./a.pcap
|
||||
## Strip vlan tag, such as EC2 etc.
|
||||
#vlanstrip=1
|
||||
|
||||
## Kni config: if enabled and method=reject,
|
||||
## all packets that do not belong to the following tcp_port and udp_port
|
||||
|
@ -23,13 +29,9 @@ gateway=192.168.1.1
|
|||
#[kni]
|
||||
#enable=1
|
||||
#method=reject
|
||||
#tcp_port=80
|
||||
#tcp_port=80,443
|
||||
#udp_port=53
|
||||
|
||||
[log]
|
||||
level=1
|
||||
dir=/var/log
|
||||
|
||||
## FreeBSD network performance tuning configurations.
|
||||
## Most native FreeBSD configurations are supported.
|
||||
[freebsd.boot]
|
||||
|
|
|
@ -154,6 +154,8 @@ port_cfg_handler(struct ff_config *cfg, const char *section,
|
|||
cur->gateway = strdup(value);
|
||||
} else if (strcmp(name, "pcap") == 0) {
|
||||
cur->pcap = strdup(value);
|
||||
} else if (strcmp(name, "vlanstrip") == 0) {
|
||||
cur->vlanstrip = atoi(value);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -38,6 +38,7 @@ struct ff_port_cfg {
|
|||
char *name;
|
||||
uint8_t port_id;
|
||||
uint8_t mac[6];
|
||||
uint8_t vlanstrip;
|
||||
char *addr;
|
||||
char *netmask;
|
||||
char *broadcast;
|
||||
|
|
|
@ -103,6 +103,8 @@ static struct rte_eth_conf default_port_conf = {
|
|||
.header_split = 0, /**< Header Split disabled */
|
||||
.hw_ip_checksum = 0, /**< IP checksum offload disabled */
|
||||
.hw_vlan_filter = 0, /**< VLAN filtering disabled */
|
||||
.hw_vlan_strip = 0, /**< VLAN strip disabled. */
|
||||
.hw_vlan_extend = 0, /**< Extended VLAN disabled. */
|
||||
.jumbo_frame = 0, /**< Jumbo Frame Support disabled */
|
||||
.hw_strip_crc = 0, /**< CRC stripped by hardware */
|
||||
.enable_lro = 0, /**< LRO disabled */
|
||||
|
@ -561,6 +563,7 @@ init_port_start(void)
|
|||
* Set port conf according to dev's capability.
|
||||
*/
|
||||
struct rte_eth_conf port_conf = default_port_conf;
|
||||
port_conf.rxmode.hw_vlan_strip = ff_global_cfg.dpdk.port_cfgs[port_id].vlanstrip;
|
||||
|
||||
/* Currently, proc id 1:1 map to queue id per port. */
|
||||
int ret = rte_eth_dev_configure(port_id, nb_procs, nb_procs, &port_conf);
|
||||
|
|
Loading…
Reference in New Issue