Upload
felix-stone
View
212
Download
0
Embed Size (px)
Citation preview
Fall 2004 FSU CIS 5930 Internet Protocols 1
Traffic control and Quality of Service
Reading: Chapter 18
Fall 2004 FSU CIS 5930 Internet Protocols 2
Some basic concepts• Traffic policing
– Incompliant packets dropped
• Traffic shaping– Incompliant packets held till satisfied
• Queueing discipline– Packet departure order (time)
• Classes– Packet holders
• Filters– Packet classifiers
Fall 2004 FSU CIS 5930 Internet Protocols 3
Traffic control in Linux kernel
..........
dev.cdev.c
dev.cdev.c
driver.cdriver.c
net_interrupt
netif_rx
net_rx_action
Scheduler
do_softirq
br_input.cbr_input.c
handle_bridgeCONFIG_BRIDGE
dev_alloc_skb()
eth_type_trans()
CPU1 CPU2
softnet_data[cpun].input_pkt_queue
Dat
a-lin
k la
yer
(OS
I-La
yer
1+2)
arp_rcv ip_rcv p8022_rcv
Laye
r 3
dev.cdev.c
dev_queue_xmit
dev->qdisc->enqueue
dev.cdev.c
driver.cdriver.c
dev->hard_start_xmit
qdisc_run
qdisc_restart
dev->qdisc->dequeue
Scheduler
eth0 eth1
ip_queue_xmitarp_send
...
net_tx_action
ETH_P_802_2
Fall 2004 FSU CIS 5930 Internet Protocols 4
Traffic control
dev.c, net/sched/*dev.c, net/sched/*
softirq.c, netdevice.hsoftirq.c, netdevice.h
dev->qdisc->enqueue
driver.cdriver.c
dev->hard_start_xmit
qdisc_run
qdisc_restart dev->qdisc->dequeue
Scheduler
net_tx_action
dev_queue_xmit
timer_handler netif_scheduleTimer
cpu_raise_softirq
do_softirq
NET_TX_SOFTIRQ
One specificqueueing discipline
enqueue dequeue
Fall 2004 FSU CIS 5930 Internet Protocols 5
Basic queue discipline interface
• enqueue()– Put a packet into queue
• dequeue()– Get a packet from the queue
• drop()– Remove a packet
• requeue(), reset(), init(), destroy(), change(), dump()
Fall 2004 FSU CIS 5930 Internet Protocols 6
struct Qdisc
Struct Qdisc {int (*enqueue)(…);struct sk_buff (*dequeue)(…);struct Qdisc_ops *ops;struct Qdisc *next;struct sk_buff_head q;struct net_device *dev;…
}
Fall 2004 FSU CIS 5930 Internet Protocols 7
Adding a discipline into kernel
• pktsched_init()– Used when a discipline is compiled
permanently into kernel– Initializing RT-NETLINK interface– Calling register_qdisc() function
• register_qdisc()– Called by pktsched_init() or init_module()– Inserting discipline into the list– Allocating operations (functions)
Fall 2004 FSU CIS 5930 Internet Protocols 8
Filters
• classify()• init()• destroy()• delete()
Fall 2004 FSU CIS 5930 Internet Protocols 9
Implementing a discipline
• Concepts of token bucket filter– Rate R– Depth B
• Functions – tbf_init()– tbf_enqueue()– tbf_dequeue()