Copyright 1996 Erik Lindsley
Tour overview (draft)
An SKB can be dissected into several parts, and a couple of these
parts are used only with a specific protocol. Please load
figure 1 in a separate window and follow along.
The parts are as follows:
In addition to the SKB structure, a structure is used to hold a list
of SKBs. This structure is called sk_buff_head, and is made up of the links
for the doublely-linked list (QUEUE), and a counter for the number of
SKBs in the que (qlen). Note that while all of the (list) fields of the SKBs
placed in the que will point to the same header, the (dev) and (sk)
pointers commonly do not.
- This part is concerned primarily with the maitainence of the doublely-linked
list (next,prev), a reference counter (count), a pointer to the socket that the
SKB is going to/from (sk), a pointer to the device it is going to/from, a
pointer to the list header (list) so that the length of the queue (qlen) can
be updated properly, and a destructor function to call once the
PDU is no longer needed (destructor).
- This is a union structure (a.k.a variant record) of pointers to several
popular types of link-layer transport headers, such as Ethernet, TCP, UDP,
File handles, Raw (unkown) headers, etc. It can only point to a single
header at a time, however.
- This part is concerned with the actual kernel-space memory reserved for the
SKB's used. It has pointer to the beginning (head) and end (tail) of the
reserved space, as well as its size (truesize).
- This part indicates where the actual PDU data is located within the MEMORY
space reserved for the SKB. It too has a beginning (data), an end (end), and
length of valid data (len).
- This part originaly stored all of the fields of an IP datagram, as well as
all of the state information for the transmission protocol. It is very
messy. It does, however, have the field which indicates which higher-layer
protocol is being used with this SKB.
- This part adds some additional information that Werner's ATM driver will
occationally use. It currently store such information as the size of the
interface's PDU (size), some adapter-specific data (pos), a pointer to the
ATM drivers VC data structure (VCC), a state information for I/O vectoring
(iovcnt), and an additional timestamp field (timestamp) -- the IP part has
one as well, but it is used for round trip time calculations.
The standard kernel source provides many
library functions to
manipulate and use these structions.