Tải bản đầy đủ (.pdf) (254 trang)

Embedding TCP_IP Working Through Implementation Challenges

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (7.36 MB, 254 trang )

Renesas Electronics America Inc.
© 2012 Renesas Electronics America Inc. All rights reserved.
Embedding TCP/IP
Working Through Implementation Challenges
Micriµm
© 2012 Renesas Electronics America Inc. All rights reserved.2
Micriµm
Renesas Technology & Solution Portfolio
© 2012 Renesas Electronics America Inc. All rights reserved.3
Micriµm
Introduction : Objectives
Block 1 : What is a TCP/IP stack?
Block 2
: Embedded system requirements
Block 3
: LAN = Ethernet
Block 4 : ARP Operation
Block 5 : Hardware/Software setup
Block 6 : IPv4 Addressing
Block 7 : IPv6 Addressing
Block 8 : Troubleshooting connection
Block 9 : Transport protocols
Block 10 : Network services and application
Agenda
© 2012 Renesas Electronics America Inc. All rights reserved.4
Micriµm
Objectives
 Learn to use TCP/IP properly from the start.
 Understand the requirements difference to perform IP
connectivity versus IP performance.
 Perform TCP/IP networking activities. Record network traffic


and analyze results.
© 2012 Renesas Electronics America Inc. All rights reserved.5
MicriµmMicriµm
Block 1
What is a TCP/IP stack?
© 2012 Renesas Electronics America Inc. All rights reserved.6
Micriµm
What is a TCP/IP stack?
The Internet Protocol suite—like many protocol suites—can be viewed as a set
of layers.
Each layer solves a set of problems involving the transmission of data, and
provides a well-defined service to the upper layer protocols based on using
services from some lower layers.
Upper layers are logically closer to the user and deal with more abstract data,
relying on lower layer protocols to translate data into forms that can
eventually be physically transmitted.
It has also been referred to as the TCP/IP protocol suite, which is named after
two of the most important protocols in it: the Transmission Control Protocol
(TCP) and the Internet Protocol (IP), which were also the first two IP
networking protocols defined.
© 2012 Renesas Electronics America Inc. All rights reserved.7
Micriµm
1. Device Drivers
Physical (hardware)
2. Network Access
3. Internet
5-6-7. Application
4. Transport
Telnet, FTP, TFTP, HTTP,
BOOTP, DHCP, SNMP

Socket API
TCP, UDP
IP, ARP, ICMP
PPP,SLIP, Ethernet
User
data
Physical Devices
App
Header
TCP Segment
Application dataTCP
Header
Application dataTCP
Header
IP
Header
IP Datagram
14
Application data
4
2020
46 to 1500 bytes
Ethernet Frame
Transport Protocol
Messages
Network-Specific
Frames
User Data
(Messages or Streams)
Ethernet

Trailer
TCP
Header
IP
Header
IP Datagrams
Layers in the Internet Protocol suite
Ethernet
Header
User
data
What is a TCP/IP stack?
The TCP/IP reference model consists of four layers plus the physical layer.
© 2012 Renesas Electronics America Inc. All rights reserved.8
Micriµm
Layered communication
© 2012 Renesas Electronics America Inc. All rights reserved.9
Micriµm
TCP/IP Protocol Architecture
Protocol Family
© 2012 Renesas Electronics America Inc. All rights reserved.10
Micriµm
The starting point
1. Device Drivers
Physical (hardware)
2. Network Access
3. Internet
5-6-7. Application
4. Transport
Telnet, FTP, TFTP, HTTP,

BOOTP, DHCP, SNMP
Socket API
TCP, UDP
IP, ARP, ICMP
PPP,SLIP, Ethernet
Physical Devices
Ethernet
Applications
and services
Implementing
TCP/IP
Understanding
TCP/IP
© 2012 Renesas Electronics America Inc. All rights reserved.11
MicriµmMicriµm
Block 2
Requirements
 Performance
 Connectivity only
Or

Throughput?
© 2012 Renesas Electronics America Inc. All rights reserved.12
Micriµm
Performance
CPU
Most embedded targets are slower consumers
when compared to laptop and desktop
computers.
Packets generated by a faster producer and

received by the target will consume most or all
NIC network buffers and some packets will be
dropped.
Hardware features such as DMA and CPU speed
can improve this situation. The latter is trivial,
the faster the target can receive and process the
packets, the faster the network buffers can be
freed.
© 2012 Renesas Electronics America Inc. All rights reserved.13
Micriµm
Requirements
Footprint
For connectivity, a TCP/IP stack or a subset of it
can be implemented with very few RAM
(approximately 32K).
For a few Megabits per second, a more complete
TCP/IP stack is required. In this case, embedded
system requirements dictate in the range of 96K
of RAM for a minimal sustained throughput.
Resources need to be allocated to the protocol
stack so that it can perform its duties.
© 2012 Renesas Electronics America Inc. All rights reserved.14
Micriµm
Memory Usage Summary
of our setup
Module ROM Bytes RAM Bytes RAM %
Estimated µC/LIB ROM / RAM Usage 5380 0 0.00%
Estimated TCP-IP ROM / RAM Usage 106779 41976 61.03%
Estimated RTOS ROM / RAM Usage 29114 9852 14.32%
Estimated Probe ROM / RAM Usage 6231 5684 8.26%

Estimated HTTPs ROM / RAM Usage 7121 8756 12.73%
Estimated µC/CPU ROM / RAM Usage 1104 58 0.08%
Estimated App + BSP Code ROM / RAM Usage 9905 1338 1.95%
Other ROM / RAM Usage (cstartup, µC/CPU, CPU, µC/LCD, ) 7406 1120 1.63%
Total Code 173040
Total RAM Data 68784
8 receive buffers
8 large transmit buffers
2 small transmit buffers
3 receive descriptors
8 transmit descriptors
© 2012 Renesas Electronics America Inc. All rights reserved.15
Micriµm
Requirements
Protocols and services
Optional protocols:
IGMP
ICMP
TCP Congestion control
TCP keepalive
TCP
IP fragmentation
© 2012 Renesas Electronics America Inc. All rights reserved.16
MicriµmMicriµm
Questions?
© 2012 Renesas Electronics America Inc. All rights reserved.17
MicriµmMicriµm
Block 3
LAN = Ethernet
Why Ethernet?

Because Ethernet is the ubiquitous LAN (Local Area Network)
Most of the world wide data initiates or terminates on an
Ethernet port (>99%).
Embedded systems sometimes use serial links (SLIP, PPP or PPPoE)
© 2012 Renesas Electronics America Inc. All rights reserved.18
Micriµm
Ethernet technology
Regardless of the speed, the following aspects are always the
same :
 Frame format
 Access method
S
PEED
S
TANDARD
10 MBPS IEEE 802.3
100 MBPS IEEE 802.3u
1000 MBPS IEEE 802.3z
10,000 MBPS IEEE 802.3ae
Supports various speed :
© 2012 Renesas Electronics America Inc. All rights reserved.19
Micriµm
Ethernet technology
Topology
1st Generation
Today
© 2012 Renesas Electronics America Inc. All rights reserved.20
Micriµm
Ethernet 802.3 Frame Structure
802.3 frame format

PRE Preamble
SFD Start Frame Delimiter
DA Destination address
SA Source address
LEN Length
DATA ….
PAD Padding
FCS Frame check sequence
© 2012 Renesas Electronics America Inc. All rights reserved.21
Micriµm
Unicast (point to point)
00-02-0C-4B-59-78 = unique station address
Traffic types
© 2012 Renesas Electronics America Inc. All rights reserved.22
Micriµm
Broadcast (point to all-point)
FF-FF-FF-FF-FF-FF = all stations group address
Traffic types
© 2012 Renesas Electronics America Inc. All rights reserved.23
Micriµm
Multicast (point to a group)
01-80-C2-00-00-01 = spanning tree group address
Traffic types
© 2012 Renesas Electronics America Inc. All rights reserved.24
Micriµm
Network buffers
A TCP-IP stack network buffer includes the Ethernet frame and
metadata to manage the buffer.
Header Ethernet Frame
Network Buffer

Typically 1518
(1520 for alignment)
A TCP/IP stack places received packets in network buffers to be processed by the upper
protocol layers and also places data to send in network buffers for transmission. Network
buffers are data structure defined in RAM.
The data portion of the network buffer contains the application data and protocol headers.
© 2012 Renesas Electronics America Inc. All rights reserved.25
Micriµm
Drivers
 Ethernet controllers require ‘drivers’
– The software that interfaces between the TCP/IP stack and
the Ethernet controller
 Could be complex depending on the Ethernet controller
(1000-3000 lines)
 Two most popular Ethernet controller types
– Has dedicated memory
– Uses main memory
 TCP/IP uses main memory for ‘network buffer’
– Ethernet packets need to be transferred to these network
buffers

Either copied by the CPU or through a DMA controller

×