ENETC not sending with CBS enabled

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ENETC not sending with CBS enabled

跳至解决方案
1,910 次查看
_mkl
Contributor II

Hello,

I am extending a custom driver for enetc on ls1028ardb to also support the TSN features of the board.

Now as soon as I enable the credit based shaper, no packets are transmitted. I have configured two TX BDR with prios 0 and 7 and set the PTC7CBSR0 and PTC7CBSR1 registers. But no matter which credit or bandwidth values I use, no data gets transmitted from either ring as soon as the CBSE bit is set. It is simply filling up until full.

I looked into the LSDK driver implementation and also only find these registers configured for CBS as described in the manual. Is there any hidden configuration I missed? Or are there more constrains to have a valid CBS configuration?

标记 (1)
0 项奖励
回复
1 解答
1,423 次查看
_mkl
Contributor II

For the curious reader:

I was finally able to get TSN on ENETC working. The difference was in the IEEE1588 Timer Module configuration.

  • My configuration: TMR_CTRL[TCLK_PERIOD] = 16, TMR_ADD=0x28000000
  • The Linux config: TMR_CTRL[TCLK_PERIOD] = 5, TMR_ADD=0x80000000

After decreasing the CLK_PERIOD to 5 or 4 and recalculating TMR_ADD accordingly it is now functional.

在原帖中查看解决方案

0 项奖励
回复
9 回复数
1,424 次查看
_mkl
Contributor II

For the curious reader:

I was finally able to get TSN on ENETC working. The difference was in the IEEE1588 Timer Module configuration.

  • My configuration: TMR_CTRL[TCLK_PERIOD] = 16, TMR_ADD=0x28000000
  • The Linux config: TMR_CTRL[TCLK_PERIOD] = 5, TMR_ADD=0x80000000

After decreasing the CLK_PERIOD to 5 or 4 and recalculating TMR_ADD accordingly it is now functional.

0 项奖励
回复
1,746 次查看
_mkl
Contributor II

I have the same problem with other TSN features as well, e.g. Qbv scheduler. Once enabled, only a single frame is transmitted. 
I assume there is a dependant timing/frequency configuration I am missing? IEEE1588 clock is already initialized and running and the speed value is set to 1Gbps.

0 项奖励
回复
1,608 次查看
yipingwang
NXP TechSupport
NXP TechSupport

For the same environment and steps, LSDK driver is working well, right?

do you use ptp4l to do the time synchronization?

you can dump the related registers and compare them with that in LSDK driver.

0 项奖励
回复
1,602 次查看
_mkl
Contributor II
Yes, the LSDK driver works as expected, I have two ls1028a boards connected to each other. There ptp4l is able to synchronize both boards with gPTP.
In my system I do not have ptp synchronization yet, only the ptp clock counting the system runtime. Do I have to set up a proper PTP calibration before enabling TSN?
I already compared the registers, here are some differences I found but assume unrelated, please comment if there is something mandatory:
- LSDK uses two VSI with 4 queues each behind the PSI, I only use the 8 PSI queues directly.
- LSDK uses SI based VLAN extraction/insertion, I currently handle VLANs in software.
0 项奖励
回复
1,566 次查看
yipingwang
NXP TechSupport
NXP TechSupport

PTP synchronization is needed, so you should enable it.

you can test your code in LSDK's environment, just replace ENET driver using your driver.
it can exclude some interference factors.

0 项奖励
回复
1,847 次查看
yipingwang
NXP TechSupport
NXP TechSupport

for ENETC port,
if want to enable CBS, should make sure the other TC (that are numerically higher than this TC) have been enabled.
if want to disable CBS, should make sure the other TC (that are numerically lower than this TC) have been disabled.

you can refer to the function enetc_set_cbs in drivers/net/ethernet/freescale/enetc/enetc_tsn.c,

Thanks

0 项奖励
回复
1,792 次查看
_mkl
Contributor II

I know, for this reason I have only enabled the highest TC 7.
As I mentioned in my original post I took the code in enetc_set_cbs as reference and configured the same registers.

0 项奖励
回复
1,762 次查看
yipingwang
NXP TechSupport
NXP TechSupport

For CBS test, should send the frames using the corresponding queue, for example "pktgen -q ...".

 

you can refer to " 4.1.4.1.5.2 Using CBS Qdisc to setup Qav" of real-time-edge RM.

 

can also use "ethtool -S enox" command to show the rx/tx counter, it can help to find why the packets are blocked.

 

Thanks

0 项奖励
回复
1,757 次查看
_mkl
Contributor II
Ok, with the rx/tx counter I can see that the first frame is transmitted, but no further ones. Maybe the credits are not replenished or another missing configuration causes starvation?
I now tried with all 8 traffic classes with a 1:1 mapping from BDR priority to traffic class to VLAN PCP, but it still does not send any further packets from any of the queues.
0 项奖励
回复