mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
5e38c15856
commit
e18f4c18ab
10 changed files with 129 additions and 89 deletions
|
@ -65,7 +65,6 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
|
|||
{
|
||||
struct switchdev_attr attr = {
|
||||
.orig_dev = p->dev,
|
||||
.id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS,
|
||||
};
|
||||
struct switchdev_notifier_port_attr_info info = {
|
||||
.attr = &attr,
|
||||
|
@ -76,7 +75,9 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
|
|||
if (!mask)
|
||||
return 0;
|
||||
|
||||
attr.u.brport_flags = mask;
|
||||
attr.id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS;
|
||||
attr.u.brport_flags.val = flags;
|
||||
attr.u.brport_flags.mask = mask;
|
||||
|
||||
/* We run from atomic context here */
|
||||
err = call_switchdev_notifiers(SWITCHDEV_PORT_ATTR_SET, p->dev,
|
||||
|
@ -94,7 +95,6 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
|
|||
|
||||
attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS;
|
||||
attr.flags = SWITCHDEV_F_DEFER;
|
||||
attr.u.brport_flags = flags;
|
||||
|
||||
err = switchdev_port_attr_set(p->dev, &attr);
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue