views:

89

answers:

2

Hello

Is there a good overview of tcp data path in Linux (2.6, not 2.4 if the path actually differ)? Where is a packet on different stages of tcp/ip stack handling?

How packet is packed to tcp segment, then ip packet. How it is transmitted to network card? (with series of I/O regs write and DMA?) Is it transmitted to network card in the "write" syscall handler (with some deep callstack) or is it transmitted at some other moment?

+2  A: 

Try this: The Linux TCP/IP Stack: Networking for Embedded Systems

The Linux TCP/IP Stack: Networking for Embedded Systems /by Thomas Herbert (Author) .The Linux TCP/IP Stack: Networking for Embedded Systems provides an in-depth guide to implementing and using the Linux TCP/IP stack in embedded systems projects. It begins with a general overview of TCP/IP networking, with background information on applicable networking standards. From there, it details the TCP/IP implementation in Linux 2.6 by following a packet of data as it flows through the stack from the sending system, out the wire, and back through the input side of the stack in the receiving machine. This unique approach gives programmers an "inside" look at the entire process. Throughout the text, topics of particular interest to engineers implementing embedded systems are discussed, such as sockets, network interfaces, application layer protocols, and practical considerations. This is a great resource for embedded systems programmers and engineers, as well as networking professionals interested in learning more about the implementation of Linux TCP/IP in the 2.6 kernel.

Robert S. Barnes
Very-very good, thanks! Now need the second part of such - what is done in hardware, where are the queues, buffers, where are the latencies.
osgx
Robert, what do you think about http://stackoverflow.com/questions/2706192/one-two-directed-tcp-socket-or-two-one-directed-linux-high-volume-low-latency ?The book says "The fast path is only supported for unidirectional data transfers, so if we have to senddata in the other direction, we default to the slow path processing of incoming segments". So 1 byte to the opposite side and socket will be slow-path forever (from this send to the finalization of connection)?
osgx
+1  A: 

http://www.linuxfoundation.org/collaborate/workgroups/networking/kernel_flow

I think this is what you want. It shows the process all the way from sendmsg() to dev_hard_start_xmit(), which is where the net stack passes the packet off to the NIC driver.

Andy Grover
hey, skb_clone is shown as data copy. But really, skb_clone copies only skb header, leaving data inplace
osgx