#set speed 100Mbps echo ">>> setting speed 100Mbps" ethtool -s eth0 duplex full speed 100 sleep 10 echo ">>> reconfiguring eth0" #set up interface and queue configuration ip link set dev eth0 down #set-channels: 3 tx queues tx0 highest tx2 lowest prio ethtool -L eth0 tx 3 #have to disable rrobin ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off #bring up eth0 interface ip link set dev eth0 up sleep 20 echo ">>> loading switch config" #Setup EST schedule with 3 Gates (Q0-Q2). For description of Command parameters, see man tc-taprio. #3 traffic classes #priority map: p[0,1,4..15] <-> TC0, p2 <-> TC1, p3 <-> TC2 #queues: read "TC0: 1 queue at offset 0, TC1: 1 queue at offset 1, TC2: 1 queue at offset 2" #TC0 <-> Q0, TC1 <-> Q1, and TC2 <-> Q2 tc qdisc replace dev eth0 parent root handle 100 taprio \ num_tc 3 \ map 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 \ queues 1@0 1@1 1@2 \ base-time 0000 \ sched-entry S 4 2500000 \ sched-entry S 2 2500000 \ sched-entry S 1 5000000 \ flags 2 #Where num_tc is same as number of queues = 3, map, maps 16 priorities to one of 3 TCs, queues specify the #Queue associated with each TC, TC0 - One queue @0, TC1 - One queue @1 and TC2 - One queue @2 # sched-entry S 4 125000 # S - SetGateStates operation # 4 - Bit mask showing bit 2 set (Q2/TC2) # 125000 - 125000 nsecs (125 usecs ) duration of Gate open # The cycle-time is 500 usec sleep 10 echo ">>> enabling classifier" #enable classifier. Classifier is used to mark the packet based on packet meta data. For example UDP port #number tc qdisc add dev eth0 clsact sleep 15 echo ">>> supplying filters" #Using tc filter command edit the SKB priority based on udp port number. i.e Udp port 5003 -> prio 3 (TC2/Q2), port 5002 -> prio 2 (TC1/Q1), 5001 -> prio 1( TC0/Q0) tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5003 0xffff action skbedit priority 3 sleep 5 tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5002 0xffff action skbedit priority 2 sleep 5 tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5001 0xffff action skbedit priority 1 sleep 5 #Network core and Driver uses the skb priority to deliver frames to specific h/w queues. In the above case, #priority 3 SKB (packet) goes to Q2 (4th entry in map in the tc qdisc command), priority 2 SKB goes to Q1 #(3rd entry in map) and priority 1 SKB goes to Q0 (2nd entry in map) echo ">>> done..."