Check out the new USENIX Web site. next up previous
Next: Windows 2000 TCP/IP Integration Up: TCP/IP Integration Previous: TCP/IP Integration

Linux TCP/IP Integration

AFPA on Linux intercepts events in the TCP/IP stack without kernel modification. The Linux kernel socket structure contains function pointers which are invoked whenever the state of the connection changes, inbound data is queued on the socket, or outbound data is removed from the socket queue. AFPA on Linux replaces the data arrival hook with its own. When the first data packet arrives on the socket, the main AFPA hook gets called from within the network bottom half (i.e. software interrupt handler). AFPA then parses the request packet, looks up the cache object, queues the response in the socket output queue, and sends the response. If the request does not fit entirely into the first packet, AFPA creates a connection context which it retrieves when the next packet arrives and parses the request.

To manage sending data, AFPA on Linux rewrites the skbuff free hook, which is called whenever a network buffer is freed. This hook is used to send responses in 64 kB chunks. The last packet of a chunk is flagged. When the AFPA hook detects that last packet of a chunk, the AFPA hook sends the next chunk. When a request is not found in the cache, the request is queued and picked up by a service kernel thread. Tight synchronization has to be provided between the thread and the software interrupt which are competing for the socket's accept queue.

AFPA on Linux allocates a number of 128 KB blocks of pinned memory which are managed by AFPA's own memory allocator. When APFA creates a cache object, it opens the corresponding file and reads it into Ethernetframe-sized buffers. AFPA allocates space in each buffer for TCP, IP, and Ethernet headers. It reserves additional space in the first buffer for HTTP headers. When APFA receives a request, it fills in the HTTP header and queues each frame associated with the object for transmission. For large responses, AFPA queues frames in 64 KB chunks. If an additional request is received for a cache object that is in the process of being sent, AFPA makes an additional copy of the buffer (i.e. Ethernet frame).


next up previous
Next: Windows 2000 TCP/IP Integration Up: TCP/IP Integration Previous: TCP/IP Integration
Philippe Joubert 2001-05-01