staging: dpaa2-switch: prevent joining a bridge while VLAN uppers are present
authorIoana Ciornei <ioana.ciornei@nxp.com>
Wed, 10 Mar 2021 12:14:51 +0000 (14:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Mar 2021 21:30:36 +0000 (13:30 -0800)
commit1c4928fc2929a502f01d4b7001a37db51309ceb9
tree6045fe58882161a3fed865eeb0c03a7903274a75
parent685b480145c15b81c411ad8b9a6b74a472274793
staging: dpaa2-switch: prevent joining a bridge while VLAN uppers are present

Each time a switch port joins a bridge, it will start to use a FDB table
common with all the other switch ports that are under the same bridge.
This means that any VLAN added prior to a bridge join, will retain its
previous FDB table destination. With this patch, I choose to restrict
when a switch port can change it's upper device (either join or leave)
so that the driver does not have to delete all the previously installed
VLANs from the previous FDB and add them into the new one.

Thus, in the PRECHANGEUPPER  notification we check if there are any VLAN
type upper devices and if that's true, deny the CHANGEUPPER.

This way, the user is not restricted in the topology but rather in the
order in which the setup is done: it must first create the bridging
domain layout and after that add the necessary VLAN devices if
necessary. The teardown is similar, the VLAN devices will need to be
destroyed prior to a change in the bridging layout.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/staging/fsl-dpaa2/ethsw/ethsw.c