Download - 63716148-Lwip-Final
LWIP TCP/IP Stack
Presented byDeepa.s.pillaiR7ARoll no.42
What is LWIP?
An implementation of the TCP/IP protocol stack.
The focus of the lwIP stack is to reduce memory usage and code size suitable for embedded systems.
uses a tailor made API that does not require any data copying.
Features of TCP/IP stack(Traditional version) Designing in a layered
fashion leads to… communication
overhead between layers
Network communication is similar to IPC or file I/O APP can’t aware of the
buffer mechanisms. (e.g. reuse buffers
with frequently used data.)
<Layered model>
Features of TCP/IP stack(LWIP version) Do not maintain a strict layer.
More relaxed scheme for communication between layers.
(By means of shared memory)- APP layer can use the buffer handling mechanisms
used by the lower layers.- APP can more efficiently reuse buffers.
Application process can use the same memory as the networking code App can read and write directly to the internal
buffers. Saving the expense of performing a copy
Hardware and Software Requirements One of Xilinx ML605, SP605, or SP601
Development Boards Xilinx Platform USB Cable RS232 USB Cable A crossover ethernet cable connecting the
board to a Windows or Linux host
Process model of LWIP
All protocols reside in a single process thus are separated from the OS kernel. Allow to be portable across different OS.
APP may either reside in the LWIP process or be in separate processes. Communicate are done by function calls. Or a more abstract API.
The operating system emulation layers
OS specific function calls and data structures are not used directly in the code. The operating system emulation layer is used.
The OS emulation layer provides Timers, process synchronization, message
passing mechanisms, and so on.
Porting to a different OS Only need the operating system emulation
layer.
Buffer and memory management
Packet buffers – pbufs LWIP’s internal representation of a packet, Designed for the special needs of the
minimal stack.
Types of pbufs PBUF_RAM, PBUF_ROM, PBUF_POOL A pbuf chain may consist of multiple types
of pbufs.
PBUF_RAM pbuf
has the packet data stored in memory managed by the pbuf subsystem.
used when an application sends data that is dynamically generated.
PBUF_ROM pbuf
Used when an application sends data that is located in memory managed by the application.
The main use is when the data is located in ROM Header that are prepended to the data in a
PBUF_ROM pbuf are stored in a PBUF_RAM pbuf.
PBUF_POOL Consist of fixed size pbufs allocated from a pool of fixed
size pbufs. Mainly used by network device drivers since the operation
of allocating a single pbuf is fast and is therefore suitable for use in an interrupt handler
Network interfacesThe network interfaces are kept on a global linked list.
Reflect the kind of H/WEx) Bluetooth => bt
WLAN => wlThe function the device
driver should call when a packet has been received.
The function in the device driver that transmits a packet on the physical network and it is called by the IP layer when a
packet is to be sent.
Points to device driver specific state for the network interface and is set by the device driver.
IP processing(1/3)
Receiving packets Network device driver calls ip_input() function.
Checking IP version, header length Computing the header checksum Checking destination address.
Sending packets Handled by the function ip_output()
Find the appropriate network interface. All IP header fields are filled. IP header checksum is computed. The source and destination address are passed.
IP processing(2/3)
Forwarding packets The packet should be forwarded…
When none of the network interfaces has the same IP address as an incoming packet’s destination address.
This is done by the function ip_forward() ttl field is decreased. If ttl reaches zero, an ICMP error message is
sent.
IP processing(3/3)
ICMP processing This is for ICMP ECHO message. Just swapping the IP destination
and source address of the incoming packet.
TCP processing(1/2)
Next sequence number
Receiver’s window
Timer for TIME-WAIT
state
Used when passing received data to the
application layer.
Function to call when a listener has been
connected.
TCP processing(2/2)
Application Program Interface
The LWIP socket API Utilizes knowledge of the internal structure of
LWIP to achieve effectiveness. Does not require that data is copied. Since the application program can manipulate
the internal buffers directly.
Applications
Echo server Web server TFTP server
Echo Server
A simple program that echoes input that is sent to the program via the network.
The socket mode echo server is structured as follows:
A main thread listens continually on a specified echo server port.
For each connection request,it spawns a separate echo service thread.
It then continues listening on the echo port.
Web Server
Reference for a TCP based application. Implements only a subset of the HTTP1.1
protocol. Web sever demonstrates these features: Accessing files residing on a memory file
system via HTTP GET commands. Controlling the LED lights on the development
board using the HTTP POST command.
TFTP Server(Trivial File Transfer Protocol) UDP based protocol for sending and receiving
files A main thread listens on the TFTP port and
spawns a new TFTP thread for each incoming connection request
It support either read or write requests
Conclusion(1/2)
Lwip is an open source networking stack designed for embedded systems
Echo server provides a simple starting point for networking applications
Web server application show a more complex TCP based application
Conclusion(2/2)
So applications to measure receive and transmit throughput provide an indication of the maximum possible throughput using lwip with Xilinx adapters.
REFERNCES
1.lwIP – A Lightweight TCP/IP Stack– CVS Repositories
2. RFC 1350 – The TFTP Protocol 3. iperf software 4. XAPP1043 Measuring Treck TCP/IP
Performance Using the XPS LocalLink TEMAC in an Embedded Processor
THANK YOU!!!!
QUESTIONS??????????