mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v4 0/8] net: dsa: Add support for SoC-e Ethernet switch IP cores
@ 2026-11-05 14:16 Vasilij Strassheim
  2026-11-05 14:16 ` [PATCH net-next v4 1/8] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Vasilij Strassheim @ 2026-11-05 14:16 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Lunn,
	Vladimir Oltean, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Russell King, Andrew Lunn, Heiner Kallweit,
	Eric Dumazet, Lee Jones, Eric Dumazet
  Cc: Vasilij Strassheim, devicetree, linux-kernel, netdev, mfd,
	Martin Kaistra, Benedikt Spranger, Krzysztof Kozlowski

Add support for SoC-e Ethernet switch IP cores implemented in FPGAs.

The series introduces the SoC-e vendor prefix and Device Tree bindings,
an MFD parent driver, an EtherType-based SDSA tagger, an MDIO controller
driver, and a DSA switch driver.

The drivers use a memory-mapped control interface. The MFD parent
validates the core version and instantiates the child devices. The
switch driver reads the licensed and implemented port counts and
detects optional hardware features. Implemented port counts from 3
through 31 are supported.

The driver configures the hardware DSA feature to isolate user ports
from each other and restrict them to exchanging frames with the CPU
port. Bridge forwarding is handled in software by the Linux bridge.
Hardware STP offload is not implemented. The driver disables the
hardware STP feature when present, leaving STP state handling to the
Linux bridge.

Supported port interfaces are MII, GMII, RMII, and RGMII. On cores
synthesized with Port VLAN support, the driver programs VLAN membership
tables. Bridge VLAN filtering is not offloaded.

On cores synthesized without Port VLAN support, VLAN information is
lost when frames enter the switch through the CPU port and is not
preserved in the SDSA header. The driver therefore rejects direct VLAN
uppers on such cores. VLAN-aware software bridging is also unsupported
on these cores.

External MDIO outputs are exposed as separate logical MDIO buses sharing
the integrated MDIO controller. The controller supports Clause 22 and
Clause 45 transactions. The generic MMIO MDIO mux selects the external
bus through the upper halfword of the shared control register, while
the controller accesses the lower halfword.

The drivers were tested with a SoC-e MRS 25.01 IP core on a Xilinx
ZynqMP platform. The tested core was synthesized with three ports, DSA,
IEEE 802.1w RSTP, hybrid SVL/IVL MAC tables, port-based VLAN support,
QoS priorities, and statistics counters.

VLAN TX testing exercised in-band C-tags. TX VLAN offload is disabled
and cannot be enabled on this platform, so the accelerated SDSA-TCI TX
path was not tested.

Signed-off-by: Vasilij Strassheim <v.strassheim@linutronix.de>
---
Changes in v4:
- Rebase onto net-next/main.
- Introduce an MFD parent for core version validation and DT-based
  child-device creation. Keep feature detection and switch register
  mapping in the DSA driver. (Andrew)
- Split the combined switch binding into MFD-parent and switch-function
  bindings. Use soce,swip for the parent and
  soce,swip-switch-00-04-0c-10 for the switch function.
- Reference dsa.yaml#/$defs/ethernet-ports and remove the redundant
  local DSA port schema reference and property closure. (Rob)
- Update description for swip-switch-00-04-0c-10 compatible. (Rob,
  Andrew)
- Rename the MDIO compatible to soce,swip-mdio and update the examples.
- Move the switch driver directly into drivers/net/dsa/, rename it
  to soce-swip.c, and remove its subdirectory Kconfig and Makefile.
- Rename the DSA and MDIO Kconfig symbols to NET_DSA_SOCE_SWIP and
  MDIO_SOCE_SWIP. Make the MFD and MDIO options internal and select
  them from NET_DSA_SOCE_SWIP.
- Reserve and map switch register blocks separately instead of
  claiming the entire IP-core window, and validate their ranges
  against the parent resource.
- Restrict the MDIO control resource to its lower 16-bit halfword.
  Use readw_poll_timeout() and writew() instead of 32-bit
  read-modify-write accesses, leaving the mux selector untouched.
  (Andrew, sashiko-bot)
- Replace the MDIO mapping helper with named platform resource mappings
  and propagate mapping errors through IS_ERR()/PTR_ERR().
- Report feature-detection failures with dev_err_probe() and use
  explicit masks and FIELD_GET() for version extraction. (Andrew)
- Advertise half-duplex capabilities for RMII and RGMII in phylink.
- Disable all user ports during setup before configuring VLANs,
  disabling hardware STP, and enabling tagging. (sashiko-bot)
- Remove the unreachable bridge VLAN-filtering callback and associated
  PVID and untagged-mask tracking. Keep hardware ports VLAN-unaware
  with ingress filtering disabled. (sashiko-bot)
- Program standalone VLAN 1 membership explicitly and preserve it
  when explicit VLAN membership is removed. Explicit membership takes
  precedence over default untagging. (sashiko-bot)
- Wait for both VLAN WRITE bits to clear before changing the shared
  VID selector or data registers. On programming failure, restore
  the software shadow, attempt hardware rollback, log rollback
  failures, and return the original error. (sashiko-bot)
- Clear the VLAN membership shadow after a successful setup reset.
- Handle VID 0 before checking hardware VLAN support in both callbacks.
  Return -EINVAL for unsupported non-zero VID additions. (sashiko-bot)
- Set needs_standalone_vlan_filtering only when Port VLAN is present.
  Reject direct VLAN uppers otherwise through port_prechangeupper,
  while retaining software-bridge support.
- Rename vlan_lock to feature_lock, initialize it independently of
  VLAN support, and remove unnecessary setup locking. (Andrew)
- Push accelerated non-802.1Q VLAN tags in-band before inserting
  SDSA, and handle allocation failure. (sashiko-bot)
- Include linux/bitfield.h explicitly in the SDSA tagger and document
  the duplicated VLAN TCI in received frames.
- Replace SKB_DROP_REASON_HDR_TRUNC with the reason returned by
  pskb_may_pull_reason(), following API change in net-next.

- Link to v3: https://patch.msgid.link/20260923-devel-vstrassheim-soce-dsa-ml-v3-0-ddebafcb9ba7@linutronix.de

Changes in v3:
- Rebase onto net-next/main and update tag protocol number in dsa.h
- Drop the deprecated ports and port@ node names and keep only
  ethernet-ports and ethernet-port@ in the binding.
- Drop labels from the switch binding example.
- Rename the MDIO master to MDIO controller.
- New Patches 2 and 5: Move the integrated MDIO controller into a
  separate driver and add the corresponding binding, Kconfig entry, and
  build integration.
- Switch from internal MDIO multiplexing to the generic MMIO MDIO mux
  framework for selecting the synthesized external MDIO buses.
- Check that the MDIO controller is idle before programming a
  transaction and wait for completion afterward.
- Replace MDIO magic values and resource indices with named definitions.
- Reduce MDIO timeout from 1s to more reasonable 1ms.
- Remove inline declarations and unnecessary checks from the remaining
  MDIO code.
- Use mdio-mux-mmioreg for the 11-bit MDIO bus selector at bits 26:16
  and access it through the upper 16-bit half of the shared control
  register.
- Update the switch binding to describe the MDIO controller, generic
  MMIO mux, child buses, and PHY references.
- Remove struct soce_probe_desc, since only one register layout is
  supported.
- Reject configurations with fewer than three implemented ports.
- Add port enable and disable callbacks to prevent unmanaged forwarding
  after driver unbind or module removal.
- Disable tagging during teardown.
- Rename and regroup register field macros to identify their associated
  registers.
- Remove obsolete and irrelevant comments.
- Add new comments for proper documentation and clarity.
- Switch to dev_err_probe() to improve probe error reporting.
- Embed struct dsa_switch in struct soce_priv instead of allocating it
  separately.
- Remove the trailing comma after the sentinel entry in the match table.

Follow-up validation and feature work using a new IP core:
- New patch 7: Add basic VLAN hardware offload through
  port_vlan_filtering, port_vlan_add, and port_vlan_del.
- Warn when the Port VLAN feature is unavailable and reject VLAN
  configuration with netlink extended acknowledgements.
- Reset VLAN offloading configuration during teardown.
- New patch 8: Disable STP offloading, which is not supported by the
  initial driver.
- Improvements in SDSA tag handling:
  - Add specific skb drop reasons for malformed SDSA frames.
  - Restore VLAN metadata from the SDSA tag on receive and encode skb
    VLAN metadata into the SDSA tag on transmit.

- Link to v2: https://patch.msgid.link/20260903-devel-vstrassheim-soce-dsa-ml-v2-0-fb0587cb466b@linutronix.de

Changes in v2:
- Correctly use net-next prefix
- Rework the binding into a single MMIO-based switch node
- Model hardware MDIO outputs as separate logical MDIO buses
- Detect the switch version, features, and port count from hardware
- Drop incomplete STP, bridge, and FDB offloading
- Derive phylink capabilities from each port's phy-mode
- Harden MDIO access and SDSA receive validation
- Address binding, naming, and coding style review comments

Link to v1: https://patch.msgid.link/20260729-devel-vstrassheim-soce-dsa-ml-v1-0-be569dae1b20@linutronix.de

To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <olteanv@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
To: Eric Dumazet <edumazet@google.com>
To: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
To: Vasilij Strassheim <v.strassheim@linutronix.de>
To: Simon Horman <horms@kernel.org>
To: Russell King <linux@armlinux.org.uk>
To: Andrew Lunn <andrew+netdev@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
To: Eric Dumazet <edumazet@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: mfd@lists.linux.dev
Cc: Martin Kaistra <martin.kaistra@linutronix.de>
Cc: Benedikt Spranger <b.spranger@linutronix.de>

---
Vasilij Strassheim (8):
      dt-bindings: vendor-prefixes: Add soce
      dt-bindings: net: Add SoC-e SWIP MDIO controller
      dt-bindings: net: dsa: Add SoC-e SWIP switch function
      dt-bindings: mfd: Add SoC-e SWIP parent
      net: dsa: Add tag handling for SoC-e switches
      net: mdio: Add SoC-e SWIP MDIO controller driver
      net: dsa: soce: Add basic support for SoC-e switch IP cores
      net: dsa: soce: Add VLAN membership table support

 .../devicetree/bindings/mfd/soce,swip.yaml         | 137 ++++
 .../bindings/net/dsa/soce,swip-switch.yaml         |  96 +++
 .../devicetree/bindings/net/soce,swip-mdio.yaml    |  47 ++
 .../devicetree/bindings/vendor-prefixes.yaml       |   2 +
 drivers/mfd/Kconfig                                |   9 +
 drivers/mfd/Makefile                               |   2 +
 drivers/mfd/soce-swip-core.c                       |  76 +++
 drivers/net/dsa/Kconfig                            |  15 +
 drivers/net/dsa/Makefile                           |   1 +
 drivers/net/dsa/soce-swip.c                        | 717 +++++++++++++++++++++
 drivers/net/dsa/soce-swip.h                        |  39 ++
 drivers/net/mdio/Kconfig                           |  10 +
 drivers/net/mdio/Makefile                          |   1 +
 drivers/net/mdio/mdio-soce.c                       | 213 ++++++
 include/net/dsa.h                                  |   2 +
 net/dsa/Kconfig                                    |   6 +
 net/dsa/Makefile                                   |   1 +
 net/dsa/tag_sdsa.c                                 | 168 +++++
 18 files changed, 1542 insertions(+)
---
base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
change-id: 20260729-devel-vstrassheim-soce-dsa-ml-20d6a5adb838

Best regards,
--  
Vasilij Strassheim <v.strassheim@linutronix.de>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-10 16:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 14:16 [PATCH net-next v4 0/8] net: dsa: Add support for SoC-e Ethernet switch IP cores Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 1/8] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 2/8] dt-bindings: net: Add SoC-e SWIP MDIO controller Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 3/8] dt-bindings: net: dsa: Add SoC-e SWIP switch function Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 4/8] dt-bindings: mfd: Add SoC-e SWIP parent Vasilij Strassheim
2026-11-06 11:13   ` Krzysztof Kozlowski
2026-11-06 21:51     ` Vasilij Strassheim
2026-11-10 16:10       ` Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 5/8] net: dsa: Add tag handling for SoC-e switches Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 6/8] net: mdio: Add SoC-e SWIP MDIO controller driver Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 7/8] net: dsa: soce: Add basic support for SoC-e switch IP cores Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 8/8] net: dsa: soce: Add VLAN membership table support Vasilij Strassheim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®