* [PATCH net-next 0/2] net: dsa: b53: Add support for MDB
@ 2019-10-24 19:45 Florian Fainelli
2019-10-24 19:45 ` [PATCH net-next 1/2] " Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Florian Fainelli @ 2019-10-24 19:45 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski
Hi all,
This patch series adds support for programming multicast database
entries on b53 and bcm_sf2. This is extracted from a previously
submitted series that added managed mode support, but these patches are
usable in isolation. The larger series still needs to be reworked.
Florian Fainelli (2):
net: dsa: b53: Add support for MDB
net: dsa: bcm_sf2: Wire up MDB operations
drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++--
drivers/net/dsa/b53/b53_priv.h | 8 ++++-
drivers/net/dsa/bcm_sf2.c | 3 ++
3 files changed, 70 insertions(+), 3 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH net-next 1/2] net: dsa: b53: Add support for MDB 2019-10-24 19:45 [PATCH net-next 0/2] net: dsa: b53: Add support for MDB Florian Fainelli @ 2019-10-24 19:45 ` Florian Fainelli 2019-10-25 18:43 ` Vivien Didelot 2019-10-24 19:45 ` [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations Florian Fainelli 2019-10-28 20:58 ` [PATCH net-next 0/2] net: dsa: b53: Add support for MDB David Miller 2 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2019-10-24 19:45 UTC (permalink / raw) To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski In preparation for supporting IGMP snooping with or without the use of a bridge, add support within b53_common.c to program the ARL entries for multicast operations. The key difference is that a multicast ARL entry is comprised of a bitmask of enabled ports, instead of a port number. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++-- drivers/net/dsa/b53/b53_priv.h | 8 ++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index baadf622ac55..36828f210030 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -1503,11 +1503,25 @@ static int b53_arl_op(struct b53_device *dev, int op, int port, idx = 1; } - memset(&ent, 0, sizeof(ent)); - ent.port = port; + /* For multicast address, the port is a bitmask and the validity + * is determined by having at least one port being still active + */ + if (!is_multicast_ether_addr(addr)) { + ent.port = port; + ent.is_valid = is_valid; + } else { + if (is_valid) + ent.port |= BIT(port); + else + ent.port &= ~BIT(port); + + ent.is_valid = !!(ent.port); + } + ent.is_valid = is_valid; ent.vid = vid; ent.is_static = true; + ent.is_age = false; memcpy(ent.mac, addr, ETH_ALEN); b53_arl_from_entry(&mac_vid, &fwd_entry, &ent); @@ -1626,6 +1640,47 @@ int b53_fdb_dump(struct dsa_switch *ds, int port, } EXPORT_SYMBOL(b53_fdb_dump); +int b53_mdb_prepare(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) +{ + struct b53_device *priv = ds->priv; + + /* 5325 and 5365 require some more massaging, but could + * be supported eventually + */ + if (is5325(priv) || is5365(priv)) + return -EOPNOTSUPP; + + return 0; +} +EXPORT_SYMBOL(b53_mdb_prepare); + +void b53_mdb_add(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) +{ + struct b53_device *priv = ds->priv; + int ret; + + ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); + if (ret) + dev_err(ds->dev, "failed to add MDB entry\n"); +} +EXPORT_SYMBOL(b53_mdb_add); + +int b53_mdb_del(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb) +{ + struct b53_device *priv = ds->priv; + int ret; + + ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false); + if (ret) + dev_err(ds->dev, "failed to delete MDB entry\n"); + + return ret; +} +EXPORT_SYMBOL(b53_mdb_del); + int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) { struct b53_device *dev = ds->priv; @@ -1994,6 +2049,9 @@ static const struct dsa_switch_ops b53_switch_ops = { .port_fdb_del = b53_fdb_del, .port_mirror_add = b53_mirror_add, .port_mirror_del = b53_mirror_del, + .port_mdb_prepare = b53_mdb_prepare, + .port_mdb_add = b53_mdb_add, + .port_mdb_del = b53_mdb_del, }; struct b53_chip_data { diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index a7dd8acc281b..1877acf05081 100644 --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h @@ -250,7 +250,7 @@ b53_build_op(write48, u64); b53_build_op(write64, u64); struct b53_arl_entry { - u8 port; + u16 port; u8 mac[ETH_ALEN]; u16 vid; u8 is_valid:1; @@ -351,6 +351,12 @@ 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_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, + const struct switchdev_obj_port_mdb *mdb); +int b53_mdb_del(struct dsa_switch *ds, int port, + const struct switchdev_obj_port_mdb *mdb); int b53_mirror_add(struct dsa_switch *ds, int port, struct dsa_mall_mirror_tc_entry *mirror, bool ingress); enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); -- 2.17.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: b53: Add support for MDB 2019-10-24 19:45 ` [PATCH net-next 1/2] " Florian Fainelli @ 2019-10-25 18:43 ` Vivien Didelot 0 siblings, 0 replies; 6+ messages in thread From: Vivien Didelot @ 2019-10-25 18:43 UTC (permalink / raw) To: Florian Fainelli; +Cc: netdev, Florian Fainelli, andrew, davem, Jakub Kicinski On Thu, 24 Oct 2019 12:45:07 -0700, Florian Fainelli <f.fainelli@gmail.com> wrote: > In preparation for supporting IGMP snooping with or without the use of > a bridge, add support within b53_common.c to program the ARL entries for > multicast operations. The key difference is that a multicast ARL entry > is comprised of a bitmask of enabled ports, instead of a port number. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations 2019-10-24 19:45 [PATCH net-next 0/2] net: dsa: b53: Add support for MDB Florian Fainelli 2019-10-24 19:45 ` [PATCH net-next 1/2] " Florian Fainelli @ 2019-10-24 19:45 ` Florian Fainelli 2019-10-25 18:44 ` Vivien Didelot 2019-10-28 20:58 ` [PATCH net-next 0/2] net: dsa: b53: Add support for MDB David Miller 2 siblings, 1 reply; 6+ messages in thread From: Florian Fainelli @ 2019-10-24 19:45 UTC (permalink / raw) To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, davem, Jakub Kicinski Leverage the recently add b53_mdb_{add,del,prepare} functions since they work as-is for bcm_sf2. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/net/dsa/bcm_sf2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index c068a3b7207b..a4a46f8df352 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -968,6 +968,9 @@ static const struct dsa_switch_ops bcm_sf2_ops = { .set_rxnfc = bcm_sf2_set_rxnfc, .port_mirror_add = b53_mirror_add, .port_mirror_del = b53_mirror_del, + .port_mdb_prepare = b53_mdb_prepare, + .port_mdb_add = b53_mdb_add, + .port_mdb_del = b53_mdb_del, }; struct bcm_sf2_of_data { -- 2.17.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations 2019-10-24 19:45 ` [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations Florian Fainelli @ 2019-10-25 18:44 ` Vivien Didelot 0 siblings, 0 replies; 6+ messages in thread From: Vivien Didelot @ 2019-10-25 18:44 UTC (permalink / raw) To: Florian Fainelli; +Cc: netdev, Florian Fainelli, andrew, davem, Jakub Kicinski On Thu, 24 Oct 2019 12:45:08 -0700, Florian Fainelli <f.fainelli@gmail.com> wrote: > Leverage the recently add b53_mdb_{add,del,prepare} functions since they > work as-is for bcm_sf2. > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: b53: Add support for MDB 2019-10-24 19:45 [PATCH net-next 0/2] net: dsa: b53: Add support for MDB Florian Fainelli 2019-10-24 19:45 ` [PATCH net-next 1/2] " Florian Fainelli 2019-10-24 19:45 ` [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations Florian Fainelli @ 2019-10-28 20:58 ` David Miller 2 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2019-10-28 20:58 UTC (permalink / raw) To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, jakub.kicinski From: Florian Fainelli <f.fainelli@gmail.com> Date: Thu, 24 Oct 2019 12:45:06 -0700 > This patch series adds support for programming multicast database > entries on b53 and bcm_sf2. This is extracted from a previously > submitted series that added managed mode support, but these patches are > usable in isolation. The larger series still needs to be reworked. Series applied, thanks Florian. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-28 20:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-24 19:45 [PATCH net-next 0/2] net: dsa: b53: Add support for MDB Florian Fainelli 2019-10-24 19:45 ` [PATCH net-next 1/2] " Florian Fainelli 2019-10-25 18:43 ` Vivien Didelot 2019-10-24 19:45 ` [PATCH net-next 2/2] net: dsa: bcm_sf2: Wire up MDB operations Florian Fainelli 2019-10-25 18:44 ` Vivien Didelot 2019-10-28 20:58 ` [PATCH net-next 0/2] net: dsa: b53: Add support for MDB David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox