# Copyright (c) 2016 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. export WS_ROOT=$(CURDIR) export BR=$(WS_ROOT)/build-root CCACHE_DIR?=$(BR)/.ccache GDB?=gdb PLATFORM?=vpp SAMPLE_PLUGIN?=no STARTUP_DIR?=$(PWD) MACHINE=$(shell uname -m) SUDO?=sudo -E DPDK_CONFIG?=no-pci ,:=, define disable_plugins $(if $(1), \ "plugins {" \ $(patsubst %,"plugin %_plugin.so { disable }",$(subst $(,), ,$(1))) \ " }" \ ,) endef MINIMAL_STARTUP_CONF=" \ unix { \ interactive \ cli-listen /run/vpp/cli.sock \ gid $(shell id -g) \ $(if $(wildcard startup.vpp),"exec startup.vpp",) \ } \ $(if $(DPDK_CONFIG), "dpdk { $(DPDK_CONFIG) }",) \ $(call disable_plugins,$(DISABLED_PLUGINS)) \ " GDB_ARGS= -ex "handle SIGUSR1 noprint nostop" # # OS Detection # # We allow Darwin (MacOS) for docs generation; VPP build will still fail. ifneq ($(shell uname),Darwin) OS_ID = $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') endif ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID)) PKG=deb else ifeq ($(filter rhel centos fedora,$(OS_ID)),$(OS_ID)) PKG=rpm endif # +libganglia1-dev if building the gmond plugin DEB_DEPENDS = curl build-essential autoconf automake ccache DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd dh-python DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev DEB_DEPENDS += python3-all python3-setuptools check DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml DEB_DEPENDS += python3-venv # ensurepip DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil # python3.6 on 16.04 requires python36-dev LIBFFI=libffi6 # works on all but 20.04 and debian-testing ifeq ($(OS_VERSION_ID),18.04) DEB_DEPENDS += python-dev python-all python-pip python-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += clang-9 else ifeq ($(OS_VERSION_ID),20.04) DEB_DEPENDS += python3-virtualenv DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) LIBFFI=libffi7 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9) DEB_DEPENDS += libssl1.0-dev DEB_DEPENDS += python-all python-pip DEB_DEPENDS += python-dev python-all python-pip python-virtualenv else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10) DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) else DEB_DEPENDS += libssl-dev DEB_DEPENDS += libelf-dev # for libbpf (af_xdp) LIBFFI=libffi7 endif DEB_DEPENDS += $(LIBFFI) RPM_DEPENDS = redhat-lsb glibc-static RPM_DEPENDS += apr-devel RPM_DEPENDS += numactl-devel RPM_DEPENDS += check check-devel RPM_DEPENDS += boost boost-devel RPM_DEPENDS += selinux-policy selinux-policy-devel RPM_DEPENDS += ninja-build RPM_DEPENDS += libuuid-devel RPM_DEPENDS += mbedtls-devel RPM_DEPENDS += ccache RPM_DEPENDS += xmlto RPM_DEPENDS += elfutils-libelf-devel ifeq ($(OS_ID),fedora) RPM_DEPENDS += dnf-utils RPM_DEPENDS += subunit subunit-devel RPM_DEPENDS += compat-openssl10-devel RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil RPM_DEPENDS += python3-ply # for vppapigen RPM_DEPENDS += python3-virtualenv python3-jsonschema RPM_DEPENDS += cmake RPM_DEPENDS_GROUPS = 'C Development Tools and Libraries' else ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8) RPM_DEPENDS += yum-utils RPM_DEPENDS += compat-openssl10 RPM_DEPENDS += python2-devel python36-devel python3-ply RPM_DEPENDS += python3-virtualenv python3-jsonschema RPM_DEPENDS += cmake RPM_DEPENDS_GROUPS = 'Development Tools' else RPM_DEPENDS += yum-utils RPM_DEPENDS += openssl-devel RPM_DEPENDS += python36-ply # for vppapigen RPM_DEPENDS += python3-devel python3-pip RPM_DEPENDS += python-virtualenv python36-jsonschema RPM_DEPENDS += devtoolset-9 devtoolset-9-libasan-devel RPM_DEPENDS += cmake3 RPM_DEPENDS_GROUPS = 'Development Tools' endif # +ganglia-devel if building the ganglia plugin RPM_DEPENDS += chrpath libffi-devel rpm-build RPM_DEPENDS_DEBUG = glibc-debuginfo e2fsprogs-debuginfo RPM_DEPENDS_DEBUG += krb5-debuginfo openssl-debuginfo RPM_DEPENDS_DEBUG += zlib-debuginfo nss-softokn-debuginfo RPM_DEPENDS_DEBUG += yum-plugin-auto-update-debug-info ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),) STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf endif ifeq ($(findstring y,$(UNATTENDED)),y) CONFIRM=-y FORCE=--force-yes endif TARGETS = vpp ifneq ($(SAMPLE_PLUGIN),no) TARGETS += sample-plugin endif define banner @echo "========================================================================" @echo " $(1)" @echo "========================================================================" @echo " " endef .PHONY: help help: @echo "Make Targets:" @echo " install-dep[s] - install software dependencies" @echo " wipe - wipe all products of debug build " @echo " wipe-release - wipe all products of release build " @echo " build - build debug binaries" @echo " build-release - build release binaries" @echo " build-coverity - build coverity artifacts" @echo " rebuild - wipe and build debug binaries" @echo " rebuild-release - wipe and build release binaries" @echo " run - run debug binary" @echo " run-release - run release binary" @echo " debug - run debug binary with debugger" @echo " debug-release - run release binary with debugger" @echo " test - build and run tests" @echo " test-help - show help on test framework" @echo " run-vat - run vpp-api-test tool" @echo " pkg-deb - build DEB packages" @echo " pkg-deb-debug - build DEB debug packages" @echo " pkg-snap - build SNAP package" @echo " snap-clean - clean up snap build environment" @echo " pkg-rpm - build RPM packages" @echo " install-ext-dep[s] - install external development dependencies" @echo " ctags - (re)generate ctags database" @echo " gtags - (re)generate gtags database" @echo " cscope - (re)generate cscope database" @echo " compdb - (re)generate compile_commands.json" @echo " checkstyle - check coding style" @echo " checkstyle-commit - check commit message format" @echo " checkstyle-test - check test framework coding style" @echo " checkstyle-api - check api for incompatible changes" @echo " fixstyle - fix coding style" @echo " doxygen - (re)generate documentation" @echo " bootstrap-doxygen - setup Doxygen dependencies" @echo " wipe-doxygen - wipe all generated documentation" @echo " checkfeaturelist - check FEATURE.yaml according to schema" @echo " featurelist - dump feature list in markdown" @echo " json-api-files - (re)-generate json api files" @echo " json-api-files-debug - (re)-generate json api files for debug target" @echo " docs - Build the Sphinx documentation" @echo " docs-venv - Build the virtual environment for the Sphinx docs" @echo " docs-clean - Remove the generated files from the Sphinx docs" @echo "" @echo "Make Arguments:" @echo " V=[0|1] - set build verbosity level" @echo " STARTUP_CONF= - startup configuration file" @echo " (e.g. /etc/vpp/startup.conf)" @echo " STARTUP_DIR= - startup directory (e.g. /etc/vpp)" @echo " It also sets STARTUP_CONF if" @echo " startup.conf file is present" @echo " GDB= - gdb binary to use for debugging" @echo " PLATFORM= - target platform. default is vpp" @echo " TEST= - apply filter to test set, see test-help" @echo " DPDK_CONFIG= - add specified dpdk config commands to" @echo " autogenerated startup.conf" @echo " (e.g. \"no-pci\" )" @echo " SAMPLE_PLUGIN=yes - in addition build/run/debug sample plugin" @echo " DISABLED_PLUGINS= - comma separated list of plugins which" @echo " should not be loaded" @echo "" @echo "Current Argument Values:" @echo " V = $(V)" @echo " STARTUP_CONF = $(STARTUP_CONF)" @echo " STARTUP_DIR = $(STARTUP_DIR)" @echo " GDB = $(GDB)" @echo " PLATFORM = $(PLATFORM)" @echo " DPDK_VERSION = $(DPDK_VERSION)" @echo " DPDK_CONFIG = $(DPDK_CONFIG)" @echo " SAMPLE_PLUGIN = $(SAMPLE_PLUGIN)" @echo " DISABLED_PLUGINS = $(DISABLED_PLUGINS)" $(BR)/.deps.ok: ifeq ($(findstring y,$(UNATTENDED)),y) make install-dep endif ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID)) @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \ if [ -n "$$MISSING" ] ; then \ echo "\nPlease install missing packages: \n$$MISSING\n" ; \ echo "by executing \"make install-dep\"\n" ; \ exit 1 ; \ fi ; \ exit 0 else ifneq ("$(wildcard /etc/redhat-release)","") @for i in $(RPM_DEPENDS) ; do \ RPM=$$(basename -s .rpm "$${i##*/}" | cut -d- -f1,2,3,4) ; \ MISSING+=$$(rpm -q $$RPM | grep "^package") ; \ done ; \ if [ -n "$$MISSING" ] ; then \ echo "Please install missing RPMs: \n$$MISSING\n" ; \ echo "by executing \"make instal
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef included_vnet_vnet_device_h
#define included_vnet_vnet_device_h

#include <vnet/unix/pcap.h>
#include <vnet/l3_types.h>

typedef enum
{
  VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT,
  VNET_DEVICE_INPUT_NEXT_IP4_INPUT,
  VNET_DEVICE_INPUT_NEXT_IP6_INPUT,
  VNET_DEVICE_INPUT_NEXT_MPLS_INPUT,
  VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT,
  VNET_DEVICE_INPUT_NEXT_DROP,
  VNET_DEVICE_INPUT_N_NEXT_NODES,
} vnet_device_input_next_t;

#define VNET_DEVICE_INPUT_NEXT_NODES {					\
    [VNET_DEVICE_INPUT_NEXT_DROP] = "error-drop",			\
    [VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT] = "ethernet-input",		\