You are on page 1of 4

Introduction to TCP/IP over Ethernet

Sören Wellhöfer
soeren.wellhoefer@gmx.net
November 1, 2009

This document present a brief disquisition other’s hardware or MAC (Media Access Con-
about the fundamental concepts involved in trol) address if only the higher-level IP ad-
TCP/IP networking over Ethernet. The focus dress is know. MAC addresses are unique to
is put on explaining broader concepts rather each piece of hardware equipment; it must be
than on technical details; it is attempted to known because Ethernet frames are generally
foster a wider general understanding of the sent to a specific MAC address.
subject matter in those without prior knowl- An IP datagram, being encapsuled in an Eth-
edge. ernet frame, in turn dedicates a specific section
The text has a slight bias towards pinpoint- of space for arbitrary data that can for instance
ing bandwidth-weak spots in the area of em- be used by more upper-layer protocols such
bedded computing with Linux. as TCP (Transmission Control Protocol) or UDP
(User Datagram Protocol).
Because Ethernet as a networking technol-
1 Frames, Datagrams, and Packets
ogy and IP as a networking protocol are in-
Most of the TCP/IP networking done today is herently unreliable, meaning packets sent are
grounded in Ethernet. As a fundamental com- never guaranteed to arrive, a more advanced
puter networking technology it is classified to protocol becomes necessary to cater to the
belong to the lowest, the Physical Layer of the needs of reliability.
OSI1 reference model. TCP provides reliability by employing a
Data is transmitted in big-endian byte or- set of rather elaborate control and verification
der2 in consecutive packets called frames; each mechanism, amongst those being the concept
of them delimited by a distinctive bit pattern of ports, checksums, and acknowledgements.
called preamble. A simple one, for instance, is that TCP is a
stateful protocol whereas IP itself is stateless.
An Ethernet frame provides a section of
This simply means that TCP keeps track of
space dedicated for a payload of arbitrary data;
connection states between two hosts saying
it must be between 46 and 1500 bytes in size.
whether they are connected, transmitting data
Usually this section is fully or partially used
or are about to disconnect.
up by IP datagrams. The Internet Protocol (IP)
It must be pointed out that TCP’s responsi-
sets a layer of abstraction on top of Ethernet
bilities only lie in point-to-point connections
and defines an addressing scheme by which
between two computers; it is not at all con-
it is possible for nodes on a network to com-
municate with each solely by knowing each 1. The OSI (Open System Interconnection) reference
other’s IP address. With this IP implements the model is a layered-abstraction model with which it is
Network Layer of the OSI reference model. attempted to characterize different computer networking
The Data Link Layer, which is an interme- and communication technologies by associating them
with a particular layer. On the lowest layer, the Phys-
diate layer between the Physical and Network
ical Layer, it categorizes close-to-hardware technologies
one, is implemented by the Address Resolution whereas on the highest layer it places those closer to the
Protocol, or ARP. Through ARP it is possible end user.
for computers on a network to find out each 2. Also sometimes seen referred to as network byte order.

1
cerned with addressing or packet delivery as Oftentimes it is the case that for a given path
this is taken care of by IP and Ethernet, which in a network along multiple hops, the MTU
are underlying technologies. is of a much smaller size than the maximum
Furthermore, TCP aims at creating the illu- allowable value of 1500. This is owed by the
sion of having a continuous data stream be- fact that many routers, firewalls or switches
tween two applications on either side of the part of the path have to downsize this quan-
network connection. This allows programs tity. Sometimes it is ineluctable for them to
running on two totally unrelated computer do so because for them it represents a means
systems to communicate with each other over of controlling the traffic flowing through them,
a channel that much resembles the interface lest their buffers get filled up too quickly and
that pipes or Unix domain sockets provide for it would become necessary to revert to more
applications running on the same host. drastic methods such as dropping whole pack-
TCP implements the Transport Layer of the ets altogether; understandably, this is even
OSI reference model that sits on top of those worse.
previously mentioned and directly interacts If a packet of certain size is transmitted along
with the Session Layer, the first one that ex- a network path and subsequently encounters
hibits indispensable significance for all pro- a station whose MTU is set to a smaller value
grams settled on higher levels; those all rely than the packet’s size, the router or firewall
on the stream-based network connections pro- will usually opt for fragmenting it up into
vided by TCP. several pieces, that is into several IP packets.
Together IP and TCP are often said to form This, as a rule, is deemed undesirable be-
the Internet Protocol Suite which is also some- cause it is quite inefficient - a whole Ether-
times plainly called TCP/IP; it is the founda- net frame including protocol headers and IP
tion of most of the Internet as we now know it datagram and that in most cases carries only
today. the left-overs byte chunks from a larger frag-
The Ethernet payload value of 1500 bytes mented one is created as a result.
mentioned earlier is often referred to as Max- To avoid this inexpedient situation it is pos-
imum Transmission Unit, short MTU. As sug- sible for a network controller to lower the Max-
gested by the name itself, the MTU value rep- imum Transmission Unit (MTU) of the packets
resents the maximum amount of data that can egressing its interface. Unfavourably, it can
be transported over a network connection in only do so indirectly by altering the Maximum
one go. Segment Size (MSS); the extra space taken away
There exists another quantity named Maxi- by the TCP/IP headers from the datagram size
mum Segment Size, or MSS, which is the size of must remain unchanged.
the current MTU minus that which whatever is Obviously, the efficiency in terms of useful
occupied by the IP and TCP headers together; payload goes down when the MSS is lowered
this is usually 20 bytes for each, adding up to further, as an increasingly larger percentage of
a total of 40 bytes. So for a maximum MTU of header information is used for a decreasingly
1500 bytes, the MSS would be 1460 bytes due smaller percentage of actual data. This un-
to the 40 bytes being used up already. doubtedly affects the overall bandwidth neg-
MSS as a notion expresses the amount of atively.
data that is now truly available for any kind It is furthermore possible for computers at
of user data. The term “maximum” in its name the two endpoints of a path to dynamically
can be understood in the sense of that which is adapt their currently transmitted MTU de-
truly useable as the payload of user data. pending on the circumstances of the path itself;

2
this is called MTU path discovery and can help encompassing network that is endangered of
to reduce fragmentation tremendously. More being flooded with data from many unlikely
on it is given in the next section. sources.
Limiting factors that this paper is concerned
with the most are revolving around the issue
2 TCP Flow and Congestion Control that the embedded systems might not be able
to handle extensive networking traffic when
As was said previously, the mechanisms em-
under high loads because of the tasks running
ployed by TCP are of a rather complex nature
on them besides the exclusive control of their
and hard to grasp in one swift glance. Hence,
networking interfaces. Moreover, the user-
the effort is brought forth in this section to
space applications run on embedded Linux
briefly outline those portions of the TCP proto-
systems are supposed to do all kinds of actual
col which are crucial in gaining an understand-
work with the data sent through the network,
ing of how flow control is achieved.
thereby imposing additional work loads to be
Flow control is a mechanism of administer- coped with. The effects on responsiveness and
ing the transmission rate between two con- overall systems performance are things to be
nected network nodes and is always done by monitored closely.
the receiving end of a connection; it reports
back to the sender and discloses to him how
much data it is currently able to handle. With 3 Acknowledgments, Transmission
this information the sender is able to adjust Buffers, and the Sliding Window
his output rate to such a degree that possible Principle
sources of delay are obviated altogether, thus
smoothing the flow. Not accidentally, this Realiability in TCP mainly comes from the
makes better use of the total bandwidth at fact that if a packet of certain size is sent and
hand. subsequentially received by the receiving side,
It was also mentioned earlier that TCP uses the packet gets buffered first and an acknowl-
many progressive algorithms for congestion edgement packet is sent back to the sending
control, which disguises a related but yet fun- side, acknowledging this specific packet. Only
damentally different concept in the discipline if the acknowledgement is received by the
of TCP networking. Congestion control is gen- sender will an acknowledgement be sent to
erally manged by the sender and is a way of the sender. In this acknowledgement of the
bypassing discommodious situations that arise acknowledgement, the sender acknowledges
when a network is used by many demanding that it has received the first acknowledgement
hosts all at once, thus threatening to congest from the sender. Only now can the sender
the network in unfathomable ways. Once move the data out from the receiving buffer
congested, a network may have worsened re- and free the space for other incoming packets.
sponse times that can lead to many problems This buffer is commonly called the receiv-
such as heightened delay times with negative ing buffer; in Linux it has a size of about 65
effects on bandwidth as a whole. kbytes. If it is full, the sender may not transmit
The main emphasise in this document is, any data anymore because the receiver is not
however, placed on flow control because capable of buffering it. Through this method,
in the area of embedded networking it is the receiver does what is called flow control; it
rather unlikely to occur that a larger num- tells the sender when it may send data so that
ber of bandwidth-demanding embedded sys- the receiver takes only this what it can take.
tems will be linked together in one all- This is the basic idea behind the whole sub-

3
ject; however, there is still a little more com- 4 UDP
plexity behind all this which is expressed in
the notion of the receiver telling the sender To throw another protocol into the discussion,
not only when to send, but also how much to let us take a look at UDP (User Datagram Pro-
send. This concept is called the sliding window tocol), one of TCP’s close relatives. It was
principle. designed to allow servers and other computers
on a network to send and receive messages
What this basically means is that when the in the form of minimalistic datagrams. UDP,
the available size of the receive buffer shrinks, unlike TCP, does not maintain an elaborate
the receiving side reports the amount it is now header that would puff up the data frame size.
capable of receiving to the sender by including This would for once already eliminate the huge
this number in the acknowledgment sent to the data overhead created by TCP.
sender for the previously received packet. This There is not communication prior to trans-
size which the receiver reports (or advertises) mitting data nor is there anything like the
to the sender is called the advertised window ordering of packets that have arrived from a
size. The sending side will never send more particual host. This is why UDP is generally
data than is given as the advertised window said to be an unreliable protocol. By virtue of
size. If the advertised window size is zero this particular fact UDP is not suitable when it
the buffer is full and the scenario that was is important to communicate information that
described above occurs; no data will be sent are to be received at the other end, not even for
until the advertised window size is larger than smaller amounts of data.
zero again. Though not originally indented for, UDP
nowadays often finds an application in con-
The “sliding” part about the sliding window texts where huge amounts of data must be
principle is that the window of the amount of transferred and a certain loss rate is tolerable.
data that the sender is willing to receive looks For instance for VoIP or video streaming a loss
as if it is sliding along. The front edge of this of 40% total does still produce usable results.
window is represented by the amount of data Seen from the embedded side of computing,
the that is already received an acknowledged; UDP might be an option if there either aren’t
the end is formed by the amount of data the many sources of noise inside a network that
receiver is still willing to take. could defer the UDP datagram packet from
All this makes the flow control more subtle arriving, or if the application context closely
and fine-grained for the receiver to perform. resembles that kind of bulk data transfer which
Recall that the whole idea behind all this is not has been discribed in the previous paragraph.
to overflow the receiving side and let it decide
how much it can take.

The large protocol overhead and the some-


times long lasting retransmission times render
TCP an ineffective protocol for uses in real-
time applications. However, for bulk and
streaming data traffic it offers advanced mech-
anisms of congestion and flow control while
guaranteeing the dilvery of segements of data
one hundredt percent; this might be efficacious
for the goal of optimizing total bandwidth use.

You might also like