RE: [PATCH 2/2] net: ethernet: Add driver for Sunplus SP7021
From: Wells Lu 呂芳騰
Date: Tue Nov 09 2021 - 12:05:19 EST
> > I don't know how to implement STP in L2 switch like SP7021.
>
> That is the nice thing about using Linux. It already knows how to implement
> STP. The bridge will do it for you. You just need to add the callbacks in the
> driver which are needed. Please take a look at other switchdev drivers.
>
> > If this is acceptable, I'd like to have Ethernet of SP7021 have two
> > operation
> > modes:
> > - Dual NIC mode
> > - Single NIC with 2-port frame-flooding hub mode
>
> No, sorry. Do it correctly, or do not do it. Please start with a clean driver doing
> Dual NIC mode. You can add L2 support later, once you have done the research
> to understand switchdev, etc.
Sorry, I will go with Dual NIC mode. I'll do a whole cleanup on driver for this.
Please kindly review again.
I need time to study more about switchdev and propose a plan to high
management of company. However, Sunplus is not a networking company,
but targets on Linux-based industrial control, autonomous mobile robot, ...
> > RMII pins of PHY ports of SP7021 are multiplexable. I'd like to switch
> > RMII pins of the second PHY for other use if single NIC mode is used.
> > In fact, some SP7021 boards have dual Ethernet and some have only one
> > Ethernet. We really need the two operation modes.
>
> Only using a subset of ports in a switch is common. The common binding for
> DSA switches is described in:
>
> Documentation/devicetree/bindings/net/dsa/dsa.yaml and for example
> Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml is a
> memory mapped switch. Notice the reg numbers:
>
> ethernet-ports {
> #address-cells = <1>;
> #size-cells = <0>;
>
> port@0 {
> reg = <0>;
> label = "cpu";
> ethernet = <&gmac0>;
> };
>
> port@2 {
> reg = <2>;
> label = "lan0";
> phy-handle = <&phy1>;
> };
>
> reg = <1> is missing in this example. Port 1 of the switch is not used. You can
> do the same with a 2 port switch, when you don't want to make use of a port.
> Just don't list it in DT.
Thank you for routing me to the document.
Now I know there are switch device examples in folder dsa/.
We can refer to them when we want to make a switch.
> > After looking up some data, I find RMC means reserved multi-cast.
> > RMC packets means packets with DA = 0x0180c2000000, 0x0180c2000002 ~
> > 0x0180c200000f, except the PAUSE packet (DA = 0x0180c2000001)
>
> Ah, good. BPDUs use 01:80:C2:00:00:00. So they will be passed when the port is
> in blocking mode. PTP uses 01:80:C2:00:00:0E. So the hardware designers
> appear to of designed a proper L2 switch with everything you need for a
> managed switch. What is missing is software. The more i learn about this
> hardware, the more i've convinced you need to write proper Linux support for
> it, not your mode hacks.
>
> Andrew
Thanks for confirming that the L2 switch is good enough for switch device.
Actually, the IP was licensed from other company long ago. We don’t know
all details.