-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KSZ9477 HSR driver for 4.9 Linux #98
Comments
There is no automatic HSR frame generation. The path field is always A. Hardware duplicate discard only works on sequence id and source MAC address. So if the the source MAC address is different as if sent from 2 independent network devices then the feature will not work. Also using just even number nodes like 2 will not trigger the effect as the two frames likely arrive at the same time. |
@triha2work - Thanks for your reply. Yes - it also looks to me that there is no automatic HSR field generation in the KSZ9477 - this must be done in SoC SW. My question is - how the frame duplication works? In the 4.9 driver each HSR frame is sent from SoC with tail tag assigned to separate port. In other words - the frame duplication offloading in KSZ9477 is not utilized. Am I correct? If I would like to use this offloading (i.e. frame duplication) - then I would need to enable ports in "HSR Port Map" register and modify tail tag to has bits set for those HSR aware ports? Is this enough? I also would like to ask about supported HSR version. From mine observation - the "Supervision Frames" with EtherType=0x88FB (PRP) are send by the 4.9 Linux driver. However, when I dump skb data in Linux 4.9 HSR driver just before sending it by MAC there is no frames with EtherType=0x892F. Why such frames are not observed (the HSR seems to work as I can see ongoing transmission with unplugged one cable)? To sum up - could you clarify which HSR version (v0 or v1) is supported by the KSZ9477 IC and the Linux 4.9 driver? Last but not least - for current mainline (v6.5-rc3) I can observe, that when I do use pure SW based HSR (CONFIG_HSR=y) with DSA driver - the feature is not working and I notice a lot of "error" frames with "Link Down/Up" observed all the time. Do you have any idea why this happens? Thanks in advance for your help. |
The frame duplication is just a normal feature in KSZ switches where the host can send a frame to any port. In this case the same frame is sent to ports 1 and 2 as defined as HSR ports. There is no specific switch hardware register to enable this feature except the tail tagging, which is always required to implement the DSA driver. |
Ok, this is clear - the KSZ9477 is copying 1 to 1 the HSR header when it duplicates it.
I see - the duplication is enabled when both ports (previously enabled in "HSR PORT MAP" register) are marked in KSZ9477 TAG
So the 4.9 (non DSA driver) supports only HSR v0 ?
Which code is that? Is the 4.9 ported driver? Or is it the only-SW-based HSR implementation already present in the Linux kernel (enabled with CONFIG_HSR)?
I'm using with
I would expect to have the in-SW HSR working with KSZ9477 (on EVB-KSZ9477) with only using
Yes - I've noticed it. The
Are you sure? Maybe, I've misunderstood the
This must be supported anyway, as there is a chance to have two frames with the same sequence number passed to MAC, as in some circumstances the KSZ9477 will not drop the duplicate frame.
The PTP is not utilized in my use case. I do only need HSR support in the newest mainline. |
The non-DSA switch driver uses its built-in HSR driver, not the one from the kernel. That was updated to use v1. If you want to use the kernel HSR driver then you need to set up the non-DSA driver to create independent network devices, just like the DSA driver. |
Ok. That is for Linux 4.9 HSR driver from Microchip?
Is this sentence regarding 4.9 Microchip driver? Or is it regarding newest Linux 6.5-rc3? I guess that the former? Am I correct?
Yes, I've noticed that on 4.9 driver only eth0 is present.
Yes, correct. I'm able to setup KSZ9477 EVB board to work in this mode with 4.9 Linux kernel (from Microchip). |
The drivers in the GitHub repository are non-DSA drivers. There are DSA drivers in the 4.9 kernel but they are for testing only. The official DSA drivers should come from the mainline kernels, like 5.4 and up. |
The kernel DSA driver (without HSR) for KSZ9477-EVB works as expected without issues on
The issue here is the permanent link status change (Link UP/DOWN) in the logs for HSR enabled interfaces. Only a fraction of HSR frames are delivered. It looks like the network subsystem seems to not be working reliable.
Yes. I can confirm that.
Yes. The 'ip" command is outdated in KSZ9477-EVB BSP setup (I'm using the newest one built from buildbot).
I also did the same.
Could you share more details about your's setup to test the performance of mainline kernel's HSR and DSA drivers (enabled together)? With
Could you be more specific here ?
Can you point me to some bug reports? Are those for the non-DSA HSR driver only?
|
Are you using the KSZ9477 evaluation board with SAMA5D3? I do not see the link issues you mentioned. And they should not be related to the HSR driver. Are you connecting the switch to some other switch and somehow the PHY settings are not compatible and there are link issues? |
I'm using the KSZ9477-EVB board with SAMA5D3 (KSZ9477-EVB) I connect the cables to Port1 and Port2 between two KSZ9477-EVB boards. The driver with HSR from 4.9 (and proper configuration passed when kernel boots: I've found that the HSR frames have tag with 0x3 - so yes, KSZ9477 duplicates frames in HW. In When I use the same HW setup with 6.5-rcX kernels on both KSZ9477-EVB boards the very frequent link up/down are shown - hence I guess that this is issue with the kernel. On the other hand - when 4.9 (with non-DSA HSR driver) is used on one KSZ9477-EVB board and 6.5-rc7 on the other - there are no issues with HSR.
When I connect two KSZ9477-EVB with running v6.5-rc7 the link up/down issue is present also with:
I will test is 5.4 is working correctly with the KSZ9477-EVB board.
Do you plan to publish those fixes ? (to kernel mailing list or some web available Microchip repository)
It is set by default in
Thanks for clarification - then I must set the same MAC address for lan1 and lan2.
I will look on this more closely - thanks for pointing this out. |
I finally saw the link problem you mentioned. It is so bad the board is unusable. You should use 6.1 until the problem is fixed. It is caused by EEE and a special DSP PHY register setting. The latest kernel code enables EEE after the main PHY driver thinks EEE support is there. The workaround is to clear the EEE register first before the main PHY driver reads it. An alternative is to the use the non-DSA driver in another board which has EEE disabled so that the link problem does not happen. |
I would prefer to use 6.5-rc7 and then manually disable EEE via This fixes the problem with Link Stability (without the need to modify driver). Exactly this issue is mentioned in errata Module 4. I've prepared proper patches for mainline kernel. |
With this one I'm a bit puzzled. The AN3474 note in Unfortunately, in the data sheet I cannot find it. It looks like it is not documented. In the sources I've found: Is this the correct register to set bit 3 in it to enable per port self-filtering ? I'm asking as (according to AN3474) to have this feature enabled, I do need to enable the self MAC filtering globally (this I've found) AND per HSR port (this I'm looking for). |
Maybe you got tired after reading all the document. The AN3474 note states correctly the names that are in the datasheet. Switch Lookup Engine Control 1 Register is 0x0311. Port Control 2 Register is 0xNB00. The datasheet has links in the descriptions of these registers so you can jump between them. |
Ach..... Now I do see. The Thanks for pointing this out. |
The patches now has been posted to ML (@triha2work you were added to receive them :-) ) The performance measurements:
|
@triha2work - I'm wondering why KSZ9477 doesn't support in HW in any way forwarding HSR frames between switch ports? I've read somewhere that this may contribute to some slow down when many HSR aware devices work in a "ring". Do you have any thoughts about this issue? |
Are you referring to the DSA driver behavior? The hardware and non-DSA driver do work correctly in forwarding HSR frames. The behavior of DSA driver is at initialization all ports act independently and requires a software bridge device to forward frames. After the ports are joined to the bridge they are linked to forward frames inside the switch. There is an indication to the bridge device to stop forwarding the frames itself. |
Yes, the frame forwarding can be setup in HW and then when bridging is used the DSA driver would offload it.
This is really interesting, as HSR driver has
Why the further node? The App Note says that it shall work for more than 2 nodes. According to the note - the problem is when two packets arrive together at almost the same time. Or is there any other problem?
Yes, the HSR works better with more than 2 HSR nodes. |
The switch forwarding is simply manipulating the port membership bits. The default value is 0x7f for 7-port switch. It is set to 0x21 for port 1; 0x22, port 2; 0x24, port 3; and so on at the beginning. When port 1 and 2 are joined their membership values becomes 0x23. When all 6 ports are joined the value goes back to 0x7f. In HSR the HSR port 1 and 2 have this membership value: 0x23. |
When I call I guess that both HSR ports (1,2) shall have the value of Then the I will have more info regarding the performance impact (about frames passing) when I form the HSR mesh (with 3 devices). |
@triha2work - If I may ask about the RedBox setup for the HSR driver [*]. Why in the Please also correct me, but it looks like in your driver there is some kind of "bridge" HSR driver (L2), which decides (based on configuration) if the HSR frame shall be forwarded to port marked as Have you tried to upstream the HSR RedBox functionality to Linux mainline? I've poked around mainline Linux sources and I did not spot any attempt of such work done yet. However, "bridging" those two interfaces on L2 level is not working out of the box. Note: |
I would like to ask for some clarification regarding HSR support on EVB-KSZ9477 board (Linux v4.9).
Especially in "TX PACKET DUPLICATION FROM HOST TO SWITCH" paragraph - there is clearly stated that the TX HSR frames duplication can be offloaded to KSZ9477 switch.
To do that the "HSR Port Map" register must be programmed and also the tag for KSZ9477 must have bits set for both HSR ports.
Please clarify mine questions:
the same sequence number and different KSZ9477 engress port set in tag
Thanks in advance for help.
The text was updated successfully, but these errors were encountered: