Skip to content

Commit 1e0bff3

Browse files
committed
Merge branch 'fix-felix-dsa-taprio-gates-after-clock-jump'
Vladimir Oltean says: ==================== Fix Felix DSA taprio gates after clock jump Richie Pearn presented a reproducible situation where traffic would get blocked on the NXP LS1028A switch if a certain taprio schedule was applied, and stepping the PTP clock would take place. The latter event is an expected initial occurrence, but also at runtime, for example when transitioning from one grandmaster to another. The issue is completely described in patch 1/4, which also contains the fix, but it has left me with some doubts regarding the need for vsc9959_tas_clock_adjust() in general. In order to prove to myself that vsc9959_tas_clock_adjust() is needed in general, I have written a selftest for the tc-taprio data path in patch 4/4. On the LS1028A, we can clearly see the following failures without that function: INFO: Forcing a backward clock jump TEST: ping [FAIL] INFO: Setting up taprio after PTP TEST: In band with gate [FAIL] Reception of 100 packets failed TEST: Out of band with gate [FAIL] Reception of 100 packets failed As for testing my fix from patch 1/4, that was quite a bit more complex to do automatically. In fact, I couldn't find any other schedule that would fail to be updated by vsc9959_tas_clock_adjust() as cleanly as the schedule from Richie, so I've added that specific schedule as the test_clock_jump_backward() test. The test ordering is also (unfortunately) very strategic. Running the selftest to the end dirties the GCL RAM, and when running test_clock_jump_backward() once again, the GCL entries won't be all zeroes as they were the first time around. They will contain bits and pieces of old schedules, making it very challenging to make it fail. Thus, test_clock_jump_backward() is the first in the test suite, and without patch 1/4, it is only supposed to fail the _first_ time when running after a clean boot. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6e0490f + 4eb9da0 commit 1e0bff3

File tree

5 files changed

+454
-7
lines changed

5 files changed

+454
-7
lines changed

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot)
15431543
struct tc_taprio_qopt_offload *taprio;
15441544
struct ocelot_port *ocelot_port;
15451545
struct timespec64 base_ts;
1546-
int port;
1546+
int i, port;
15471547
u32 val;
15481548

15491549
mutex_lock(&ocelot->fwd_domain_lock);
@@ -1575,6 +1575,9 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot)
15751575
QSYS_PARAM_CFG_REG_3_BASE_TIME_SEC_MSB_M,
15761576
QSYS_PARAM_CFG_REG_3);
15771577

1578+
for (i = 0; i < taprio->num_entries; i++)
1579+
vsc9959_tas_gcl_set(ocelot, i, &taprio->entries[i]);
1580+
15781581
ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE,
15791582
QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE,
15801583
QSYS_TAS_PARAM_CFG_CTRL);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run_net_forwarding_test.sh

tools/testing/selftests/drivers/net/ocelot/psfp.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,14 @@ run_test()
266266
"${base_time}" \
267267
"${CYCLE_TIME_NS}" \
268268
"${SHIFT_TIME_NS}" \
269+
"${GATE_DURATION_NS}" \
269270
"${NUM_PKTS}" \
270271
"${STREAM_VID}" \
271272
"${STREAM_PRIO}" \
272273
"" \
273274
"${isochron_dat}"
274275

275-
# Count all received packets by looking at the non-zero RX timestamps
276-
received=$(isochron report \
277-
--input-file "${isochron_dat}" \
278-
--printf-format "%u\n" --printf-args "R" | \
279-
grep -w -v '0' | wc -l)
280-
276+
received=$(isochron_report_num_received "${isochron_dat}")
281277
if [ "${received}" = "${expected}" ]; then
282278
RET=0
283279
else

0 commit comments

Comments
 (0)