Basic Design

This project modifies the Data Link Layer and Physical Layer of the TCP/IP protocol stack. The Data Link Layer is replaced by SLIP protocol. The UART is used as the Physical Layer.

Figure 1. TCP stack and modificatins on it

This project is organized as a network driver module.

When the module is inserted in to the kernel, the init_module() function gets executed. In the function init_module() we have to register the network driver object. Then register the interrupt handler. After registering the handler we have to initialize the UART. Similarly when the module is to be removed from the kernel,the function cleanup_module() gets invoked. In this function we have to unregister the network driver and free the interrupt handler.

The UART is programmed to transfer the data at a baud rate of 9600 baud. The data packet contains 8 bits, one stop bit and no parity. The UART is programmed to raise the interrupt, when a new data packet is arrived to the system. The IRQ number of COM1 is 4 and that of COM2 is 3.

The data to be transmitted would be arriving at the network interface, encapsulated in the skbuff structure. This skbuff structure has got an important function. The upper layers use this structure to pass the data to the lower layers. When this structure reaches the data link layer the data field of the skbuff is passed to the send_packet() function. This function reads data from the data field of the skbuff structure character by character. Each character is converted in to a data packet consisting a header and a trailer. This header and trailer is added according to the SLIP protocol. This also performs character stuffing. Then the data packets are transmitted through the serial port.

When the incoming data arrives at the serial port, the interrupt handler gets invoked. The handler calls the function recv_packet(). This function performs the slip decoding. That is this function removes the header and trailer of the data packet, and places the character in to a buffer. When the data reception is complete the interrupt handler allocates the memory for an object of the skbuff structure. It sets the various fields of the skbuff structure and copies the buffer in to the data field of the skbuff object and gives this object to the upper protocol layers using the function netif_rx().

When the network driver is activated using the ifconfig command the function whose adress is given in the 'open' field of the structure net_device gets invoked. This function increments the usage count of the network driver module. Similarly when the network driver is brought down the function whose address is given in the 'stop' field of the structure net_device gets invoked. This function decrements the usage count of the network driver module.