Traffic control and queuing discipline - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Traffic control and queuing discipline

Description:

Interaction of kernel with queuing functions. Interaction of user with queuing functions ... Source code of tc: http://snafu.freedom.org/linux2.2/iproute-notes.html ... – PowerPoint PPT presentation

Number of Views:203
Avg rating:3.0/5.0
Slides: 23
Provided by: scie305
Category:

less

Transcript and Presenter's Notes

Title: Traffic control and queuing discipline


1
Traffic control and queuing discipline
  • Jennifer Hou and Honghai Zhang

2
Outline
  • Linux traffic control overview
  • Queuing discipline
  • Queuing functions
  • Interaction of kernel with queuing functions
  • Interaction of user with queuing functions
  • Case Study TCP RED

3
Linux traffic control
4
Processing of network data
A non-terminal machine
Upper layers (TCP, UDP, )
Traffic control
Input de-multiplexing
forwarding
Output queuing
5
Components of traffic control
  • Queuing disciplines
  • Classes (within a queuing disciplines)
  • Filters
  • policing

6
Queuing discipline
  • Each network device has a queuing discipline
  • It controls how packets enqueued on that device
    are treated
  • Keep, drop, mark
  • A simple one may just consist of a single queue

Queuing discipline
7
Complex queuing discipline
  • Queuing discipline
  • May use filters to distinguish among different
    classes of packets
  • Process each class in a specific way
  • Two filters can point to one class
  • Classes
  • do not store packets
  • They use another queuing discipline to do that

8
Complex queuing discipline (cont)
9
Policing
  • When enqueuing packets, the corresponding flow
    can be policed
  • Letting it go
  • Dropping
  • Letting it going but marking

10
Queuing disciplines data structure
  • struct Qdisc_ops
  • struct Qdisc_ops next
  • struct Qdisc_class_ops cl_ops
  • char idIFNAMSIZ
  • int priv_size
  • int (enqueue)(struct sk_buff , struct Qdisc
    )
  • struct sk_buff (dequeue)(struct Qdisc )
  • int (requeue)(struct sk_buff , struct Qdisc
    )
  • unsigned int (drop)(struct Qdisc )
  • int (init)(struct Qdisc , struct rtattr
    arg)
  • void (reset)(struct Qdisc )
  • void (destroy)(struct Qdisc )
  • int (change)(struct Qdisc , struct rtattr
    arg)
  • int (dump)(struct Qdisc , struct sk_buff )

11
Queuing disciplinesFunctions
  • enqueue)()
  • Enqueues a packet
  • dequeue()
  • Returns the next packet eligible for sending
  • requeue()
  • Puts a packets back into the queue after
    dequeuing it with dequeue
  • Drop()
  • Drops one packet from the queue

12
Queuing disciplinesFunctions (cont)
  • Init()
  • Initalize and configures the queuing discipline
  • reset()
  • Reset the queuing discipline to its initial state
  • destroy()
  • Remove a queuing discipline
  • change()
  • Change the configurations of a queuing discipline
  • dump()
  • Returns diagnostic data for maintenance.

13
TCP RED
14
Dropping probability pa
Linux implementation
pb
15
TCP RED implementation I
  • struct red_sched_data / Parameters /
  • u32 limit / HARD maximal queue length /
  • u32 qth_min / Min average length threshold A
    scaled /
  • u32 qth_max / Max average length threshold A
    scaled /
  • char Wlog / log(W) /
  • char Plog / random number bits /
  • unsigned long qave / Average queue length A
    scaled /
  • int qcount / Packets since last random number
    generation /
  • u32 qR / Cached random number /
  • psched_time_t qidlestart / Start of idle period
    /
  • struct tc_red_xstats st

16
TCP RED implementation II Compute average queue
length
  • We want
  • avg avg (1- w) w backlog
  • Code in Linux
  • q-gtqave sch-gtstats.backlog - (q-gtqave gtgt
    q-gtWlog)
  • Explain
  • avg q-gtqave w
  • w 2(-wlog)

17
TCP RED implementation III
  • Ideally avg should be calculated every constant
    clock interval
  • In Linux it is updated every packet outgoing
  • Care need to be taken for idle period

18
TCP RED implementation IVDecide dropping
probability
  • We want enqueue if
  • Linux code
  • if (((q-gtqave - q-gtqth_min)gtgtq-gtWlog)q-gtqcount lt
    q-gtqR) goto enqeue
  • max_P (qth_max qth_min)/2Plog
  • q-gtqR rnd 2Plog

19
Interaction with Kernel
20
Interaction with User
  • Command tc usage example
  • tc qdisc add dev eth0 root red HELP OPTIONS
  • tc qdisc show dev eth0
  • Source code of tc http//snafu.freedom.org/linux2
    .2/iproute-notes.html
  • Directory of the source code for tc
  • Iproute2/tc/

21
Flow of functions when calltc qdisc add dev eth0
root red
tc
filter
qdisc do_qdisc() in tc.c
class
add tc_qdisc_modify
q-gtparse_qopt() rtnl_open() rtnl_talk()
22
Flow of functions when calltc qdisc show (or tc
s qdisc)
tc
filter
qdisc do_qdisc in tc.c
class
show tc_qdisc_list
rt_open
rtnl_dump_request
rtnl_dump_filter
print_qstat print_qopt print_tcstat
Write a Comment
User Comments (0)
About PowerShow.com