diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-02-12 16:15:52 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-13 02:08:04 +0100 |
commit | 304ae3bf1c1abe66faece2040a5525392ea49f68 (patch) | |
tree | 36fcb2f40791a387624d1c18564ad92c4392ba7d /net/bridge/br_switchdev.c | |
parent | net: switchdev: propagate extack to port attributes (diff) | |
download | linux-304ae3bf1c1abe66faece2040a5525392ea49f68.tar.xz linux-304ae3bf1c1abe66faece2040a5525392ea49f68.zip |
net: bridge: offload all port flags at once in br_setport
If for example this command:
ip link set swp0 type bridge_slave flood off mcast_flood off learning off
succeeded at configuring BR_FLOOD and BR_MCAST_FLOOD but not at
BR_LEARNING, there would be no attempt to revert the partial state in
any way. Arguably, if the user changes more than one flag through the
same netlink command, this one _should_ be all or nothing, which means
it should be passed through switchdev as all or nothing.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_switchdev.c')
-rw-r--r-- | net/bridge/br_switchdev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index a9c23ef83443..6a9db6aa5c04 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -65,16 +65,18 @@ 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, - .u.brport_flags = mask, }; struct switchdev_notifier_port_attr_info info = { .attr = &attr, }; int err; - if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) + mask &= BR_PORT_FLAGS_HW_OFFLOAD; + if (!mask) return 0; + attr.u.brport_flags = mask; + /* We run from atomic context here */ err = call_switchdev_notifiers(SWITCHDEV_PORT_ATTR_SET, p->dev, &info.info, NULL); |