net: switchdev: pass flags and mask to both {PRE_,}BRIDGE_FLAGS attributes
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 12 Feb 2021 15:15:55 +0000 (17:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2021 01:08:04 +0000 (17:08 -0800)
commite18f4c18ab5b0dd47caaf8377c2e36d66f632a8c
treea89ff5e705df268b0035f9d8611f7cb408ff8b83
parent5e38c15856e94f9da616e663fda683502bac2e43
net: switchdev: pass flags and mask to both {PRE_,}BRIDGE_FLAGS attributes

This switchdev attribute offers a counterproductive API for a driver
writer, because although br_switchdev_set_port_flag gets passed a
"flags" and a "mask", those are passed piecemeal to the driver, so while
the PRE_BRIDGE_FLAGS listener knows what changed because it has the
"mask", the BRIDGE_FLAGS listener doesn't, because it only has the final
value. But certain drivers can offload only certain combinations of
settings, like for example they cannot change unicast flooding
independently of multicast flooding - they must be both on or both off.
The way the information is passed to switchdev makes drivers not
expressive enough, and unable to reject this request ahead of time, in
the PRE_BRIDGE_FLAGS notifier, so they are forced to reject it during
the deferred BRIDGE_FLAGS attribute, where the rejection is currently
ignored.

This patch also changes drivers to make use of the "mask" field for edge
detection when possible.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/ti/am65-cpsw-switchdev.c
drivers/net/ethernet/ti/cpsw_switchdev.c
drivers/staging/fsl-dpaa2/ethsw/ethsw.c
include/net/switchdev.h
net/bridge/br_switchdev.c
net/dsa/dsa_priv.h
net/dsa/port.c