History

taprio: Add support for txtime-assist mode

Currently, we are seeing non-critical packets being transmitted outside of their timeslice. We can confirm that the packets are being dequeued at the right time. So, the delay is induced in the hardware side. The most likely reason is the hardware queues are starving the lower priority queues. In order to improve the performance of taprio, we will be making use of the txtime feature provided by the ETF qdisc. For all the packets which do not have the SO_TXTIME option set, taprio will set the transmit timestamp (set in skb->tstamp) in this mode. TAPrio Qdisc will ensure that the transmit time for the packet is set to when the gate is open. If SO_TXTIME is set, the TAPrio qdisc will validate whether the timestamp (in skb->tstamp) occurs when the gate corresponding to skb's traffic class is open. Following two parameters added to support this mode: - flags: used to enable txtime-assist mode. Will also be used to enable other modes (like hardware offloading) later. - txtime-delay: This indicates the minimum time it will take for the packet to hit the wire. This is useful in determining whether we can transmit the packet in the remaining time if the gate corresponding to the packet is currently open. An example configuration for enabling txtime-assist: tc qdisc replace dev eth0 parent root handle 100 taprio \\ num_tc 3 \\ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \\ queues 1@0 1@0 1@0 \\ base-time 1558653424279842568 \\ sched-entry S 01 300000 \\ sched-entry S 02 300000 \\ sched-entry S 04 400000 \\ flags 0x1 \\ txtime-delay 40000 \\ clockid CLOCK_TAI tc qdisc replace dev $IFACE parent 100:1 etf skip_sock_check \\ offload delta 200000 clockid CLOCK_TAI Note that all the traffic classes are mapped to the same queue. This is only possible in taprio when txtime-assist is enabled. Also, note that the ETF Qdisc is enabled with offload mode set. In this mode, if the packet's traffic class is open and the complete packet can be transmitted, taprio will try to transmit the packet immediately. This will be done by setting skb->tstamp to current_time + the time delta indicated in the txtime-delay parameter. This parameter indicates the time taken (in software) for packet to reach the network adapter. If the packet cannot be transmitted in the current interval or if the packet's traffic is not currently transmitting, the skb->tstamp is set to the next available timestamp value. This is tracked in the next_launchtime parameter in the struct sched_entry. The behaviour w.r.t admin and oper schedules is not changed from what is present in software mode. The transmit time is already known in advance. So, we do not need the HR timers to advance the schedule and wakeup the dequeue side of taprio. So, HR timer won't be run when this mode is enabled.

Vedang Patel committed 7 years ago

Commit 4cfd5771 parent 566af332 files · +328 −17Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/pkt_sched.h+4−0
@@ -1159,6 +1159,8 @@ enum { · 1158 unmodified lines
1159 * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL]1159 * [TCA_TAPRIO_ATTR_SCHED_ENTRY_INTERVAL]
1160 */1160 */
1161 1161
1162#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST 0x1
1163
1162enum {1164enum {
1163 TCA_TAPRIO_ATTR_UNSPEC,1165 TCA_TAPRIO_ATTR_UNSPEC,
1164 TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */1166 TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */
@@ -1170,6 +1172,8 @@ enum { · 5 unmodified lines
1170 TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */1172 TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */
1171 TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */1173 TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */
1172 TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */1174 TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */
1175 TCA_TAPRIO_ATTR_FLAGS, /* u32 */
1176 TCA_TAPRIO_ATTR_TXTIME_DELAY, /* s32 */
1173 __TCA_TAPRIO_ATTR_MAX,1177 __TCA_TAPRIO_ATTR_MAX,
1174};1178};
1175 1179