From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
andrew@lunn.ch, vivien.didelot@gmail.com, davem@davemloft.net,
idosch@mellanox.com, jiri@mellanox.com,
ilias.apalodimas@linaro.org, ivan.khoronzhuk@linaro.org,
roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com
Subject: [PATCH net-next 12/14] net: dsa: Wire up multicast IGMP snooping attribute notification
Date: Wed, 16 Jan 2019 12:01:00 -0800 [thread overview]
Message-ID: <20190116200102.2749-13-f.fainelli@gmail.com> (raw)
In-Reply-To: <20190116200102.2749-1-f.fainelli@gmail.com>
The bridge can at runtime be configured with or without IGMP snooping
enabled but we were not processing the switchdev attribute that notifies
about that toggle, do this now.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 2 ++
net/dsa/dsa_priv.h | 11 +++++++++++
net/dsa/port.c | 13 +++++++++++++
net/dsa/slave.c | 4 ++++
net/dsa/switch.c | 28 ++++++++++++++++++++++++++++
5 files changed, 58 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b3eefe8e18fd..11cd4db3bc9e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -479,6 +479,8 @@ struct dsa_switch_ops {
/*
* Multicast database
*/
+ int (*port_multicast_toggle)(struct dsa_switch *ds, int port,
+ bool mc_disabled);
int (*port_mdb_prepare)(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb);
void (*port_mdb_add)(struct dsa_switch *ds, int port,
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index aad8acc70183..6f7ed2b3494f 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -27,6 +27,7 @@ enum {
DSA_NOTIFIER_VLAN_ADD,
DSA_NOTIFIER_VLAN_DEL,
DSA_NOTIFIER_VLAN_FILTERING,
+ DSA_NOTIFIER_MC_DISABLED,
};
/* DSA_NOTIFIER_AGEING_TIME */
@@ -74,6 +75,14 @@ struct dsa_notifier_vlan_filtering_info {
int port;
};
+/* DSA_NOTIFIER_MC_DISABLED */
+struct dsa_notifier_mc_disabled_info {
+ bool mc_disabled;
+ struct switchdev_trans *trans;
+ int sw_index;
+ int port;
+};
+
struct dsa_slave_priv {
/* Copy of CPU port xmit for faster access in slave transmit hot path */
struct sk_buff * (*xmit)(struct sk_buff *skb,
@@ -154,6 +163,8 @@ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy);
void dsa_port_disable(struct dsa_port *dp, struct phy_device *phy);
int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br);
void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
+int dsa_port_multicast_toggle(struct dsa_port *dp, bool mc_disabled,
+ struct switchdev_trans *trans);
int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
struct switchdev_trans *trans);
int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
diff --git a/net/dsa/port.c b/net/dsa/port.c
index d7b057d46460..148458941b51 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -143,6 +143,19 @@ void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br)
dsa_port_set_state_now(dp, BR_STATE_FORWARDING);
}
+int dsa_port_multicast_toggle(struct dsa_port *dp, bool mc_disabled,
+ struct switchdev_trans *trans)
+{
+ struct dsa_notifier_mc_disabled_info info = {
+ .sw_index = dp->ds->index,
+ .port = dp->index,
+ .trans = trans,
+ .mc_disabled = mc_disabled,
+ };
+
+ return dsa_port_notify(dp, DSA_NOTIFIER_MC_DISABLED, &info);
+}
+
int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
struct switchdev_trans *trans)
{
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e266ef329583..acb7f1830e98 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -337,6 +337,10 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
break;
+ case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED:
+ ret = dsa_port_multicast_toggle(dp, attr->u.mc_disabled,
+ trans);
+ break;
default:
ret = -EOPNOTSUPP;
break;
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 831334dc5e79..e095eb808434 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -261,6 +261,31 @@ static int dsa_switch_vlan_filtering(struct dsa_switch *ds,
return 0;
}
+static int dsa_switch_mc_disabled(struct dsa_switch *ds,
+ struct dsa_notifier_mc_disabled_info *info)
+{
+ struct switchdev_trans *trans = info->trans;
+ bool mc_disabled = info->mc_disabled;
+ int port = info->port;
+ int err;
+
+ if (switchdev_trans_ph_prepare(trans))
+ return ds->ops->port_multicast_toggle ? 0 : -EOPNOTSUPP;
+
+ /* Build a mask of port members */
+ bitmap_zero(ds->bitmap, ds->num_ports);
+ if (ds->index == info->sw_index)
+ set_bit(port, ds->bitmap);
+
+ for_each_set_bit(port, ds->bitmap, ds->num_ports) {
+ err = ds->ops->port_multicast_toggle(ds, port, mc_disabled);
+ if (err)
+ return err;
+ }
+
+ return 0;
+}
+
static int dsa_switch_event(struct notifier_block *nb,
unsigned long event, void *info)
{
@@ -298,6 +323,9 @@ static int dsa_switch_event(struct notifier_block *nb,
case DSA_NOTIFIER_VLAN_FILTERING:
err = dsa_switch_vlan_filtering(ds, info);
break;
+ case DSA_NOTIFIER_MC_DISABLED:
+ err = dsa_switch_mc_disabled(ds, info);
+ break;
default:
err = -EOPNOTSUPP;
break;
--
2.17.1
next prev parent reply other threads:[~2019-01-16 20:03 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 20:00 [PATCH net-next 00/14] net: dsa: management mode for bcm_sf2 Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 01/14] net: bridge: multicast: Propagate br_mc_disabled_update() return Florian Fainelli
2019-01-17 13:47 ` Ido Schimmel
2019-01-17 19:27 ` Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 02/14] net: dsa: b53: Fix default VLAN ID Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 03/14] net: dsa: b53: Properly account for VLAN filtering Florian Fainelli
2019-01-17 16:36 ` Vivien Didelot
2019-01-17 17:48 ` Florian Fainelli
2019-01-17 18:47 ` Vivien Didelot
2019-01-17 19:06 ` Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 04/14] net: systemport: Fix reception of BPDUs Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 05/14] net: dsa: b53: Define registers for IGMP snooping Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 06/14] net: dsa: b53: Add support for MDB Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 07/14] net: dsa: Add ability to program multicast filter for CPU port Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 08/14] net: dsa: Add ndo_vlan_rx_{add,kill}_vid implementation Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 09/14] net: bridge: Propagate MC addresses with VID through switchdev Florian Fainelli
2019-01-17 14:05 ` Ido Schimmel
2019-01-17 19:17 ` Florian Fainelli
2019-01-18 10:43 ` Ido Schimmel
2019-01-18 11:41 ` Ido Schimmel
2019-01-18 21:48 ` Florian Fainelli
2019-01-19 13:55 ` Ido Schimmel
2019-01-20 3:22 ` Florian Fainelli
2019-01-21 8:41 ` Ido Schimmel
2019-01-21 8:46 ` Jiri Pirko
2019-01-16 20:00 ` [PATCH net-next 10/14] net: vlan: " Florian Fainelli
2019-01-17 14:49 ` Ido Schimmel
2019-01-17 19:12 ` Florian Fainelli
2019-01-21 9:13 ` Ido Schimmel
2019-01-21 9:17 ` Ilias Apalodimas
2019-01-22 11:30 ` Ivan Khoronzhuk
2019-01-22 11:39 ` Ivan Khoronzhuk
2019-01-16 20:00 ` [PATCH net-next 11/14] net: dsa: Make VLAN filtering use DSA notifiers Florian Fainelli
2019-01-16 20:01 ` Florian Fainelli [this message]
2019-01-17 18:36 ` [PATCH net-next 12/14] net: dsa: Wire up multicast IGMP snooping attribute notification Vivien Didelot
2019-01-17 19:07 ` Florian Fainelli
2019-01-16 20:01 ` [PATCH net-next 13/14] net: dsa: b53: Add support for toggling IGMP snooping Florian Fainelli
2019-01-16 20:01 ` [PATCH net-next 14/14] net: dsa: bcm_sf2: Enable management mode Florian Fainelli
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=20190116200102.2749-13-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=ilias.apalodimas@linaro.org \
--cc=ivan.khoronzhuk@linaro.org \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
--cc=vivien.didelot@gmail.com \
/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).