IP Version 6
- Architecture
- Network Devices
- Device Drivers
Layering
- a packet on the wire has a sequence of headers followed by the
payload, possibly followed by a sequence of trailers
- headers and trailers are properly nested: each layer will
encapsulate as its own payload the header, payload, and trailer of the layer (transparent exception for fragmentation)
- if a layer can have more than one layer above it, the header
must contain one or more demultiplexing fields
- layers communicate by:
- sending frames/packets/buffers
- receiving frames/packets/buffers
- establishing and clearing connections
Upcalls and Queues
- in sending, the data can be transferred from one layer to
another as parameter of a call
- in receiving, the data can be transferred from one layer to
another as:
- parameter of an upcall
- return value of a downcall
- a downcall requires synchronization to handle:
- the downcall being ready before the data (blocking, context switch)
- the data being ready before the downcall (queueing)
- an upcall may also require synchronization
Upcalls and Downcalls
- upcalls are simpler to implement and generally more efficient
(less synchronization for each packet)
- upcalls are harder to fit into an overall program (multiple
threads of control, requiring possibly pervasive synchronization)
- Linux (version 2.0) uses 2 queues:
- the interrupt hander is an upcall. It does device handling
(described later), and puts the received packet in a device-specific queue
- the network code reads the queue, and when packets are received,
upcalls through the entire network stack, then puts the packet(s)
in a socket-specific queue
- the system call reads the queue
Network Interface Devices
- Networking Hardware, NIC
- UART/USART, Universal [Synchronous /] Asynchronous
Receiver Transmitter
- UART is a single-chip device accepts or returns data depending
on the address on the computer's bus
- the hardware device has bits which control its operation (e.g. a
bit to decide whether to interrupt the host). These
are grouped into one or more control registers
- the hardware device has bits which record events (e.g. a bit
to record whether a character was received, but not given to the host). These
are grouped into one or more status registers
Programmed Input and Output
- input:
- interrupt handler is called to signal availability of data
- program checks the status register to see if everything is OK
- program reads the data register to load the data
- output:
- program checks the status register to see if it is OK to send
- (if not, next step done by interrupt handler)
- program writes the data register to send the data
Direct Memory Access
- input:
- program sets up buffers for incoming data, gives pointer into
control register
- device copies data into buffer
- device interrupts when buffer(s) are full
- output:
- program sets up buffers for outgoing data
- device copies data from buffers onto network
- device interrupts when buffers are sent
Device Drivers
- at boot time, must do device initialization: discovery (probing),
data structure setup
- at interrupt time, the device must put a byte on the (shared) bus
to identify who the interrupt is from (interrupt vector)
- the system interrupt handler uses this information to decide
which device interrupt handler to call
- the device interrupt handler ("lower half") must read the
status register and internal data structures and decide what to do
- the device driver ("top half") handles downcalls