1 # Copyright (c) 2020 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 DPDK_PKTMBUF_HEADROOM ?= 128
18 DPDK_MLX5_COMMON_PMD ?= n
20 DPDK_FAILSAFE_PMD ?= n
21 DPDK_MACHINE ?= default
24 dpdk_base_url ?= http://fast.dpdk.org/rel
25 dpdk_tarball := dpdk-$(dpdk_version).tar.xz
26 dpdk_tarball_md5sum_20.08 := 64badd32cd6bc0761befc8f2402c2148
27 dpdk_tarball_md5sum := $(dpdk_tarball_md5sum_$(dpdk_version))
28 dpdk_url := $(dpdk_base_url)/$(dpdk_tarball)
29 dpdk_tarball_strip_dirs := 1
33 DPDK_BUILD_TYPE:=release
34 ifeq ($(DPDK_DEBUG), y)
35 DPDK_BUILD_TYPE:=debug
38 DPDK_DRIVERS_DISABLED := baseband/\*, \
60 DPDK_LIBS_DISABLED := acl, \
85 # Adjust disabled pmd and libs depending on user provided variables
86 ifeq ($(DPDK_MLX4_PMD), n)
87 DPDK_DRIVERS_DISABLED += ,net/mlx4
89 ifeq ($(DPDK_MLX5_PMD), n)
90 DPDK_DRIVERS_DISABLED += ,net/mlx5
92 ifeq ($(DPDK_MLX5_COMMON_PMD), n)
93 DPDK_DRIVERS_DISABLED += ,common/mlx5
95 ifeq ($(DPDK_TAP_PMD), n)
96 DPDK_DRIVERS_DISABLED += ,net/tap
98 ifeq ($(DPDK_FAILSAFE_PMD), n)
99 DPDK_DRIVERS_DISABLED += ,net/failsafe
102 # Sanitize DPDK_DRIVERS_DISABLED and DPDK_LIBS_DISABLED
103 DPDK_DRIVERS_DISABLED := $(shell echo $(DPDK_DRIVERS_DISABLED) | tr -d '\\\t ')
104 DPDK_LIBS_DISABLED := $(shell echo $(DPDK_LIBS_DISABLED) | tr -d '\\\t ')
107 # post-meson-setup snippet to alter rte_build_config.h
109 if grep -q RTE_$(1) $(dpdk_src_dir)/config/rte_config.h ; then \
110 sed -i -e 's/$(HASH)define RTE_$(1).*/$(HASH)define RTE_$(1) $(DPDK_$(1))/' \
111 $(dpdk_src_dir)/config/rte_config.h; \
112 elif grep -q RTE_$(1) $(dpdk_build_dir)/rte_build_config.h ; then \
113 sed -i -e 's/$(HASH)define RTE_$(1).*/$(HASH)define RTE_$(1) $(DPDK_$(1))/' \
114 $(dpdk_build_dir)/rte_build_config.h; \
116 echo '$(HASH)define RTE_$(1) $(DPDK_$(1))' \
117 >> $(dpdk_build_dir)/rte_build_config.h ; \
122 --default-library static \
124 --prefix $(dpdk_install_dir) \
126 "-Ddisable_drivers=$(DPDK_DRIVERS_DISABLED)" \
127 "-Ddisable_libs=$(DPDK_LIBS_DISABLED)" \
129 -Dmachine=$(DPDK_MACHINE) \
130 --buildtype=$(DPDK_BUILD_TYPE)
132 define dpdk_config_cmds
133 cd $(dpdk_build_dir) && \
134 rm -rf ../dpdk-meson-venv && \
135 mkdir -p ../dpdk-meson-venv && \
136 python3 -m venv ../dpdk-meson-venv && \
137 source ../dpdk-meson-venv/bin/activate && \
138 pip3 install meson==0.54 && \
139 meson setup $(dpdk_src_dir) \
142 | tee $(dpdk_config_log) && \
144 echo "DPDK post meson configuration" && \
145 echo "Altering rte_build_config.h" && \
146 $(call dpdk_config,PKTMBUF_HEADROOM)
149 define dpdk_build_cmds
150 cd $(dpdk_build_dir) && \
151 source ../dpdk-meson-venv/bin/activate && \
152 meson compile -C . | tee $(dpdk_build_log) && \
156 define dpdk_install_cmds
157 cd $(dpdk_build_dir) && \
158 source ../dpdk-meson-venv/bin/activate && \
160 cd $(dpdk_install_dir)/lib && \
161 echo "GROUP ( $$(ls librte*.a ) )" > libdpdk.a && \
162 rm -rf librte*.so librte*.so.* dpdk/*/librte*.so dpdk/*/librte*.so.* && \
164 rm -rf $(dpdk_build_dir)/../dpdk-meson-venv
167 $(eval $(call package,dpdk))