2021-11-08 20:30:38

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 2/2] net: ethernet: Add driver for Sunplus SP7021

> The switch will not recognize type of packets, regardless BPDU, PTP or any other
> packets. If turning off source-address learning function, it works like an Ethernet
> plus a 2-port hub.

So without STP, there is no way to stop an loop, and a broadcast storm
taking down your network?

Looking at the TX descriptor, there are two bits:

[18]: force forward to port 0
[19]: force forward to port 1

When the switch is enabled, can these two bits be used?

In the RX descriptor there is:

pkt_sp:
000: from port0
001: from port1
110: soc0 loopback
101: soc1 loopback

Are these bits used when the switch is enabled?

0.31 port control 1 (port cntl1) blocking state seems to have what you
need for STP.

Andrew


2021-11-08 16:47:51

by Wells Lu 呂芳騰

[permalink] [raw]
Subject: RE: [PATCH 2/2] net: ethernet: Add driver for Sunplus SP7021

> > The switch will not recognize type of packets, regardless BPDU, PTP or
> > any other packets. If turning off source-address learning function, it
> > works like an Ethernet plus a 2-port hub.
>
> So without STP, there is no way to stop an loop, and a broadcast storm taking
> down your network?

Do you mean connecting two PHY ports to the same LAN? We never
connect two PHY ports to the same LAN (or hub). I never think of this
loop problem. I thought only WAN has the loop problem.

The switch has some kinds of flow control, refer to 0.2 "Flow control threshold"
and 0.3 "CPU port flow control threshold". It will drop extra packets.
How an Ethernet hub take care of this situation?
Is that reasonable to connect two ports of an Ethernet hub together?


> Looking at the TX descriptor, there are two bits:
>
> [18]: force forward to port 0
> [19]: force forward to port 1
>
> When the switch is enabled, can these two bits be used?

Yes, for example, when bit 19 of TX descriptor is enabled, a packet from CPU
port is forwarded to LAN port 0 forcibly.


> In the RX descriptor there is:
>
> pkt_sp:
> 000: from port0
> 001: from port1
> 110: soc0 loopback
> 101: soc1 loopback
>
> Are these bits used when the switch is enabled?

Yes, E- MAC driver uses these bits to tell where a packet comes from.
Note that soc1 port (CPU port) has been removed in this chip.


> 0.31 port control 1 (port cntl1) blocking state seems to have what you need for
> STP.

From document, if bit 17 or bit 16 of port_cntl1 register is set, only RMC
packets will be forwarded to other LAN port. I am not sure whether
enabling the bits helps the issue. Should I enable the bits?
Sorry, I don't know what is a RMC packet?
Could you please teach me?


> Andrew

Thank you for review.