Skip to contentSkip to conversation

net: ipqess: introduce Qualcomm IPQESS driver

PATCH Superseded Maxime Chevallier 4 participants 14 messages Nov 4, 2022

Subsystems (6)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover net: ipqess: introduce Qualcomm IPQESS driver

Hello everyone,

This is the 7th iteration on the IPQESS driver, that includes a new DSA tagger to let the MAC convey the tag to the switch through an out-of-band medium, here using DMA descriptors.

Notables changes on V7 :
- Fixed sparse warnings
- Fixed a typo in the bindings
- Added missing maintainers in CC

Notables changes on V6 :
- Cleanup unused helpers and fields in the tagger
- Cleanup ordering in various files
- Added more documentation on the tagger
- Fixed the CHANGEUPPER caching
- Cleanups in the IPQESS driver

Thanks Andrew, Vlad and Krzysztof for the reviews !

Notables changes on V5 :
- Fix caching of CHANGEUPPER events
- Use a skb extension-based tagger
- Rename the binding file
- Some cleanups in the ipqess driver itself

Notables changes on V4 :
- Cache the uses_dsa info from CHANGEUPPER events
- Use better string handling helpers for ethtool stats
- rename ethtool callbacks
- Fix a binding typo

Notables changes on V3 :
- Took into account Russell's review on the ioctl handler and the mac capabilities that were missing
- Took Andrew's reviews into account by reworking the napi rx loop, some stray "inline" keywords, and useless warnings
- Took Vlad's reviews into account by reworking a few macros
- Took Christophe's review into account by removing extra GFP_ZERO
- Took Rob's review into account by simplifying the binding

Notables changes on V2 :
- Put the DSA tag in the skb itself instead of using skb->shinfo
- Fixed the initialisation sequence based on Andrew's comments
- Reworked the error paths in the init sequence
- Add support for the clock and reset lines on that controller
- Fixed and updated the binding

The driver itself is pretty straightforward, but has lived out-of-tree for a while. I've done my best to clean-up some outdated API calls, but some might remain.

This controller is somewhat special, since it's part of the IPQ4019 SoC which also includes an QCA8K switch, and uses the IPQESS controller for the CPU port. The switch is so tightly intergrated with the MAC that it is connected to the MAC using an internal link (hence the fact that we only support PHY_INTERFACE_MODE_INTERNAL), and this has some consequences on the DSA side.

The tagging for the switch isn't done inband as most switch do, but out-of-band, the DSA tag being included in the DMA descriptor.

This series includes a new out-of-band tagger that uses skb extensions to convey the tag between the tagger and the MAC driver.

Thanks to the Sartura folks who worked on a base version of this driver, and provided test hardware.

Best regards,

Maxime Chevallier
Maxime Chevallier (5):
net: dt-bindings: Introduce the Qualcomm IPQESS Ethernet controller
net: ipqess: introduce the Qualcomm IPQESS driver
net: dsa: add out-of-band tagging protocol
net: ipqess: Add out-of-band DSA tagging support
ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet
controller

 .../bindings/net/qcom,ipq4019-ess-edma.yaml   |   94 ++
 Documentation/networking/dsa/dsa.rst          |   13 +-
 MAINTAINERS                                   |    8 +
 arch/arm/boot/dts/qcom-ipq4019.dtsi           |   44 +
 drivers/net/ethernet/qualcomm/Kconfig         |   12 +
 drivers/net/ethernet/qualcomm/Makefile        |    2 +
 drivers/net/ethernet/qualcomm/ipqess/Makefile |    8 +
 drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 1308 +++++++++++++++++
 drivers/net/ethernet/qualcomm/ipqess/ipqess.h |  522 +++++++
 .../ethernet/qualcomm/ipqess/ipqess_ethtool.c |  164 +++
 include/linux/dsa/oob.h                       |   16 +
 include/linux/skbuff.h                        |    3 +
 include/net/dsa.h                             |    2 +
 net/core/skbuff.c                             |   10 +
 net/dsa/Kconfig                               |    9 +
 net/dsa/Makefile                              |    1 +
 net/dsa/tag_oob.c                             |   48 +
 17 files changed, 2263 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/Makefile
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess.c
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess.h
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c
 create mode 100644 include/linux/dsa/oob.h
 create mode 100644 net/dsa/tag_oob.c
Signature · 7 lines
2.37.3


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH v7 1/5 net: dt-bindings: Introduce the Qualcomm IPQESS Ethernet controller

Add the DT binding for the IPQESS Ethernet Controller. This is a simple controller, only requiring the phy-mode, interrupts, clocks, and possibly a MAC address setting.

---
V6->V7:
- Fixed a typo (firts -> first)
V5->V6:
- Fixed the $id that used the wrong compatible
- Force passing all the per-queue interrupts
V4->V5:
- Remove stray quotes arount the ref property
- Rename the binding to match the compatible string
V3->V4:
- Fix a binding typo in the compatible string
V2->V3:
- Cleanup on reset and clock names
V1->V2:
- Fixed the example
- Added reset and clocks
- Removed generic ethernet attributes

 .../bindings/net/qcom,ipq4019-ess-edma.yaml   | 94 +++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml
Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml new file +94 -0
new file mode 100644
index 000000000000..a16e707a4694
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/qcom,ipq4019-ess-edma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm IPQ ESS EDMA Ethernet Controller
+
+maintainers:
+  - Maxime Chevallier <[email protected]>
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    const: qcom,ipq4019-ess-edma
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 32
+    description: One interrupt per tx and rx queue, the first 16 are rx queues
+                 and the last 16 are the tx queues
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - resets
+  - phy-mode
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-ipq4019.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    gmac: ethernet@c080000 {
+        compatible = "qcom,ipq4019-ess-edma";
+        reg = <0xc080000 0x8000>;
+        resets = <&gcc ESS_RESET>;
+        clocks = <&gcc GCC_ESS_CLK>;
+        interrupts = <GIC_SPI  65 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  66 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  67 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  68 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  69 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  70 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  71 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  72 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  73 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  74 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  75 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  76 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  77 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  78 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  79 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI  80 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 240 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 241 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 242 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 243 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 244 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 245 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 246 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 248 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 249 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 250 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 251 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 252 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 253 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 254 IRQ_TYPE_EDGE_RISING>,
+                     <GIC_SPI 255 IRQ_TYPE_EDGE_RISING>;
+
+        phy-mode = "internal";
+        fixed-link {
+            speed = <1000>;
+            full-duplex;
+            pause;
+        };
+    };
+
+...
Signature · 7 lines
2.37.3


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH v7 2/5 net: ipqess: introduce the Qualcomm IPQESS driver

In reply to Maxime Chevallier

The Qualcomm IPQESS controller is a simple 1G Ethernet controller found on the IPQ4019 chip. This controller has some specificities, in that the IPQ4019 platform that includes that controller also has an internal switch, based on the QCA8K IP.

It is connected to that switch through an internal link, and doesn't expose directly any external interface, hence it only supports the PHY_INTERFACE_MODE_INTERNAL for now.

It has 16 RX and TX queues, with a very basic RSS fanout configured at init time.

---

V6->V7 :
- Added proper endianness conversion to access descriptor fields
V5->V6 :
- Use the devm_platform_get_and_ioremap_resource() helper
- Use the correct endianness for TX descriptors
- Cleaned up the de-init sequence
V4->V5 :
- Reworked the NAPI loops
- Used sizeof(*var) when possible
V3->V4 :
- Renamed the ethtool ksettings callbacks
- Use ethtool_sprintf
- Cache uses_dsa on CHANGEUPPER events
V2->V3 :
- Cleaned up ioctls and phylink support
- Reworked the napi loop
- cleaned up some macros and warnings
V1->V2 :
- Reworked the init sequence, following Andrew's comments
- Added clock and reset support
- Reworked the error paths
- Added extra endianness wrappers to fix sparse warnings

 MAINTAINERS                                   |    7 +
 drivers/net/ethernet/qualcomm/Kconfig         |   11 +
 drivers/net/ethernet/qualcomm/Makefile        |    2 +
 drivers/net/ethernet/qualcomm/ipqess/Makefile |    8 +
 drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 1246 +++++++++++++++++
 drivers/net/ethernet/qualcomm/ipqess/ipqess.h |  518 +++++++
 .../ethernet/qualcomm/ipqess/ipqess_ethtool.c |  164 +++
 7 files changed, 1956 insertions(+)
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/Makefile
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess.c
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess.h
 create mode 100644 drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c
MAINTAINERS +7 -0
index 7d44c5a6607d..6c6ffbb0f6ed 100644
@@ -17044,6 +17044,13 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/qualcomm/emac/
 
+QUALCOMM IPQESS ETHERNET DRIVER
+M:	Maxime Chevallier <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml
+F:	drivers/net/ethernet/qualcomm/ipqess/
+
 QUALCOMM ETHQOS ETHERNET DRIVER
 M:	Vinod Koul <[email protected]>
 R:	Bhupesh Sharma <[email protected]>
drivers/net/ethernet/qualcomm/Kconfig +11 -0
index a4434eb38950..28861bca5a5b 100644
@@ -60,6 +60,17 @@ config QCOM_EMAC
 	  low power, Receive-Side Scaling (RSS), and IEEE 1588-2008
 	  Precision Clock Synchronization Protocol.
 
+config QCOM_IPQ4019_ESS_EDMA
+	tristate "Qualcomm Atheros IPQ4019 ESS EDMA support"
+	depends on (OF && ARCH_QCOM) || COMPILE_TEST
+	select PHYLINK
+	help
+	  This driver supports the Qualcomm Atheros IPQ40xx built-in
+	  ESS EDMA ethernet controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ipqess.
+
 source "drivers/net/ethernet/qualcomm/rmnet/Kconfig"
 
 endif # NET_VENDOR_QUALCOMM
drivers/net/ethernet/qualcomm/Makefile +2 -0
index 9250976dd884..db463c9ea1f9 100644
@@ -11,4 +11,6 @@ qcauart-objs := qca_uart.o
 
 obj-y += emac/
 
+obj-$(CONFIG_QCOM_IPQ4019_ESS_EDMA) += ipqess/
+
 obj-$(CONFIG_RMNET) += rmnet/
drivers/net/ethernet/qualcomm/ipqess/Makefile new file +8 -0
new file mode 100644
index 000000000000..4f2db7283ebf
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the IPQ ESS driver
+#
+
+obj-$(CONFIG_QCOM_IPQ4019_ESS_EDMA) += ipq_ess.o
+
+ipq_ess-objs := ipqess.o ipqess_ethtool.o
drivers/net/ethernet/qualcomm/ipqess/ipqess.c new file +1246 -0

1,246 lines not on this page · raw message

drivers/net/ethernet/qualcomm/ipqess/ipqess.h new file +518 -0

518 lines not on this page · raw message

drivers/net/ethernet/qualcomm/ipqess/ipqess_ethtool.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.37.3
#3 lore raw

PATCH v7 3/5 net: dsa: add out-of-band tagging protocol

In reply to Maxime Chevallier

This tagging protocol is designed for the situation where the link between the MAC and the Switch is designed such that the Destination Port, which is usually embedded in some part of the Ethernet Header, is sent out-of-band, and isn't present at all in the Ethernet frame.

This can happen when the MAC and Switch are tightly integrated on an SoC, as is the case with the Qualcomm IPQ4019 for example, where the DSA tag is inserted directly into the DMA descriptors. In that case, the MAC driver is responsible for sending the tag to the switch using the out-of-band medium. To do so, the MAC driver needs to have the information of the destination port for that skb.

Add a new tagging protocol based on SKB extensions to convey the information about the destination port to the MAC driver

---

V6->V7:
- Fixed a sparse warning by making the dsa ops static
V5->V6:
- Added some documentation
- Removed the pop/push helpers
- Removed unused fields
V4->V5
- Use SKB extensions to convey the tag
V3->V4
- No changes
V3->V2:
- No changes, as the discussion is ongoing
V1->V2:
- Reworked the tagging method, putting the tag at skb->head instead of putting it into skb->shinfo, as per Andrew, Florian and Vlad's reviews

 Documentation/networking/dsa/dsa.rst | 13 +++++++-
 MAINTAINERS                          |  1 +
 include/linux/dsa/oob.h              | 16 ++++++++++
 include/linux/skbuff.h               |  3 ++
 include/net/dsa.h                    |  2 ++
 net/core/skbuff.c                    | 10 ++++++
 net/dsa/Kconfig                      |  9 ++++++
 net/dsa/Makefile                     |  1 +
 net/dsa/tag_oob.c                    | 48 ++++++++++++++++++++++++++++
 9 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/dsa/oob.h
 create mode 100644 net/dsa/tag_oob.c
Documentation/networking/dsa/dsa.rst +12 -1
index a94ddf83348a..2909ed5f00f6 100644
@@ -66,7 +66,8 @@ Switch tagging protocols
 ------------------------
 
 DSA supports many vendor-specific tagging protocols, one software-defined
-tagging protocol, and a tag-less mode as well (``DSA_TAG_PROTO_NONE``).
+tagging protocol, a tag-less mode as well (``DSA_TAG_PROTO_NONE``) and an
+out-of-band tagging protocol (``DSA_TAG_PROTO_OOB``).
 
 The exact format of the tag protocol is vendor specific, but in general, they
 all contain something which:
@@ -217,6 +218,16 @@ receive all frames regardless of the value of the MAC DA. This can be done by
 setting the ``promisc_on_master`` property of the ``struct dsa_device_ops``.
 Note that this assumes a DSA-unaware master driver, which is the norm.
 
+Some SoCs have a tight integration between the conduit network interface and the
+embedded switch, such that the DSA tag isn't transmitted in the packet data,
+but through another media, using so-called out-of-band tagging. In that case,
+the host MAC driver is in charge of transmitting the tag to the switch.
+An example is the IPQ4019 SoC, that transmits the tag between the ipqess
+ethernet controller and the qca8k switch using the DMA descriptor. In that
+configuration, tag-chaining is permitted, but the OOB tag will always be the
+top-most switch in the tree. The tagger (``DSA_TAG_PROTO_OOB``) uses skb
+extensions to transmit the tag to and from the MAC driver.
+
 Master network devices
 ----------------------
 
MAINTAINERS +1 -0
index 6c6ffbb0f6ed..46bf0a4bfbaa 100644
@@ -17050,6 +17050,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/qcom,ipq4019-ess-edma.yaml
 F:	drivers/net/ethernet/qualcomm/ipqess/
+F:	net/dsa/tag_oob.c
 
 QUALCOMM ETHQOS ETHERNET DRIVER
 M:	Vinod Koul <[email protected]>
include/linux/dsa/oob.h new file +16 -0
new file mode 100644
index 000000000000..b5683a9a647d
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ * Copyright (C) 2022 Maxime Chevallier <[email protected]>
+ */
+
+#ifndef _NET_DSA_OOB_H
+#define _NET_DSA_OOB_H
+
+#include <linux/skbuff.h>
+
+struct dsa_oob_tag_info {
+	u16 port;
+};
+
+int dsa_oob_tag_push(struct sk_buff *skb, struct dsa_oob_tag_info *ti);
+int dsa_oob_tag_pop(struct sk_buff *skb, struct dsa_oob_tag_info *ti);
+#endif
include/linux/skbuff.h +3 -0
index 59c9fd55699d..ace765ae56b3 100644
@@ -4573,6 +4573,9 @@ enum skb_ext_id {
 #endif
 #if IS_ENABLED(CONFIG_MCTP_FLOWS)
 	SKB_EXT_MCTP,
+#endif
+#if IS_ENABLED(CONFIG_NET_DSA_TAG_OOB)
+	SKB_EXT_DSA_OOB,
 #endif
 	SKB_EXT_NUM, /* must be last */
 };
include/net/dsa.h +2 -0
index ee369670e20e..114176efacc9 100644
@@ -55,6 +55,7 @@ struct phylink_link_state;
 #define DSA_TAG_PROTO_RTL8_4T_VALUE		25
 #define DSA_TAG_PROTO_RZN1_A5PSW_VALUE		26
 #define DSA_TAG_PROTO_LAN937X_VALUE		27
+#define DSA_TAG_PROTO_OOB_VALUE			28
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -85,6 +86,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_RTL8_4T		= DSA_TAG_PROTO_RTL8_4T_VALUE,
 	DSA_TAG_PROTO_RZN1_A5PSW	= DSA_TAG_PROTO_RZN1_A5PSW_VALUE,
 	DSA_TAG_PROTO_LAN937X		= DSA_TAG_PROTO_LAN937X_VALUE,
+	DSA_TAG_PROTO_OOB		= DSA_TAG_PROTO_OOB_VALUE,
 };
 
 struct dsa_switch;
net/core/skbuff.c +10 -0
index 42a35b59fb1e..571ef7fd95b4 100644
@@ -61,8 +61,12 @@
 #include <linux/if_vlan.h>
 #include <linux/mpls.h>
 #include <linux/kcov.h>
+#ifdef CONFIG_NET_DSA_TAG_OOB
+#include <linux/dsa/oob.h>
+#endif
 
 #include <net/protocol.h>
+#include <net/dsa.h>
 #include <net/dst.h>
 #include <net/sock.h>
 #include <net/checksum.h>
@@ -4487,6 +4491,9 @@ static const u8 skb_ext_type_len[] = {
 #if IS_ENABLED(CONFIG_MCTP_FLOWS)
 	[SKB_EXT_MCTP] = SKB_EXT_CHUNKSIZEOF(struct mctp_flow),
 #endif
+#if IS_ENABLED(CONFIG_NET_DSA_TAG_OOB)
+	[SKB_EXT_DSA_OOB] = SKB_EXT_CHUNKSIZEOF(struct dsa_oob_tag_info),
+#endif
 };
 
 static __always_inline unsigned int skb_ext_total_length(void)
@@ -4506,6 +4513,9 @@ static __always_inline unsigned int skb_ext_total_length(void)
 #endif
 #if IS_ENABLED(CONFIG_MCTP_FLOWS)
 		skb_ext_type_len[SKB_EXT_MCTP] +
+#endif
+#if IS_ENABLED(CONFIG_NET_DSA_TAG_OOB)
+		skb_ext_type_len[SKB_EXT_DSA_OOB] +
 #endif
 		0;
 }
net/dsa/Kconfig +9 -0
index 3eef72ce99a4..2ba4bbe07df1 100644
@@ -113,6 +113,15 @@ config NET_DSA_TAG_OCELOT_8021Q
 	  this mode, less TCAM resources (VCAP IS1, IS2, ES0) are available for
 	  use with tc-flower.
 
+config NET_DSA_TAG_OOB
+	select SKB_EXTENSIONS
+	tristate "Tag driver for Out-of-band tagging drivers"
+	help
+	  Say Y or M if you want to enable support for pairs of embedded
+	  switches and host MAC drivers which perform demultiplexing and
+	  packet steering to ports using out of band metadata processed
+	  by the DSA master, rather than tags present in the packets.
+
 config NET_DSA_TAG_QCA
 	tristate "Tag driver for Qualcomm Atheros QCA8K switches"
 	help
net/dsa/Makefile +1 -0
index bf57ef3bce2a..b11c24c969ee 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
 obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
 obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
 obj-$(CONFIG_NET_DSA_TAG_OCELOT_8021Q) += tag_ocelot_8021q.o
+obj-$(CONFIG_NET_DSA_TAG_OOB) += tag_oob.o
 obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
 obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o
 obj-$(CONFIG_NET_DSA_TAG_RTL8_4) += tag_rtl8_4.o
net/dsa/tag_oob.c new file +48 -0

48 lines not on this page · raw message

Signature · 7 lines
2.37.3


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH v7 4/5 net: ipqess: Add out-of-band DSA tagging support

In reply to Maxime Chevallier

On the IPQ4019, there's an 5 ports switch connected to the CPU through the IPQESS Ethernet controller. The way the DSA tag is sent-out to that switch is through the DMA descriptor, due to how tightly it is integrated with the switch.

We use the out-of-band tagging protocol by getting the source port from the descriptor, push it into the skb extensions, and have the tagger pull it to infer the destination netdev. The reverse process is done on the TX side, where the driver pulls the tag from the skb and builds the descriptor accordingly.

---
V6->V7:
- Added proper endianness conversion for descriptor accesses
V5->V6:
- Fixed the CHANGEUPPER event handling
- removed pop/push helpers
V4->V5:
- Rework the CHANGEUPPER event handling
V3->V4:
- No changes
V2->V3:
- No changes
V1->V2:
- Use the new tagger, and the dsa_oob_tag_* helpers

 drivers/net/ethernet/qualcomm/Kconfig         |  1 +
 drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 64 ++++++++++++++++++-
 drivers/net/ethernet/qualcomm/ipqess/ipqess.h |  4 ++
 3 files changed, 68 insertions(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/Kconfig +1 -0
index 28861bca5a5b..7eda94131cb1 100644
@@ -64,6 +64,7 @@ config QCOM_IPQ4019_ESS_EDMA
 	tristate "Qualcomm Atheros IPQ4019 ESS EDMA support"
 	depends on (OF && ARCH_QCOM) || COMPILE_TEST
 	select PHYLINK
+	select NET_DSA_TAG_OOB
 	help
 	  This driver supports the Qualcomm Atheros IPQ40xx built-in
 	  ESS EDMA ethernet controller.
drivers/net/ethernet/qualcomm/ipqess/ipqess.c +63 -1

117 lines not on this page · raw message

drivers/net/ethernet/qualcomm/ipqess/ipqess.h +4 -0
index dae17f3a23e4..5999a3b26235 100644
@@ -171,6 +171,10 @@ struct ipqess {
 	struct platform_device *pdev;
 	struct phylink *phylink;
 	struct phylink_config phylink_config;
+
+	struct notifier_block netdev_notifier;
+	int dsa_ports;
+
 	struct ipqess_tx_ring tx_ring[IPQESS_NETDEV_QUEUES];
 
 	struct ipqess_statistics ipqess_stats;
Signature · 1 line
2.37.3
#5 lore raw

PATCH v7 5/5 ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

In reply to Maxime Chevallier

The Qualcomm IPQ4019 includes an internal 5 ports switch, which is connected to the CPU through the internal IPQESS Ethernet controller.

Add support for this internal interface, which is internally connected to a modified version of the QCA8K Ethernet switch.

This Ethernet controller only support a specific internal interface mode for connection to the switch.

---
V6->V7:
- No Changes
V5->V6:
- Removed extra blank lines
- Put the status property last
V4->V5:
- Reword the commit log
V3->V4:
- No Changes
V2->V3:
- No Changes
V1->V2:
- Added clock and resets

 arch/arm/boot/dts/qcom-ipq4019.dtsi | 44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +44 -0
index b23591110bd2..5fa1af147df9 100644
@@ -38,6 +38,7 @@ aliases {
 		spi1 = &blsp1_spi2;
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;
 	};
 
 	cpus {
@@ -591,6 +592,49 @@ wifi1: wifi@a800000 {
 			status = "disabled";
 		};
 
+		gmac: ethernet@c080000 {
+			compatible = "qcom,ipq4019-ess-edma";
+			reg = <0xc080000 0x8000>;
+			resets = <&gcc ESS_RESET>;
+			reset-names = "ess";
+			clocks = <&gcc GCC_ESS_CLK>;
+			clock-names = "ess";
+			interrupts = <GIC_SPI  65 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  66 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  67 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  68 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  69 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  70 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  71 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  72 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  73 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  74 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  75 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  76 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  77 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  78 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  79 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI  80 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 240 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 241 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 242 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 243 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 244 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 245 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 246 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 248 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 249 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 250 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 251 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 252 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 253 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 254 IRQ_TYPE_EDGE_RISING>,
+				     <GIC_SPI 255 IRQ_TYPE_EDGE_RISING>;
+			phy-mode = "internal";
+			status = "disabled";
+		};
+
 		mdio: mdio@90000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.37.3
#6 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 34 lines · Maxime Chevallier

The Qualcomm IPQ4019 includes an internal 5 ports switch, which is connected to the CPU through the internal IPQESS Ethernet controller.

Add support for this internal interface, which is internally connected to a modified version of the QCA8K Ethernet switch.

This Ethernet controller only support a specific internal interface mode for connection to the switch.

---
V6->V7:
- No Changes
V5->V6:
- Removed extra blank lines
- Put the status property last
V4->V5:
- Reword the commit log
V3->V4:
- No Changes
V2->V3:
- No Changes
V1->V2:
- Added clock and resets

 arch/arm/boot/dts/qcom-ipq4019.dtsi | 44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +0 -0
index b23591110bd2..5fa1af147df9 100644

arch/arm/boot/dts/qcom-ipq4019.dtsi aliases { · line 41

Quoted 4 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +1 -0
@@ -38,6 +38,7 @@ aliases {
 		spi1 = &blsp1_spi2;
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;

Hm, I have doubts about this one. Why alias is needed and why it is a property of a SoC? Not every board has Ethernet enabled, so this looks like board property.

I also wonder why do you need it at all?

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 14 lines · Krzysztof Kozlowski

arch/arm/boot/dts/qcom-ipq4019.dtsi aliases { · line 41

Quoted 9 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +1 -0
index b23591110bd2..5fa1af147df9 100644
@@ -38,6 +38,7 @@ aliases {
 		spi1 = &blsp1_spi2;
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;

Hm, I have doubts about this one. Why alias is needed and why it is a property of a SoC? Not every board has Ethernet enabled, so this looks like board property.

Quoted 1 line

I also wonder why do you need it at all?

In general, Ethernet aliases are needed so that the bootloader can fix up the MAC address of each port's OF node with values it gets from the U-Boot environment or an AT24 EEPROM or something like that.
_______________________________________________
linux-arm-kernel mailing list [email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#8 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 15 lines · Vladimir Oltean
Quoted 14 lines · Krzysztof Kozlowski

arch/arm/boot/dts/qcom-ipq4019.dtsi aliases { · line 41

Quoted 9 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +1 -0
index b23591110bd2..5fa1af147df9 100644
@@ -38,6 +38,7 @@ aliases {
 		spi1 = &blsp1_spi2;
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;

Hm, I have doubts about this one. Why alias is needed and why it is a property of a SoC? Not every board has Ethernet enabled, so this looks like board property.

Quoted 5 lines
Quoted 1 line

I also wonder why do you need it at all?

In general, Ethernet aliases are needed so that the bootloader can fix up the MAC address of each port's OF node with values it gets from the U-Boot environment or an AT24 EEPROM or something like that.

Assuming that's the case here, my other part of question remains - is this property of SoC or board? The buses (SPI, I2C) are properties of boards, even though were incorrectly put here. If the board has multiple ethernets, the final ordering is the property of the board, not SoC. I would assume that bootloader also configures the MAC address based on the board config, not per SoC...

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 22 lines · Krzysztof Kozlowski
Quoted 15 lines · Vladimir Oltean
Quoted 14 lines · Krzysztof Kozlowski

arch/arm/boot/dts/qcom-ipq4019.dtsi aliases { · line 41

Quoted 9 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +1 -0
index b23591110bd2..5fa1af147df9 100644
@@ -38,6 +38,7 @@ aliases {
 		spi1 = &blsp1_spi2;
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;

Hm, I have doubts about this one. Why alias is needed and why it is a property of a SoC? Not every board has Ethernet enabled, so this looks like board property.

Quoted 5 lines
Quoted 1 line

I also wonder why do you need it at all?

In general, Ethernet aliases are needed so that the bootloader can fix up the MAC address of each port's OF node with values it gets from the U-Boot environment or an AT24 EEPROM or something like that.

Quoted 6 lines

Assuming that's the case here, my other part of question remains - is this property of SoC or board? The buses (SPI, I2C) are properties of boards, even though were incorrectly put here. If the board has multiple ethernets, the final ordering is the property of the board, not SoC. I would assume that bootloader also configures the MAC address based on the board config, not per SoC...

I don't disagree. On NXP LS1028A, we also have all aliases in board device trees and not in the SoC dtsi.

#10 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Hello Krzysztof, Vladimir,

Quoted 32 lines · On Fri, 4 Nov 2022 15:40:48 +0000 Vladimir Oltean <[email protected]>…
Quoted 24 lines · Krzysztof Kozlowski
Quoted 16 lines · Vladimir Oltean
Quoted 14 lines · Krzysztof Kozlowski

arch/arm/boot/dts/qcom-ipq4019.dtsi aliases { · line 41

Quoted 9 lines
(quoted diff) +0 -0

b/arch/arm/boot/dts/qcom-ipq4019.dtsi index b23591110bd2..5fa1af147df9 100644 --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi @@ -38,6 +38,7 @@ aliases { spi1 = &blsp1_spi2;

arch/arm/boot/dts/qcom-ipq4019.dtsi +1 -0
 		i2c0 = &blsp1_i2c3;
 		i2c1 = &blsp1_i2c4;
+		ethernet0 = &gmac;  

Hm, I have doubts about this one. Why alias is needed and why it is a property of a SoC? Not every board has Ethernet enabled, so this looks like board property.

Quoted 6 lines
Quoted 1 line

I also wonder why do you need it at all?

In general, Ethernet aliases are needed so that the bootloader can fix up the MAC address of each port's OF node with values it gets from the U-Boot environment or an AT24 EEPROM or something like that.

Quoted 6 lines

Assuming that's the case here, my other part of question remains - is this property of SoC or board? The buses (SPI, I2C) are properties of boards, even though were incorrectly put here. If the board has multiple ethernets, the final ordering is the property of the board, not SoC. I would assume that bootloader also configures the MAC address based on the board config, not per SoC...

Quoted 2 lines

I don't disagree. On NXP LS1028A, we also have all aliases in board device trees and not in the SoC dtsi.

You're right indeed, it was put there so that it's alongside the other aliases, but it makes more sense to include it in the board file. I'll respin with the alias removed.

Thanks,

Maxime

#11 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

In reply to Maxime Chevallier
Quoted 77 lines · Maxime Chevallier

The Qualcomm IPQ4019 includes an internal 5 ports switch, which is connected to the CPU through the internal IPQESS Ethernet controller.

Add support for this internal interface, which is internally connected to a modified version of the QCA8K Ethernet switch.

This Ethernet controller only support a specific internal interface mode for connection to the switch.

---
V6->V7:
- No Changes
V5->V6:
- Removed extra blank lines
- Put the status property last
V4->V5:
- Reword the commit log
V3->V4:
- No Changes
V2->V3:
- No Changes
V1->V2:
- Added clock and resets

 arch/arm/boot/dts/qcom-ipq4019.dtsi | 44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +32 -0
index b23591110bd2..5fa1af147df9 100644
@@ -38,6 +38,7 @@ aliases {
                spi1 = &blsp1_spi2;
                i2c0 = &blsp1_i2c3;
                i2c1 = &blsp1_i2c4;
+               ethernet0 = &gmac;
        };
 
        cpus {
@@ -591,6 +592,49 @@ wifi1: wifi@a800000 {
                        status = "disabled";
                };
 
+               gmac: ethernet@c080000 {
+                       compatible = "qcom,ipq4019-ess-edma";
+                       reg = <0xc080000 0x8000>;
+                       resets = <&gcc ESS_RESET>;
+                       reset-names = "ess";
+                       clocks = <&gcc GCC_ESS_CLK>;
+                       clock-names = "ess";
+                       interrupts = <GIC_SPI  65 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  66 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  67 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  68 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  69 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  70 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  71 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  72 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  73 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  74 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  75 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  76 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  77 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  78 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  79 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI  80 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 240 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 241 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 242 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 243 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 244 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 245 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 246 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>,

arch/arm/boot/dts/qcom-ipq4019.dtsi wifi1: wifi@a800000 { · line 635

Quoted 10 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +10 -0
+                                    <GIC_SPI 248 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 249 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 250 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 251 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 252 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 253 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 254 IRQ_TYPE_EDGE_RISING>,
+                                    <GIC_SPI 255 IRQ_TYPE_EDGE_RISING>;
+                       phy-mode = "internal";
+                       status = "disabled";

The fixed-link should be defined here AFAIK, otherwise it will fail probing with just internal PHY mode.

Regards,
Robert

Quoted 8 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -1
+               };
+
                mdio: mdio@90000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
--

2.37.3

Signature · 7 lines
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: [email protected]
Web: www.sartura.hr
#12 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 5 lines · Robert Marko

arch/arm/boot/dts/qcom-ipq4019.dtsi wifi1: wifi@a800000 { · line 635

Quoted 2 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -0
+                       phy-mode = "internal";
+                       status = "disabled";

The fixed-link should be defined here AFAIK, otherwise it will fail probing with just internal PHY mode.

It wouldn't fail to probe because it has status = "disabled" by default, and who enables that would also provide the fixed-link presumably. But if the speed of the pseudo-MAC that goes to the switch is not board specific, indeed the fixed-link belongs to the SoC dtsi.

#13 lore raw

Re: [PATCH net-next v7 5/5] ARM: dts: qcom: ipq4019: Add description for the IPQESS Ethernet controller

Quoted 5 lines · Vladimir Oltean
Quoted 3 lines · Robert Marko
Quoted 2 lines
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -0
+                       phy-mode = "internal";
+                       status = "disabled";
Quoted 7 lines
Quoted 2 lines

The fixed-link should be defined here AFAIK, otherwise it will fail probing with just internal PHY mode.

It wouldn't fail to probe because it has status = "disabled" by default, and who enables that would also provide the fixed-link presumably. But if the speed of the pseudo-MAC that goes to the switch is not board specific, indeed the fixed-link belongs to the SoC dtsi.

Yes, its directly connected to the switch CPU port and its a part of the SoC, so it should be defined in the SoC DTSI as it cannot really be changed on boards.

Regards,
Robert

Signature · 12 lines
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: [email protected]
Web: www.sartura.hr

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel