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

Alex Marginean alexandru.marginean at nxp.com
Tue Dec 3 15:56:39 CET 2019


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

>From the doc:

	Summarized, this is basically how DSA looks like from a network device
	perspective:


		    |---------------------------
		    | CPU network device (eth0)|
		    ----------------------------
		    | <tag added by switch     |
		    |                          |
		    |                          |
		    |        tag added by CPU> |
		|--------------------------------------------|
		| Switch driver				     |
		|--------------------------------------------|
		    ||        ||         ||
		|-------|  |-------|  |-------|
		| sw0p0 |  | sw0p1 |  | sw0p2 |
		|-------|  |-------|  |-------|

This patch set introduces a DSA class in U-Boot to support drivers of such
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.

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/fom 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

=> tftp 80000000 test
Using swp2 device
TFTP from server 192.168.100.1; our IP address is 192.168.100.100
Filename 'test'.
Load address: 0x80000000
Loading: #################################################################
         #################################################################
         ########################################################
         6.8 MiB/s
done
Bytes transferred = 949880 (e7e78 hex)

Changes in v3:
 - fix Felix platdata size
 - move include/dsa.h to include/net/dsa.h
 - updated TODO in dsa.h
 - other minor fixes

Changes in v2:
 - Don't use NULL PHY in Felix driver
 - guard dsa.h with #ifndef __DSA__H__, somehow I missed that in v1
 - added a TODO for setting master Eth in promiscuous mode
 - Minor fixes in patch descriptions, API comments
 - Added address/size-cells to LS1028A DT ports node

This patch set replaces v2:
https://patchwork.ozlabs.org/project/uboot/list/?series=144912
and depends on:
https://patchwork.ozlabs.org/project/uboot/list/?series=144907
https://patchwork.ozlabs.org/project/uboot/list/?series=142879

Alex Marginean (6):
  net: introduce DSA class for Ethernet switches
  drivers: net: add a DSA sandbox driver
  test: dm: add a simple unit test for DSA class
  drivers: net: add Felix DSA switch driver
  arm: dts: ls1028a: adds Ethernet switch node and its dependencies
  configs: ls1028a: enable the Ethernet switch driver in defconfig

 arch/Kconfig                                 |   1 +
 arch/arm/dts/fsl-ls1028a-rdb.dts             |  36 ++
 arch/arm/dts/fsl-ls1028a.dtsi                |  44 +-
 arch/sandbox/dts/test.dts                    |  49 ++
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig |   3 +-
 configs/ls1028aqds_tfa_defconfig             |   3 +-
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig |   3 +-
 configs/ls1028ardb_tfa_defconfig             |   3 +-
 drivers/net/Kconfig                          |  21 +
 drivers/net/Makefile                         |   1 +
 drivers/net/dsa_sandbox.c                    | 272 +++++++++++
 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      | 454 +++++++++++++++++++
 include/configs/sandbox.h                    |   4 +
 include/dm/uclass-id.h                       |   1 +
 include/dsa.h                                | 140 ++++++
 net/Makefile                                 |   1 +
 net/dsa-uclass.c                             | 369 +++++++++++++++
 test/dm/Makefile                             |   1 +
 test/dm/dsa.c                                |  58 +++
 test/dm/test-fdt.c                           |   2 +-
 23 files changed, 1474 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/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