[LARTC] Clarification required for Prio in CBQ dequeing order

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have been modifying the Wonder shaper to include another queue.  My 
understanding was packets would be de queued to hardware in the following 
order:

  cbq1 -> sfq10 > sfq20 > sfq30.

Also we only move onto the next queue when the preceding one is empty.

However is seems to be prio xx number that reflects the order packets are 
de queued not to what flowid they belong to.

If I enter the commands below and ping my next hop with lots of traffic 
matching sport 10240 0x200.

# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 11 u32 \
         match ip protocol 1 0xff flowid 1:10
tc filter add dev $DEV parent 1:0 protocol ip prio 24 u32 \
         match ip sport 10240 0x200 flowid 1:30

     Packets: Sent = 85, Received = 85, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 20ms, Maximum = 145ms, Average = 79ms

---------------------------------------------------------------------------------
!! Now we change the bottom filter to prio4 in flowid 1:30

# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 11 u32 \
         match ip protocol 1 0xff flowid 1:10
tc filter add dev $DEV parent 1:0 protocol ip prio 4 u32 \
         match ip sport 10240 0x200 flowid 1:30

     Packets: Sent = 127, Received = 127, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 129ms, Maximum = 2405ms, Average = 475ms

[root@box root]# tc -s qdisc
qdisc sfq 30: dev ppp0 quantum 1500b perturb 10sec
  Sent 6040688 bytes 4199 pkts (dropped 0, overlimits 0)
  backlog 34p

  qdisc sfq 20: dev ppp0 quantum 1500b perturb 10sec
  Sent 75210 bytes 1167 pkts (dropped 0, overlimits 0)

  qdisc sfq 10: dev ppp0 quantum 1500b perturb 10sec
  Sent 317956 bytes 6133 pkts (dropped 0, overlimits 0)

  qdisc cbq 1: dev ppp0 rate 10Mbit (bounded,isolated) prio no-transmit
  Sent 6455294 bytes 11521 pkts (dropped 0, overlimits 26113)
  backlog 34p
   borrowed 0 overactions 0 avgidle 624 undertime 0

Packets are sent to the correct flow but ICMP response is far worse!

---------------------------------------------------------------------------------

I know the filters are matching correctly as the right number of packets go 
to the correct flow.  But could you please confirm if sfq10 should get de 
queued before sfq30.

Thanks,
Mark




#!/bin/bash

# The Ultimate Setup For Your Internet Connection At Home
#
#
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits
DOWNLINK=800
UPLINK=220
DEV=ppp0

# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root    2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null

###### uplink

# install root CBQ

tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 10mbit

# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
# main class

tc class add dev $DEV parent 1: classid 1:1 cbq rate ${UPLINK}kbit \
allot 1500 prio 5 bounded isolated

# high prio class 1:10:

tc class add dev $DEV parent 1:1 classid 1:10 cbq rate ${UPLINK}kbit \
    allot 1600 prio 1 avpkt 1000

# bulk and default class 1:20 - gets slightly less traffic,
#  and a lower priority:

tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $[9*$UPLINK/10]kbit \
    allot 1600 prio 2 avpkt 1000

# ftp in 1:30:  We send this shit last :)

tc class add dev $DEV parent 1:1 classid 1:30 cbq rate $[9*$UPLINK/10]kbit \
    allot 1600 prio 3 avpkt 1000

# all get Stochastic Fairness:
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10

# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:

tc filter add dev $DEV parent 1: protocol ip prio 10 u32 \
    match ip protocol 6 0xff \
    match u8 0x05 0x0f at 0 \
    match u16 0x0000 0xffc0 at 2 \
    match u8 0x10 0xff at 33 \
    flowid 1:10



# start filters

# TOS Minimum Delay (ssh, NOT scp) in 1:10:
#tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
#      match ip tos 0x10 0xff  flowid 1:10

# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 11 u32 \
         match ip protocol 1 0xff flowid 1:10

# Halflife
tc filter add dev $DEV parent 1:0 protocol ip prio 12 u32 \
         match tcp src 27005 0xffff flowid 1:10

tc filter add dev $DEV parent 1:0 protocol ip prio 12 u32 \
         match udp src 27005 0xffff flowid 1:10

# tcp 22 (ssh)
tc filter add dev $DEV parent 1:0 protocol ip prio 13 u32 \
         match tcp src 22 0xffff flowid 1:10


# tcp 23 (telnet)
tc filter add dev $DEV parent 1:0 protocol ip prio 13 u32 \
         match tcp src 23 0xffff flowid 1:10


# UDP
tc filter add dev $DEV parent 1:0 protocol ip prio 14 u32 \
         match ip protocol 17 0xff flowid 1:10

# ftp filter IP src ports 10240-10751

tc filter add dev $DEV parent 1:0 protocol ip prio 24 u32 \
         match ip sport 10240 0x200 flowid 1:30

# rest is 'non-interactive' ie 'bulk' and ends up in 1:20.

tc filter add dev $DEV parent 1: protocol ip prio 25 u32 \
    match ip dst 0.0.0.0/0 flowid 1:20

[root@box root]#



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux