Upload
monad-bobo
View
22.617
Download
3
Embed Size (px)
DESCRIPTION
introduction to linux kernel tcp/ip ptocotol stack
Citation preview
Introduction to Linux Kernel TCP/IP procotol stack
雕梁核心系统服务器平台组[email protected]
[email protected]://www.pagefault.info
2011/01/15
AgendaIntroduction
Networking code in the Linux kernel tree
L2 (Link Layer)
L3 (Network Layer)
L4 (Transport Layer)
Config and benchmark tools
Resource
Introduction
Sourcehttp://git.kernel.org/net-next-2.6 and net-2.6
DeveloperAlan Cox, David Miller, Eric Dumazet, Patrick Mchardy etc.
Traffic directionsinput , forward and output
LayerL2(Link Layer)/L3(Network Layer)/L4(Transport Layer)
Device interfacePCI/PCI-E
Networking code in the Linux kernel tree
Net-Kernel source tree
Big picture
Link layerFrame type
802.3/802.2/802.2-SNAP/EthernetInput
DriverNAPI
Poll + InterruptSoft interrupt
GROfeed packet to network stack
RPS/RFSmake steer in SMP
Protocol handleruse eth_type_transPacket_type list
Link layerOutput
Traffic ControlSoft interrupt
Transmit SKBScatter/Gather DMA
Free skbXPS
multiqueueavoid cache line bouncingimprove locality
BridgeVirtual device, must bind one or more real deviceSpanning Tree Protocol
Link Layer bigmap
Network Layer(IP)Input
Protocol handlernet_protocol array
defragmentHashtable
Each IP packet being defragmented save in a liststored in kernel memory until they are totally processed
Outputfragment
MTUScatter/Gather IOudp
neighboring
Network Layer(IP)Forward
process ip optionigonore defragmentation
Router Alert optionRoute
Forwarding Information Base(routing table)cache
NetfilterHOOK point
NF_IP_LOCAL_OUT/ NF_IP_LOCAL_IN etc..Management
Long-living IP peer information AVL tree
IP statistics per cpu data ipstats_mib/proc/net/snmp
Network Layer Bigmap
Transport Layer (tcp)Init
bind callback (sock_create)Three handshrek
accept queuesyn tablecreate new socket fd and change state
Manage socketinet_ehash_bucket
TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSEinet_bind_hashbucket
local binding port infolistening_hash
socket in TCP_LISTEN state
Transport Layer (tcp)Output
Tcp pushCongestion control
state transitioncongestion windowspacket count
Inputfast path and slow pathInterrupt context/ Process contextsk_backlog/receive_queue/prequeue
Tcp state transitionKernel control
TimerRetransmit/keep-alive/time-wait etc
TCPBigmap
Config and Benchmark Tools
Ethtooloffload fetures
Benchmark and test toolsNetperf/pktgenMpstat/tcpstat
Proc FileSystem
/proc/net/proc/sys/net
ipv4core
Sys FileSystem/sys/class/net/ethx
Resource
http://kernelnewbies.org http://kernel.org http://www.kernelplanet.org https://lkml.org http://vger.kernel.org/vger-lists.html http://www.pagefault.info/?tag=kernel