+ All Categories
Home > Documents > Lwip Final

Lwip Final

Date post: 29-Nov-2014
Category:
Upload: aswathy-subash
View: 245 times
Download: 20 times
Share this document with a friend
Popular Tags:
28
LWIP TCP/IP Stack Presented by Deepa.s.pillai R7A Roll no.42
Transcript
Page 1: Lwip Final

LWIP TCP/IP Stack

Presented byDeepa.s.pillaiR7ARoll no.42

Page 2: Lwip Final

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.

Page 3: Lwip Final

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>

Page 4: Lwip Final

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

Page 5: Lwip Final

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

Page 6: Lwip Final

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.

Page 7: Lwip Final

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.

Page 8: Lwip Final

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.

Page 9: Lwip Final

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.

Page 10: Lwip Final

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.

Page 11: Lwip Final

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

Page 12: Lwip Final

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.

Page 13: Lwip Final

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.

Page 14: Lwip Final

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.

Page 15: Lwip Final

IP processing(3/3)

ICMP processing This is for ICMP ECHO message. Just swapping the IP destination

and source address of the incoming packet.

Page 16: Lwip Final

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.

Page 17: Lwip Final

TCP processing(2/2)

Page 18: Lwip Final

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.

Page 19: Lwip Final

Applications

Echo server Web server TFTP server

Page 20: Lwip Final

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.

Page 21: Lwip Final

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.

Page 22: Lwip Final

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

Page 23: Lwip Final

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

Page 24: Lwip Final

Conclusion(2/2)

So applications to measure receive and transmit throughput provide an indication of the maximum possible throughput using lwip with Xilinx adapters.

Page 25: Lwip Final

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

Page 26: Lwip Final

THANK YOU!!!!

Page 27: Lwip Final

QUESTIONS??????????

Page 28: Lwip Final

Recommended