[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190116200102.2749-14-f.fainelli@gmail.com>
Date: Wed, 16 Jan 2019 12:01:01 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>, andrew@...n.ch,
vivien.didelot@...il.com, davem@...emloft.net, idosch@...lanox.com,
jiri@...lanox.com, ilias.apalodimas@...aro.org,
ivan.khoronzhuk@...aro.org, roopa@...ulusnetworks.com,
nikolay@...ulusnetworks.com
Subject: [PATCH net-next 13/14] net: dsa: b53: Add support for toggling IGMP snooping
Add the required configuration knobs to honor the turning off of IGMP
snooping (typically through the bridge interface) which means that when
IGMP snooping is off, we must be flooding mutlicast since we do not get
any notifications about IGMP join/leave through the network stack
running on the bridge.
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
drivers/net/dsa/b53/b53_common.c | 30 ++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 6c894ad4768a..2c9f6f6abdf3 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1640,6 +1640,35 @@ int b53_fdb_dump(struct dsa_switch *ds, int port,
}
EXPORT_SYMBOL(b53_fdb_dump);
+int b53_multicast_toggle(struct dsa_switch *ds, int port,
+ bool mc_disabled)
+{
+ struct b53_device *dev = ds->priv;
+ u16 mc_ctrl;
+
+ if (is5325(dev) || is5365(dev))
+ return -EOPNOTSUPP;
+
+ /* Allow port to flood multicast */
+ b53_read16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, &mc_ctrl);
+ if (mc_disabled)
+ mc_ctrl |= BIT(port);
+ else
+ mc_ctrl &= ~BIT(port);
+ b53_write16(dev, B53_CTRL_PAGE, B53_MC_FLOOD_MASK, mc_ctrl);
+
+ /* And flood IP multicast as well */
+ b53_read16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, &mc_ctrl);
+ if (mc_disabled)
+ mc_ctrl |= BIT(port);
+ else
+ mc_ctrl &= ~BIT(port);
+ b53_write16(dev, B53_CTRL_PAGE, B53_IPMC_FLOOD_MASK, mc_ctrl);
+
+ return 0;
+}
+EXPORT_SYMBOL(b53_multicast_toggle);
+
int b53_mdb_prepare(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb)
{
@@ -2025,6 +2054,7 @@ static const struct dsa_switch_ops b53_switch_ops = {
.port_mirror_add = b53_mirror_add,
.port_mirror_del = b53_mirror_del,
.port_mdb_prepare = b53_mdb_prepare,
+ .port_multicast_toggle = b53_multicast_toggle,
.port_mdb_add = b53_mdb_add,
.port_mdb_del = b53_mdb_del,
};
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 620638ff9338..cd259fb8b00e 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -350,6 +350,8 @@ int b53_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid);
int b53_fdb_dump(struct dsa_switch *ds, int port,
dsa_fdb_dump_cb_t *cb, void *data);
+int b53_multicast_toggle(struct dsa_switch *ds, int port,
+ bool mc_disabled);
int b53_mdb_prepare(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb);
void b53_mdb_add(struct dsa_switch *ds, int port,
--
2.17.1
Powered by blists - more mailing lists