Usage¶
In this section, it is assumed that Virtual Accelerator has been properly installed and configured. See Getting Started for more details.
You can manage VLANs either under Linux or in the fast path.
# modprobe vlan
Linux¶
You can manage VLAN devices via the Linux commands below.
If you do not receive netlink notifications from the lower interface, set the lower interface in
promiscuous
andallmulticast
modes:$ sudo ip link set eth2 promisc on $ sudo ip link set eth2 allmulticast on
Interface eth2 should now have the flags ALL_MULTI and PROMISC:
$ fpcmd iface ... 6:eth2 [VR-0] ifid=6 (port 1) <UP|RUNNING|PROMISC|FWD4|FWD6> (0x73) type=ether mac=00:02:02:00:00:21 mtu=1500 tcp4mss=0 tcp6mss=0 IPv4 routes=0 IPv6 routes=0 if_ops: rx_dev=none tx_dev=none ip_output=none ...
Create a VLAN device:
$ sudo ip link add link eth2 name eth2.1000 type vlan id 1000
This adds the VLAN (802.1Q) device number
1000
to the link interfaceeth2
. The new VLAN interface name iseth2.1000
. A VLAN tag is appended to frames traversing this VLAN device.Display information about the VLAN device:
$ ip -d link show eth2.1000
Delete the VLAN device:
$ sudo ip link delete eth2.1000
Egress QoS mapping¶
This feature allows setting the VLAN priority field of outgoing packets based on the priority of input packets.
In Linux, it depends on both the TOS to skb priority mapping table and the skb priority to VLAN priority mapping table. The former is hardcoded and the later can be configured via iproute2. Besides that, skb priority can be forced by an iptables rule with CLASSIFY target(–set-class).
The TOS octet in the IP header has an interesting history having been redefined several times. The TOS to skb priority table is based on RFC 1349:
3. Specification of the Type of Service Octet
0 1 2 3 4 5 6 7
+-----+-----+-----+-----+-----+-----+-----+-----+
| | | |
| PRECEDENCE | TOS | MBZ |
| | | |
+-----+-----+-----+-----+-----+-----+-----+-----+
4. Specification of the TOS Field
1000 -- minimize delay
0100 -- maximize throughput
0010 -- maximize reliability
0001 -- minimize monetary cost
0000 -- normal service
In fact, Linux uses only the bit 3 and 4. Here is the mapping:
bit #3 |
bit# 4 |
skb priority |
0 |
0 |
0 |
0 |
1 |
2 |
1 |
0 |
6 |
1 |
1 |
4 |
Here is an example on how to configure the skb priority to VLAN priority mapping table.
$ sudo ip link add link eth2 name eth2.1000 type vlan id 1000 egress-qos-map 2:6 4:5
The resulting mapping for the previous example is described in the following table:
bit #3 |
bit# 4 |
skb priority |
vlan priority |
0 |
0 |
0 |
0 |
0 |
1 |
2 |
6 |
1 |
0 |
6 |
0 |
1 |
1 |
4 |
5 |
As a result, incoming packets with tos 0x18 will get the vlan priority field set to 5.
Note
$ sudo ip link add link eth2 name eth2.1000 type vlan help
Usage: ... vlan [ protocol VLANPROTO ] id VLANID [ FLAG-LIST ]
[ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]
VLANPROTO: [ 802.1Q / 802.1ad ]
VLANID := 0-4095
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ] [ mvrp { on | off } ]
[ loose_binding { on | off } ]
QOS-MAP := [ QOS-MAP ] QOS-MAPPING
QOS-MAPPING := FROM:TO
Linux packet priority can also be set by iptables rules. For example:
$ iptables -t mangle -A POSTROUTING -p udp -o eth2.1000 -j CLASSIFY --set-class 0:2
By the rule, the skb priority of an udp packet to be sent on eth2.1000 will be set to 2. For the previous egress qos mapping example, these udp packets will get the vlan priority field set to 6.
Ingress QoS mapping¶
This feature allows mapping VLAN header prio field to the Linux internal packet priority(skb->priority) on incoming VLAN packets.
The ingress-qos-map parameters can be configured by the above ip link add
command.
Fast path¶
You can manage VLAN devices via the fp-cli
commands below.
Displaying VLAN devices¶
Synopsis
vlan
Example
<fp-0> vlan
eth2-vr0:
eth2.1000-vr0: vlanid: 1000 vlanproto: 0x8100
Ingress QOS mappings:
0:2 1:6 2:4 3:0 4:0 5:0 6:0 7:0
Egress QOS mappings:
2:6 4:5
Note
The fp-cli vlan
command displays the egress mapping between mbuf’s
priority value and the three priority bit values set in the VLAN tag.
Displaying VLAN information¶
Synopsis
iface
Example
<fp-0> iface
...
6:eth2.1000 [VR-0] ifid=6 (virtual) <FWD4|FWD6> (0x60)
type=vlan mac=00:02:02:00:00:21 mtu=1500 tcp4mss=0 tcp6mss=0
IPv4 routes=0 IPv6 routes=0
if_ops: rx_dev=none tx_dev=vlan ip_output=none
vlan id 1000 vlan proto 0x8100 link eth2 <REORDER_HDR>
...
Providing options¶
Some capabilities can be tuned for this module.
- --ifaces¶
Maximum number of VLAN interfaces
- Default value
127
- Memory footprint per VLAN interfaces
150 B
- Range
0 .. 50000
Example
FP_OPTIONS="--mod-opt=vlan:--ifaces=512"
Then fast path can manage up to 512 VLAN interfaces.
- --hash-order¶
Size order of VLAN interfaces hash table. Value automatically updated if
--ifaces
is changed.- Default value
8
- Range
1 .. 31
Example
FP_OPTIONS="--mod-opt=vlan:--hash-order=10"
Note
See Fast Path Capabilities documentation for impact of the available memory on the default value of configurable capabilities
Tip
To get optimal performance, apply the following ratios to the two parameters:
Parameter |
Value |
---|---|
–hash-order |
|
–ifaces |
|