802.1Qbv Enhancements for Scheduled Traffic - InnoRoute/RealtimeHAT GitHub Wiki
TAS with ta-prio
- This tutorial require minimum release release r0.4 of the codebase.
- the current TAS implementation is based on the qdisc ta-prio module. If you need more information regarding ta-prio:
Test the TAS
- the following example code will configure an simple GCL which opens and closes all gates for 1s
sudo tc qdisc add dev RT0 parent root handle 100 taprio \
num_tc 8 \
map 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 \
queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
base-time 0 \
sched-entry S 00 1000000000 sched-entry S ff 1000000000 \
clockid CLOCK_REALTIME
- To test the applied GCL you can start a packet-generator:
sudo mz RT0 '00:00:00:00:00:05 00:00:00:00:00:01 08:00 ca:fe:ba:be' -c 0 -d 1m -p 1400 -r
- Now all packets leaving the HAT on port RT0 will be scheduled, you will notice that the whole traffic is blocked for 1s and running in the next second.
- To remove the applied TAS configuration run:
sudo tc qdisc del dev RT0 parent root handle 100 taprio
- We noticed that the configuration via ta-prio is not very comfortable, for the configuration of the hardware accelerated Implementations a python module will be available.
Sending scheduled packets from own applications
- ta-prio uses the socket-priority to sort packets to the specified queue. Sou have to activate the
SO_PRIORITY socket option within your application.
ta-prio clock synchronization
- ta-prio uses CLOCK_REALTIME as reference. If you notice problems regarding the time sync of your TAS, check if CLOCK_REALTIME and the Realtime-HAT are synchronized:
sudo phc_ctl /dev/ptp0 get
sudo phc_ctl CLOCK_REALTIME get
- both commands should show nearly the same result, for TSN it is not important to have the valid time of the day here, but the time should be equal on all synchronized devices.
- in case of error the tool phc2sys is not able to sync both clocks, this can be caused by an running ntp-deamon or because both clocks are to fare away
- kill try to start phc2sys manually to debug the problem
sudo phc2sys -a -rr --transportSpecific 0x1 -m
ta-prio and linuxPTP
- the linuxptp installed with the HAT is patched to send packets with the socket priority 1. This works just in L2-mode of PTP. (if you change the config file you should consider this.) The GCL should not block the PTP traffic.
Hardware TAS implementation