diff --git a/README.md b/README.md index d835b661f..457914855 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,14 @@ Currently, besides authorized DNS server of DNSPod, there are various products i # or NUMA echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages - + # Using Hugepage with the DPDK 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 @@ -55,7 +58,7 @@ Currently, besides authorized DNS server of DNSPod, there are various products i python dpdk-devbind.py --status ifconfig eth0 down python dpdk-devbind.py --bind=igb_uio eth0 # assuming that use 10GE NIC and eth0 - + # Compile F-Stack cd ../../lib/ make diff --git a/config.ini b/config.ini index e158fcda8..f5f8103b5 100644 --- a/config.ini +++ b/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] diff --git a/lib/ff_config.c b/lib/ff_config.c index 5a09d092c..45080bad7 100644 --- a/lib/ff_config.c +++ b/lib/ff_config.c @@ -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; diff --git a/lib/ff_config.h b/lib/ff_config.h index 837a2b1d9..08ad87bb2 100644 --- a/lib/ff_config.h +++ b/lib/ff_config.h @@ -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; diff --git a/lib/ff_dpdk_if.c b/lib/ff_dpdk_if.c index b00394900..d932ed3d0 100644 --- a/lib/ff_dpdk_if.c +++ b/lib/ff_dpdk_if.c @@ -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);