diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-02-12 18:15:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-13 04:08:04 +0300 |
commit | e18f4c18ab5b0dd47caaf8377c2e36d66f632a8c (patch) | |
tree | a89ff5e705df268b0035f9d8611f7cb408ff8b83 /include/net/switchdev.h | |
parent | 5e38c15856e94f9da616e663fda683502bac2e43 (diff) | |
download | linux-e18f4c18ab5b0dd47caaf8377c2e36d66f632a8c.tar.xz |
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>
Diffstat (limited to 'include/net/switchdev.h')
-rw-r--r-- | include/net/switchdev.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 9279d4245bab..25d9e4570934 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -32,6 +32,11 @@ enum switchdev_attr_id { #endif }; +struct switchdev_brport_flags { + unsigned long val; + unsigned long mask; +}; + struct switchdev_attr { struct net_device *orig_dev; enum switchdev_attr_id id; @@ -40,7 +45,7 @@ struct switchdev_attr { void (*complete)(struct net_device *dev, int err, void *priv); union { u8 stp_state; /* PORT_STP_STATE */ - unsigned long brport_flags; /* PORT_{PRE}_BRIDGE_FLAGS */ + struct switchdev_brport_flags brport_flags; /* PORT_BRIDGE_FLAGS */ bool mrouter; /* PORT_MROUTER */ clock_t ageing_time; /* BRIDGE_AGEING_TIME */ bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */ |