net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 20 Feb 2019 22:35:39 +0000 (14:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Feb 2019 19:53:32 +0000 (11:53 -0800)
commit061f6a505ac33659eab007731c0f6374df39ab55
treeeaa11fe77005b43a576b173c4bf9a54ae2135f35
parentcc1d5bda17c8eb4cd195f05a5558ed63df057fce
net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation

In order to properly support VLAN filtering being enabled/disabled on a
bridge, while having other ports being non bridge port members, we need
to support the ndo_vlan_rx_{add,kill}_vid callbacks in order to make
sure the non-bridge ports can continue receiving VLAN tags, even when
the switch is globally configured to do ingress/egress VID checking.

Since we can call dsa_port_vlan_{add,del} with a bridge_dev pointer
NULL, we now need to check that in these two functions.

We specifically deal with two possibly problematic cases:

- creating a bridge VLAN entry while there is an existing VLAN device
  claiming that same VID

- creating a VLAN device while there is an existing bridge VLAN entry
  with that VID

Those are both resolved with returning -EBUSY back to user-space.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/port.c
net/dsa/slave.c
net/dsa/switch.c