[PATCH 0/5] Introduce DSA Ethernet switch class and Felix driver

Claudiu Manoil claudiu.manoil at nxp.com
Wed Jan 13 19:05:21 CET 2021


DSA stands for Distributed Switch Architecture and it is a subsystem
introduced in the Linux kernel to support switches that:
- have an Ethernet link up to the CPU
- use some form of tagging to identify the source/destination port for
  Rx/Tx
- may be cascaded in tree-like structures.

DSA is described in depth here:
https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt

This patch set introduces a DSA class in U-Boot to support drivers of DSA
switches.  DSA drivers have to implement the following ops:
- enable/disable of switch ports,
- insert a tag in frames being transmitted, used by the switch to select
  the egress port,
- parse a tag in frames being received, used for Rx traffic.

DSA class code deals with presentation of switch ports as Ethernet
interfaces, deals with the master Ethernet device for I/O and helps with
parsing of the DT assuming the structure follows the DSA kernel binding.

Support for switch cascading is not included yet.

In the sandbox environment, the DSA sandbox driver, the switch ports and
master eth interface look like this:
=> dm tree
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
[...]
 eth           4  [ + ]   eth_sandbox           |-- dsa-test-eth
 dsa           0  [ + ]   dsa_sandbox           |-- dsa-test
 eth           5  [ + ]   dsa-port              |   |-- lan0
 eth           6  [ + ]   dsa-port              |   `-- lan1

=> setenv ethact lan1
=> ping 1.2.3.5
Using lan1 device
host 1.2.3.5 is alive
=>

This patch set also introduces a driver for the Ethernet switch integrated
into NXP LS1028A, called Felix.  The switch has 4 front panel ports, I/O
to/from it is done though an ENETC Ethernet interface and meta-data is
carried between the switch and the driver though an additional header
pre-pended to the original frame.
Network commands like tftp can be used on these front panel ports.  The
ports are disabled unless used so they do not cause issues on network
topologies that include loops.

Felix as seen on LS1028A RDB:
=> dm tree
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
[...]
 dsa           0  [ + ]   felix-switch          |   |-- felix-switch
 eth           4  [ + ]   dsa-port              |   |   |-- swp0
 eth           5  [ + ]   dsa-port              |   |   |-- swp1
 eth           6  [ + ]   dsa-port              |   |   |-- swp2
 eth           7  [ + ]   dsa-port              |   |   `-- swp3

=> mdio list
[...]
10 - Vitesse VSC8514 <--> swp0
11 - Vitesse VSC8514 <--> swp1
12 - Vitesse VSC8514 <--> swp2
13 - Vitesse VSC8514 <--> swp3

NOTE:
This patchset is a major rework of the dsa-class code since the last
submission from May 5th:
https://patchwork.ozlabs.org/project/uboot/cover/1588700588-8587-1-git-send-email-claudiu.manoil@nxp.com/
The basic concepts and data path operation (tagging) in the DSA class
code remain the same as in the initial patchset from Alex, however the
external API has been changed significantly (simplified), the driver
model integration has been improved to the point that the DSA class
code no longer needs to allocate extra memory internally (via malloc),
reduced memory footprint, internal state data moved from the external
API and internalized, cleaner external API, internal code reworked,
completly reworked DSA sandbox driver and unit tests for better coverage
and to integrate better with the eth sandbox driver and tests, etc.
The DSA class code is now ported on top of the latest u-boot master
branch (obviously), and I tested it thoroughly with the sandbox driver
and unit tests.  The felix driver has been tested with an older uboot,
since there are some issues booting the latest upstream uboot on a
LS1028A RDB board.  Note that the felix driver itself didn't change
since the last submission, except for the DSA API function calls.

Alex Marginean (3):
  drivers: net: Add Felix DSA switch driver
  arm: dts: ls1028a: Add Ethernet switch node and dependencies
  configs: ls1028a: Enable the Ethernet switch driver in defconfig

Claudiu Manoil (2):
  net: Introduce DSA class for Ethernet switches
  sandbox: Add a DSA sandbox driver and unit test

 arch/Kconfig                                 |   1 +
 arch/arm/dts/fsl-ls1028a-rdb.dts             |  36 ++
 arch/arm/dts/fsl-ls1028a.dtsi                |  55 +-
 arch/sandbox/dts/test.dts                    |  40 ++
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig |   2 +
 configs/ls1028aqds_tfa_defconfig             |   2 +
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig |   2 +
 configs/ls1028ardb_tfa_defconfig             |   2 +
 drivers/net/Kconfig                          |  23 +
 drivers/net/Makefile                         |   1 +
 drivers/net/dsa_sandbox.c                    | 181 +++++++
 drivers/net/fsl_enetc.h                      |   5 +
 drivers/net/mscc_eswitch/Kconfig             |   8 +
 drivers/net/mscc_eswitch/Makefile            |   1 +
 drivers/net/mscc_eswitch/felix_switch.c      | 432 ++++++++++++++++
 include/configs/sandbox.h                    |   2 +
 include/dm/uclass-id.h                       |   1 +
 include/net.h                                |   6 +
 include/net/dsa.h                            | 206 ++++++++
 net/Makefile                                 |   1 +
 net/dsa-uclass.c                             | 517 +++++++++++++++++++
 test/dm/Makefile                             |   1 +
 test/dm/dsa.c                                |  91 ++++
 test/dm/eth.c                                |  10 +-
 24 files changed, 1620 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/dsa_sandbox.c
 create mode 100644 drivers/net/mscc_eswitch/felix_switch.c
 create mode 100644 include/net/dsa.h
 create mode 100644 net/dsa-uclass.c
 create mode 100644 test/dm/dsa.c

-- 
2.17.1



More information about the U-Boot mailing list