VLAN 802.1 q priority and IP QoS

I've been reading about the VLAN priority at the OpenWRT firmware, and I've understood that the
"swconfig" is being deprecated, it will replace by DSA if I didn't have understood wrong.

I got a Linksys WRT 3200 ACM router, which will be ported to DSA, but right now it uses swconfig, and like I want to learn, I'm curious about how the switch is working right now at OpenWRT firmware and how to establish VLAN 802.1q priority, for WAN and LAN VLANs.

My router shows the next:

swconfig dev switch0 help
switch0: 10.mvsw61xx(MV88E6352), ports: 7 (cpu @ 5), vlans: 64
     --switch
        Attribute 1 (int): enable_vlan (Enable 802.1q VLAN support)
        Attribute 2 (int): enable_mirror_rx (Enable mirroring of RX packets)
        Attribute 3 (int): enable_mirror_tx (Enable mirroring of TX packets)
        Attribute 4 (int): mirror_monitor_port (Mirror monitor port)
        Attribute 5 (int): mirror_source_port (Mirror source port)
        Attribute 6 (none): apply (Activate changes in the hardware)
        Attribute 7 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (int): port_based (Use port-based (non-802.1q) VLAN only)
        Attribute 2 (int): vid (Get/set VLAN ID)
        Attribute 3 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (string): mask (Port-based VLAN mask)
        Attribute 2 (int): qmode (802.1q mode: 0=off/1=fallback/2=check/3=secure)
        Attribute 3 (int): pvid (Primary VLAN ID)
        Attribute 4 (unknown): link (Get port link information)

After read this wiki article, I've understood all that the above command tells me about the switch at my router, the switch section is configured at the network config file, and the vlan and port section show how is configured the VLANs at my router right now.

The current config is this (swconfig dev switch0 show):

Global attributes:
        enable_vlan: 1
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
Port 0:
        mask: 0x0000: (0)
        qmode: 3
        pvid: 35
        link: port:0 link:up speed:100baseT full-duplex
Port 1:
        mask: 0x0000: (1)
        qmode: 3
        pvid: 0
        link: port:1 link:up speed:100baseT full-duplex
Port 2:
        mask: 0x0000: (2)
        qmode: 3
        pvid: 0
        link: port:2 link:up speed:1000baseT full-duplex
Port 3:
        mask: 0x0000: (3)
        qmode: 3
        pvid: 0
        link: port:3 link:down
Port 4:
        mask: 0x0000: (4)
        qmode: 3
        pvid: 21
        link: port:4 link:up speed:1000baseT full-duplex
Port 5:
        mask: 0x0000: (5)
        qmode: 3
        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex
Port 6:
        mask: 0x0000: (6)
        qmode: 3
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
VLAN 1:
        port_based: 0
        vid: 20
        ports: 4t 6t
VLAN 2:
        port_based: 0
        vid: 21
        ports: 4 6t
VLAN 4:
        port_based: 0
        vid: 25
        ports: 1t 2t 3t 5t
VLAN 5:
        port_based: 0
        vid: 30
        ports: 2t 3t 5t
VLAN 6:
        port_based: 0
        vid: 35
        ports: 0 1t 2t 3t 5t
VLAN 7:
        port_based: 0
        vid: 40
        ports: 5t
VLAN 8:
        port_based: 0
        vid: 45
        ports: 5t
VLAN 9:
        port_based: 0
        vid: 50
        ports: 5t

Until here, I get it everything, but I want to make "VLAN priority" at WAN and LAN levels, and when it's done, make QoS at level 3, because at my subnets (one level2 subnet for each level3 subnet) there are hosts with more priority than others. I think that this has sense, I'm learning.

(Maybe you want to check my current network setup to understand what I'm talking about.)

My ISP doesn't divide the data, voip and tv, being the VLAN 20 and the priority 0, I want to set this correctly or at least, learn how to check the priority of a VLAN at the switch, because with the above information showed by the commands, I don't see it.

I've been reading about this and I've found two threads about how to set the VLAN priority, one of them using vconfig (that is deprecated), and another using ip link that it seems to be the current way.

I don't understand well the syntax and the purpose of the command,

ip link set eth1.20 type vlan egress 0:2

I want to meant that I understand that commands sets the VLAN 20 egress priority, but I don't know which is the meaning of the las section (0:2), and of course talking about ip link, if I type the next command:

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 532
    link/ether 30:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 532
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
7: br-voip: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
8: eth0.25@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-voip state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
9: br-wireless: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
10: eth0.40@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wireless state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
11: br-wlessguests: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
12: eth0.45@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wlessguests state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
13: eth0.35@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
14: eth1.21@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 30:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
15: eth0.30@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
16: eth0.50@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1420 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 32:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
17: eth1.20@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1472 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 30:23:03:de:10:70 brd ff:ff:ff:ff:ff:ff
18: vpnlocal: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/none
19: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-voip state UP mode DEFAULT group default qlen 1000
    link/ether 30:23:03:de:10:71 brd ff:ff:ff:ff:ff:ff
20: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br-wireless state UP mode DEFAULT group default qlen 1000
    link/ether 30:23:03:de:10:72 brd ff:ff:ff:ff:ff:ff

I understand more or less that the output tells me, but not in its whole, mainly the "mode DEFAULT", the "group default" and "qlenxxxx".

If you can help me, it will be so useful.

Kind regards.

This is short for the egress-qos-map described here https://manpages.debian.org/experimental/iproute2/ip-link.8.en.html

Basically 0:2 says any packet with internal linux priority field 0 will have it's vlan priority set to 2 on transmit.

All the vlan tags and priorities are handled by linux not the switch chip.

1 Like

Then, if I've understood well after read it, for this example case (ip link set eth1.20 type vlan egress 0:2), each LAN VLAN with a egress priority setted as 0, will have a priority to egress of 2 from WAN. I say this because in my case the VLAN eth1.20 is the WAN interface.

Like my ISP doesn't divide the data and voice, the ingress (at WAN interface) will be ever 0 for data and voice, but once time that data and voice passtrough the WAN interface, I can set the priority for voice and data, no?

One example to see if I have understood well:
#####INGRESS_PRIORITY####
Set that the voip VLAN (0.25) ingress priority is 0, the syntax will be:
ip link set eth0.25 type vlan ingress 0:0

Set that the servers VLAN (0.30) ingress priority is 2, then the syntax is:
ip link set eth0.30 type vlan ingress 0:2

#####EGRESS_PRIORITY####
Set that the voip VLAN (0.25) egress priority is 0, the syntax will be:
ip link set eth0.25 type vlan egress 0:0

Set that the servers VLAN (0.30) egress priority is 1, then the syntax is:
ip link set eth0.30 type vlan egress 2:1

I don't know if I've understood well the VLANs priority works and/or the syntax, I've doubts about the two lastest syntaxs, mainly the 0.30 egress.

no, each packet which has an internal kernel priority of 0 will have its egress priority set to 2 on eth1.20 but each packet can have its kernel priority set by a wide variety of kernel processes (the kernel priority is a field in the skb struct). In this case, 0 is basically just the default priority, any iptables rules using -j CLASSIFY for example will set the kernel packet priority, as can various other mechanisms.

I'd recommend you wireshark things to see what happens.

Also I'd guess that the switch in the WRT3200ACM doesn't do anything with port priorities etc. This is all probably pointless unless you plan to send packets to a commercial managed or web-managed switch.