Re: [OpenWrt-Devel] [PATCH v3 0/6] staging: Introduce DPAA2 Ethernet Switch driver

From: Florian Fainelli
Date: Sat Oct 14 2017 - 18:11:25 EST


On October 14, 2017 2:59:22 PM PDT, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>On Sat, Oct 14, 2017 at 8:52 PM, Florian Fainelli
><f.fainelli@xxxxxxxxx> wrote:
>
>> The most deployed switch device drivers have been converted to DSA
>> already: b53, qca8k (ar83xx in OpenWrt/LEDE) and mtk7530 are all in
>> tree, and now we are getting new submissions from Michrochip to
>support
>> their pretty large KSZ series. Converting from swconfig to DSA is
>> actually quite simple, but like anything requires time and testing,
>and
>> access to hardware and ideally datasheet.
>
>Hm, I have a Realtek RB8366RB in this router on my desk.
>
>I guess that means I should just take the old switchdev-based
>SMI-driver and convert it to DSA.
>
>I bet I can do that :D

Yes, it really should not be too hard. The OpenWrt/LEDE driver had mostly the same semantics as what is needed for being a proper DSA driver. You should of course start simple: get basic switching working, then add statistics, VLAN, FDB, etc. OpenWrt/LEDE models switches as PHY device objects which would not work upstream so you should have the driver be probed as a MDIO/SPI/I2C (see b53 for example) and set up fixed-link properties between the CPU and the switch.

>
>Well, I will try. Because it's blocking me to work on the Gemini
>ethernet driver.

Well usually the boot loader may leave the switch in a good enough state that you can work on the CPU controller mostly independently from dealing with the switch. This is not universally true, and a properly working bootloader should actually quiesce/reset both blocks prior to OS control.

Don't hesitate if you have questions.

Cheers.

--
Florian