a8f5832bc8e50a246187d511011d38069fa7e5eb
[dpdk.git] / doc / guides / prog_guide / source_org.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2014 Intel Corporation.
3
4 **Part 2: Development Environment**
5
6 Source Organization
7 ===================
8
9 This section describes the organization of sources in the DPDK framework.
10
11 Makefiles and Config
12 --------------------
13
14 .. note::
15
16     In the following descriptions,
17     ``RTE_SDK`` is the environment variable that points to the base directory into which the tarball was extracted.
18     See
19     :ref:`Useful_Variables_Provided_by_the_Build_System`
20     for descriptions of other variables.
21
22 Makefiles that are provided by the DPDK libraries and applications are located in ``$(RTE_SDK)/mk``.
23
24 Config templates are located in ``$(RTE_SDK)/config``. The templates describe the options that are enabled for each target.
25 The config file also contains items that can be enabled and disabled for many of the DPDK libraries,
26 including debug options.
27 The user should look at the config file and become familiar with these options.
28 The config file is also used to create a header file, which will be located in the new build directory.
29
30 Libraries
31 ---------
32
33 Libraries are located in subdirectories of ``$(RTE_SDK)/lib``.
34 By convention a library refers to any code that provides an API to an application.
35 Typically, it generates an archive file (``.a``), but a kernel module would also go in the same directory.
36
37 The lib directory contains::
38
39     lib
40     +-- librte_cmdline      # Command line interface helper
41     +-- librte_distributor  # Packet distributor
42     +-- librte_eal          # Environment abstraction layer
43     +-- librte_ether        # Generic interface to poll mode driver
44     +-- librte_hash         # Hash library
45     +-- librte_ip_frag      # IP fragmentation library
46     +-- librte_kni          # Kernel NIC interface
47     +-- librte_kvargs       # Argument parsing library
48     +-- librte_lpm          # Longest prefix match library
49     +-- librte_mbuf         # Packet and control mbuf manipulation
50     +-- librte_mempool      # Memory pool manager (fixed sized objects)
51     +-- librte_meter        # QoS metering library
52     +-- librte_net          # Various IP-related headers
53     +-- librte_power        # Power management library
54     +-- librte_ring         # Software rings (act as lockless FIFOs)
55     +-- librte_sched        # QoS scheduler and dropper library
56     +-- librte_timer        # Timer library
57
58 Drivers
59 -------
60
61 Drivers are special libraries which provide poll-mode driver implementations for
62 devices: either hardware devices or pseudo/virtual devices. They are contained
63 in the *drivers* subdirectory, classified by type, and each compiles to a
64 library with the format ``librte_pmd_X.a`` where ``X`` is the driver name.
65
66 The drivers directory has a *net* subdirectory which contains::
67
68     drivers/net
69     +-- af_packet          # Poll mode driver based on Linux af_packet
70     +-- bonding            # Bonding poll mode driver
71     +-- cxgbe              # Chelsio Terminator 10GbE/40GbE poll mode driver
72     +-- e1000              # 1GbE poll mode drivers (igb and em)
73     +-- enic               # Cisco VIC Ethernet NIC Poll-mode Driver
74     +-- fm10k              # Host interface PMD driver for FM10000 Series
75     +-- i40e               # 40GbE poll mode driver
76     +-- ixgbe              # 10GbE poll mode driver
77     +-- mlx4               # Mellanox ConnectX-3 poll mode driver
78     +-- null               # NULL poll mode driver for testing
79     +-- pcap               # PCAP poll mode driver
80     +-- ring               # Ring poll mode driver
81     +-- szedata2           # SZEDATA2 poll mode driver
82     +-- virtio             # Virtio poll mode driver
83     +-- vmxnet3            # VMXNET3 poll mode driver
84
85 .. note::
86
87    Several of the ``driver/net`` directories contain a ``base``
88    sub-directory. The ``base`` directory generally contains code the shouldn't
89    be modified directly by the user. Any enhancements should be done via the
90    ``X_osdep.c`` and/or ``X_osdep.h`` files in that directory. Refer to the
91    local README in the base directories for driver specific instructions.
92
93
94 Applications
95 ------------
96
97 Applications are source files that contain a ``main()`` function.
98 They are located in the ``$(RTE_SDK)/app`` and ``$(RTE_SDK)/examples`` directories.
99
100 The app directory contains sample applications that are used to test DPDK (such as autotests)
101 or the Poll Mode Drivers (test-pmd)::
102
103     app
104     +-- chkincs            # Test program to check include dependencies
105     +-- cmdline_test       # Test the commandline library
106     +-- test               # Autotests to validate DPDK features
107     +-- test-acl           # Test the ACL library
108     +-- test-pipeline      # Test the IP Pipeline framework
109     +-- test-pmd           # Test and benchmark poll mode drivers
110
111 The examples directory contains sample applications that show how libraries can be used::
112
113     examples
114     +-- cmdline            # Example of using the cmdline library
115     +-- exception_path     # Sending packets to and from Linux TAP device
116     +-- helloworld         # Basic Hello World example
117     +-- ip_reassembly      # Example showing IP reassembly
118     +-- ip_fragmentation   # Example showing IPv4 fragmentation
119     +-- ipv4_multicast     # Example showing IPv4 multicast
120     +-- kni                # Kernel NIC Interface (KNI) example
121     +-- l2fwd              # L2 forwarding with and without SR-IOV
122     +-- l3fwd              # L3 forwarding example
123     +-- l3fwd-power        # L3 forwarding example with power management
124     +-- l3fwd-vf           # L3 forwarding example with SR-IOV
125     +-- link_status_interrupt # Link status change interrupt example
126     +-- load_balancer      # Load balancing across multiple cores/sockets
127     +-- multi_process      # Example apps using multiple DPDK processes
128     +-- qos_meter          # QoS metering example
129     +-- qos_sched          # QoS scheduler and dropper example
130     +-- timer              # Example of using librte_timer library
131     +-- vmdq_dcb           # Example of VMDQ and DCB receiving
132     +-- vmdq               # Example of VMDQ receiving
133     +-- vhost              # Example of userspace vhost and switch
134
135 .. note::
136
137     The actual examples directory may contain additional sample applications to those shown above.
138     Check the latest DPDK source files for details.