aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch31
-rw-r--r--target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch130
-rw-r--r--target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch27
-rw-r--r--target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch81
-rw-r--r--target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch30
5 files changed, 299 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch
new file mode 100644
index 0000000000..d9602fab7a
--- /dev/null
+++ b/target/linux/generic/backport-5.4/702-Revert-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch
@@ -0,0 +1,31 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 7 Dec 2022 07:57:58 +0100
+Subject: [PATCH] Revert "net: dsa: b53: Fix valid setting for MDB entries"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit 1fae6eb0fc91d3ecb539e03f9e4dcd1c53ada553.
+
+Upstream commit was a fix for an overlook of setting "ent.is_valid"
+twice after 5d65b64a3d97 ("net: dsa: b53: Add support for MDB").
+
+Since MDB support was not backported to stable kernels (it's not a bug
+fix) there is nothing to fix there. Backporting this commit resulted in
+"env.is_valid" not being set at all.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ drivers/net/dsa/b53/b53_common.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1551,6 +1551,7 @@ static int b53_arl_op(struct b53_device
+
+ memset(&ent, 0, sizeof(ent));
+ ent.port = port;
++ ent.is_valid = is_valid;
+ ent.vid = vid;
+ ent.is_static = true;
+ memcpy(ent.mac, addr, ETH_ALEN);
diff --git a/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch
new file mode 100644
index 0000000000..8349d31900
--- /dev/null
+++ b/target/linux/generic/backport-5.4/703-v5.5-0001-net-dsa-b53-Add-support-for-MDB.patch
@@ -0,0 +1,130 @@
+From 5d65b64a3d97011796b225ce315b3ce0011551e7 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Thu, 24 Oct 2019 12:45:07 -0700
+Subject: [PATCH] net: dsa: b53: Add support for MDB
+
+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>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++--
+ drivers/net/dsa/b53/b53_priv.h | 8 ++++-
+ 2 files changed, 67 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1549,11 +1549,25 @@ static int b53_arl_op(struct b53_device
+ break;
+ }
+
+- 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);
+
+@@ -1672,6 +1686,47 @@ int b53_fdb_dump(struct dsa_switch *ds,
+ }
+ 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;
+@@ -2050,6 +2105,9 @@ static const struct dsa_switch_ops b53_s
+ .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 {
+--- 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, i
+ 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);
diff --git a/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch
new file mode 100644
index 0000000000..98c69fc51e
--- /dev/null
+++ b/target/linux/generic/backport-5.4/703-v5.5-0002-net-dsa-bcm_sf2-Wire-up-MDB-operations.patch
@@ -0,0 +1,27 @@
+From 29bb5e8337caf2e3d9802ee6a6804561f125bfcf Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Thu, 24 Oct 2019 12:45:08 -0700
+Subject: [PATCH] net: dsa: bcm_sf2: Wire up MDB operations
+
+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>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/bcm_sf2.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/dsa/bcm_sf2.c
++++ b/drivers/net/dsa/bcm_sf2.c
+@@ -981,6 +981,9 @@ static const struct dsa_switch_ops bcm_s
+ .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 {
diff --git a/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch
new file mode 100644
index 0000000000..be62e7f077
--- /dev/null
+++ b/target/linux/generic/backport-5.4/703-v5.5-0003-net-dsa-bcm_sf2-Add-support-for-optional-reset-contr.patch
@@ -0,0 +1,81 @@
+From eee87e4377a4b86dc2eea0ade162b0dc33f40576 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Mon, 4 Nov 2019 13:51:39 -0800
+Subject: [PATCH] net: dsa: bcm_sf2: Add support for optional reset controller
+ line
+
+Grab an optional and exclusive reset controller line for the switch and
+manage it during probe/remove functions accordingly. For 7278 devices we
+change bcm_sf2_sw_rst() to use the reset controller line since the
+WATCHDOG_CTRL register does not reset the switch contrary to stated
+documentation.
+
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++
+ drivers/net/dsa/bcm_sf2.h | 3 +++
+ 2 files changed, 22 insertions(+)
+
+--- a/drivers/net/dsa/bcm_sf2.c
++++ b/drivers/net/dsa/bcm_sf2.c
+@@ -346,6 +346,18 @@ static int bcm_sf2_sw_rst(struct bcm_sf2
+ {
+ unsigned int timeout = 1000;
+ u32 reg;
++ int ret;
++
++ /* The watchdog reset does not work on 7278, we need to hit the
++ * "external" reset line through the reset controller.
++ */
++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) {
++ ret = reset_control_assert(priv->rcdev);
++ if (ret)
++ return ret;
++
++ return reset_control_deassert(priv->rcdev);
++ }
+
+ reg = core_readl(priv, CORE_WATCHDOG_CTRL);
+ reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET;
+@@ -1099,6 +1111,11 @@ static int bcm_sf2_sw_probe(struct platf
+ priv->core_reg_align = data->core_reg_align;
+ priv->num_cfp_rules = data->num_cfp_rules;
+
++ priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
++ "switch");
++ if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER)
++ return PTR_ERR(priv->rcdev);
++
+ /* Auto-detection using standard registers will not work, so
+ * provide an indication of what kind of device we are for
+ * b53_common to work with
+@@ -1237,6 +1254,8 @@ static int bcm_sf2_sw_remove(struct plat
+ dsa_unregister_switch(priv->dev->ds);
+ bcm_sf2_cfp_exit(priv->dev->ds);
+ bcm_sf2_mdio_unregister(priv);
++ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev))
++ reset_control_assert(priv->rcdev);
+
+ return 0;
+ }
+--- a/drivers/net/dsa/bcm_sf2.h
++++ b/drivers/net/dsa/bcm_sf2.h
+@@ -18,6 +18,7 @@
+ #include <linux/types.h>
+ #include <linux/bitops.h>
+ #include <linux/if_vlan.h>
++#include <linux/reset.h>
+
+ #include <net/dsa.h>
+
+@@ -64,6 +65,8 @@ struct bcm_sf2_priv {
+ void __iomem *fcb;
+ void __iomem *acb;
+
++ struct reset_control *rcdev;
++
+ /* Register offsets indirection tables */
+ u32 type;
+ const u16 *reg_offsets;
diff --git a/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch
new file mode 100644
index 0000000000..cb6497f28a
--- /dev/null
+++ b/target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch
@@ -0,0 +1,30 @@
+From eab167f4851a19c514469dfa81147f77e17b5b20 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Mon, 20 Apr 2020 20:26:52 -0700
+Subject: [PATCH] net: dsa: b53: Fix valid setting for MDB entries
+
+When support for the MDB entries was added, the valid bit was correctly
+changed to be assigned depending on the remaining port bitmask, that is,
+if there were no more ports added to the entry's port bitmask, the entry
+now becomes invalid. There was another assignment a few lines below that
+would override this which would invalidate entries even when there were
+still multiple ports left in the MDB entry.
+
+Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device
+ ent.is_valid = !!(ent.port);
+ }
+
+- ent.is_valid = is_valid;
+ ent.vid = vid;
+ ent.is_static = true;
+ ent.is_age = false;