packet reception, the bottom-half is implemented us-
ing a technique called soft irqs (Love, 2004).
3.2.2 NAPI and NOT NAPI Top-halves
The top-half part can be implemented in two styles:
the classic style and the NAPI (New API) style (Ben-
venuti, 2005). This has deep implications for accurate
timestamping arriving packets.
In the classic implementation, the arriving packets
are processed by the top-half one by one; therefore,
every time a packet is received, the interrupt context
is accessed. The main kernel function implementing
the classic top-half is the
netif rx()
function that is
invoked every time an interrupt is fired. The problem
with this implementation is that in high speed inter-
faces, under heavy traffic conditions, entering the in-
terrupt context for every packet could imply that the
packets are processed slower than received. This can
cause NIC buffer overload and packet losing.
For solving these issues, NAPI was introduced
in the 2.4.20 kernel version. It implements the
top-half with a combination of polling and inter-
rupts for minimizing the time spent in interrupt con-
text. The main functions implementing the NAPI
top-half in the kernel are
netif rx schedule()
and
napi schedule()
.
It is not in the scope of this paper deeply explain
NAPI, but it is important to note that in this context,
the real arrival-time of the packets is lost. According
to this, it is necessary to use the classic top-half style
to obtain precise and real packet arrival-times.
4 IMPLEMENTATION
4.1 General Scheme
An schematic representation of the developed tool can
be seen in Figure 1, showing its different blocks.
The logic of the measurement system is integrated
into a Graphical User Interface (Logic Module in the
scheme). This logic module performs the measuring
procedure using the services of an external user-space
application (Support Application in the scheme). This
application acts as a middleware between the logic
module and the kernel part of the tool, making the
execution of the individual measures possible. In this
manner, the real control of the kernel functionality is
done by this application.
The timestamping and packet sending functionali-
ties are implemented in the kernel, which are the core
of the tool. For this, a new socket family was devel-
oped from the Linux Raw Socket family (module la-
beled as Modified Raw Socket in Figure 1). This new
kind of socket sends and receives the prove packets
with no intervention from the user space (i.e., without
context switching), in order to fulfill the back-to-back
traffic generation requirement.
The highly accurate packet timestamping system
is composed of both the socket family and the Linux
kernel top-half functions (the modified version). In
the top-half reception functions, the arrival-times of
the packets of the specific protocol are measured and
introduced in the data field of the packets. By doing
this, the goal of taking accurate arrival-times is ful-
filled. These times are later extracted from the pack-
ets at socket level, making possible a high accurate
capacity estimation.
Furthermore, as it has been explained in previous
sections, the drivers of the NICs were also modified
for obtaining real packet arrival-times.
4.2 Logic Module and Support App
As it has been said, the term Logic Module refers
to an user application developed for controlling the
measurement process and retrieving the results. It is
written in Java and includes a graphical user interface
written using SWT (Standard Widget Toolkit).
Using this interface, the user of the tool defines
the remote host for performing the capacity measure
(which, of course, has also to be using the tool). Af-
ter this, the Logic Module performs a traceroute for
obtaining the different hopes in the path between lo-
cal host and remote host, and displays the obtained
path in the interface. Then, the user selects the link
which capacity is intended to be measured and indi-
cates the Logic Module starting the measure proce-
dure. At this moment, the Logic Module coordinates
the execution of the different individual measures (via
the Support Application) and stores all the individual
results. Once all this process is done, the Logic Mod-
ule computes the final result and shows it in the inter-
face.
The Support Application is written in C language
and provides services to the Logic Module, connect-
ing it with the in-kernel implementation. In this man-
ner, it sends the requests from the Logic Module to
the Modified Socket using a set of IOCTL calls (Ben-
venuti, 2005) written for that purpose.
4.3 Modified RAW Socket
It has been developed using the Linux Raw Socket
Family (written in the /net/packet/af packet.c file),
adding to this kind of sockets capabilities for perform-
ing the individual measures with no intervention from
ACCURATE PACKET TIMESTAMPING ON LINUX PLATFORMS FOR PRECISE CAPACITY ESTIMATION - An
Implementation of a Highly Accurate Timestamping System Embedded in the Linux Kernel and its Application to
Capacity Estimation
139