Skip to contentSkip to conversation

net: dsa: initial support for MaxLinear MxL862xx switches

PATCH Superseded Daniel Golle 3 participants 10 messages Jan 12 – Jan 21

Subsystems (6)

v5 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Daniel Golle

author maintainer
#0 lore raw

v5 cover net: dsa: initial support for MaxLinear MxL862xx switches

This series adds very basic DSA support for the MaxLinear MxL86252 (5 PHY ports) and MxL86282 (8 PHY ports) switches.

MxL862xx integrates a firmware running on an embedded processor (Zephyr RTOS). Host interaction uses a simple API transported over MDIO/MMD. This series includes only what's needed to pass traffic between user ports and the CPU port: relayed MDIO to internal PHYs, basic port enable/disable, and CPU-port special tagging.

At this point the driver does NOT configure any bridges and bridge ports, so isolation of the userports depends on the pre-configuration stored on the flash chip attached to the switch IC.

This is going to be addressed in follow-up series adding support for configuring bridges and bridge-ports, and also use the added API for that to make sure the switch is always in a well-defined condition (ie. all ports isolated in individual bridges, learning disabled, and not depending on attached pre-configuration) after reset.

Changes since RFC v4
1/4 dt-bindings: net: dsa: add MaxLinear MxL862xx
* no changes

2/4 net: dsa: add tag format for MxL862xx switches
* drop unused precompiler macros

3/4 net: mdio: add unlocked mdiodev C45 bus accessors
* fix indentation

4/4 net: dsa: add basic initial driver for MxL862xx switches
* output warning in .setup regarding unknown pre-configuration
* add comment explaining why CFGGET is used in reset function

Changes since RFC v3
1/4 dt-bindings: net: dsa: add MaxLinear MxL862xx
* remove labels from example
* remove 'bindings for' from commit title

2/4 net: dsa: add tag format for MxL862xx switches
* describe fields and variables with comments
* sub-interface is only 5 bits
* harmonize Kconfig symbol name
* maintain alphabetic order in Kconfig
* fix typo s/beginnig/beginning/
* fix typo s/swtiches/switches/
* arrange local variables in reverse xmas tree order

3/4 net: mdio: add unlocked mdiodev C45 bus accessors
* unchanged

4/4 net: dsa: add basic initial driver for MxL862xx switches
* poll switch readiness after reset
* implement driver shutdown
* added port_fast_aging API call and driver op
* unified port setup in new .port_setup op
* improve comment explaining special handlign for unaligned API read
* various typos and formatting improvements

Changes since RFC v2
1/4, 2/4, 3/4: unchanged

4/4 net: dsa: add basic initial driver for MxL862xx switches
* fix return value being uninitialized on error in mxl862xx_api_wrap()
* add missing description in kerneldoc comment of
struct mxl862xx_ss_sp_tag

Changes since initial RFC

1/4 dt-bindings: net: dsa: add bindings for MaxLinear MxL862xx
* better description in dt-bindings doc

2/4 net: dsa: add tag formats for MxL862xx switches
* make sure all tag fields are initialized

3/4 net: mdio: add unlocked mdiodev C45 bus accessors
* new patch

4/4 net: dsa: add basic initial driver for MxL862xx switches
* make use of struct mdio_device
* add phylink_mac_ops stubs
* drop leftover nonsense from mxl862xx_phylink_get_caps()
* fix endian conversions
* use __le32 instead of enum types in over-the-wire structs
* use existing MDIO_* macros whenever possible
* simplify API constants to be more readable
* use readx_poll_timeout instead of open-coding poll timeout loop
* add mxl862xx_reg_read() and mxl862xx_reg_write() helpers
* demystify error codes returned by the firmware
* add #defines for mxl862xx_ss_sp_tag member values
* move reset to dedicated function, clarify magic number being the reset command ID

Daniel Golle (4):
dt-bindings: net: dsa: add MaxLinear MxL862xx
net: dsa: add tag format for MxL862xx switches
net: mdio: add unlocked mdiodev C45 bus accessors
net: dsa: add basic initial driver for MxL862xx switches

 .../bindings/net/dsa/maxlinear,mxl862xx.yaml  | 154 +++++++
 MAINTAINERS                                   |   8 +
 drivers/net/dsa/Kconfig                       |   2 +
 drivers/net/dsa/Makefile                      |   1 +
 drivers/net/dsa/mxl862xx/Kconfig              |  12 +
 drivers/net/dsa/mxl862xx/Makefile             |   3 +
 drivers/net/dsa/mxl862xx/mxl862xx-api.h       | 177 +++++++
 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h       |  32 ++
 drivers/net/dsa/mxl862xx/mxl862xx-host.c      | 230 ++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-host.h      |   5 +
 drivers/net/dsa/mxl862xx/mxl862xx.c           | 433 ++++++++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx.h           |  24 +
 include/linux/mdio.h                          |  13 +
 include/net/dsa.h                             |   2 +
 net/dsa/Kconfig                               |   7 +
 net/dsa/Makefile                              |   1 +
 net/dsa/tag_mxl862xx.c                        | 116 +++++
 17 files changed, 1220 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
 create mode 100644 drivers/net/dsa/mxl862xx/Kconfig
 create mode 100644 drivers/net/dsa/mxl862xx/Makefile
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-api.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.h
 create mode 100644 net/dsa/tag_mxl862xx.c
Signature · 1 line
2.52.0
author maintainer
#1 lore raw

PATCH v5 1/4 dt-bindings: net: dsa: add MaxLinear MxL862xx

Add documentation and an example for MaxLinear MxL86282 and MxL86252 switches.

---
v5: no changes
RFC v4:
* remove labels from example
* remove 'bindings for' from commit title
RFC v3: no changes
RFC v2: better description in dt-bindings doc

 .../bindings/net/dsa/maxlinear,mxl862xx.yaml  | 154 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 160 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml new file +154 -0
new file mode 100644
index 0000000000000..77e48f0c7b1e3
@@ -0,0 +1,154 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/maxlinear,mxl862xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MaxLinear MxL862xx Ethernet Switch Family
+
+maintainers:
+  - Daniel Golle <[email protected]>
+
+description:
+  The MaxLinear MxL862xx switch family are multi-port Ethernet switches with
+  integrated 2.5GE PHYs. The MxL86252 has five PHY ports and the MxL86282
+  has eight PHY ports. Both models come with two 10 Gigabit/s SerDes
+  interfaces to be used to connect external PHYs or SFP cages, or as CPU
+  port.
+
+allOf:
+  - $ref: dsa.yaml#/$defs/ethernet-ports
+
+properties:
+  compatible:
+    enum:
+      - maxlinear,mxl86252
+      - maxlinear,mxl86282
+
+  reg:
+    maxItems: 1
+    description: MDIO address of the switch
+
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        switch@0 {
+            compatible = "maxlinear,mxl86282";
+            reg = <0>;
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    phy-handle = <&phy0>;
+                    phy-mode = "internal";
+                };
+
+                port@1 {
+                    reg = <1>;
+                    phy-handle = <&phy1>;
+                    phy-mode = "internal";
+                };
+
+                port@2 {
+                    reg = <2>;
+                    phy-handle = <&phy2>;
+                    phy-mode = "internal";
+                };
+
+                port@3 {
+                    reg = <3>;
+                    phy-handle = <&phy3>;
+                    phy-mode = "internal";
+                };
+
+                port@4 {
+                    reg = <4>;
+                    phy-handle = <&phy4>;
+                    phy-mode = "internal";
+                };
+
+                port@5 {
+                    reg = <5>;
+                    phy-handle = <&phy5>;
+                    phy-mode = "internal";
+                };
+
+                port@6 {
+                    reg = <6>;
+                    phy-handle = <&phy6>;
+                    phy-mode = "internal";
+                };
+
+                port@7 {
+                    reg = <7>;
+                    phy-handle = <&phy7>;
+                    phy-mode = "internal";
+                };
+
+                port@8 {
+                    reg = <8>;
+                    label = "cpu";
+                    ethernet = <&gmac0>;
+                    phy-mode = "usxgmii";
+
+                    fixed-link {
+                        speed = <10000>;
+                        full-duplex;
+                    };
+                };
+            };
+
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                phy0: ethernet-phy@0 {
+                    reg = <0>;
+                };
+
+                phy1: ethernet-phy@1 {
+                    reg = <1>;
+                };
+
+                phy2: ethernet-phy@2 {
+                    reg = <2>;
+                };
+
+                phy3: ethernet-phy@3 {
+                    reg = <3>;
+                };
+
+                phy4: ethernet-phy@4 {
+                    reg = <4>;
+                };
+
+                phy5: ethernet-phy@5 {
+                    reg = <5>;
+                };
+
+                phy6: ethernet-phy@6 {
+                    reg = <6>;
+                };
+
+                phy7: ethernet-phy@7 {
+                    reg = <7>;
+                };
+            };
+        };
+    };
MAINTAINERS +6 -0
index 90aa1f5575c01..162859534a77c 100644
@@ -15614,6 +15614,12 @@ S:	Supported
 F:	drivers/net/phy/mxl-86110.c
 F:	drivers/net/phy/mxl-gpy.c
 
+MAXLINEAR MXL862XX SWITCH DRIVER
+M:	Daniel Golle <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
+
 MCAN DEVICE DRIVER
 M:	Markus Schneider-Pargmann <[email protected]>
 L:	[email protected]
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH v5 2/4 net: dsa: add tag format for MxL862xx switches

In reply to Daniel Golle

Add proprietary special tag format for the MaxLinear MXL862xx family of switches. While using the same Ethertype as MaxLinear's GSW1xx switches, the actual tag format differs significantly, hence we need a dedicated tag driver for that.

---
v5:
* remove unused macro definitions

RFC v4:
* describe fields and variables with comments
* sub-interface is only 5 bits
* harmonize Kconfig symbol name
* maintain alphabetic order in Kconfig
* fix typo s/beginnig/beginning/
* fix typo s/swtiches/switches/
* arrange local variables in reverse xmas tree order

RFC v3: no changes
RFC v2: make sure all tag fields are initialized

 MAINTAINERS            |   1 +
 include/net/dsa.h      |   2 +
 net/dsa/Kconfig        |   7 +++
 net/dsa/Makefile       |   1 +
 net/dsa/tag_mxl862xx.c | 116 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 127 insertions(+)
 create mode 100644 net/dsa/tag_mxl862xx.c
MAINTAINERS +1 -0
index 162859534a77c..686591074b34d 100644
@@ -15619,6 +15619,7 @@ M:	Daniel Golle <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
+F:	net/dsa/tag_mxl862xx.c
 
 MCAN DEVICE DRIVER
 M:	Markus Schneider-Pargmann <[email protected]>
include/net/dsa.h +2 -0
index 6b2b5ed64ea4c..1e33242b6d94d 100644
@@ -57,6 +57,7 @@ struct tc_action;
 #define DSA_TAG_PROTO_BRCM_LEGACY_FCS_VALUE	29
 #define DSA_TAG_PROTO_YT921X_VALUE		30
 #define DSA_TAG_PROTO_MXL_GSW1XX_VALUE		31
+#define DSA_TAG_PROTO_MXL862_VALUE		32
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -91,6 +92,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_VSC73XX_8021Q	= DSA_TAG_PROTO_VSC73XX_8021Q_VALUE,
 	DSA_TAG_PROTO_YT921X		= DSA_TAG_PROTO_YT921X_VALUE,
 	DSA_TAG_PROTO_MXL_GSW1XX	= DSA_TAG_PROTO_MXL_GSW1XX_VALUE,
+	DSA_TAG_PROTO_MXL862		= DSA_TAG_PROTO_MXL862_VALUE,
 };
 
 struct dsa_switch;
net/dsa/Kconfig +7 -0
index f86b30742122f..efc95759a10e1 100644
@@ -104,6 +104,13 @@ config NET_DSA_TAG_MTK
 	  Say Y or M if you want to enable support for tagging frames for
 	  Mediatek switches.
 
+config NET_DSA_TAG_MXL_862XX
+	tristate "Tag driver for MxL862xx switches"
+	help
+	  Say Y or M if you want to enable support for tagging frames for the
+	  Maxlinear MxL86252 and MxL86282 switches using their native 8-byte
+	  tagging protocol.
+
 config NET_DSA_TAG_MXL_GSW1XX
 	tristate "Tag driver for MaxLinear GSW1xx switches"
 	help
net/dsa/Makefile +1 -0
index 42d173f5a7013..bf7247759a64a 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o
 obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
 obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
 obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
+obj-$(CONFIG_NET_DSA_TAG_MXL_862XX) += tag_mxl862xx.o
 obj-$(CONFIG_NET_DSA_TAG_MXL_GSW1XX) += tag_mxl-gsw1xx.o
 obj-$(CONFIG_NET_DSA_TAG_NONE) += tag_none.o
 obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
net/dsa/tag_mxl862xx.c new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
2.52.0
maintainer
#3 lore raw

Re: [PATCH net-next v5 2/4] net: dsa: add tag format for MxL862xx switches

Quoted 131 lines · Daniel Golle

Add proprietary special tag format for the MaxLinear MXL862xx family of switches. While using the same Ethertype as MaxLinear's GSW1xx switches, the actual tag format differs significantly, hence we need a dedicated tag driver for that.

---
v5:
* remove unused macro definitions

RFC v4:
* describe fields and variables with comments
* sub-interface is only 5 bits
* harmonize Kconfig symbol name
* maintain alphabetic order in Kconfig
* fix typo s/beginnig/beginning/
* fix typo s/swtiches/switches/
* arrange local variables in reverse xmas tree order

RFC v3: no changes
RFC v2: make sure all tag fields are initialized

 MAINTAINERS            |   1 +
 include/net/dsa.h      |   2 +
 net/dsa/Kconfig        |   7 +++
 net/dsa/Makefile       |   1 +
 net/dsa/tag_mxl862xx.c | 116 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 127 insertions(+)
 create mode 100644 net/dsa/tag_mxl862xx.c
MAINTAINERS +1 -0
index 162859534a77c..686591074b34d 100644
@@ -15619,6 +15619,7 @@ M:	Daniel Golle <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
+F:	net/dsa/tag_mxl862xx.c
 
 MCAN DEVICE DRIVER
 M:	Markus Schneider-Pargmann <[email protected]>
include/net/dsa.h +2 -0
index 6b2b5ed64ea4c..1e33242b6d94d 100644
@@ -57,6 +57,7 @@ struct tc_action;
 #define DSA_TAG_PROTO_BRCM_LEGACY_FCS_VALUE	29
 #define DSA_TAG_PROTO_YT921X_VALUE		30
 #define DSA_TAG_PROTO_MXL_GSW1XX_VALUE		31
+#define DSA_TAG_PROTO_MXL862_VALUE		32
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -91,6 +92,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_VSC73XX_8021Q	= DSA_TAG_PROTO_VSC73XX_8021Q_VALUE,
 	DSA_TAG_PROTO_YT921X		= DSA_TAG_PROTO_YT921X_VALUE,
 	DSA_TAG_PROTO_MXL_GSW1XX	= DSA_TAG_PROTO_MXL_GSW1XX_VALUE,
+	DSA_TAG_PROTO_MXL862		= DSA_TAG_PROTO_MXL862_VALUE,
 };
 
 struct dsa_switch;
net/dsa/Kconfig +7 -0
index f86b30742122f..efc95759a10e1 100644
@@ -104,6 +104,13 @@ config NET_DSA_TAG_MTK
 	  Say Y or M if you want to enable support for tagging frames for
 	  Mediatek switches.
 
+config NET_DSA_TAG_MXL_862XX
+	tristate "Tag driver for MxL862xx switches"
+	help
+	  Say Y or M if you want to enable support for tagging frames for the
+	  Maxlinear MxL86252 and MxL86282 switches using their native 8-byte
+	  tagging protocol.
+
 config NET_DSA_TAG_MXL_GSW1XX
 	tristate "Tag driver for MaxLinear GSW1xx switches"
 	help
net/dsa/Makefile +1 -0
index 42d173f5a7013..bf7247759a64a 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o
 obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
 obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
 obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
+obj-$(CONFIG_NET_DSA_TAG_MXL_862XX) += tag_mxl862xx.o
 obj-$(CONFIG_NET_DSA_TAG_MXL_GSW1XX) += tag_mxl-gsw1xx.o
 obj-$(CONFIG_NET_DSA_TAG_NONE) += tag_none.o
 obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
net/dsa/tag_mxl862xx.c new file +33 -0
new file mode 100644
index 0000000000000..c4d0ea2eb48f9
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * DSA Special Tag for MaxLinear 862xx switch chips
+ *
+ * Copyright (C) 2025 Daniel Golle <[email protected]>
+ * Copyright (C) 2024 MaxLinear Inc.
+ */
+
+#include <linux/bitops.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <net/dsa.h>
+#include "tag.h"
+
+#define MXL862_NAME	"mxl862xx"
+
+#define MXL862_HEADER_LEN	8
+
+/* Word 0 -> EtherType */
+
+/* Word 2 */
+#define MXL862_SUBIF_ID		GENMASK(4, 0)
+
+/* Word 3 */
+#define MXL862_IGP_EGP		GENMASK(3, 0)
+
+static struct sk_buff *mxl862_tag_xmit(struct sk_buff *skb,
+				       struct net_device *dev)
+{
+	unsigned int cpu_port, usr_port, sub_interface;
+	struct dsa_port *dp = dsa_user_to_port(dev);
+	struct dsa_port *cpu_dp = dp->cpu_dp;
+	__be16 *mxl862_tag;

net/dsa/tag_mxl862xx.c line 43

Quoted 10 lines
net/dsa/tag_mxl862xx.c new file +10 -0
+
+	/* switch firmware expects ports to be counted starting from 1 */
+	cpu_port = cpu_dp->index + 1;
+	usr_port = dp->index + 1;
+
+	/* target port sub-interface ID relative to the CPU port */
+	sub_interface = usr_port + 16 - cpu_port;
+
+	if (!skb)
+		return skb;

I think skb can't be NULL here?!? Otherwise it would be better to move the check at the beginning of the function and return NULL directly.

Quoted 27 lines
net/dsa/tag_mxl862xx.c new file +27 -0
+
+	/* provide additional space 'MXL862_HEADER_LEN' bytes */
+	skb_push(skb, MXL862_HEADER_LEN);
+
+	/* shift MAC address to the beginning of the enlarged buffer,
+	 * releasing the space required for DSA tag (between MAC address and
+	 * Ethertype)
+	 */
+	dsa_alloc_etype_header(skb, MXL862_HEADER_LEN);
+
+	/* special tag ingress */
+	mxl862_tag = dsa_etype_header_pos_tx(skb);
+	mxl862_tag[0] = htons(ETH_P_MXLGSW);
+	mxl862_tag[1] = 0;
+	mxl862_tag[2] = htons(FIELD_PREP(MXL862_SUBIF_ID, sub_interface));
+	mxl862_tag[3] = htons(FIELD_PREP(MXL862_IGP_EGP, cpu_port));
+
+	return skb;
+}
+
+static struct sk_buff *mxl862_tag_rcv(struct sk_buff *skb,
+				      struct net_device *dev)
+{
+	__be16 *mxl862_tag;
+	int port;
+
+	if (unlikely(!pskb_may_pull(skb, MXL862_HEADER_LEN))) {

net/dsa/tag_mxl862xx.c line 80

Quoted 10 lines
net/dsa/tag_mxl862xx.c new file +10 -0
+		dev_warn_ratelimited(&dev->dev, "Cannot pull SKB, packet dropped\n");
+		return NULL;
+	}
+
+	mxl862_tag = dsa_etype_header_pos_rx(skb);
+
+	if (unlikely(mxl862_tag[0] != htons(ETH_P_MXLGSW))) {
+		dev_warn_ratelimited(&dev->dev, "Invalid special tag marker, packet dropped\n");
+		dev_warn_ratelimited(&dev->dev, "Rx Packet Tag: %8ph\n",
+				     mxl862_tag);

Why breaking the message in 2 strings? a single dev_warn_ratelimited() would be more readable and will generate smaller code. Similar thing below.

/P

author maintainer
#4 lore raw

PATCH v5 3/4 net: mdio: add unlocked mdiodev C45 bus accessors

In reply to Daniel Golle

Add helper inline functions __mdiodev_c45_read() and __mdiodev_c45_write(), which are the C45 equivalents of the existing __mdiodev_read() and __mdiodev_write() added by commit e6a45700e7e1 ("net: mdio: add unlocked mdiobus and mdiodev bus accessors")

---
v5: fix indentation
RFC v4: no changes
RFC v3: no changes
RFC v2: add this patch, initial submission

 include/linux/mdio.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
include/linux/mdio.h +13 -0
index 42d6d47e445b7..52d94b8ae371e 100644
@@ -648,6 +648,19 @@ static inline int mdiodev_modify_changed(struct mdio_device *mdiodev,
 				      mask, set);
 }
 
+static inline int __mdiodev_c45_read(struct mdio_device *mdiodev, int devad,
+				     u16 regnum)
+{
+	return __mdiobus_c45_read(mdiodev->bus, mdiodev->addr, devad, regnum);
+}
+
+static inline int __mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
+				      u16 regnum, u16 val)
+{
+	return __mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
+				   val);
+}
+
 static inline int mdiodev_c45_modify(struct mdio_device *mdiodev, int devad,
 				     u32 regnum, u16 mask, u16 set)
 {
Signature · 1 line
2.52.0
author maintainer
#5 lore raw

PATCH v5 4/4 net: dsa: add basic initial driver for MxL862xx switches

In reply to Daniel Golle

Add very basic DSA driver for MaxLinear's MxL862xx switches.

In contrast to previous MaxLinear switches the MxL862xx has a built-in processor that runs a sophisticated firmware based on Zephyr RTOS. Interaction between the host and the switch hence is organized using a software API of that firmware rather than accessing hardware registers directly.

Add descriptions of the most basic firmware API calls to access the built-in MDIO bus hosting the 2.5GE PHYs, basic port control as well as setting up the CPU port.

Implement a very basic DSA driver using that API which is sufficient to get packets flowing between the user ports and the CPU port.

The firmware offers all features one would expect from a modern switch hardware, they will be added one by one in follow-up patch series.

---
v5:
* output warning in .setup regarding unknown pre-configuration
* add comment explaining why CFGGET is used in reset function

RFC v4:
* poll switch readiness after reset
* implement driver shutdown
* added port_fast_aging API call and driver op
* unified port setup in new .port_setup op
* improve comment explaining special handlign for unaligned API read
* various typos

RFC v3:
* fix return value being uninitialized on error in mxl862xx_api_wrap()
* add missing descrition in kerneldoc comment of
struct mxl862xx_ss_sp_tag

RFC v2:
* make use of struct mdio_device
* add phylink_mac_ops stubs
* drop leftover nonsense from mxl862xx_phylink_get_caps()
* use __le32 instead of enum types in over-the-wire structs
* use existing MDIO_* macros whenever possible
* simplify API constants to be more readable
* use readx_poll_timeout instead of open-coding poll timeout loop
* add mxl862xx_reg_read() and mxl862xx_reg_write() helpers
* demystify error codes returned by the firmware
* add #defines for mxl862xx_ss_sp_tag member values
* move reset to dedicated function, clarify magic number being the reset command ID

 MAINTAINERS                              |   1 +
 drivers/net/dsa/Kconfig                  |   2 +
 drivers/net/dsa/Makefile                 |   1 +
 drivers/net/dsa/mxl862xx/Kconfig         |  12 +
 drivers/net/dsa/mxl862xx/Makefile        |   3 +
 drivers/net/dsa/mxl862xx/mxl862xx-api.h  | 177 +++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h  |  32 ++
 drivers/net/dsa/mxl862xx/mxl862xx-host.c | 230 ++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-host.h |   5 +
 drivers/net/dsa/mxl862xx/mxl862xx.c      | 433 +++++++++++++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx.h      |  24 ++
 11 files changed, 920 insertions(+)
 create mode 100644 drivers/net/dsa/mxl862xx/Kconfig
 create mode 100644 drivers/net/dsa/mxl862xx/Makefile
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-api.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.h
MAINTAINERS +1 -0
index 686591074b34d..a37acb043a0a6 100644
@@ -15619,6 +15619,7 @@ M:	Daniel Golle <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml
+F:	drivers/net/dsa/mxl862xx/
 F:	net/dsa/tag_mxl862xx.c
 
 MCAN DEVICE DRIVER
drivers/net/dsa/Kconfig +2 -0
index 7eb301fd987d1..18f6e8b7f4cb2 100644
@@ -74,6 +74,8 @@ source "drivers/net/dsa/microchip/Kconfig"
 
 source "drivers/net/dsa/mv88e6xxx/Kconfig"
 
+source "drivers/net/dsa/mxl862xx/Kconfig"
+
 source "drivers/net/dsa/ocelot/Kconfig"
 
 source "drivers/net/dsa/qca/Kconfig"
drivers/net/dsa/Makefile +1 -0
index 16de4ba3fa388..f5a463b87ec25 100644
@@ -20,6 +20,7 @@ obj-y				+= hirschmann/
 obj-y				+= lantiq/
 obj-y				+= microchip/
 obj-y				+= mv88e6xxx/
+obj-y				+= mxl862xx/
 obj-y				+= ocelot/
 obj-y				+= qca/
 obj-y				+= realtek/
drivers/net/dsa/mxl862xx/Kconfig new file +12 -0
new file mode 100644
index 0000000000000..3722260da7d82
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config NET_DSA_MXL862
+	tristate "MaxLinear MxL862xx"
+	depends on NET_DSA
+	select MAXLINEAR_GPHY
+	select NET_DSA_TAG_MXL_862XX
+	help
+	  This enables support for the MaxLinear MxL862xx switch family.
+	  These switches have two 10GE SerDes interfaces, one typically
+	  used as CPU port.
+	   MxL86282 has eight 2.5 Gigabit PHYs
+	   MxL86252 has five 2.5 Gigabit PHYs
drivers/net/dsa/mxl862xx/Makefile new file +3 -0
new file mode 100644
index 0000000000000..d23dd3cd511d4
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_NET_DSA_MXL862) += mxl862xx_dsa.o
+mxl862xx_dsa-y := mxl862xx.o mxl862xx-host.o
drivers/net/dsa/mxl862xx/mxl862xx-api.h new file +177 -0

177 lines not on this page · raw message

drivers/net/dsa/mxl862xx/mxl862xx-cmd.h new file +32 -0
new file mode 100644
index 0000000000000..79e66aa622ea2
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#define MXL862XX_MMD_DEV		30
+#define MXL862XX_MMD_REG_CTRL		0
+#define MXL862XX_MMD_REG_LEN_RET	1
+#define MXL862XX_MMD_REG_DATA_FIRST	2
+#define MXL862XX_MMD_REG_DATA_LAST	95
+#define MXL862XX_MMD_REG_DATA_MAX_SIZE \
+	(MXL862XX_MMD_REG_DATA_LAST - MXL862XX_MMD_REG_DATA_FIRST + 1)
+
+#define MXL862XX_COMMON_MAGIC		0x100
+#define MXL862XX_CTP_MAGIC		0x500
+#define MXL862XX_SWMAC_MAGIC		0xa00
+#define MXL862XX_SS_MAGIC		0x1600
+#define GPY_GPY2XX_MAGIC		0x1800
+#define SYS_MISC_MAGIC			0x1900
+
+#define MXL862XX_COMMON_CFGGET		(MXL862XX_COMMON_MAGIC + 0x9)
+#define MXL862XX_COMMON_REGISTERMOD	(MXL862XX_COMMON_MAGIC + 0x11)
+
+#define MXL862XX_CTP_PORTASSIGNMENTSET	(MXL862XX_CTP_MAGIC + 0x3)
+
+#define MXL862XX_MAC_TABLECLEARCOND	(MXL862XX_SWMAC_MAGIC + 0x8)
+
+#define MXL862XX_SS_SPTAG_SET		(MXL862XX_SS_MAGIC + 0x02)
+
+#define INT_GPHY_READ			(GPY_GPY2XX_MAGIC + 0x01)
+#define INT_GPHY_WRITE			(GPY_GPY2XX_MAGIC + 0x02)
+
+#define SYS_MISC_FW_VERSION		(SYS_MISC_MAGIC + 0x02)
+
+#define MMD_API_MAXIMUM_ID		0x7fff
drivers/net/dsa/mxl862xx/mxl862xx-host.c new file +230 -0

230 lines not on this page · raw message

drivers/net/dsa/mxl862xx/mxl862xx-host.h new file +5 -0
new file mode 100644
index 0000000000000..0f558193d9d48
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+int mxl862xx_api_wrap(struct mxl862xx_priv *priv, u16 cmd, void *data, u16 size,
+		      bool read, bool quiet);
+int mxl862xx_reset(struct mxl862xx_priv *priv);
drivers/net/dsa/mxl862xx/mxl862xx.c new file +433 -0

433 lines not on this page · raw message

drivers/net/dsa/mxl862xx/mxl862xx.h new file +24 -0
new file mode 100644
index 0000000000000..66d194db8d6dd
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#define MXL862XX_MAX_PHY_PORT_NUM	8
+#define MXL862XX_MAX_EXT_PORT_NUM	7
+#define MXL862XX_MAX_PORT_NUM		(MXL862XX_MAX_PHY_PORT_NUM + \
+					 MXL862XX_MAX_EXT_PORT_NUM)
+
+#define MXL86252_PHY_PORT_NUM		5
+#define MXL86282_PHY_PORT_NUM		8
+
+#define MXL86252_EXT_PORT_NUM		2
+#define MXL86282_EXT_PORT_NUM		2
+
+struct mxl862xx_hw_info {
+	u8 max_ports;
+	u8 phy_ports;
+	u8 ext_ports;
+};
+
+struct mxl862xx_priv {
+	struct dsa_switch *ds;
+	struct mdio_device *mdiodev;
+	const struct mxl862xx_hw_info *hw_info;
+};
Signature · 1 line
2.52.0
maintainer
#6 lore raw

Re: [PATCH net-next v5 4/4] net: dsa: add basic initial driver for MxL862xx switches

Quoted 80 lines · Daniel Golle

Add very basic DSA driver for MaxLinear's MxL862xx switches.

In contrast to previous MaxLinear switches the MxL862xx has a built-in processor that runs a sophisticated firmware based on Zephyr RTOS. Interaction between the host and the switch hence is organized using a software API of that firmware rather than accessing hardware registers directly.

Add descriptions of the most basic firmware API calls to access the built-in MDIO bus hosting the 2.5GE PHYs, basic port control as well as setting up the CPU port.

Implement a very basic DSA driver using that API which is sufficient to get packets flowing between the user ports and the CPU port.

The firmware offers all features one would expect from a modern switch hardware, they will be added one by one in follow-up patch series.

---
v5:
* output warning in .setup regarding unknown pre-configuration
* add comment explaining why CFGGET is used in reset function

RFC v4:
* poll switch readiness after reset
* implement driver shutdown
* added port_fast_aging API call and driver op
* unified port setup in new .port_setup op
* improve comment explaining special handlign for unaligned API read
* various typos

RFC v3:
* fix return value being uninitialized on error in mxl862xx_api_wrap()
* add missing descrition in kerneldoc comment of
struct mxl862xx_ss_sp_tag

RFC v2:
* make use of struct mdio_device
* add phylink_mac_ops stubs
* drop leftover nonsense from mxl862xx_phylink_get_caps()
* use __le32 instead of enum types in over-the-wire structs
* use existing MDIO_* macros whenever possible
* simplify API constants to be more readable
* use readx_poll_timeout instead of open-coding poll timeout loop
* add mxl862xx_reg_read() and mxl862xx_reg_write() helpers
* demystify error codes returned by the firmware
* add #defines for mxl862xx_ss_sp_tag member values
* move reset to dedicated function, clarify magic number being the reset command ID

 MAINTAINERS                              |   1 +
 drivers/net/dsa/Kconfig                  |   2 +
 drivers/net/dsa/Makefile                 |   1 +
 drivers/net/dsa/mxl862xx/Kconfig         |  12 +
 drivers/net/dsa/mxl862xx/Makefile        |   3 +
 drivers/net/dsa/mxl862xx/mxl862xx-api.h  | 177 +++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h  |  32 ++
 drivers/net/dsa/mxl862xx/mxl862xx-host.c | 230 ++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-host.h |   5 +
 drivers/net/dsa/mxl862xx/mxl862xx.c      | 433 +++++++++++++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx.h      |  24 ++
 11 files changed, 920 insertions(+)
 create mode 100644 drivers/net/dsa/mxl862xx/Kconfig
 create mode 100644 drivers/net/dsa/mxl862xx/Makefile
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-api.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.h
drivers/net/dsa/mxl862xx/mxl862xx.c new file +8 -0
+static int mxl862xx_setup(struct dsa_switch *ds)
+{
+	struct mxl862xx_priv *priv = ds->priv;
+	int ret;
+
+	ret = mxl862xx_reset(priv);
+	if (ret)
+		return ret;

drivers/net/dsa/mxl862xx/mxl862xx.c line 273

Quoted 10 lines
drivers/net/dsa/mxl862xx/mxl862xx.c new file +10 -0
+
+	ret = mxl862xx_wait_ready(ds);
+	if (ret)
+		return ret;
+
+	ret = mxl862xx_setup_mdio(ds);
+	if (ret)
+		return ret;
+
+	dev_warn(ds->dev, "Unknown switch pre-configuration, ports may be bridged!\n");

Nack. User space needs to be in control of the forwarding domain of the ports, and isolating user ports is the bare minimum requirement, otherwise you cannot even connect the ports of this device to a switch without creating L2 loops.

It seems that it is too early for this switch to be supported by mainline. Maybe in staging...

Quoted 3 lines
drivers/net/dsa/mxl862xx/mxl862xx.c new file +3 -0
+
+	return 0;
+}
author maintainer
#7 lore raw

Re: [PATCH net-next v5 4/4] net: dsa: add basic initial driver for MxL862xx switches

Quoted 97 lines · Vladimir Oltean
Quoted 80 lines · Daniel Golle

Add very basic DSA driver for MaxLinear's MxL862xx switches.

In contrast to previous MaxLinear switches the MxL862xx has a built-in processor that runs a sophisticated firmware based on Zephyr RTOS. Interaction between the host and the switch hence is organized using a software API of that firmware rather than accessing hardware registers directly.

Add descriptions of the most basic firmware API calls to access the built-in MDIO bus hosting the 2.5GE PHYs, basic port control as well as setting up the CPU port.

Implement a very basic DSA driver using that API which is sufficient to get packets flowing between the user ports and the CPU port.

The firmware offers all features one would expect from a modern switch hardware, they will be added one by one in follow-up patch series.

---
v5:
* output warning in .setup regarding unknown pre-configuration
* add comment explaining why CFGGET is used in reset function

RFC v4:
* poll switch readiness after reset
* implement driver shutdown
* added port_fast_aging API call and driver op
* unified port setup in new .port_setup op
* improve comment explaining special handlign for unaligned API read
* various typos

RFC v3:
* fix return value being uninitialized on error in mxl862xx_api_wrap()
* add missing descrition in kerneldoc comment of
struct mxl862xx_ss_sp_tag

RFC v2:
* make use of struct mdio_device
* add phylink_mac_ops stubs
* drop leftover nonsense from mxl862xx_phylink_get_caps()
* use __le32 instead of enum types in over-the-wire structs
* use existing MDIO_* macros whenever possible
* simplify API constants to be more readable
* use readx_poll_timeout instead of open-coding poll timeout loop
* add mxl862xx_reg_read() and mxl862xx_reg_write() helpers
* demystify error codes returned by the firmware
* add #defines for mxl862xx_ss_sp_tag member values
* move reset to dedicated function, clarify magic number being the reset command ID

 MAINTAINERS                              |   1 +
 drivers/net/dsa/Kconfig                  |   2 +
 drivers/net/dsa/Makefile                 |   1 +
 drivers/net/dsa/mxl862xx/Kconfig         |  12 +
 drivers/net/dsa/mxl862xx/Makefile        |   3 +
 drivers/net/dsa/mxl862xx/mxl862xx-api.h  | 177 +++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h  |  32 ++
 drivers/net/dsa/mxl862xx/mxl862xx-host.c | 230 ++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-host.h |   5 +
 drivers/net/dsa/mxl862xx/mxl862xx.c      | 433 +++++++++++++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx.h      |  24 ++
 11 files changed, 920 insertions(+)
 create mode 100644 drivers/net/dsa/mxl862xx/Kconfig
 create mode 100644 drivers/net/dsa/mxl862xx/Makefile
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-api.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.h
drivers/net/dsa/mxl862xx/mxl862xx.c new file +8 -0
+static int mxl862xx_setup(struct dsa_switch *ds)
+{
+	struct mxl862xx_priv *priv = ds->priv;
+	int ret;
+
+	ret = mxl862xx_reset(priv);
+	if (ret)
+		return ret;

drivers/net/dsa/mxl862xx/mxl862xx.c line 273

Quoted 10 lines
drivers/net/dsa/mxl862xx/mxl862xx.c new file +10 -0
+
+	ret = mxl862xx_wait_ready(ds);
+	if (ret)
+		return ret;
+
+	ret = mxl862xx_setup_mdio(ds);
+	if (ret)
+		return ret;
+
+	dev_warn(ds->dev, "Unknown switch pre-configuration, ports may be bridged!\n");

Nack. User space needs to be in control of the forwarding domain of the ports, and isolating user ports is the bare minimum requirement, otherwise you cannot even connect the ports of this device to a switch without creating L2 loops.

Quoted 2 lines

It seems that it is too early for this switch to be supported by mainline. Maybe in staging...

In order to avoid the detour via staging, from my perspective there are two ways to go from here:

a) Keep nagging MaxLinear to provide a switch firmware with an additional firmware command which flushes the pre-configuration and puts the switch in a well-defined state (all ports isolated, learning disabled) for DSA.

b) Extend the patch to cover all the API calls needed to do this manually (more than double of LoC).

Obviously a) would be better for me and you, but MaxLinear indicated they prefer not to release an new firmware adding that feature at this point.

b) would allow me to proceed right away, but it would burden reviewers with a rather huge patch for initial support for this switch. For the sake of making review more easy I'd prefer to still keep this in a series of not terribly huge patches rather than a single patch which immediately brings in everything (ie. have bridge and bridgeport configuration in one patch, FDB access in the next, ...). Would a series adding everything needed to end up with isolated ports be acceptable?

Please let me know what you think.

maintainer
#8 lore raw

Re: [PATCH net-next v5 4/4] net: dsa: add basic initial driver for MxL862xx switches

Quoted 123 lines · Daniel Golle
Quoted 97 lines · Vladimir Oltean
Quoted 80 lines · Daniel Golle

Add very basic DSA driver for MaxLinear's MxL862xx switches.

In contrast to previous MaxLinear switches the MxL862xx has a built-in processor that runs a sophisticated firmware based on Zephyr RTOS. Interaction between the host and the switch hence is organized using a software API of that firmware rather than accessing hardware registers directly.

Add descriptions of the most basic firmware API calls to access the built-in MDIO bus hosting the 2.5GE PHYs, basic port control as well as setting up the CPU port.

Implement a very basic DSA driver using that API which is sufficient to get packets flowing between the user ports and the CPU port.

The firmware offers all features one would expect from a modern switch hardware, they will be added one by one in follow-up patch series.

---
v5:
* output warning in .setup regarding unknown pre-configuration
* add comment explaining why CFGGET is used in reset function

RFC v4:
* poll switch readiness after reset
* implement driver shutdown
* added port_fast_aging API call and driver op
* unified port setup in new .port_setup op
* improve comment explaining special handlign for unaligned API read
* various typos

RFC v3:
* fix return value being uninitialized on error in mxl862xx_api_wrap()
* add missing descrition in kerneldoc comment of
struct mxl862xx_ss_sp_tag

RFC v2:
* make use of struct mdio_device
* add phylink_mac_ops stubs
* drop leftover nonsense from mxl862xx_phylink_get_caps()
* use __le32 instead of enum types in over-the-wire structs
* use existing MDIO_* macros whenever possible
* simplify API constants to be more readable
* use readx_poll_timeout instead of open-coding poll timeout loop
* add mxl862xx_reg_read() and mxl862xx_reg_write() helpers
* demystify error codes returned by the firmware
* add #defines for mxl862xx_ss_sp_tag member values
* move reset to dedicated function, clarify magic number being the reset command ID

 MAINTAINERS                              |   1 +
 drivers/net/dsa/Kconfig                  |   2 +
 drivers/net/dsa/Makefile                 |   1 +
 drivers/net/dsa/mxl862xx/Kconfig         |  12 +
 drivers/net/dsa/mxl862xx/Makefile        |   3 +
 drivers/net/dsa/mxl862xx/mxl862xx-api.h  | 177 +++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h  |  32 ++
 drivers/net/dsa/mxl862xx/mxl862xx-host.c | 230 ++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx-host.h |   5 +
 drivers/net/dsa/mxl862xx/mxl862xx.c      | 433 +++++++++++++++++++++++
 drivers/net/dsa/mxl862xx/mxl862xx.h      |  24 ++
 11 files changed, 920 insertions(+)
 create mode 100644 drivers/net/dsa/mxl862xx/Kconfig
 create mode 100644 drivers/net/dsa/mxl862xx/Makefile
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-api.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-cmd.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx-host.h
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.c
 create mode 100644 drivers/net/dsa/mxl862xx/mxl862xx.h
drivers/net/dsa/mxl862xx/mxl862xx.c new file +8 -0
+static int mxl862xx_setup(struct dsa_switch *ds)
+{
+	struct mxl862xx_priv *priv = ds->priv;
+	int ret;
+
+	ret = mxl862xx_reset(priv);
+	if (ret)
+		return ret;

drivers/net/dsa/mxl862xx/mxl862xx.c line 273

Quoted 10 lines
drivers/net/dsa/mxl862xx/mxl862xx.c new file +10 -0
+
+	ret = mxl862xx_wait_ready(ds);
+	if (ret)
+		return ret;
+
+	ret = mxl862xx_setup_mdio(ds);
+	if (ret)
+		return ret;
+
+	dev_warn(ds->dev, "Unknown switch pre-configuration, ports may be bridged!\n");

Nack. User space needs to be in control of the forwarding domain of the ports, and isolating user ports is the bare minimum requirement, otherwise you cannot even connect the ports of this device to a switch without creating L2 loops.

Quoted 2 lines

It seems that it is too early for this switch to be supported by mainline. Maybe in staging...

In order to avoid the detour via staging, from my perspective there are two ways to go from here:

a) Keep nagging MaxLinear to provide a switch firmware with an additional firmware command which flushes the pre-configuration and puts the switch in a well-defined state (all ports isolated, learning disabled) for DSA.

b) Extend the patch to cover all the API calls needed to do this manually (more than double of LoC).

Obviously a) would be better for me and you, but MaxLinear indicated they prefer not to release an new firmware adding that feature at this point.

b) would allow me to proceed right away, but it would burden reviewers with a rather huge patch for initial support for this switch. For the sake of making review more easy I'd prefer to still keep this in a series of not terribly huge patches rather than a single patch which immediately brings in everything (ie. have bridge and bridgeport configuration in one patch, FDB access in the next, ...). Would a series adding everything needed to end up with isolated ports be acceptable?

Quoted 1 line

Please let me know what you think.

Do you have the additional work required to isolate user ports prepared on some branch that can be pre-reviewed? I'm not sure that I have all information to make an informed comment.

author maintainer
#9 lore raw

Re: [PATCH net-next v5 4/4] net: dsa: add basic initial driver for MxL862xx switches

Hi Vladimir,

Quoted 24 lines · Vladimir Oltean
Quoted 23 lines · Daniel Golle

[...]
In order to avoid the detour via staging, from my perspective there are two ways to go from here:

a) Keep nagging MaxLinear to provide a switch firmware with an additional firmware command which flushes the pre-configuration and puts the switch in a well-defined state (all ports isolated, learning disabled) for DSA.

b) Extend the patch to cover all the API calls needed to do this manually (more than double of LoC).

Obviously a) would be better for me and you, but MaxLinear indicated they prefer not to release an new firmware adding that feature at this point.

b) would allow me to proceed right away, but it would burden reviewers with a rather huge patch for initial support for this switch. For the sake of making review more easy I'd prefer to still keep this in a series of not terribly huge patches rather than a single patch which immediately brings in everything (ie. have bridge and bridgeport configuration in one patch, FDB access in the next, ...). Would a series adding everything needed to end up with isolated ports be acceptable?

Quoted 5 lines
Quoted 1 line

Please let me know what you think.

Do you have the additional work required to isolate user ports prepared on some branch that can be pre-reviewed? I'm not sure that I have all information to make an informed comment.

I've sent a follow-up version of the series[1] adding support for the switch which includes basic usage of BRIDGE and BRIDGEPORT firmware API to make sure ports are always isolated.

The function mxl862xx_isolate_port() introduced for this purpose is going to be changed quite a lot in upcoming follow-up series, as we do need to track and free allocated bridges used for port isolation for now once bridge offloading is going to be implemented.

Please let me know if this is acceptable.

Thank you!

Daniel

[1]: https://patchwork.kernel.org/project/netdevbpf/list/?series=1043728