source_org.rst revision 6b3e017e
1..  BSD LICENSE
2    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms, with or without
6    modification, are permitted provided that the following conditions
7    are met:
8
9    * Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11    * Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in
13    the documentation and/or other materials provided with the
14    distribution.
15    * Neither the name of Intel Corporation nor the names of its
16    contributors may be used to endorse or promote products derived
17    from this software without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31**Part 2: Development Environment**
32
33Source Organization
34===================
35
36This section describes the organization of sources in the DPDK framework.
37
38Makefiles and Config
39--------------------
40
41.. note::
42
43    In the following descriptions,
44    ``RTE_SDK`` is the environment variable that points to the base directory into which the tarball was extracted.
45    See
46    :ref:`Useful_Variables_Provided_by_the_Build_System`
47    for descriptions of other variables.
48
49Makefiles that are provided by the DPDK libraries and applications are located in ``$(RTE_SDK)/mk``.
50
51Config templates are located in ``$(RTE_SDK)/config``. The templates describe the options that are enabled for each target.
52The config file also contains items that can be enabled and disabled for many of the DPDK libraries,
53including debug options.
54The user should look at the config file and become familiar with these options.
55The config file is also used to create a header file, which will be located in the new build directory.
56
57Libraries
58---------
59
60Libraries are located in subdirectories of ``$(RTE_SDK)/lib``.
61By convention a library refers to any code that provides an API to an application.
62Typically, it generates an archive file (``.a``), but a kernel module would also go in the same directory.
63
64The lib directory contains::
65
66    lib
67    +-- librte_cmdline      # Command line interface helper
68    +-- librte_distributor  # Packet distributor
69    +-- librte_eal          # Environment abstraction layer
70    +-- librte_ether        # Generic interface to poll mode driver
71    +-- librte_hash         # Hash library
72    +-- librte_ip_frag      # IP fragmentation library
73    +-- librte_kni          # Kernel NIC interface
74    +-- librte_kvargs       # Argument parsing library
75    +-- librte_lpm          # Longest prefix match library
76    +-- librte_mbuf         # Packet and control mbuf manipulation
77    +-- librte_mempool      # Memory pool manager (fixed sized objects)
78    +-- librte_meter        # QoS metering library
79    +-- librte_net          # Various IP-related headers
80    +-- librte_power        # Power management library
81    +-- librte_ring         # Software rings (act as lockless FIFOs)
82    +-- librte_sched        # QoS scheduler and dropper library
83    +-- librte_timer        # Timer library
84
85Drivers
86-------
87
88Drivers are special libraries which provide poll-mode driver implementations for
89devices: either hardware devices or pseudo/virtual devices. They are contained
90in the *drivers* subdirectory, classified by type, and each compiles to a
91library with the format ``librte_pmd_X.a`` where ``X`` is the driver name.
92
93The drivers directory has a *net* subdirectory which contains::
94
95    drivers/net
96    +-- af_packet          # Poll mode driver based on Linux af_packet
97    +-- bonding            # Bonding poll mode driver
98    +-- cxgbe              # Chelsio Terminator 10GbE/40GbE poll mode driver
99    +-- e1000              # 1GbE poll mode drivers (igb and em)
100    +-- enic               # Cisco VIC Ethernet NIC Poll-mode Driver
101    +-- fm10k              # Host interface PMD driver for FM10000 Series
102    +-- i40e               # 40GbE poll mode driver
103    +-- ixgbe              # 10GbE poll mode driver
104    +-- mlx4               # Mellanox ConnectX-3 poll mode driver
105    +-- null               # NULL poll mode driver for testing
106    +-- pcap               # PCAP poll mode driver
107    +-- ring               # Ring poll mode driver
108    +-- szedata2           # SZEDATA2 poll mode driver
109    +-- virtio             # Virtio poll mode driver
110    +-- vmxnet3            # VMXNET3 poll mode driver
111    +-- xenvirt            # Xen virtio poll mode driver
112
113.. note::
114
115   Several of the ``driver/net`` directories contain a ``base``
116   sub-directory. The ``base`` directory generally contains code the shouldn't
117   be modified directly by the user. Any enhancements should be done via the
118   ``X_osdep.c`` and/or ``X_osdep.h`` files in that directory. Refer to the
119   local README in the base directories for driver specific instructions.
120
121
122Applications
123------------
124
125Applications are source files that contain a ``main()`` function.
126They are located in the ``$(RTE_SDK)/app`` and ``$(RTE_SDK)/examples`` directories.
127
128The app directory contains sample applications that are used to test DPDK (such as autotests)
129or the Poll Mode Drivers (test-pmd)::
130
131    app
132    +-- chkincs            # Test program to check include dependencies
133    +-- cmdline_test       # Test the commandline library
134    +-- test               # Autotests to validate DPDK features
135    +-- test-acl           # Test the ACL library
136    +-- test-pipeline      # Test the IP Pipeline framework
137    +-- test-pmd           # Test and benchmark poll mode drivers
138
139The examples directory contains sample applications that show how libraries can be used::
140
141    examples
142    +-- cmdline            # Example of using the cmdline library
143    +-- dpdk_qat           # Sample integration with Intel QuickAssist
144    +-- exception_path     # Sending packets to and from Linux TAP device
145    +-- helloworld         # Basic Hello World example
146    +-- ip_reassembly      # Example showing IP reassembly
147    +-- ip_fragmentation   # Example showing IPv4 fragmentation
148    +-- ipv4_multicast     # Example showing IPv4 multicast
149    +-- kni                # Kernel NIC Interface (KNI) example
150    +-- l2fwd              # L2 forwarding with and without SR-IOV
151    +-- l3fwd              # L3 forwarding example
152    +-- l3fwd-power        # L3 forwarding example with power management
153    +-- l3fwd-vf           # L3 forwarding example with SR-IOV
154    +-- link_status_interrupt # Link status change interrupt example
155    +-- load_balancer      # Load balancing across multiple cores/sockets
156    +-- multi_process      # Example apps using multiple DPDK processes
157    +-- qos_meter          # QoS metering example
158    +-- qos_sched          # QoS scheduler and dropper example
159    +-- timer              # Example of using librte_timer library
160    +-- vmdq_dcb           # Example of VMDQ and DCB receiving
161    +-- vmdq               # Example of VMDQ receiving
162    +-- vhost              # Example of userspace vhost and switch
163
164.. note::
165
166    The actual examples directory may contain additional sample applications to those shown above.
167    Check the latest DPDK source files for details.
168