kernel: backport b53/bcm_sf2 changes from v5.6
authorRafał Miłecki <rafal@milecki.pl>
Wed, 7 Dec 2022 08:37:08 +0000 (09:37 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Wed, 7 Dec 2022 09:30:14 +0000 (10:30 +0100)
This b53 backport significantly stabilizes switch traffic performance.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
29 files changed:
target/linux/bcm4908/patches-5.4/070-v5.10-0001-net-dsa-b53-Use-dev_-err-info-instead-of-pr_.patch
target/linux/bcm4908/patches-5.4/070-v5.10-0002-net-dsa-b53-Print-err-message-on-SW_RST-timeout.patch
target/linux/bcm4908/patches-5.4/071-v5.12-0001-net-dsa-bcm_sf2-support-BCM4908-s-integrated-switch.patch
target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch [new file with mode: 0644]
target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch [new file with mode: 0644]
target/linux/generic/backport-5.4/707-v5.7-0016-net-dsa-b53-Fix-valid-setting-for-MDB-entries.patch
target/linux/generic/backport-5.4/745-v5.7-net-dsa-mt7530-add-support-for-port-mirroring.patch
target/linux/generic/backport-5.4/747-v5.5-net-dsa-mv88e6xxx-Add-support-for-port-mirroring.patch
target/linux/generic/backport-5.4/748-v5.5-net-dsa-mv88e6xxx-fix-broken-if-statement-because-of.patch
target/linux/generic/backport-5.4/752-v5.8-net-dsa-provide-an-option-for-drivers-to-always-rece.patch
target/linux/generic/backport-5.4/753-v5.8-net-dsa-mt7530-fix-VLAN-setup.patch
target/linux/generic/backport-5.4/758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch
target/linux/generic/backport-5.4/765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch
target/linux/generic/backport-5.4/771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch
target/linux/generic/backport-5.4/772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch
target/linux/generic/backport-5.4/773-v5.12-net-dsa-move-switchdev-event-implementation-under-th.patch
target/linux/generic/backport-5.4/774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch
target/linux/generic/backport-5.4/775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch
target/linux/generic/pending-5.4/647-net-dsa-support-hardware-flow-table-offload.patch
target/linux/generic/pending-5.4/761-net-dsa-mt7530-Support-EEE-features.patch
target/linux/generic/pending-5.4/765-net-dsa-Include-local-addresses-in-assisted-CPU-port.patch
target/linux/generic/pending-5.4/766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch
target/linux/generic/pending-5.4/767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch
target/linux/generic/pending-5.4/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch
target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch
target/linux/mediatek/patches-5.4/0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch
target/linux/mediatek/patches-5.4/0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch
target/linux/mediatek/patches-5.4/0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch
target/linux/mediatek/patches-5.4/0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch

index 0b2ebbe1f876f8eee14a28889810c527200d692f..04e506f6fe0eb2ebcbcee9c87391646faed6e9d8 100644 (file)
@@ -26,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  #include <linux/delay.h>
  #include <linux/export.h>
  #include <linux/gpio.h>
-@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device
+@@ -2567,8 +2565,9 @@ int b53_switch_detect(struct b53_device
                        dev->chip_id = id32;
                        break;
                default:
@@ -38,7 +38,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
                        return -ENODEV;
                }
        }
-@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic
+@@ -2598,7 +2597,8 @@ int b53_switch_register(struct b53_devic
        if (ret)
                return ret;
  
index 2661b0918ecabab123d24074a32163c063715276..d619aa45b7d5d42edb6d8c1a12e313489b8bbeed 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- a/drivers/net/dsa/b53/b53_common.c
 +++ b/drivers/net/dsa/b53/b53_common.c
-@@ -755,8 +755,11 @@ static int b53_switch_reset(struct b53_d
+@@ -768,8 +768,11 @@ static int b53_switch_reset(struct b53_d
                        usleep_range(1000, 2000);
                } while (timeout-- > 0);
  
index bd8bb1e51e588a498bc7cb37e104700d382af875..e27ecc349867606e5ff34094afba346bc8a3bd44 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
 --- a/drivers/net/dsa/b53/b53_common.c
 +++ b/drivers/net/dsa/b53/b53_common.c
-@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw
+@@ -2363,6 +2363,22 @@ static const struct b53_chip_data b53_sw
                .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
                .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
        },
diff --git a/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch b/target/linux/generic/backport-5.4/704-v5.6-net-dsa-Get-information-about-stacked-DSA-protocol.patch
new file mode 100644 (file)
index 0000000..0a05721
--- /dev/null
@@ -0,0 +1,363 @@
+From 4d776482ecc689bdd68627985ac4cb5a6f325953 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 7 Jan 2020 21:06:05 -0800
+Subject: [PATCH] net: dsa: Get information about stacked DSA protocol
+
+It is possible to stack multiple DSA switches in a way that they are not
+part of the tree (disjoint) but the DSA master of a switch is a DSA
+slave of another. When that happens switch drivers may have to know this
+is the case so as to determine whether their tagging protocol has a
+remove chance of working.
+
+This is useful for specific switch drivers such as b53 where devices
+have been known to be stacked in the wild without the Broadcom tag
+protocol supporting that feature. This allows b53 to continue supporting
+those devices by forcing the disabling of Broadcom tags on the outermost
+switches if necessary.
+
+The get_tag_protocol() function is therefore updated to gain an
+additional enum dsa_tag_protocol argument which denotes the current
+tagging protocol used by the DSA master we are attached to, else
+DSA_TAG_PROTO_NONE for the top of the dsa_switch_tree.
+
+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       | 22 +++++++++++-------
+ drivers/net/dsa/b53/b53_priv.h         |  4 +++-
+ drivers/net/dsa/dsa_loop.c             |  3 ++-
+ drivers/net/dsa/lan9303-core.c         |  3 ++-
+ drivers/net/dsa/lantiq_gswip.c         |  3 ++-
+ drivers/net/dsa/microchip/ksz8795.c    |  3 ++-
+ drivers/net/dsa/microchip/ksz9477.c    |  3 ++-
+ drivers/net/dsa/mt7530.c               |  3 ++-
+ drivers/net/dsa/mv88e6060.c            |  3 ++-
+ drivers/net/dsa/mv88e6xxx/chip.c       |  3 ++-
+ drivers/net/dsa/ocelot/felix.c         |  3 ++-
+ drivers/net/dsa/qca/ar9331.c           |  3 ++-
+ drivers/net/dsa/qca8k.c                |  3 ++-
+ drivers/net/dsa/rtl8366rb.c            |  3 ++-
+ drivers/net/dsa/sja1105/sja1105_main.c |  3 ++-
+ drivers/net/dsa/vitesse-vsc73xx-core.c |  3 ++-
+ include/net/dsa.h                      |  3 ++-
+ net/dsa/dsa2.c                         | 31 ++++++++++++++++++++++++--
+ net/dsa/dsa_priv.h                     |  1 +
+ net/dsa/slave.c                        |  4 +---
+ 20 files changed, 78 insertions(+), 29 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -587,9 +587,8 @@ EXPORT_SYMBOL(b53_disable_port);
+ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
+ {
+-      bool tag_en = !(ds->ops->get_tag_protocol(ds, port) ==
+-                       DSA_TAG_PROTO_NONE);
+       struct b53_device *dev = ds->priv;
++      bool tag_en = !(dev->tag_protocol == DSA_TAG_PROTO_NONE);
+       u8 hdr_ctl, val;
+       u16 reg;
+@@ -1921,7 +1920,8 @@ static bool b53_can_enable_brcm_tags(str
+       return ret;
+ }
+-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port)
++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
++                                         enum dsa_tag_protocol mprot)
+ {
+       struct b53_device *dev = ds->priv;
+@@ -1931,16 +1931,22 @@ enum dsa_tag_protocol b53_get_tag_protoc
+        * misses on multicast addresses (TBD).
+        */
+       if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) ||
+-          !b53_can_enable_brcm_tags(ds, port))
+-              return DSA_TAG_PROTO_NONE;
++          !b53_can_enable_brcm_tags(ds, port)) {
++              dev->tag_protocol = DSA_TAG_PROTO_NONE;
++              goto out;
++      }
+       /* Broadcom BCM58xx chips have a flow accelerator on Port 8
+        * which requires us to use the prepended Broadcom tag type
+        */
+-      if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT)
+-              return DSA_TAG_PROTO_BRCM_PREPEND;
++      if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) {
++              dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND;
++              goto out;
++      }
+-      return DSA_TAG_PROTO_BRCM;
++      dev->tag_protocol = DSA_TAG_PROTO_BRCM;
++out:
++      return dev->tag_protocol;
+ }
+ EXPORT_SYMBOL(b53_get_tag_protocol);
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -118,6 +118,7 @@ struct b53_device {
+       u8 jumbo_size_reg;
+       int reset_gpio;
+       u8 num_arl_entries;
++      enum dsa_tag_protocol tag_protocol;
+       /* used ports mask */
+       u16 enabled_ports;
+@@ -359,7 +360,8 @@ int b53_mdb_del(struct dsa_switch *ds, i
+               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);
++enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
++                                         enum dsa_tag_protocol mprot);
+ void b53_mirror_del(struct dsa_switch *ds, int port,
+                   struct dsa_mall_mirror_tc_entry *mirror);
+ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
+--- a/drivers/net/dsa/dsa_loop.c
++++ b/drivers/net/dsa/dsa_loop.c
+@@ -61,7 +61,8 @@ struct dsa_loop_priv {
+ static struct phy_device *phydevs[PHY_MAX_ADDR];
+ static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
+-                                                 int port)
++                                                 int port,
++                                                 enum dsa_tag_protocol mp)
+ {
+       dev_dbg(ds->dev, "%s: port: %d\n", __func__, port);
+--- a/drivers/net/dsa/lan9303-core.c
++++ b/drivers/net/dsa/lan9303-core.c
+@@ -889,7 +889,8 @@ static int lan9303_check_device(struct l
+ /* ---------------------------- DSA -----------------------------------*/
+ static enum dsa_tag_protocol lan9303_get_tag_protocol(struct dsa_switch *ds,
+-                                                    int port)
++                                                    int port,
++                                                    enum dsa_tag_protocol mp)
+ {
+       return DSA_TAG_PROTO_LAN9303;
+ }
+--- a/drivers/net/dsa/lantiq_gswip.c
++++ b/drivers/net/dsa/lantiq_gswip.c
+@@ -860,7 +860,8 @@ static int gswip_setup(struct dsa_switch
+ }
+ static enum dsa_tag_protocol gswip_get_tag_protocol(struct dsa_switch *ds,
+-                                                  int port)
++                                                  int port,
++                                                  enum dsa_tag_protocol mp)
+ {
+       return DSA_TAG_PROTO_GSWIP;
+ }
+--- a/drivers/net/dsa/microchip/ksz8795.c
++++ b/drivers/net/dsa/microchip/ksz8795.c
+@@ -645,7 +645,8 @@ static void ksz8795_w_phy(struct ksz_dev
+ }
+ static enum dsa_tag_protocol ksz8795_get_tag_protocol(struct dsa_switch *ds,
+-                                                    int port)
++                                                    int port,
++                                                    enum dsa_tag_protocol mp)
+ {
+       return DSA_TAG_PROTO_KSZ8795;
+ }
+--- a/drivers/net/dsa/microchip/ksz9477.c
++++ b/drivers/net/dsa/microchip/ksz9477.c
+@@ -295,7 +295,8 @@ static void ksz9477_port_init_cnt(struct
+ }
+ static enum dsa_tag_protocol ksz9477_get_tag_protocol(struct dsa_switch *ds,
+-                                                    int port)
++                                                    int port,
++                                                    enum dsa_tag_protocol mp)
+ {
+       enum dsa_tag_protocol proto = DSA_TAG_PROTO_KSZ9477;
+       struct ksz_device *dev = ds->priv;
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
+@@ -1144,7 +1144,8 @@ mt7530_port_vlan_del(struct dsa_switch *
+ }
+ static enum dsa_tag_protocol
+-mtk_get_tag_protocol(struct dsa_switch *ds, int port)
++mtk_get_tag_protocol(struct dsa_switch *ds, int port,
++                   enum dsa_tag_protocol mp)
+ {
+       struct mt7530_priv *priv = ds->priv;
+--- a/drivers/net/dsa/mv88e6060.c
++++ b/drivers/net/dsa/mv88e6060.c
+@@ -43,7 +43,8 @@ static const char *mv88e6060_get_name(st
+ }
+ static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
+-                                                      int port)
++                                                      int port,
++                                                      enum dsa_tag_protocol m)
+ {
+       return DSA_TAG_PROTO_TRAILER;
+ }
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -4878,7 +4878,8 @@ static struct mv88e6xxx_chip *mv88e6xxx_
+ }
+ static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
+-                                                      int port)
++                                                      int port,
++                                                      enum dsa_tag_protocol m)
+ {
+       struct mv88e6xxx_chip *chip = ds->priv;
+--- a/drivers/net/dsa/qca8k.c
++++ b/drivers/net/dsa/qca8k.c
+@@ -1016,7 +1016,8 @@ qca8k_port_fdb_dump(struct dsa_switch *d
+ }
+ static enum dsa_tag_protocol
+-qca8k_get_tag_protocol(struct dsa_switch *ds, int port)
++qca8k_get_tag_protocol(struct dsa_switch *ds, int port,
++                     enum dsa_tag_protocol mp)
+ {
+       return DSA_TAG_PROTO_QCA;
+ }
+--- a/drivers/net/dsa/rtl8366rb.c
++++ b/drivers/net/dsa/rtl8366rb.c
+@@ -964,7 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw
+ }
+ static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds,
+-                                                    int port)
++                                                    int port,
++                                                    enum dsa_tag_protocol mp)
+ {
+       /* For now, the RTL switches are handled without any custom tags.
+        *
+--- a/drivers/net/dsa/sja1105/sja1105_main.c
++++ b/drivers/net/dsa/sja1105/sja1105_main.c
+@@ -1591,7 +1591,8 @@ static int sja1105_setup_8021q_tagging(s
+ }
+ static enum dsa_tag_protocol
+-sja1105_get_tag_protocol(struct dsa_switch *ds, int port)
++sja1105_get_tag_protocol(struct dsa_switch *ds, int port,
++                       enum dsa_tag_protocol mp)
+ {
+       return DSA_TAG_PROTO_SJA1105;
+ }
+--- a/drivers/net/dsa/vitesse-vsc73xx-core.c
++++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
+@@ -542,7 +542,8 @@ static int vsc73xx_phy_write(struct dsa_
+ }
+ static enum dsa_tag_protocol vsc73xx_get_tag_protocol(struct dsa_switch *ds,
+-                                                    int port)
++                                                    int port,
++                                                    enum dsa_tag_protocol mp)
+ {
+       /* The switch internally uses a 8 byte header with length,
+        * source port, tag, LPA and priority. This is supposedly
+--- a/include/net/dsa.h
++++ b/include/net/dsa.h
+@@ -353,7 +353,8 @@ typedef int dsa_fdb_dump_cb_t(const unsi
+                             bool is_static, void *data);
+ struct dsa_switch_ops {
+       enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds,
+-                                                int port);
++                                                int port,
++                                                enum dsa_tag_protocol mprot);
+       int     (*setup)(struct dsa_switch *ds);
+       void    (*teardown)(struct dsa_switch *ds);
+--- a/net/dsa/dsa2.c
++++ b/net/dsa/dsa2.c
+@@ -631,6 +631,32 @@ static int dsa_port_parse_dsa(struct dsa
+       return 0;
+ }
++static enum dsa_tag_protocol dsa_get_tag_protocol(struct dsa_port *dp,
++                                                struct net_device *master)
++{
++      enum dsa_tag_protocol tag_protocol = DSA_TAG_PROTO_NONE;
++      struct dsa_switch *mds, *ds = dp->ds;
++      unsigned int mdp_upstream;
++      struct dsa_port *mdp;
++
++      /* It is possible to stack DSA switches onto one another when that
++       * happens the switch driver may want to know if its tagging protocol
++       * is going to work in such a configuration.
++       */
++      if (dsa_slave_dev_check(master)) {
++              mdp = dsa_slave_to_port(master);
++              mds = mdp->ds;
++              mdp_upstream = dsa_upstream_port(mds, mdp->index);
++              tag_protocol = mds->ops->get_tag_protocol(mds, mdp_upstream,
++                                                        DSA_TAG_PROTO_NONE);
++      }
++
++      /* If the master device is not itself a DSA slave in a disjoint DSA
++       * tree, then return immediately.
++       */
++      return ds->ops->get_tag_protocol(ds, dp->index, tag_protocol);
++}
++
+ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master)
+ {
+       struct dsa_switch *ds = dp->ds;
+@@ -638,20 +664,21 @@ static int dsa_port_parse_cpu(struct dsa
+       const struct dsa_device_ops *tag_ops;
+       enum dsa_tag_protocol tag_protocol;
+-      tag_protocol = ds->ops->get_tag_protocol(ds, dp->index);
++      tag_protocol = dsa_get_tag_protocol(dp, master);
+       tag_ops = dsa_tag_driver_get(tag_protocol);
+       if (IS_ERR(tag_ops)) {
+               if (PTR_ERR(tag_ops) == -ENOPROTOOPT)
+                       return -EPROBE_DEFER;
+               dev_warn(ds->dev, "No tagger for this switch\n");
++              dp->master = NULL;
+               return PTR_ERR(tag_ops);
+       }
++      dp->master = master;
+       dp->type = DSA_PORT_TYPE_CPU;
+       dp->filter = tag_ops->filter;
+       dp->rcv = tag_ops->rcv;
+       dp->tag_ops = tag_ops;
+-      dp->master = master;
+       dp->dst = dst;
+       return 0;
+--- a/net/dsa/dsa_priv.h
++++ b/net/dsa/dsa_priv.h
+@@ -189,6 +189,7 @@ extern const struct dsa_device_ops notag
+ void dsa_slave_mii_bus_init(struct dsa_switch *ds);
+ int dsa_slave_create(struct dsa_port *dp);
+ void dsa_slave_destroy(struct net_device *slave_dev);
++bool dsa_slave_dev_check(const struct net_device *dev);
+ int dsa_slave_suspend(struct net_device *slave_dev);
+ int dsa_slave_resume(struct net_device *slave_dev);
+ int dsa_slave_register_notifier(void);
+--- a/net/dsa/slave.c
++++ b/net/dsa/slave.c
+@@ -22,8 +22,6 @@
+ #include "dsa_priv.h"
+-static bool dsa_slave_dev_check(const struct net_device *dev);
+-
+ /* slave mii_bus handling ***************************************************/
+ static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
+ {
+@@ -1494,7 +1492,7 @@ void dsa_slave_destroy(struct net_device
+       free_netdev(slave_dev);
+ }
+-static bool dsa_slave_dev_check(const struct net_device *dev)
++bool dsa_slave_dev_check(const struct net_device *dev)
+ {
+       return dev->netdev_ops == &dsa_slave_netdev_ops;
+ }
diff --git a/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch b/target/linux/generic/backport-5.4/705-v5.6-0001-net-dsa-b53-Enable-Broadcom-tags-for-531x5-539x-fami.patch
new file mode 100644 (file)
index 0000000..abc2dc8
--- /dev/null
@@ -0,0 +1,104 @@
+From 8fab459e69abfd04a66d76423d18ba853fced4ab Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 7 Jan 2020 21:06:06 -0800
+Subject: [PATCH] net: dsa: b53: Enable Broadcom tags for 531x5/539x families
+
+The BCM531x5 and BCM539x families require that the IMP port be enabled
+within the management page and that management mode (SM_SW_FWD_MODE) be
+turned on. Once this is done, everything works as expected, including
+multicast with standalone DSA devices or bridge devices.
+
+Because such switches are frequencly cascaded with other internal
+Broadcom switches on which we want to enable Broadcom tags, update
+b53_can_enable_brcm_tags() to check the kind of DSA master tagging
+protocol being used, if it is one of the two supported Broadcom tagging
+protocols, force DSA_TAG_PROTO_NONE.
+
+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 | 46 +++++++++++++++++++++++++-------
+ 1 file changed, 37 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -371,8 +371,6 @@ static void b53_enable_vlan(struct b53_d
+               b53_read8(dev, B53_VLAN_PAGE, B53_VLAN_CTRL5, &vc5);
+       }
+-      mgmt &= ~SM_SW_FWD_MODE;
+-
+       if (enable) {
+               vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID;
+               vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN;
+@@ -608,6 +606,22 @@ void b53_brcm_hdr_setup(struct dsa_switc
+               break;
+       }
++      /* Enable management mode if tagging is requested */
++      b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &hdr_ctl);
++      if (tag_en)
++              hdr_ctl |= SM_SW_FWD_MODE;
++      else
++              hdr_ctl &= ~SM_SW_FWD_MODE;
++      b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, hdr_ctl);
++
++      /* Configure the appropriate IMP port */
++      b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl);
++      if (port == 8)
++              hdr_ctl |= GC_FRM_MGMT_PORT_MII;
++      else if (port == 5)
++              hdr_ctl |= GC_FRM_MGMT_PORT_M;
++      b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
++
+       /* Enable Broadcom tags for IMP port */
+       b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
+       if (tag_en)
+@@ -1910,13 +1924,29 @@ static bool b53_possible_cpu_port(struct
+       return false;
+ }
+-static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port)
++static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port,
++                                   enum dsa_tag_protocol tag_protocol)
+ {
+       bool ret = b53_possible_cpu_port(ds, port);
+-      if (!ret)
++      if (!ret) {
+               dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n",
+                        port);
++              return ret;
++      }
++
++      switch (tag_protocol) {
++      case DSA_TAG_PROTO_BRCM:
++      case DSA_TAG_PROTO_BRCM_PREPEND:
++              dev_warn(ds->dev,
++                       "Port %d is stacked to Broadcom tag switch\n", port);
++              ret = false;
++              break;
++      default:
++              ret = true;
++              break;
++      }
++
+       return ret;
+ }
+@@ -1926,12 +1956,10 @@ enum dsa_tag_protocol b53_get_tag_protoc
+       struct b53_device *dev = ds->priv;
+       /* Older models (5325, 5365) support a different tag format that we do
+-       * not support in net/dsa/tag_brcm.c yet. 539x and 531x5 require managed
+-       * mode to be turned on which means we need to specifically manage ARL
+-       * misses on multicast addresses (TBD).
++       * not support in net/dsa/tag_brcm.c yet.
+        */
+-      if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) ||
+-          !b53_can_enable_brcm_tags(ds, port)) {
++      if (is5325(dev) || is5365(dev) ||
++          !b53_can_enable_brcm_tags(ds, port, mprot)) {
+               dev->tag_protocol = DSA_TAG_PROTO_NONE;
+               goto out;
+       }
index cb6497f28ab8dc927de1a32c37021559601fcac9..8225ca1d299c1b97f48eb5d6e2298b9a9ce9bce7 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- 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
+@@ -1577,7 +1577,6 @@ static int b53_arl_op(struct b53_device
                ent.is_valid = !!(ent.port);
        }
  
index 71a06997c3b70fcd5329efee3917ea848b037f58..566dfce5ca3c5d3fa13c948414baa7b412fe8889 100644 (file)
@@ -80,9 +80,9 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 +}
 +
  static enum dsa_tag_protocol
- mtk_get_tag_protocol(struct dsa_switch *ds, int port)
- {
-@@ -1520,6 +1578,8 @@ static const struct dsa_switch_ops mt753
+ mtk_get_tag_protocol(struct dsa_switch *ds, int port,
+                    enum dsa_tag_protocol mp)
+@@ -1521,6 +1579,8 @@ static const struct dsa_switch_ops mt753
        .port_vlan_prepare      = mt7530_port_vlan_prepare,
        .port_vlan_add          = mt7530_port_vlan_add,
        .port_vlan_del          = mt7530_port_vlan_del,
index a45a22e48548eb43c03193dc8ded1ee6aab445aa..81acdaecd2d1f07057e3a0c03e128e7556d588d4 100644 (file)
@@ -25,7 +25,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- a/drivers/net/dsa/mv88e6xxx/chip.c
 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
-@@ -4928,6 +4928,80 @@ static int mv88e6xxx_port_mdb_del(struct
+@@ -4929,6 +4929,80 @@ static int mv88e6xxx_port_mdb_del(struct
        return err;
  }
  
@@ -106,7 +106,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  static int mv88e6xxx_port_egress_floods(struct dsa_switch *ds, int port,
                                         bool unicast, bool multicast)
  {
-@@ -4982,6 +5056,8 @@ static const struct dsa_switch_ops mv88e
+@@ -4983,6 +5057,8 @@ static const struct dsa_switch_ops mv88e
        .port_mdb_prepare       = mv88e6xxx_port_mdb_prepare,
        .port_mdb_add           = mv88e6xxx_port_mdb_add,
        .port_mdb_del           = mv88e6xxx_port_mdb_del,
index 837126a336f79507dc62a55027162ecd1dbb6864..9985e1cf564c96b16621d5c1717831be71b15d3f 100644 (file)
@@ -19,7 +19,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- a/drivers/net/dsa/mv88e6xxx/chip.c
 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
-@@ -4995,7 +4995,7 @@ static void mv88e6xxx_port_mirror_del(st
+@@ -4996,7 +4996,7 @@ static void mv88e6xxx_port_mirror_del(st
                if (chip->info->ops->set_egress_port(chip,
                                                     direction,
                                                     dsa_upstream_port(ds,
index 52d9351b704c86bde1abfe71d1cff3c302738722..86f1f8300e0b17fe3cd0fec0fe96b24d91669b12 100644 (file)
@@ -83,7 +83,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  {
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -319,7 +319,7 @@ static int dsa_slave_vlan_add(struct net
+@@ -317,7 +317,7 @@ static int dsa_slave_vlan_add(struct net
        if (obj->orig_dev != dev)
                return -EOPNOTSUPP;
  
@@ -92,7 +92,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
                return 0;
  
        vlan = *SWITCHDEV_OBJ_PORT_VLAN(obj);
-@@ -386,7 +386,7 @@ static int dsa_slave_vlan_del(struct net
+@@ -384,7 +384,7 @@ static int dsa_slave_vlan_del(struct net
        if (obj->orig_dev != dev)
                return -EOPNOTSUPP;
  
@@ -101,7 +101,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
                return 0;
  
        /* Do not deprogram the CPU port as it may be shared with other user
-@@ -1120,7 +1120,7 @@ static int dsa_slave_vlan_rx_add_vid(str
+@@ -1118,7 +1118,7 @@ static int dsa_slave_vlan_rx_add_vid(str
         * need to emulate the switchdev prepare + commit phase.
         */
        if (dp->bridge_dev) {
@@ -110,7 +110,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
                        return 0;
  
                /* br_vlan_get_info() returns -EINVAL or -ENOENT if the
-@@ -1154,7 +1154,7 @@ static int dsa_slave_vlan_rx_kill_vid(st
+@@ -1152,7 +1152,7 @@ static int dsa_slave_vlan_rx_kill_vid(st
         * need to emulate the switchdev prepare + commit phase.
         */
        if (dp->bridge_dev) {
index 0804cea9f7882762987312e523f28b88a80f9d82..e26829ee60b142a4f37c17fc6706e23f65967476 100644 (file)
@@ -41,7 +41,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        mutex_lock(&priv->reg_mutex);
  
        pvid = priv->ports[port].pvid;
-@@ -1232,6 +1220,7 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1233,6 +1221,7 @@ mt7530_setup(struct dsa_switch *ds)
         * as two netdev instances.
         */
        dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent;
index b68c033bbe2a7b1f3a47c9df1bae0d2953a70094..cabb9d9a9287141e8f3667d01a6f7973b198305b 100644 (file)
@@ -74,9 +74,9 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        if (ret)
                return ret;
  
-@@ -966,21 +964,8 @@ static int rtl8366rb_setup(struct dsa_sw
static enum dsa_tag_protocol rtl8366_get_tag_protocol(struct dsa_switch *ds,
-                                                     int port)
+@@ -967,21 +965,8 @@ static enum dsa_tag_protocol rtl8366_get
                                                    int port,
+                                                     enum dsa_tag_protocol mp)
  {
 -      /* For now, the RTL switches are handled without any custom tags.
 -       *
index 7ec26899f9b946a434af3244a01c4385e6492526..3b630377f9a918dc87319c71d8d8da4631063e59 100644 (file)
@@ -69,7 +69,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -70,8 +70,11 @@ static int dsa_slave_open(struct net_dev
+@@ -68,8 +68,11 @@ static int dsa_slave_open(struct net_dev
        struct dsa_port *dp = dsa_slave_to_port(dev);
        int err;
  
index 893eb719cad688fce47049a06a47d6c45f56bb9b..f8894899158f3883a02eab40ed7748e39e9c2516 100644 (file)
@@ -25,7 +25,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1593,7 +1593,9 @@ static void dsa_slave_switchdev_event_wo
+@@ -1591,7 +1591,9 @@ static void dsa_slave_switchdev_event_wo
  
                err = dsa_port_fdb_add(dp, fdb_info->addr, fdb_info->vid);
                if (err) {
@@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
                        break;
                }
                fdb_info->offloaded = true;
-@@ -1608,9 +1610,11 @@ static void dsa_slave_switchdev_event_wo
+@@ -1606,9 +1608,11 @@ static void dsa_slave_switchdev_event_wo
  
                err = dsa_port_fdb_del(dp, fdb_info->addr, fdb_info->vid);
                if (err) {
index 275870d19f6cad3a759ab922932f376c4521521a..bd1685a16ac626e8fa31e1af8d726777b451b363 100644 (file)
@@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
        struct sk_buff *        (*xmit)(struct sk_buff *skb,
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1568,76 +1568,66 @@ static int dsa_slave_netdevice_event(str
+@@ -1566,76 +1566,66 @@ static int dsa_slave_netdevice_event(str
        return NOTIFY_DONE;
  }
  
@@ -167,7 +167,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  }
  
  /* Called under rcu_read_lock() */
-@@ -1645,7 +1635,9 @@ static int dsa_slave_switchdev_event(str
+@@ -1643,7 +1633,9 @@ static int dsa_slave_switchdev_event(str
                                     unsigned long event, void *ptr)
  {
        struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
@@ -177,7 +177,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
        int err;
  
        if (event == SWITCHDEV_PORT_ATTR_SET) {
-@@ -1658,20 +1650,32 @@ static int dsa_slave_switchdev_event(str
+@@ -1656,20 +1648,32 @@ static int dsa_slave_switchdev_event(str
        if (!dsa_slave_dev_check(dev))
                return NOTIFY_DONE;
  
@@ -213,7 +213,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
                dev_hold(dev);
                break;
        default:
-@@ -1681,10 +1685,6 @@ static int dsa_slave_switchdev_event(str
+@@ -1679,10 +1683,6 @@ static int dsa_slave_switchdev_event(str
  
        dsa_schedule_work(&switchdev_work->work);
        return NOTIFY_OK;
index b70986fcc1c9335ee3271f0b88dd6bf0b8314e4f..acc6e1611761b1197879fd254ca2dd730295953f 100644 (file)
@@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1640,31 +1640,29 @@ static int dsa_slave_switchdev_event(str
+@@ -1638,31 +1638,29 @@ static int dsa_slave_switchdev_event(str
        struct dsa_port *dp;
        int err;
  
@@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
                fdb_info = ptr;
  
                if (!fdb_info->added_by_user) {
-@@ -1677,13 +1675,12 @@ static int dsa_slave_switchdev_event(str
+@@ -1675,13 +1673,12 @@ static int dsa_slave_switchdev_event(str
                switchdev_work->vid = fdb_info->vid;
  
                dev_hold(dev);
index c7ed4064e85dfb4ca132dc654c99eab1c2fd1833..35266b71bc8c9b177ad7e3d48734864f571b426e 100644 (file)
@@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1653,6 +1653,9 @@ static int dsa_slave_switchdev_event(str
+@@ -1651,6 +1651,9 @@ static int dsa_slave_switchdev_event(str
  
                dp = dsa_slave_to_port(dev);
  
index e4ed6e808f88b6418bff116ff342c307c5754a5d..e49a97c81d30ac34e1472772cb7b78e1e0db3c23 100644 (file)
@@ -172,7 +172,7 @@ Signed-off-by: DENG Qingfang <dqfext@gmail.com>
         */
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1630,6 +1630,25 @@ static void dsa_slave_switchdev_event_wo
+@@ -1628,6 +1628,25 @@ static void dsa_slave_switchdev_event_wo
                dev_put(dp->slave);
  }
  
@@ -198,7 +198,7 @@ Signed-off-by: DENG Qingfang <dqfext@gmail.com>
  /* Called under rcu_read_lock() */
  static int dsa_slave_switchdev_event(struct notifier_block *unused,
                                     unsigned long event, void *ptr)
-@@ -1648,10 +1667,37 @@ static int dsa_slave_switchdev_event(str
+@@ -1646,10 +1665,37 @@ static int dsa_slave_switchdev_event(str
                return notifier_from_errno(err);
        case SWITCHDEV_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_FDB_DEL_TO_DEVICE:
@@ -239,7 +239,7 @@ Signed-off-by: DENG Qingfang <dqfext@gmail.com>
  
                if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del)
                        return NOTIFY_DONE;
-@@ -1666,18 +1712,13 @@ static int dsa_slave_switchdev_event(str
+@@ -1664,18 +1710,13 @@ static int dsa_slave_switchdev_event(str
                switchdev_work->port = dp->index;
                switchdev_work->event = event;
  
index 369a09caac510c23ec3a8351359ae6333b1b9123..ff41a17c621c45065a563d5c8327d80a8f39fc1d 100644 (file)
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  #include "dsa_priv.h"
  
-@@ -1226,6 +1230,27 @@ static struct devlink_port *dsa_slave_ge
+@@ -1224,6 +1228,27 @@ static struct devlink_port *dsa_slave_ge
        return dp->ds->devlink ? &dp->devlink_port : NULL;
  }
  
@@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static const struct net_device_ops dsa_slave_netdev_ops = {
        .ndo_open               = dsa_slave_open,
        .ndo_stop               = dsa_slave_close,
-@@ -1250,6 +1275,9 @@ static const struct net_device_ops dsa_s
+@@ -1248,6 +1273,9 @@ static const struct net_device_ops dsa_s
        .ndo_vlan_rx_add_vid    = dsa_slave_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = dsa_slave_vlan_rx_kill_vid,
        .ndo_get_devlink_port   = dsa_slave_get_devlink_port,
index c2dc35d134552b99d8e0766140d4eedd2a7682e3..93ed19374796168b0f13c8d2d95f86b00bea811b 100644 (file)
@@ -9,7 +9,7 @@ Content-Transfer-Encoding: 8bit
 Signed-off-by: René van Dorst <opensource@vdorst.com>
 --- a/drivers/net/dsa/mt7530.c
 +++ b/drivers/net/dsa/mt7530.c
-@@ -1407,9 +1407,13 @@ static void mt7530_phylink_mac_config(st
+@@ -1408,9 +1408,13 @@ static void mt7530_phylink_mac_config(st
        switch (state->speed) {
        case SPEED_1000:
                mcr_new |= PMCR_FORCE_SPEED_1000;
@@ -23,7 +23,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
                break;
        }
        if (state->duplex == DUPLEX_FULL) {
-@@ -1545,6 +1549,54 @@ mt7530_phylink_mac_link_state(struct dsa
+@@ -1546,6 +1550,54 @@ mt7530_phylink_mac_link_state(struct dsa
        return 1;
  }
  
@@ -78,7 +78,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  static const struct dsa_switch_ops mt7530_switch_ops = {
        .get_tag_protocol       = mtk_get_tag_protocol,
        .setup                  = mt7530_setup,
-@@ -1572,6 +1624,8 @@ static const struct dsa_switch_ops mt753
+@@ -1573,6 +1625,8 @@ static const struct dsa_switch_ops mt753
        .phylink_mac_config     = mt7530_phylink_mac_config,
        .phylink_mac_link_down  = mt7530_phylink_mac_link_down,
        .phylink_mac_link_up    = mt7530_phylink_mac_link_up,
index d95124626037ff17378a29e76045d2b4d5205c28..4c0c4391a3cec75911a5779486a5149e0b714e68 100644 (file)
@@ -18,7 +18,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1698,10 +1698,12 @@ static int dsa_slave_switchdev_event(str
+@@ -1696,10 +1696,12 @@ static int dsa_slave_switchdev_event(str
                fdb_info = ptr;
  
                if (dsa_slave_dev_check(dev)) {
index 46504aeeff772b6310a962641228bdd9cd81572c..14f62ec19aa8c3da3252393336f77bc21813880f 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1712,7 +1712,11 @@ static int dsa_slave_switchdev_event(str
+@@ -1710,7 +1710,11 @@ static int dsa_slave_switchdev_event(str
                        struct net_device *br_dev;
                        struct dsa_slave_priv *p;
  
index e626086bc16627bbce048c8904876e414da60bc0..33f49685bf7b2bf827ed45694aa2290ceca0a271 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
 
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1705,9 +1705,12 @@ static int dsa_slave_switchdev_event(str
+@@ -1703,9 +1703,12 @@ static int dsa_slave_switchdev_event(str
                        else if (!fdb_info->added_by_user)
                                return NOTIFY_OK;
                } else {
@@ -44,7 +44,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
                         */
                        struct net_device *br_dev;
                        struct dsa_slave_priv *p;
-@@ -1729,7 +1732,8 @@ static int dsa_slave_switchdev_event(str
+@@ -1727,7 +1730,8 @@ static int dsa_slave_switchdev_event(str
  
                        dp = p->dp->cpu_dp;
  
index 65b0e1084e7d0eff01d421bfc5cc555bb18efbc4..dc9e61eb9dd18242da7bf8c5bea9738751555667 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
 
 --- a/drivers/net/dsa/mv88e6xxx/chip.c
 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
-@@ -5082,6 +5082,7 @@ static int mv88e6xxx_register_switch(str
+@@ -5083,6 +5083,7 @@ static int mv88e6xxx_register_switch(str
        ds->ops = &mv88e6xxx_switch_ops;
        ds->ageing_time_min = chip->info->age_time_coeff;
        ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX;
index 72b101bfb0bc5ae69ad72249593ca238934f1c25..8214e1a3104392e01dab6c26bc17045e9d43c1a9 100644 (file)
@@ -648,7 +648,7 @@ Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
  static const u32 vsc9959_gcb_regmap[] = {
 --- a/include/net/dsa.h
 +++ b/include/net/dsa.h
-@@ -559,6 +559,7 @@ struct dsa_switch_ops {
+@@ -560,6 +560,7 @@ struct dsa_switch_ops {
         */
        netdev_tx_t (*port_deferred_xmit)(struct dsa_switch *ds, int port,
                                          struct sk_buff *skb);
index 22db45aced44fe7e53b07f6e9fd60abd1a6f26c0..6fc9a1643e291234cd8e8a9869eca989f48db722 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
 
 --- a/drivers/net/dsa/b53/b53_common.c
 +++ b/drivers/net/dsa/b53/b53_common.c
-@@ -1284,7 +1284,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down)
+@@ -1297,7 +1297,9 @@ EXPORT_SYMBOL(b53_phylink_mac_link_down)
  void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
                             unsigned int mode,
                             phy_interface_t interface,
@@ -25,7 +25,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
 --- a/drivers/net/dsa/b53/b53_priv.h
 +++ b/drivers/net/dsa/b53/b53_priv.h
-@@ -337,7 +337,9 @@ void b53_phylink_mac_link_down(struct ds
+@@ -338,7 +338,9 @@ void b53_phylink_mac_link_down(struct ds
  void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
                             unsigned int mode,
                             phy_interface_t interface,
@@ -51,7 +51,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        struct ethtool_eee *p = &priv->dev->ports[port].eee;
 --- a/drivers/net/dsa/lantiq_gswip.c
 +++ b/drivers/net/dsa/lantiq_gswip.c
-@@ -1661,7 +1661,9 @@ static void gswip_phylink_mac_link_down(
+@@ -1662,7 +1662,9 @@ static void gswip_phylink_mac_link_down(
  static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port,
                                      unsigned int mode,
                                      phy_interface_t interface,
@@ -64,7 +64,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
 --- a/drivers/net/dsa/mt7530.c
 +++ b/drivers/net/dsa/mt7530.c
-@@ -1440,7 +1440,9 @@ static void mt7530_phylink_mac_link_down
+@@ -1441,7 +1441,9 @@ static void mt7530_phylink_mac_link_down
  static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port,
                                       unsigned int mode,
                                       phy_interface_t interface,
@@ -103,7 +103,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  }
 --- a/include/net/dsa.h
 +++ b/include/net/dsa.h
-@@ -406,7 +406,9 @@ struct dsa_switch_ops {
+@@ -407,7 +407,9 @@ struct dsa_switch_ops {
        void    (*phylink_mac_link_up)(struct dsa_switch *ds, int port,
                                       unsigned int mode,
                                       phy_interface_t interface,
index 23fba8525298d8d909d9f3bbca497e311e897dbe..57066a3607966f70eac8653960ccc081b8eecaef 100644 (file)
@@ -51,7 +51,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  
        mutex_unlock(&priv->reg_mutex);
  }
-@@ -1395,8 +1384,7 @@ static void mt7530_phylink_mac_config(st
+@@ -1396,8 +1385,7 @@ static void mt7530_phylink_mac_config(st
  
        mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port));
        mcr_new = mcr_cur;
@@ -61,7 +61,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
                   PMCR_BACKPR_EN | PMCR_FORCE_MODE;
  
-@@ -1404,26 +1392,6 @@ static void mt7530_phylink_mac_config(st
+@@ -1405,26 +1393,6 @@ static void mt7530_phylink_mac_config(st
        if (port == 5 && dsa_is_user_port(ds, 5))
                mcr_new |= PMCR_EXT_PHY;
  
@@ -88,7 +88,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
        if (mcr_new != mcr_cur)
                mt7530_write(priv, MT7530_PMCR_P(port), mcr_new);
  }
-@@ -1434,7 +1402,7 @@ static void mt7530_phylink_mac_link_down
+@@ -1435,7 +1403,7 @@ static void mt7530_phylink_mac_link_down
  {
        struct mt7530_priv *priv = ds->priv;
  
@@ -97,7 +97,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
  }
  
  static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port,
-@@ -1445,8 +1413,31 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1446,8 +1414,31 @@ static void mt7530_phylink_mac_link_up(s
                                       bool tx_pause, bool rx_pause)
  {
        struct mt7530_priv *priv = ds->priv;
index 718ed8ea2d0393f572f540e100edec26480946d6..84579ac2c54fb3d8cffd3ac2105a973b22225cc5 100644 (file)
@@ -47,7 +47,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                return -EINVAL;
        }
  
-@@ -1332,12 +1334,11 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1333,12 +1335,11 @@ mt7530_setup(struct dsa_switch *ds)
        return 0;
  }
  
@@ -63,7 +63,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  
        switch (port) {
        case 0: /* Internal phy */
-@@ -1346,33 +1347,114 @@ static void mt7530_phylink_mac_config(st
+@@ -1347,33 +1348,114 @@ static void mt7530_phylink_mac_config(st
        case 3:
        case 4:
                if (state->interface != PHY_INTERFACE_MODE_GMII)
@@ -189,7 +189,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                return;
        }
  
-@@ -1440,61 +1522,44 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1441,61 +1523,44 @@ static void mt7530_phylink_mac_link_up(s
        mt7530_set(priv, MT7530_PMCR_P(port), mcr);
  }
  
@@ -274,7 +274,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        phylink_set(mask, Pause);
        phylink_set(mask, Asym_Pause);
  
-@@ -1590,12 +1655,45 @@ static int mt7530_set_mac_eee(struct dsa
+@@ -1591,12 +1656,45 @@ static int mt7530_set_mac_eee(struct dsa
        return 0;
  }
  
@@ -323,7 +323,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        .get_ethtool_stats      = mt7530_get_ethtool_stats,
        .get_sset_count         = mt7530_get_sset_count,
        .port_enable            = mt7530_port_enable,
-@@ -1612,18 +1710,43 @@ static const struct dsa_switch_ops mt753
+@@ -1613,18 +1711,43 @@ static const struct dsa_switch_ops mt753
        .port_vlan_del          = mt7530_port_vlan_del,
        .port_mirror_add        = mt7530_port_mirror_add,
        .port_mirror_del        = mt7530_port_mirror_del,
@@ -372,7 +372,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        { /* sentinel */ },
  };
  MODULE_DEVICE_TABLE(of, mt7530_of_match);
-@@ -1661,8 +1784,21 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -1662,8 +1785,21 @@ mt7530_probe(struct mdio_device *mdiodev
        /* Get the hardware identifier from the devicetree node.
         * We will need it for some of the clock and regulator setup.
         */
index 8ede862204ab1d89969e48f4ccd08e71ca2d9ee7..95dddf68b04997365a5585240f8281bfc1231984 100644 (file)
@@ -466,7 +466,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        }
  }
  
-@@ -1280,7 +1619,7 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1281,7 +1620,7 @@ mt7530_setup(struct dsa_switch *ds)
                           PCR_MATRIX_CLR);
  
                if (dsa_is_cpu_port(ds, i))
@@ -475,7 +475,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                else
                        mt7530_port_disable(ds, i);
  
-@@ -1334,6 +1673,118 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1335,6 +1674,118 @@ mt7530_setup(struct dsa_switch *ds)
        return 0;
  }
  
@@ -594,7 +594,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static bool
  mt7530_phy_mode_supported(struct dsa_switch *ds, int port,
                          const struct phylink_link_state *state)
-@@ -1372,6 +1823,47 @@ unsupported:
+@@ -1373,6 +1824,47 @@ unsupported:
        return false;
  }
  
@@ -642,7 +642,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static bool
  mt753x_phy_mode_supported(struct dsa_switch *ds, int port,
                          const struct phylink_link_state *state)
-@@ -1404,6 +1896,227 @@ mt7530_mac_config(struct dsa_switch *ds,
+@@ -1405,6 +1897,227 @@ mt7530_mac_config(struct dsa_switch *ds,
        return 0;
  }
  
@@ -870,7 +870,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static int
  mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
                  const struct phylink_link_state *state)
-@@ -1439,6 +2152,8 @@ mt753x_phylink_mac_config(struct dsa_swi
+@@ -1440,6 +2153,8 @@ mt753x_phylink_mac_config(struct dsa_swi
                if (mt753x_mac_config(ds, port, mode, state) < 0)
                        goto unsupported;
  
@@ -879,7 +879,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                break;
        case 6: /* 1st cpu port */
                if (priv->p6_interface == state->interface)
-@@ -1458,7 +2173,8 @@ unsupported:
+@@ -1459,7 +2174,8 @@ unsupported:
                return;
        }
  
@@ -889,7 +889,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                dev_err(ds->dev, "%s: in-band negotiation unsupported\n",
                        __func__);
                return;
-@@ -1468,7 +2184,7 @@ unsupported:
+@@ -1469,7 +2185,7 @@ unsupported:
        mcr_new = mcr_cur;
        mcr_new &= ~PMCR_LINK_SETTINGS_MASK;
        mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
@@ -898,7 +898,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  
        /* Are we connected to external phy */
        if (port == 5 && dsa_is_user_port(ds, 5))
-@@ -1478,7 +2194,18 @@ unsupported:
+@@ -1479,7 +2195,18 @@ unsupported:
                mt7530_write(priv, MT7530_PMCR_P(port), mcr_new);
  }
  
@@ -918,7 +918,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                                         unsigned int mode,
                                         phy_interface_t interface)
  {
-@@ -1487,7 +2214,19 @@ static void mt7530_phylink_mac_link_down
+@@ -1488,7 +2215,19 @@ static void mt7530_phylink_mac_link_down
        mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
  }
  
@@ -939,7 +939,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                                       unsigned int mode,
                                       phy_interface_t interface,
                                       struct phy_device *phydev,
-@@ -1497,18 +2236,29 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1498,18 +2237,29 @@ static void mt7530_phylink_mac_link_up(s
        struct mt7530_priv *priv = ds->priv;
        u32 mcr;
  
@@ -971,7 +971,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                break;
        }
        if (duplex == DUPLEX_FULL) {
-@@ -1522,6 +2272,45 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1523,6 +2273,45 @@ static void mt7530_phylink_mac_link_up(s
        mt7530_set(priv, MT7530_PMCR_P(port), mcr);
  }
  
@@ -1017,7 +1017,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt7530_mac_port_validate(struct dsa_switch *ds, int port,
                         unsigned long *supported)
-@@ -1530,6 +2319,14 @@ mt7530_mac_port_validate(struct dsa_swit
+@@ -1531,6 +2320,14 @@ mt7530_mac_port_validate(struct dsa_swit
                phylink_set(supported, 1000baseX_Full);
  }
  
@@ -1032,7 +1032,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt753x_phylink_validate(struct dsa_switch *ds, int port,
                        unsigned long *supported,
-@@ -1546,7 +2343,8 @@ mt753x_phylink_validate(struct dsa_switc
+@@ -1547,7 +2344,8 @@ mt753x_phylink_validate(struct dsa_switc
  
        phylink_set_port_modes(mask);
  
@@ -1042,7 +1042,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                phylink_set(mask, 10baseT_Half);
                phylink_set(mask, 10baseT_Full);
                phylink_set(mask, 100baseT_Half);
-@@ -1565,6 +2363,11 @@ mt753x_phylink_validate(struct dsa_switc
+@@ -1566,6 +2364,11 @@ mt753x_phylink_validate(struct dsa_switc
  
        linkmode_and(supported, supported, mask);
        linkmode_and(state->advertising, state->advertising, mask);
@@ -1054,7 +1054,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  }
  
  static int
-@@ -1655,6 +2458,63 @@ static int mt7530_set_mac_eee(struct dsa
+@@ -1656,6 +2459,63 @@ static int mt7530_set_mac_eee(struct dsa
        return 0;
  }
  
@@ -1118,7 +1118,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static int
  mt753x_phylink_mac_link_state(struct dsa_switch *ds, int port,
                              struct phylink_link_state *state)
-@@ -1708,13 +2568,14 @@ static const struct dsa_switch_ops mt753
+@@ -1709,13 +2569,14 @@ static const struct dsa_switch_ops mt753
        .port_vlan_prepare      = mt7530_port_vlan_prepare,
        .port_vlan_add          = mt7530_port_vlan_add,
        .port_vlan_del          = mt7530_port_vlan_del,
@@ -1137,7 +1137,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        .get_mac_eee            = mt7530_get_mac_eee,
        .set_mac_eee            = mt7530_set_mac_eee,
  };
-@@ -1742,11 +2603,26 @@ static const struct mt753x_info mt753x_t
+@@ -1743,11 +2604,26 @@ static const struct mt753x_info mt753x_t
                .mac_port_get_state = mt7530_phylink_mac_link_state,
                .mac_port_config = mt7530_mac_config,
        },