]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched: flower: Consider the number of tags for vlan filters
authorBoris Sukholitko <boris.sukholitko@broadcom.com>
Tue, 19 Apr 2022 08:14:34 +0000 (11:14 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Apr 2022 10:09:13 +0000 (11:09 +0100)
commitf96510dca5aedfcbbed9bfef13a6bf869110e001
treeb36c234f3fb2c2d8154b9964aee9681199328d92
parent29919a11a545bf1ec60840bd9ee2d99ce29a94c6
net/sched: flower: Consider the number of tags for vlan filters

Before this patch the existence of vlan filters was conditional on the vlan
protocol being matched in the tc rule. For example, the following rule:

tc filter add dev eth1 ingress flower vlan_prio 5

was illegal because vlan protocol (e.g. 802.1q) does not appear in the rule.

Remove the above restriction by looking at the num_of_vlans filter to
allow further matching on vlan attributes. The following rule becomes
legal as a result of this commit:

tc filter add dev eth1 ingress flower num_of_vlans 1 vlan_prio 5

because having num_of_vlans==1 implies that the packet is single tagged.

Change is_vlan_key helper to look at the number of vlans in addition to
the vlan ethertype. The outcome of this change is that outer (e.g. vlan_prio)
and inner (e.g. cvlan_prio) tag vlan filters require the number of vlan
tags to be greater then 0 and 1 accordingly.

As a result of is_vlan_key change, the ethertype may be set to 0 when
matching on the number of vlans. Update fl_set_key_vlan to avoid setting
key, mask vlan_tpid for the 0 ethertype.

Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_flower.c