From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, ivecera@redhat.com,
stephen@networkplumber.org, mlxsw@mellanox.com
Subject: [patch net-next 01/10] switchdev: bridge: Offload multicast disabled
Date: Thu, 9 Feb 2017 14:54:40 +0100 [thread overview]
Message-ID: <1486648489-16455-2-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1486648489-16455-1-git-send-email-jiri@resnulli.us>
From: Nogah Frankel <nogahf@mellanox.com>
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>
---
include/net/switchdev.h | 2 ++
net/bridge/br_multicast.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index eba80c4..2971c2a 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -48,6 +48,7 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
+ SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
};
struct switchdev_attr {
@@ -62,6 +63,7 @@ struct switchdev_attr {
unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
clock_t ageing_time; /* BRIDGE_AGEING_TIME */
bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */
+ bool mc_disabled; /* MC_DISABLED */
} u;
};
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 1de3438..8c0e896 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -27,6 +27,7 @@
#include <linux/inetdevice.h>
#include <linux/mroute.h>
#include <net/ip.h>
+#include <net/switchdev.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6.h>
#include <net/mld.h>
@@ -1007,6 +1008,18 @@ static void br_ip6_multicast_port_query_expired(unsigned long data)
}
#endif
+static void br_mc_disabled_update(struct net_device *dev, bool value)
+{
+ struct switchdev_attr attr = {
+ .orig_dev = dev,
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
+ .flags = SWITCHDEV_F_DEFER,
+ .u.mc_disabled = value,
+ };
+
+ switchdev_port_attr_set(dev, &attr);
+}
+
int br_multicast_add_port(struct net_bridge_port *port)
{
port->multicast_router = MDB_RTR_TYPE_TEMP_QUERY;
@@ -1019,6 +1032,8 @@ int br_multicast_add_port(struct net_bridge_port *port)
setup_timer(&port->ip6_own_query.timer,
br_ip6_multicast_port_query_expired, (unsigned long)port);
#endif
+ br_mc_disabled_update(port->dev, port->br->multicast_disabled);
+
port->mcast_stats = netdev_alloc_pcpu_stats(struct bridge_mcast_stats);
if (!port->mcast_stats)
return -ENOMEM;
@@ -2121,6 +2136,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
if (br->multicast_disabled == !val)
goto unlock;
+ br_mc_disabled_update(br->dev, !val);
br->multicast_disabled = !val;
if (br->multicast_disabled)
goto unlock;
--
2.7.4
next prev parent reply other threads:[~2017-02-09 14:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 13:54 [patch net-next 00/10] mlxsw: Offload MC flood for unregister MC Jiri Pirko
2017-02-09 13:54 ` Jiri Pirko [this message]
2017-02-09 15:10 ` [patch net-next 01/10] switchdev: bridge: Offload multicast disabled Ivan Vecera
2017-02-09 13:54 ` [patch net-next 02/10] bridge: mcast: Merge the mc router ports deletions to one function Jiri Pirko
2017-02-09 15:11 ` Ivan Vecera
2017-02-09 13:54 ` [patch net-next 03/10] switchdev: bridge: Offload mc router ports Jiri Pirko
2017-02-09 15:11 ` Ivan Vecera
2017-02-09 13:54 ` [patch net-next 04/10] mlxsw: spectrum: Break flood set func to be per table Jiri Pirko
2017-02-09 13:54 ` [patch net-next 05/10] mlxsw: spectrum: Make port flood update more generic Jiri Pirko
2017-02-09 13:54 ` [patch net-next 06/10] mlxsw: spectrum: Change max vfid Jiri Pirko
2017-02-09 13:54 ` [patch net-next 07/10] mlxsw: spectrum: Separate bc and mc floods Jiri Pirko
2017-02-09 13:54 ` [patch net-next 08/10] mlxsw: spectrum: Add an option to flood mc by mc_router_port Jiri Pirko
2017-02-09 13:54 ` [patch net-next 09/10] mlxsw: spectrum: Extend port_orig_get for bridge devices Jiri Pirko
2017-02-09 13:54 ` [patch net-next 10/10] mlxsw: spectrum: Update mc_disabled flag by switchdev attr Jiri Pirko
2017-02-10 18:12 ` [patch net-next 00/10] mlxsw: Offload MC flood for unregister MC David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486648489-16455-2-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=ivecera@redhat.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).