summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 4cc283b5e530fd12246a33599306cb375fdc26ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Vector Packet Processing
========================

## Introduction

The VPP platform is an extensible framework that provides out-of-the-box
production quality switch/router functionality. It is the open source version
of Cisco's Vector Packet Processing (VPP) technology: a high performance,
packet-processing stack that can run on commodity CPUs.

The benefits of this implementation of VPP are its high performance, proven
technology, its modularity and flexibility, and rich feature set.

For more information on VPP and its features please visit the
[FD.io website](http://fd.io/) and
[What is VPP?](https://wiki.fd.io/view/VPP/What_is_VPP%3F) pages.


## Changes

Details of the changes leading up to this version of VPP can be found under
@ref release_notes.


## Directory layout

| Directory name         | Description                                 |
| ---------------------- | ------------------------------------------- |
|      build-data        | Build metadata                              |
|      build-root        | Build output directory                      |
|      doxygen           | Documentation generator configuration       |
|      dpdk              | DPDK patches and build infrastructure       |
| @ref extras/libmemif   | Client library for memif                    |
| @ref src/examples      | VPP example code                            |
| @ref src/plugins       | VPP bundled plugins directory               |
| @ref src/svm           | Shared virtual memory allocation library    |
|      src/tests         | Standalone tests (not part of test harness) |
|      src/vat           | VPP API test program                        |
| @ref src/vlib          | VPP application library                     |
| @ref src/vlibapi       | VPP API library                             |
| @ref src/vlibmemory    | VPP Memory management                       |
| @ref src/vnet          | VPP networking                              |
| @ref src/vpp           | VPP application                             |
| @ref src/vpp-api       | VPP application API bindings                |
| @ref src/vppinfra      | VPP core library                            |
| @ref src/vpp/api       | Not-yet-relocated API bindings              |
|      test              | Unit tests and Python test harness          |

## Getting started

In general anyone interested in building, developing or running VPP should
consult the [VPP wiki](https://wiki.fd.io/view/VPP) for more complete
documentation.

In particular, readers are recommended to take a look at [Pulling, Building,
Running, Hacking, Pushing](https://wiki.fd.io/view/VPP/Pulling,_Building,_Run
ning,_Hacking_and_Pushing_VPP_Code) which provides extensive step-by-step
coverage of the topic.

For the impatient, some salient information is distilled below.


### Quick-start: On an existing Linux host

To install system dependencies, build VPP and then install it, simply run the
build script. This should be performed a non-privileged user with `sudo`
access from the project base directory:

    ./extras/vagrant/build.sh

If you want a more fine-grained approach because you intend to do some
development work, the `Makefile` in the root directory of the source tree
provides several convenience shortcuts as `make` targets that may be of
interest. To see the available targets run:

    make


### Quick-start: Vagrant

The directory `extras/vagrant` contains a `VagrantFile` and supporting
scripts to bootstrap a working VPP inside a Vagrant-managed Virtual Machine.
This VM can then be used to test concepts with VPP or as a development
platform to extend VPP. Some obvious caveats apply when using a VM for VPP
since its performance will never match that of bare metal; if your work is
timing or performance sensitive, consider using bare metal in addition or
instead of the VM.

For this to work you will need a working installation of Vagrant. Instructions
for this can be found [on the Setting up Vagrant wiki page]
(https://wiki.fd.io/view/DEV/Setting_Up_Vagrant).


## More information

Several modules provide documentation, see @subpage user_doc for more
end-user-oriented information. Also see @subpage dev_doc for developer notes.

Visit the [VPP wiki](https://wiki.fd.io/view/VPP) for details on more
advanced building strategies and other development notes.


## Test Framework

There is PyDoc generated documentation available for the VPP test framework.
See @ref test_framework_doc for details.
>}) list(GET VPP_LIB_VERSION 0 VPP_LIB_VERSION) ############################################################################## # cross compiling ############################################################################## if(CMAKE_CROSSCOMPILING) set(CMAKE_IGNORE_PATH /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/ /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/lib/ ) endif() set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) ############################################################################## # build config ############################################################################## check_c_compiler_flag("-Wno-address-of-packed-member" compiler_flag_no_address_of_packed_member) set(VPP_RUNTIME_DIR "bin" CACHE STRING "Relative runtime directory path") set(VPP_LIBRARY_DIR "lib" CACHE STRING "Relative library directory path") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_RUNTIME_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_LIBRARY_DIR}) if (CMAKE_BUILD_TYPE) set(CMAKE_C_FLAGS "-g -fPIC -Werror -Wall ${CMAKE_C_FLAGS}") endif() if (compiler_flag_no_address_of_packed_member) set(CMAKE_C_FLAGS "-Wno-address-of-packed-member ${CMAKE_C_FLAGS}") endif() # release list(APPEND BUILD_TYPES "release") string(CONCAT CMAKE_C_FLAGS_RELEASE "-O2 " "-fstack-protector " "-DFORTIFY_SOURCE=2 " "-fno-common " ) string(CONCAT CMAKE_EXE_LINKER_FLAGS_RELEASE "-pie") # debug list(APPEND BUILD_TYPES "debug") string(CONCAT CMAKE_C_FLAGS_DEBUG "-O0 " "-DCLIB_DEBUG " "-fstack-protector " "-DFORTIFY_SOURCE=2 " "-fno-common " ) # coverity list(APPEND BUILD_TYPES "coverity") string(CONCAT CMAKE_C_FLAGS_COVERITY "-O2 -D__COVERITY__") # gcov list(APPEND BUILD_TYPES "gcov") string(CONCAT CMAKE_C_FLAGS_GCOV "-O0 " "-DCLIB_DEBUG " "-DCLIB_GCOV " "-fprofile-arcs " "-ftest-coverage ") string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UC) string(REPLACE ";" " " BUILD_TYPES "${BUILD_TYPES}") set_property(CACHE CMAKE_BUILD_TYPE PROPERTY HELPSTRING "Build type - valid options are: ${BUILD_TYPES}") ############################################################################## # sanitizers ############################################################################## option(VPP_ENABLE_SANITIZE_ADDR "Enable Address Sanitizer" OFF) set(VPP_SANITIZE_ADDR_OPTIONS "unmap_shadow_on_exit=1:disable_coredump=0:abort_on_error=1:detect_leaks=0" CACHE STRING "Address sanitizer arguments" ) if (VPP_ENABLE_SANITIZE_ADDR) set(CMAKE_C_FLAGS "-fsanitize=address -DCLIB_SANITIZE_ADDR ${CMAKE_C_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=address ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address ${CMAKE_SHARED_LINKER_FLAGS}") endif (VPP_ENABLE_SANITIZE_ADDR) ############################################################################## # install config ############################################################################## set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_MESSAGE NEVER) include_directories ( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "vpp") set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) include(cmake/syscall.cmake) include(cmake/api.cmake) include(cmake/library.cmake) include(cmake/exec.cmake) include(cmake/plugin.cmake) ############################################################################## # subdirs - order matters ############################################################################## option(VPP_HOST_TOOLS_ONLY "Build only host tools" OFF) if(VPP_HOST_TOOLS_ONLY) set(SUBDIRS tools/vppapigen cmake) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") find_package(OpenSSL REQUIRED) set(SUBDIRS vppinfra svm vlib vlibmemory vlibapi vnet vpp vat vcl plugins vpp-api tools/vppapigen tools/g2 tools/perftool cmake pkg tools/appimage ) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") set(SUBDIRS vppinfra) else() message(FATAL_ERROR "Unsupported system: ${CMAKE_SYSTEM_NAME}") endif() foreach(DIR ${SUBDIRS}) add_subdirectory(${DIR}) endforeach() ############################################################################## # detect if we are inside git repo and add configure dependency ############################################################################## execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND git rev-parse --show-toplevel OUTPUT_VARIABLE VPP_GIT_TOPLEVEL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) if (VPP_GIT_TOPLEVEL_DIR) set_property( DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${VPP_GIT_TOPLEVEL_DIR}/.git/index ) endif() ############################################################################## # print configuration ############################################################################## message(STATUS "Configuration:") pr("VPP version" "${VPP_VERSION}") pr("VPP library version" "${VPP_LIB_VERSION}") pr("GIT toplevel dir" "${VPP_GIT_TOPLEVEL_DIR}") pr("Build type" "${CMAKE_BUILD_TYPE}") pr("C flags" "${CMAKE_C_FLAGS}${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") pr("Linker flags (apps)" "${CMAKE_EXE_LINKER_FLAGS}${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") pr("Linker flags (libs)" "${CMAKE_SHARED_LINKER_FLAGS}${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") pr("Host processor" "${CMAKE_HOST_SYSTEM_PROCESSOR}") pr("Target processor" "${CMAKE_SYSTEM_PROCESSOR}") pr("Prefix path" "${CMAKE_PREFIX_PATH}") pr("Install prefix" "${CMAKE_INSTALL_PREFIX}")