mbox series

[RFC,net-next,0/3] net: marvell: prestera: Add Switchdev driver for Prestera family ASIC device 98DX326x (AC3x)

Message ID 20200225163025.9430-1-vadym.kochan@plvision.eu
Headers show
Series net: marvell: prestera: Add Switchdev driver for Prestera family ASIC device 98DX326x (AC3x) | expand

Message

Vadym Kochan Feb. 25, 2020, 4:30 p.m. UTC
Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
wireless SMB deployment.

Prestera Switchdev is a firmware based driver which operates via PCI
bus. The driver is split into 2 modules:

    - prestera_sw.ko - main generic Switchdev Prestera ASIC related logic.

    - prestera_pci.ko - bus specific code which also implements firmware
                        loading and low-level messaging protocol between
                        firmware and the switchdev driver.

This driver implementation includes only L1 & basic L2 support.

The core Prestera switching logic is implemented in prestera.c, there is
an intermediate hw layer between core logic and firmware. It is
implemented in prestera_hw.c, the purpose of it is to encapsulate hw
related logic, in future there is a plan to support more devices with
different HW related configurations.

The firmware has to be loaded each time device is reset. The driver is
loading it from:

    /lib/firmware/marvell/prestera_fw_img.bin

The firmware image version is located within internal header and consists
of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has hard-coded
minimum supported firmware version which it can work with:

    MAJOR - reflects the support on ABI level between driver and loaded
            firmware, this number should be the same for driver and
            loaded firmware.

    MINOR - this is the minimal supported version between driver and the
            firmware.

    PATCH - indicates only fixes, firmware ABI is not changed.

The firmware image will be submitted to the linux-firmware after the
driver is accepted.

The following Switchdev features are supported:

    - VLAN-aware bridge offloading
    - VLAN-unaware bridge offloading
    - FDB offloading (learning, ageing)
    - Switchport configuration

CPU RX/TX support will be provided in the next contribution.

Vadym Kochan (3):
  net: marvell: prestera: Add Switchdev driver for Prestera family ASIC
    device 98DX325x (AC3x)
  net: marvell: prestera: Add PCI interface support
  dt-bindings: marvell,prestera: Add address mapping for Prestera
    Switchdev PCIe driver

 .../bindings/net/marvell,prestera.txt         |   13 +
 drivers/net/ethernet/marvell/Kconfig          |    1 +
 drivers/net/ethernet/marvell/Makefile         |    1 +
 drivers/net/ethernet/marvell/prestera/Kconfig |   24 +
 .../net/ethernet/marvell/prestera/Makefile    |    5 +
 .../net/ethernet/marvell/prestera/prestera.c  | 1502 +++++++++++++++++
 .../net/ethernet/marvell/prestera/prestera.h  |  244 +++
 .../marvell/prestera/prestera_drv_ver.h       |   23 +
 .../ethernet/marvell/prestera/prestera_hw.c   | 1094 ++++++++++++
 .../ethernet/marvell/prestera/prestera_hw.h   |  159 ++
 .../ethernet/marvell/prestera/prestera_pci.c  |  840 +++++++++
 .../marvell/prestera/prestera_switchdev.c     | 1217 +++++++++++++
 12 files changed, 5123 insertions(+)
 create mode 100644 drivers/net/ethernet/marvell/prestera/Kconfig
 create mode 100644 drivers/net/ethernet/marvell/prestera/Makefile
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.c
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.h
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_drv_ver.h
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.c
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.h
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_pci.c
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c

Comments

Andrew Lunn Feb. 25, 2020, 10:12 p.m. UTC | #1
> CPU RX/TX support will be provided in the next contribution.

Hi Vadym

This is a core feature which needs to be in the first version merged
into the kernel. Basically, the driver first needs to offer 24
individual interfaces which can send and receive packets. The Linux
stack does everything else. You then add offloads, like bridges,
vlans, etc, allowing the hardware to accelerate what Linux is doing.

	Andrew
Chris Packham Feb. 25, 2020, 10:45 p.m. UTC | #2
Hi Vadym,

On Tue, 2020-02-25 at 16:30 +0000, Vadym Kochan wrote:
> Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
> ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
> wireless SMB deployment.
> 
> Prestera Switchdev is a firmware based driver which operates via PCI
> bus. The driver is split into 2 modules:
> 
>     - prestera_sw.ko - main generic Switchdev Prestera ASIC related logic.
> 
>     - prestera_pci.ko - bus specific code which also implements firmware
>                         loading and low-level messaging protocol between
>                         firmware and the switchdev driver.
> 
> This driver implementation includes only L1 & basic L2 support.
> 
> The core Prestera switching logic is implemented in prestera.c, there is
> an intermediate hw layer between core logic and firmware. It is
> implemented in prestera_hw.c, the purpose of it is to encapsulate hw
> related logic, in future there is a plan to support more devices with
> different HW related configurations.

Very excited by this patch series. We have some custom designs using
the AC3x. I'm in the process of getting the board dtses ready for
submitting upstream. 

Please feel free to add me to the Cc list for future versions of this
patch set (and releated ones).

I'll also look to see what we can do to test on our hardware platforms.

> 
> The firmware has to be loaded each time device is reset. The driver is
> loading it from:
> 
>     /lib/firmware/marvell/prestera_fw_img.bin
> 
> The firmware image version is located within internal header and consists
> of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has hard-coded
> minimum supported firmware version which it can work with:
> 
>     MAJOR - reflects the support on ABI level between driver and loaded
>             firmware, this number should be the same for driver and
>             loaded firmware.
> 
>     MINOR - this is the minimal supported version between driver and the
>             firmware.
> 
>     PATCH - indicates only fixes, firmware ABI is not changed.
> 
> The firmware image will be submitted to the linux-firmware after the
> driver is accepted.
> 
> The following Switchdev features are supported:
> 
>     - VLAN-aware bridge offloading
>     - VLAN-unaware bridge offloading
>     - FDB offloading (learning, ageing)
>     - Switchport configuration
> 
> CPU RX/TX support will be provided in the next contribution.
> 
> Vadym Kochan (3):
>   net: marvell: prestera: Add Switchdev driver for Prestera family ASIC
>     device 98DX325x (AC3x)
>   net: marvell: prestera: Add PCI interface support
>   dt-bindings: marvell,prestera: Add address mapping for Prestera
>     Switchdev PCIe driver
> 
>  .../bindings/net/marvell,prestera.txt         |   13 +
>  drivers/net/ethernet/marvell/Kconfig          |    1 +
>  drivers/net/ethernet/marvell/Makefile         |    1 +
>  drivers/net/ethernet/marvell/prestera/Kconfig |   24 +
>  .../net/ethernet/marvell/prestera/Makefile    |    5 +
>  .../net/ethernet/marvell/prestera/prestera.c  | 1502 +++++++++++++++++
>  .../net/ethernet/marvell/prestera/prestera.h  |  244 +++
>  .../marvell/prestera/prestera_drv_ver.h       |   23 +
>  .../ethernet/marvell/prestera/prestera_hw.c   | 1094 ++++++++++++
>  .../ethernet/marvell/prestera/prestera_hw.h   |  159 ++
>  .../ethernet/marvell/prestera/prestera_pci.c  |  840 +++++++++
>  .../marvell/prestera/prestera_switchdev.c     | 1217 +++++++++++++
>  12 files changed, 5123 insertions(+)
>  create mode 100644 drivers/net/ethernet/marvell/prestera/Kconfig
>  create mode 100644 drivers/net/ethernet/marvell/prestera/Makefile
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.c
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.h
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_drv_ver.h
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.c
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.h
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_pci.c
>  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
>
Jiri Pirko Feb. 26, 2020, 3:44 p.m. UTC | #3
Tue, Feb 25, 2020 at 05:30:52PM CET, vadym.kochan@plvision.eu wrote:
>Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
>ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
>wireless SMB deployment.
>
>Prestera Switchdev is a firmware based driver which operates via PCI
>bus. The driver is split into 2 modules:
>
>    - prestera_sw.ko - main generic Switchdev Prestera ASIC related logic.
>
>    - prestera_pci.ko - bus specific code which also implements firmware

It is unusual to see ".ko" in patchset cover letter...


>                        loading and low-level messaging protocol between
>                        firmware and the switchdev driver.
>
>This driver implementation includes only L1 & basic L2 support.
>
>The core Prestera switching logic is implemented in prestera.c, there is
>an intermediate hw layer between core logic and firmware. It is
>implemented in prestera_hw.c, the purpose of it is to encapsulate hw
>related logic, in future there is a plan to support more devices with
>different HW related configurations.
>
>The firmware has to be loaded each time device is reset. The driver is
>loading it from:
>
>    /lib/firmware/marvell/prestera_fw_img.bin
>
>The firmware image version is located within internal header and consists
>of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has hard-coded
>minimum supported firmware version which it can work with:
>
>    MAJOR - reflects the support on ABI level between driver and loaded
>            firmware, this number should be the same for driver and
>            loaded firmware.
>
>    MINOR - this is the minimal supported version between driver and the
>            firmware.
>
>    PATCH - indicates only fixes, firmware ABI is not changed.
>

It is usual that the file name contains a version. I think it is
good to make sure you are loading the version your driver is compatible
with. There could be multiple versions for multiple kernels.


>The firmware image will be submitted to the linux-firmware after the
>driver is accepted.

Hmm, not sure how this works, shouldn't it be submitted there first?



>
>The following Switchdev features are supported:

You don't need to mention "Switchdev". It is just a offloading layer for
bridge. Does not mean anything else now...


>
>    - VLAN-aware bridge offloading
>    - VLAN-unaware bridge offloading
>    - FDB offloading (learning, ageing)
>    - Switchport configuration
>
>CPU RX/TX support will be provided in the next contribution.
>
>Vadym Kochan (3):
>  net: marvell: prestera: Add Switchdev driver for Prestera family ASIC
>    device 98DX325x (AC3x)
>  net: marvell: prestera: Add PCI interface support
>  dt-bindings: marvell,prestera: Add address mapping for Prestera
>    Switchdev PCIe driver
>
> .../bindings/net/marvell,prestera.txt         |   13 +
> drivers/net/ethernet/marvell/Kconfig          |    1 +
> drivers/net/ethernet/marvell/Makefile         |    1 +
> drivers/net/ethernet/marvell/prestera/Kconfig |   24 +
> .../net/ethernet/marvell/prestera/Makefile    |    5 +
> .../net/ethernet/marvell/prestera/prestera.c  | 1502 +++++++++++++++++
> .../net/ethernet/marvell/prestera/prestera.h  |  244 +++
> .../marvell/prestera/prestera_drv_ver.h       |   23 +
> .../ethernet/marvell/prestera/prestera_hw.c   | 1094 ++++++++++++
> .../ethernet/marvell/prestera/prestera_hw.h   |  159 ++
> .../ethernet/marvell/prestera/prestera_pci.c  |  840 +++++++++
> .../marvell/prestera/prestera_switchdev.c     | 1217 +++++++++++++
> 12 files changed, 5123 insertions(+)
> create mode 100644 drivers/net/ethernet/marvell/prestera/Kconfig
> create mode 100644 drivers/net/ethernet/marvell/prestera/Makefile
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.c
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.h
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_drv_ver.h
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.c
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.h
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_pci.c
> create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
>
>-- 
>2.17.1
>
Roopa Prabhu Feb. 26, 2020, 4:38 p.m. UTC | #4
On Tue, Feb 25, 2020 at 8:31 AM Vadym Kochan <vadym.kochan@plvision.eu> wrote:
>
> Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
> ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
> wireless SMB deployment.
>
> Prestera Switchdev is a firmware based driver which operates via PCI
> bus. The driver is split into 2 modules:
>
>     - prestera_sw.ko - main generic Switchdev Prestera ASIC related logic.
>
>     - prestera_pci.ko - bus specific code which also implements firmware
>                         loading and low-level messaging protocol between
>                         firmware and the switchdev driver.
>
> This driver implementation includes only L1 & basic L2 support.
>
> The core Prestera switching logic is implemented in prestera.c, there is
> an intermediate hw layer between core logic and firmware. It is
> implemented in prestera_hw.c, the purpose of it is to encapsulate hw
> related logic, in future there is a plan to support more devices with
> different HW related configurations.
>
> The firmware has to be loaded each time device is reset. The driver is
> loading it from:
>
>     /lib/firmware/marvell/prestera_fw_img.bin
>
> The firmware image version is located within internal header and consists
> of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has hard-coded
> minimum supported firmware version which it can work with:
>
>     MAJOR - reflects the support on ABI level between driver and loaded
>             firmware, this number should be the same for driver and
>             loaded firmware.
>
>     MINOR - this is the minimal supported version between driver and the
>             firmware.
>
>     PATCH - indicates only fixes, firmware ABI is not changed.
>
> The firmware image will be submitted to the linux-firmware after the
> driver is accepted.
>
> The following Switchdev features are supported:
>
>     - VLAN-aware bridge offloading
>     - VLAN-unaware bridge offloading
>     - FDB offloading (learning, ageing)
>     - Switchport configuration
>
> CPU RX/TX support will be provided in the next contribution.
>
> Vadym Kochan (3):
>   net: marvell: prestera: Add Switchdev driver for Prestera family ASIC
>     device 98DX325x (AC3x)
>   net: marvell: prestera: Add PCI interface support
>   dt-bindings: marvell,prestera: Add address mapping for Prestera
>     Switchdev PCIe driver
>

Have not looked at the patches yet, but very excited to see another
switchdev driver making it into the kernel!.

Thanks Marvell!.
Vadym Kochan Feb. 28, 2020, 4:50 p.m. UTC | #5
Hi Chris,

On Tue, Feb 25, 2020 at 10:45:09PM +0000, Chris Packham wrote:
> Hi Vadym,
> 
> On Tue, 2020-02-25 at 16:30 +0000, Vadym Kochan wrote:
> > Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
> > ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
> > wireless SMB deployment.
> > 
> > Prestera Switchdev is a firmware based driver which operates via PCI
> > bus. The driver is split into 2 modules:
> > 
> >     - prestera_sw.ko - main generic Switchdev Prestera ASIC related logic.
> > 
> >     - prestera_pci.ko - bus specific code which also implements firmware
> >                         loading and low-level messaging protocol between
> >                         firmware and the switchdev driver.
> > 
> > This driver implementation includes only L1 & basic L2 support.
> > 
> > The core Prestera switching logic is implemented in prestera.c, there is
> > an intermediate hw layer between core logic and firmware. It is
> > implemented in prestera_hw.c, the purpose of it is to encapsulate hw
> > related logic, in future there is a plan to support more devices with
> > different HW related configurations.
> 
> Very excited by this patch series. We have some custom designs using
> the AC3x. I'm in the process of getting the board dtses ready for
> submitting upstream. 
> 
> Please feel free to add me to the Cc list for future versions of this
> patch set (and releated ones).
> 
> I'll also look to see what we can do to test on our hardware platforms.
> 

Sure. I will add you to CC's list. Please note that you need to make
sure that your board design follows Marvell Design Guide for switchdev
solution.

> > 
> > The firmware has to be loaded each time device is reset. The driver is
> > loading it from:
> > 
> >     /lib/firmware/marvell/prestera_fw_img.bin
> > 
> > The firmware image version is located within internal header and consists
> > of 3 numbers - MAJOR.MINOR.PATCH. Additionally, driver has hard-coded
> > minimum supported firmware version which it can work with:
> > 
> >     MAJOR - reflects the support on ABI level between driver and loaded
> >             firmware, this number should be the same for driver and
> >             loaded firmware.
> > 
> >     MINOR - this is the minimal supported version between driver and the
> >             firmware.
> > 
> >     PATCH - indicates only fixes, firmware ABI is not changed.
> > 
> > The firmware image will be submitted to the linux-firmware after the
> > driver is accepted.
> > 
> > The following Switchdev features are supported:
> > 
> >     - VLAN-aware bridge offloading
> >     - VLAN-unaware bridge offloading
> >     - FDB offloading (learning, ageing)
> >     - Switchport configuration
> > 
> > CPU RX/TX support will be provided in the next contribution.
> > 
> > Vadym Kochan (3):
> >   net: marvell: prestera: Add Switchdev driver for Prestera family ASIC
> >     device 98DX325x (AC3x)
> >   net: marvell: prestera: Add PCI interface support
> >   dt-bindings: marvell,prestera: Add address mapping for Prestera
> >     Switchdev PCIe driver
> > 
> >  .../bindings/net/marvell,prestera.txt         |   13 +
> >  drivers/net/ethernet/marvell/Kconfig          |    1 +
> >  drivers/net/ethernet/marvell/Makefile         |    1 +
> >  drivers/net/ethernet/marvell/prestera/Kconfig |   24 +
> >  .../net/ethernet/marvell/prestera/Makefile    |    5 +
> >  .../net/ethernet/marvell/prestera/prestera.c  | 1502 +++++++++++++++++
> >  .../net/ethernet/marvell/prestera/prestera.h  |  244 +++
> >  .../marvell/prestera/prestera_drv_ver.h       |   23 +
> >  .../ethernet/marvell/prestera/prestera_hw.c   | 1094 ++++++++++++
> >  .../ethernet/marvell/prestera/prestera_hw.h   |  159 ++
> >  .../ethernet/marvell/prestera/prestera_pci.c  |  840 +++++++++
> >  .../marvell/prestera/prestera_switchdev.c     | 1217 +++++++++++++
> >  12 files changed, 5123 insertions(+)
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/Kconfig
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/Makefile
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.c
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera.h
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_drv_ver.h
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.c
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_hw.h
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_pci.c
> >  create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
> > 

Regards,
Vadym Kochan
Ido Schimmel March 5, 2020, 3:01 p.m. UTC | #6
On Tue, Feb 25, 2020 at 04:30:52PM +0000, Vadym Kochan wrote:
> Marvell Prestera 98DX326x integrates up to 24 ports of 1GbE with 8
> ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
> wireless SMB deployment.

It seems that this device has enough ports to loopback to each other in
order to create meaningful topologies. Therefore, I suggest running
relevant existing tests under tools/testing/selftests/net/forwarding/
and contributing new ones. See tools/testing/selftests/net/forwarding/README
for details.

One problem you will run into is that your netdev notifier only allows
bridge uppers and will therefore veto VRF uppers, which is a
prerequisite. However, since you don't support L3 offload, then all
routed traffic should reach the CPU anyway and therefore VRF uppers can
be allowed.