kernel: backport b53/bcm_sf2 changes from v5.7
[openwrt/staging/hauke.git] / target / linux / generic / backport-5.4 / 707-v5.7-0006-net-dsa-b53-Prevent-tagged-VLAN-on-port-7-for-7278.patch
1 From 88631864da093377ce6d5e60b5639328622a8e5c Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <f.fainelli@gmail.com>
3 Date: Mon, 30 Mar 2020 14:38:48 -0700
4 Subject: [PATCH] net: dsa: b53: Prevent tagged VLAN on port 7 for 7278
5
6 On 7278, port 7 of the switch connects to the ASP UniMAC which is not
7 capable of processing VLAN tagged frames. We can still allow the port to
8 be part of a VLAN entry, and we may want it to be untagged on egress on
9 that VLAN because of that limitation.
10
11 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 drivers/net/dsa/b53/b53_common.c | 8 ++++++++
15 1 file changed, 8 insertions(+)
16
17 --- a/drivers/net/dsa/b53/b53_common.c
18 +++ b/drivers/net/dsa/b53/b53_common.c
19 @@ -1366,6 +1366,14 @@ int b53_vlan_prepare(struct dsa_switch *
20 if ((is5325(dev) || is5365(dev)) && vlan->vid_begin == 0)
21 return -EOPNOTSUPP;
22
23 + /* Port 7 on 7278 connects to the ASP's UniMAC which is not capable of
24 + * receiving VLAN tagged frames at all, we can still allow the port to
25 + * be configured for egress untagged.
26 + */
27 + if (dev->chip_id == BCM7278_DEVICE_ID && port == 7 &&
28 + !(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED))
29 + return -EINVAL;
30 +
31 if (vlan->vid_end >= dev->num_vlans)
32 return -ERANGE;
33