mbox series

[v4,0/6] Introduce DSA Ethernet switch class and Felix driver

Message ID 1588700588-8587-1-git-send-email-claudiu.manoil@nxp.com
Headers show
Series Introduce DSA Ethernet switch class and Felix driver | expand

Message

Claudiu Manoil May 5, 2020, 5:43 p.m. UTC
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 v4:
 - fixed Rx buffer sizes to accomodate bigger packets, that are closer
   to the standard MTU size of 1500B. DSA needs extra room for tagging
   on top of the standard ethernet frame. Reserved a maximum overhead
   of 256B for DSA tagging, preserving the total packet size alignment.
 - addressed MAC addr propagation from DSA master eth port
   to the non-cpu switch ports for ports that don't have
   MAC addrs configured in the uboot env
 - added eth port aliases
 - fixed some in-band autoneg issues if nophy attached, in felix
 - dsa-uclass code cleanup
 - ls1028a defconfig cleanup
 - added missing device_compat.h (preventing build issues)
 - rebased on top of latest -net/master
 - updated copyright format and year

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                |  55 ++-
 arch/sandbox/dts/test.dts                    |  49 ++
 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                          |  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      | 456 +++++++++++++++++++
 include/configs/sandbox.h                    |   4 +
 include/dm/uclass-id.h                       |   1 +
 include/net.h                                |   6 +
 include/net/dsa.h                            | 137 ++++++
 net/Makefile                                 |   1 +
 net/dsa-uclass.c                             | 395 ++++++++++++++++
 test/dm/Makefile                             |   1 +
 test/dm/dsa.c                                |  58 +++
 test/dm/test-fdt.c                           |   2 +-
 24 files changed, 1516 insertions(+), 2 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

Comments

Claudiu Manoil May 29, 2020, 11:57 a.m. UTC | #1
>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Claudiu Manoil
>Sent: Tuesday, May 5, 2020 8:43 PM
>To: u-boot@lists.denx.de
>Cc: joe.hershberger@ni.com; Alexandru Marginean
><alexandru.marginean@nxp.com>; Vladimir Oltean
><vladimir.oltean@nxp.com>
>Subject: [PATCH v4 0/6] Introduce DSA Ethernet switch class and Felix driver
>

Hi Joe,
How long would it take to have these patches merged, considering that there
are no review comments so far?

Thanks,
Claudiu