Support packets in flight
[samplevnf.git] / VNFs / DPPD-PROX / Makefile
index 0288181..9a675ca 100644 (file)
@@ -1,5 +1,5 @@
 ##
-## Copyright (c) 2010-2017 Intel Corporation
+## Copyright (c) 2010-2019 Intel Corporation
 ##
 ## Licensed under the Apache License, Version 2.0 (the "License");
 ## you may not use this file except in compliance with the License.
 ##
 
 ifeq ($(RTE_SDK),)
-$(error "Please define RTE_SDK environment variable")
+define err_msg
+
+Please define RTE_SDK environment variable.
+If DPDK was built with Meson, please use meson to build Prox too.
+***
+endef
+$(error $(err_msg))
 endif
 
 # Default target, can be overriden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc
 
+ifeq ($(wildcard $(RTE_SDK)/$(RTE_TARGET)/.),)
+define err_msg
+
+Could not find build target: $(RTE_TARGET)
+Perhaps DPDK was built using meson?
+***
+endef
+$(error $(err_msg))
+endif
+
 rte_version_h := $(RTE_SDK)/$(RTE_TARGET)/include/rte_version.h
+rte_config_h := $(RTE_SDK)/$(RTE_TARGET)/include/rte_config.h
 rte_ver_part = $(shell sed -n -e 's/^\#define\s*$1\s*\(.*\)$$/\1/p' $(rte_version_h))
+rte_config_part = $(shell sed -n -e 's/^\#define\s*$1\s*\(.*\)$$/\1/p' $(rte_config_h))
 rte_ver_eval = $(shell printf '%u' $$(printf '0x%02x%02x%02x%02x' $1 $2 $3 $4))
 rte_ver_MMLR = $(call rte_ver_eval,$(call \
        rte_ver_part,RTE_VER_MAJOR),$(call \
        rte_ver_part,RTE_VER_MINOR),$(call \
        rte_ver_part,RTE_VER_PATCH_LEVEL),$(call \
        rte_ver_part,RTE_VER_PATCH_RELEASE))
-rte_ver_YMMR = $(call rte_ver_eval,$(call \
+rte_version_YMMR = $(call rte_ver_eval,$(call \
        rte_ver_part,RTE_VER_YEAR),$(call \
        rte_ver_part,RTE_VER_MONTH),$(call \
        rte_ver_part,RTE_VER_MINOR),$(call \
        rte_ver_part,RTE_VER_RELEASE))
+rte_config_YMMR = $(call rte_ver_eval,$(call \
+       rte_config_part,RTE_VER_YEAR),$(call \
+       rte_config_part,RTE_VER_MONTH),$(call \
+       rte_config_part,RTE_VER_MINOR),$(call \
+       rte_config_part,RTE_VER_RELEASE))
+rte_ver_YMMR = $(if $(shell test $(rte_config_YMMR) -gt 0 && echo 'y'),$(rte_config_YMMR),$(rte_version_YMMR))
 rte_ver_dpdk := $(if $(call rte_ver_part,RTE_VER_MAJOR),$(rte_ver_MMLR),$(rte_ver_YMMR))
 rte_ver_comp = $(shell test $(rte_ver_dpdk) $5 $(call rte_ver_eval,$1,$2,$3,$4) && echo 'y')
 rte_ver_EQ = $(call rte_ver_comp,$1,$2,$3,$4,-eq)
@@ -78,8 +102,12 @@ endif
 endif
 endif
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += -lrte_pmd_ring -lrte_pmd_null -lrte_pmd_ixgbe -lrte_pmd_i40e  -lrte_pmd_e1000  -lrte_pmd_virtio -lrte_pmd_vmxnet3_uio
+endif
+
 LD_TINFO = $(shell pkg-config --silence-errors --libs-only-l tinfo)
-LDFLAGS += -lpcap $(LD_TINFO) $(LD_LUA)
+LDFLAGS += -lm -lpcap $(LD_TINFO) $(LD_LUA)
 LDFLAGS += -lncurses -lncursesw -ledit
 
 PROX_STATS ?= y
@@ -105,6 +133,11 @@ else
 CFLAGS += -DPROX_MAX_LOG_LVL=$(log)
 endif
 
+# When ipv4 packet is de-encalpusled from ipv6 packet, genaerate IP checksum.
+ifeq ($(GEN_DECAP_IPV6_TO_IPV4_CKSUM),y)
+CFLAGS += -DGEN_DECAP_IPV6_TO_IPV4_CKSUM
+endif
+
 # override any use-case/enviroment specific choices regarding crc and
 # always use the sw implementation
 ifeq ($(crc),soft)
@@ -116,7 +149,7 @@ CFLAGS += -DPROX_PREFETCH_OFFSET=2
 #CFLAGS += -DASSERT
 #CFLAGS += -DENABLE_EXTRA_USER_STATISTICS
 CFLAGS += -DLATENCY_PER_PACKET
-CFLAGS += -DLATENCY_DETAILS
+CFLAGS += -DLATENCY_HISTOGRAM
 CFLAGS += -DGRE_TP
 CFLAGS += -std=gnu99
 CFLAGS += -D_GNU_SOURCE                # for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
@@ -157,10 +190,18 @@ SRCS-y += handle_swap.c
 SRCS-y += handle_police.c
 SRCS-y += handle_acl.c
 SRCS-y += handle_gen.c
+SRCS-y += handle_master.c
+SRCS-y += packet_utils.c
 SRCS-y += handle_mirror.c
 SRCS-y += handle_genl4.c
 SRCS-y += handle_ipv6_tunnel.c
 SRCS-y += handle_read.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += handle_esp.c
+ifneq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_MB),y)
+ifeq ($(FIRST_PROX_MAKE),)
+$(warning "Building w/o IPSEC support")
+endif
+endif
 SRCS-y += handle_cgnat.c
 SRCS-y += handle_nat.c
 SRCS-y += handle_dump.c
@@ -179,26 +220,57 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread_pipeline.c
 SRCS-y += prox_args.c prox_cfg.c prox_cksum.c prox_port_cfg.c
 
 SRCS-y += cfgfile.c clock.c commands.c cqm.c msr.c defaults.c
-SRCS-y += display.c display_latency.c display_mempools.c
-SRCS-y += display_ports.c display_rings.c display_priority.c display_pkt_len.c display_l4gen.c display_tasks.c
+SRCS-y += display.c display_latency.c display_latency_distr.c display_mempools.c
+SRCS-y += display_ports.c display_rings.c display_priority.c display_pkt_len.c display_l4gen.c display_tasks.c display_irq.c
 SRCS-y += log.c hash_utils.c main.c parse_utils.c file_utils.c
 SRCS-y += run.c input_conn.c input_curses.c
 SRCS-y += rx_pkt.c lconf.c tx_pkt.c expire_cpe.c ip_subnet.c
 SRCS-y += stats_port.c stats_mempool.c stats_ring.c stats_l4gen.c
-SRCS-y += stats_latency.c stats_global.c stats_core.c stats_task.c stats_prio.c
+SRCS-y += stats_latency.c stats_global.c stats_core.c stats_task.c stats_prio.c stats_irq.c
 SRCS-y += cmd_parser.c input.c prox_shared.c prox_lua_types.c
 SRCS-y += genl4_bundle.c heap.c genl4_stream_tcp.c genl4_stream_udp.c cdf.c
-SRCS-y += stats.c stats_cons_log.c stats_cons_cli.c stats_parser.c hash_set.c prox_lua.c prox_malloc.c
+SRCS-y += stats.c stats_cons_log.c stats_cons_cli.c stats_parser.c hash_set.c prox_lua.c prox_malloc.c prox_ipv6.c prox_compat.c
+SRCS-y += git_version.c
+
+GIT_VERSION := "$(shell git describe --abbrev=8 --dirty --always)"
 
 ifeq ($(FIRST_PROX_MAKE),)
 MAKEFLAGS += --no-print-directory
 FIRST_PROX_MAKE = 1
 export FIRST_PROX_MAKE
-all:
+all:   libedit_autoconf.h git_version.c
        @./helper-scripts/trailing.sh
        @$(MAKE) $@
+clean:
+       $(Q) $(RM) -- 'libedit_autoconf.h'
+       @$(MAKE) $@
 %::
        @$(MAKE) $@
+
+ifeq ($(call rte_ver_LT,17,2,0,0),y)
+AUTO-CONFIG-SCRIPT = $(RTE_SDK)/scripts/auto-config-h.sh
+else
+AUTO-CONFIG-SCRIPT = $(RTE_SDK)/buildtools/auto-config-h.sh
+endif
+
+# DPDK CFLAGS prevents auto-conf program to properly compile
+export CFLAGS=
+# if el_rfunc_t exists, define HAVE_LIBEDIT_EL_RFUNC_T so that PROX knows it can use it
+libedit_autoconf.h: $(AUTO-CONFIG-SCRIPT)
+       $(Q) $(RM) -- '$@'
+       $(Q) sh -- '$(AUTO-CONFIG-SCRIPT)' '$@' \
+               HAVE_LIBEDIT_EL_RFUNC_T \
+               histedit.h \
+               type 'el_rfunc_t' \
+               > /dev/null
+# auto-conf adds empty line at the end of the file, considered as error by trailing.sh script
+       $(Q) sed -i '$$ d' '$@'
+
+git_version.c: force
+       @echo 'const char *git_version=$(GIT_VERSION);' | cmp -s - $@ || echo 'const char *git_version=$(GIT_VERSION);' > $@
+       @echo $@
+force:
+       
 else
 include $(RTE_SDK)/mk/rte.extapp.mk
 endif