* [PATCH net-next] net: dsa: add cross-chip multicast support
@ 2017-06-15 20:14 Vivien Didelot
2017-06-15 23:33 ` Jason Cobham
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vivien Didelot @ 2017-06-15 20:14 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
Andrew Lunn, Jason Cobham, Vivien Didelot
Similarly to how cross-chip VLAN works, define a bitmap of multicast
group members for a switch, now including its DSA ports, so that
multicast traffic can be sent to all switches of the fabric.
A switch may drop the frames if no user port is a member.
This brings support for multicast in a multi-chip environment.
As of now, all switches of the fabric must support the multicast
operations in order to program a single fabric port.
Reported-by: Jason Cobham <jcobham@questertangent.com>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
net/dsa/switch.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index f1029a8d0e20..97e2e9c8cf3f 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -122,19 +122,30 @@ static int dsa_switch_mdb_add(struct dsa_switch *ds,
{
const struct switchdev_obj_port_mdb *mdb = info->mdb;
struct switchdev_trans *trans = info->trans;
+ DECLARE_BITMAP(group, ds->num_ports);
+ int port, err;
- /* Do not care yet about other switch chips of the fabric */
- if (ds->index != info->sw_index)
- return 0;
+ /* Build a mask of Multicast group members */
+ bitmap_zero(group, ds->num_ports);
+ if (ds->index == info->sw_index)
+ set_bit(info->port, group);
+ for (port = 0; port < ds->num_ports; port++)
+ if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+ set_bit(port, group);
if (switchdev_trans_ph_prepare(trans)) {
if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add)
return -EOPNOTSUPP;
- return ds->ops->port_mdb_prepare(ds, info->port, mdb, trans);
+ for_each_set_bit(port, group, ds->num_ports) {
+ err = ds->ops->port_mdb_prepare(ds, port, mdb, trans);
+ if (err)
+ return err;
+ }
}
- ds->ops->port_mdb_add(ds, info->port, mdb, trans);
+ for_each_set_bit(port, group, ds->num_ports)
+ ds->ops->port_mdb_add(ds, port, mdb, trans);
return 0;
}
@@ -144,14 +155,13 @@ static int dsa_switch_mdb_del(struct dsa_switch *ds,
{
const struct switchdev_obj_port_mdb *mdb = info->mdb;
- /* Do not care yet about other switch chips of the fabric */
- if (ds->index != info->sw_index)
- return 0;
-
if (!ds->ops->port_mdb_del)
return -EOPNOTSUPP;
- return ds->ops->port_mdb_del(ds, info->port, mdb);
+ if (ds->index == info->sw_index)
+ return ds->ops->port_mdb_del(ds, info->port, mdb);
+
+ return 0;
}
static int dsa_switch_vlan_add(struct dsa_switch *ds,
--
2.13.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH net-next] net: dsa: add cross-chip multicast support
2017-06-15 20:14 [PATCH net-next] net: dsa: add cross-chip multicast support Vivien Didelot
@ 2017-06-15 23:33 ` Jason Cobham
2017-06-16 0:34 ` Florian Fainelli
2017-06-16 19:21 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jason Cobham @ 2017-06-15 23:33 UTC (permalink / raw)
To: 'Vivien Didelot', netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
David S. Miller, Florian Fainelli, Andrew Lunn
On 06/15/2017 1:15 PM, Vivien Didelot wrote:
> Similarly to how cross-chip VLAN works, define a bitmap of multicast group
> members for a switch, now including its DSA ports, so that multicast traffic
> can be sent to all switches of the fabric.
>
> A switch may drop the frames if no user port is a member.
>
> This brings support for multicast in a multi-chip environment.
> As of now, all switches of the fabric must support the multicast operations in
> order to program a single fabric port.
>
> Reported-by: Jason Cobham <jcobham@questertangent.com>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Thanks for this fix:
Tested-by: Jason Cobham <jcobham@questertangent.com>
--
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: add cross-chip multicast support
2017-06-15 20:14 [PATCH net-next] net: dsa: add cross-chip multicast support Vivien Didelot
2017-06-15 23:33 ` Jason Cobham
@ 2017-06-16 0:34 ` Florian Fainelli
2017-06-16 19:21 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2017-06-16 0:34 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn, Jason Cobham
On 06/15/2017 01:14 PM, Vivien Didelot wrote:
> Similarly to how cross-chip VLAN works, define a bitmap of multicast
> group members for a switch, now including its DSA ports, so that
> multicast traffic can be sent to all switches of the fabric.
>
> A switch may drop the frames if no user port is a member.
>
> This brings support for multicast in a multi-chip environment.
> As of now, all switches of the fabric must support the multicast
> operations in order to program a single fabric port.
>
> Reported-by: Jason Cobham <jcobham@questertangent.com>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: add cross-chip multicast support
2017-06-15 20:14 [PATCH net-next] net: dsa: add cross-chip multicast support Vivien Didelot
2017-06-15 23:33 ` Jason Cobham
2017-06-16 0:34 ` Florian Fainelli
@ 2017-06-16 19:21 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-06-16 19:21 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, f.fainelli, andrew, jcobham
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Thu, 15 Jun 2017 16:14:48 -0400
> Similarly to how cross-chip VLAN works, define a bitmap of multicast
> group members for a switch, now including its DSA ports, so that
> multicast traffic can be sent to all switches of the fabric.
>
> A switch may drop the frames if no user port is a member.
>
> This brings support for multicast in a multi-chip environment.
> As of now, all switches of the fabric must support the multicast
> operations in order to program a single fabric port.
>
> Reported-by: Jason Cobham <jcobham@questertangent.com>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied, thanks Vivien.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-16 19:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-15 20:14 [PATCH net-next] net: dsa: add cross-chip multicast support Vivien Didelot
2017-06-15 23:33 ` Jason Cobham
2017-06-16 0:34 ` Florian Fainelli
2017-06-16 19:21 ` David Miller
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).