OSDN Git Service

staging: dpaa2-switch: accept only vlan-aware upper devices
authorIoana Ciornei <ioana.ciornei@nxp.com>
Wed, 10 Mar 2021 12:14:49 +0000 (14:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Mar 2021 21:30:36 +0000 (13:30 -0800)
commitd671407fccbb022ab6004bd8a8d5f1e970f2ba2e
tree813a3b2b924525eae415dca823ccc30e08663081
parent16abb6ad6abc5ffe45d1e03e9263530b263de2a1
staging: dpaa2-switch: accept only vlan-aware upper devices

The DPAA2 Switch is not capable to handle traffic in a VLAN unaware
fashion, thus the previous handling of both the accepted upper devices
and the SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING flag was wrong.

Fix this by checking if the bridge that we are joining is indeed VLAN
aware, if not return an error. Also, the RX VLAN filtering feature is
defined as 'on [fixed]' and the .ndo_vlan_rx_add_vid() and
.ndo_vlan_rx_kill_vid() callbacks are implemented just by recreating a
switchdev_obj_port_vlan object and then calling the same functions used
on the switchdev notifier path.
In addition, changing the vlan_filtering flag to 0 on a bridge under
which a DPAA2 switch interface is present is not supported, thus
rejected when SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING is received with
such a request.

This patch is also adding the use of the switchdev_handle_port_attr_set
function so that we can iterate through all the lower devices of the
bridge that the notification was received on and actually catch if the
user is trying to change the vlan_filtering state. Since on a VLAN
filtering change the net_device is the bridge, we also move the
dpaa2_switch_port_dev_check call so that we do not return NOTIFY_DONE
right away.

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