diff options
author | Nogah Frankel <nogahf@mellanox.com> | 2017-02-09 08:54:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-10 11:46:38 -0500 |
commit | 147c1e9b902c25c868024260d24bb0b1dac1433d (patch) | |
tree | 0766e9ac71fd1cb5fe7a421808b3680ade60575a /net/bridge/br_multicast.c | |
parent | 94134bf89a4747ac370ffea614a2ba483edf0ccc (diff) |
switchdev: bridge: Offload multicast disabled
Offload multicast disabled flag, for more accurate mc flood behavior:
When it is on, the mdb should be ignored.
When it is off, unregistered mc packets should be flooded to mc router
ports.
Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_multicast.c')
-rw-r--r-- | net/bridge/br_multicast.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 1de3438e36bf..8c0e896936ff 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/inetdevice.h> | 27 | #include <linux/inetdevice.h> |
28 | #include <linux/mroute.h> | 28 | #include <linux/mroute.h> |
29 | #include <net/ip.h> | 29 | #include <net/ip.h> |
30 | #include <net/switchdev.h> | ||
30 | #if IS_ENABLED(CONFIG_IPV6) | 31 | #if IS_ENABLED(CONFIG_IPV6) |
31 | #include <net/ipv6.h> | 32 | #include <net/ipv6.h> |
32 | #include <net/mld.h> | 33 | #include <net/mld.h> |
@@ -1007,6 +1008,18 @@ static void br_ip6_multicast_port_query_expired(unsigned long data) | |||
1007 | } | 1008 | } |
1008 | #endif | 1009 | #endif |
1009 | 1010 | ||
1011 | static void br_mc_disabled_update(struct net_device *dev, bool value) | ||
1012 | { | ||
1013 | struct switchdev_attr attr = { | ||
1014 | .orig_dev = dev, | ||
1015 | .id = SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED, | ||
1016 | .flags = SWITCHDEV_F_DEFER, | ||
1017 | .u.mc_disabled = value, | ||
1018 | }; | ||
1019 | |||
1020 | switchdev_port_attr_set(dev, &attr); | ||
1021 | } | ||
1022 | |||
1010 | int br_multicast_add_port(struct net_bridge_port *port) | 1023 | int br_multicast_add_port(struct net_bridge_port *port) |
1011 | { | 1024 | { |
1012 | port->multicast_router = MDB_RTR_TYPE_TEMP_QUERY; | 1025 | port->multicast_router = MDB_RTR_TYPE_TEMP_QUERY; |
@@ -1019,6 +1032,8 @@ int br_multicast_add_port(struct net_bridge_port *port) | |||
1019 | setup_timer(&port->ip6_own_query.timer, | 1032 | setup_timer(&port->ip6_own_query.timer, |
1020 | br_ip6_multicast_port_query_expired, (unsigned long)port); | 1033 | br_ip6_multicast_port_query_expired, (unsigned long)port); |
1021 | #endif | 1034 | #endif |
1035 | br_mc_disabled_update(port->dev, port->br->multicast_disabled); | ||
1036 | |||
1022 | port->mcast_stats = netdev_alloc_pcpu_stats(struct bridge_mcast_stats); | 1037 | port->mcast_stats = netdev_alloc_pcpu_stats(struct bridge_mcast_stats); |
1023 | if (!port->mcast_stats) | 1038 | if (!port->mcast_stats) |
1024 | return -ENOMEM; | 1039 | return -ENOMEM; |
@@ -2121,6 +2136,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val) | |||
2121 | if (br->multicast_disabled == !val) | 2136 | if (br->multicast_disabled == !val) |
2122 | goto unlock; | 2137 | goto unlock; |
2123 | 2138 | ||
2139 | br_mc_disabled_update(br->dev, !val); | ||
2124 | br->multicast_disabled = !val; | 2140 | br->multicast_disabled = !val; |
2125 | if (br->multicast_disabled) | 2141 | if (br->multicast_disabled) |
2126 | goto unlock; | 2142 | goto unlock; |