Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 1 | # Copyright (c) 2020 Cisco and/or its affiliates. |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 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: |
| 5 | # |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # |
| 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. |
| 13 | |
| 14 | DPDK_PKTMBUF_HEADROOM ?= 128 |
Mohammed Hawari | 1f799bc | 2020-09-18 21:47:04 +0200 | [diff] [blame] | 15 | DPDK_USE_LIBBSD ?= n |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 16 | DPDK_DEBUG ?= n |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 17 | DPDK_TAP_PMD ?= n |
| 18 | DPDK_FAILSAFE_PMD ?= n |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 19 | DPDK_MACHINE ?= default |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 20 | DPDK_MLX_IBV_LINK ?= static |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 21 | |
Kai Ji | a0fd523 | 2024-04-23 16:10:13 +0000 | [diff] [blame] | 22 | dpdk_version ?= 24.03 |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 23 | dpdk_base_url ?= http://fast.dpdk.org/rel |
| 24 | dpdk_tarball := dpdk-$(dpdk_version).tar.xz |
Kai Ji | a0fd523 | 2024-04-23 16:10:13 +0000 | [diff] [blame] | 25 | dpdk_tarball_md5sum_24.03 := a98da848d6ba09808ef00f9a26aaa49a |
Kai Ji | 327c323 | 2023-12-05 23:38:39 +0000 | [diff] [blame] | 26 | dpdk_tarball_md5sum_23.11 := 896c09f5b45b452bd77287994650b916 |
Kai Ji | 4421898 | 2023-08-08 23:46:12 +0000 | [diff] [blame] | 27 | dpdk_tarball_md5sum_23.07 := 2b6d57f077585cb15b885482362fd47f |
Xinyao Cai | df6a00f | 2023-05-09 21:29:30 +0800 | [diff] [blame] | 28 | dpdk_tarball_md5sum_23.03 := 3cf8ebbcd412d5726db230f2eeb90cc9 |
Xinyao Cai | efcf1be | 2023-04-27 09:29:44 +0800 | [diff] [blame] | 29 | dpdk_tarball_md5sum_22.11.1 := 0594708fe42ce186a55b0235c6e20cfe |
Fan Zhang | 3c285b5 | 2022-08-02 10:17:08 +0000 | [diff] [blame] | 30 | dpdk_tarball_md5sum_22.07 := fb73b58b80b1349cd05fe9cf6984afd4 |
Dastin Wilski | 2f132ef | 2022-03-30 14:19:00 +0200 | [diff] [blame] | 31 | dpdk_tarball_md5sum_22.03 := a07ca8839f98062f46e1cc359735cce8 |
Damjan Marion | 6c75cd2 | 2022-01-11 23:21:08 +0100 | [diff] [blame] | 32 | dpdk_tarball_md5sum_21.11 := 58660bbbe9e95abce86e47692b196555 |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 33 | dpdk_tarball_md5sum := $(dpdk_tarball_md5sum_$(dpdk_version)) |
| 34 | dpdk_url := $(dpdk_base_url)/$(dpdk_tarball) |
| 35 | dpdk_tarball_strip_dirs := 1 |
Tom Jones | 3b88195 | 2024-02-01 16:09:56 +0000 | [diff] [blame] | 36 | ifeq ($(shell uname), FreeBSD) |
| 37 | dpdk_depends := $(if $(ARCH_X86_64), ipsec-mb) |
| 38 | else |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 39 | dpdk_depends := rdma-core $(if $(ARCH_X86_64), ipsec-mb) |
Tom Jones | 3b88195 | 2024-02-01 16:09:56 +0000 | [diff] [blame] | 40 | endif |
Mohammed Hawari | 4e939ce | 2022-09-19 16:26:25 +0200 | [diff] [blame] | 41 | DPDK_MLX_DEFAULT := $(shell if grep -q "rdma=$(rdma-core_version) dpdk=$(dpdk_version)" mlx_rdma_dpdk_matrix.txt; then echo 'y'; else echo 'n'; fi) |
| 42 | DPDK_MLX4_PMD ?= $(DPDK_MLX_DEFAULT) |
| 43 | DPDK_MLX5_PMD ?= $(DPDK_MLX_DEFAULT) |
| 44 | DPDK_MLX5_COMMON_PMD ?= $(DPDK_MLX_DEFAULT) |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 45 | # Debug or release |
| 46 | |
| 47 | DPDK_BUILD_TYPE:=release |
| 48 | ifeq ($(DPDK_DEBUG), y) |
| 49 | DPDK_BUILD_TYPE:=debug |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 50 | endif |
| 51 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 52 | DPDK_DRIVERS_DISABLED := baseband/\*, \ |
| 53 | bus/dpaa, \ |
| 54 | bus/ifpga, \ |
Dave Wallace | f5b8e8d | 2022-08-11 15:29:54 -0400 | [diff] [blame] | 55 | common/cnxk, \ |
Fan Zhang | 1152e60 | 2020-09-25 22:36:04 +0100 | [diff] [blame] | 56 | compress/isal, \ |
| 57 | compress/octeontx, \ |
| 58 | compress/zlib, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 59 | crypto/ccp, \ |
Dave Wallace | f5b8e8d | 2022-08-11 15:29:54 -0400 | [diff] [blame] | 60 | crypto/cnxk, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 61 | crypto/dpaa_sec, \ |
| 62 | crypto/openssl, \ |
PiotrX Kleski | 9235d43 | 2020-10-12 15:33:11 +0200 | [diff] [blame] | 63 | crypto/aesni_mb, \ |
| 64 | crypto/aesni_gcm, \ |
| 65 | crypto/kasumi, \ |
| 66 | crypto/snow3g, \ |
| 67 | crypto/zuc, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 68 | event/\*, \ |
| 69 | mempool/dpaa, \ |
Dave Wallace | f5b8e8d | 2022-08-11 15:29:54 -0400 | [diff] [blame] | 70 | mempool/cnxk, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 71 | net/af_packet, \ |
| 72 | net/bnx2x, \ |
| 73 | net/bonding, \ |
Dave Wallace | f5b8e8d | 2022-08-11 15:29:54 -0400 | [diff] [blame] | 74 | net/cnxk, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 75 | net/ipn3ke, \ |
| 76 | net/liquidio, \ |
| 77 | net/pcap, \ |
| 78 | net/pfe, \ |
| 79 | net/sfc, \ |
| 80 | net/softnic, \ |
| 81 | net/thunderx, \ |
| 82 | raw/ifpga, \ |
Fan Zhang | 9303b10 | 2021-05-27 13:24:52 +0100 | [diff] [blame] | 83 | net/af_xdp |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 84 | |
| 85 | DPDK_LIBS_DISABLED := acl, \ |
| 86 | bbdev, \ |
| 87 | bitratestats, \ |
| 88 | bpf, \ |
| 89 | cfgfile, \ |
Dave Wallace | f5b8e8d | 2022-08-11 15:29:54 -0400 | [diff] [blame] | 90 | cnxk, \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 91 | distributor, \ |
| 92 | efd, \ |
| 93 | fib, \ |
| 94 | flow_classify, \ |
| 95 | graph, \ |
| 96 | gro, \ |
| 97 | gso, \ |
| 98 | jobstats, \ |
| 99 | kni, \ |
| 100 | latencystats, \ |
| 101 | lpm, \ |
| 102 | member, \ |
| 103 | node, \ |
| 104 | pipeline, \ |
| 105 | port, \ |
| 106 | power, \ |
| 107 | rawdev, \ |
| 108 | rib, \ |
| 109 | table |
| 110 | |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 111 | DPDK_MLX_CONFIG_FLAG := |
| 112 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 113 | # Adjust disabled pmd and libs depending on user provided variables |
| 114 | ifeq ($(DPDK_MLX4_PMD), n) |
| 115 | DPDK_DRIVERS_DISABLED += ,net/mlx4 |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 116 | else |
| 117 | DPDK_MLX_CONFIG_FLAG := -Dibverbs_link=${DPDK_MLX_IBV_LINK} |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 118 | endif |
| 119 | ifeq ($(DPDK_MLX5_PMD), n) |
| 120 | DPDK_DRIVERS_DISABLED += ,net/mlx5 |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 121 | else |
| 122 | DPDK_MLX_CONFIG_FLAG := -Dibverbs_link=${DPDK_MLX_IBV_LINK} |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 123 | endif |
| 124 | ifeq ($(DPDK_MLX5_COMMON_PMD), n) |
| 125 | DPDK_DRIVERS_DISABLED += ,common/mlx5 |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 126 | else |
| 127 | DPDK_MLX_CONFIG_FLAG := -Dibverbs_link=${DPDK_MLX_IBV_LINK} |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 128 | endif |
| 129 | ifeq ($(DPDK_TAP_PMD), n) |
| 130 | DPDK_DRIVERS_DISABLED += ,net/tap |
| 131 | endif |
| 132 | ifeq ($(DPDK_FAILSAFE_PMD), n) |
| 133 | DPDK_DRIVERS_DISABLED += ,net/failsafe |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 134 | endif |
| 135 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 136 | # Sanitize DPDK_DRIVERS_DISABLED and DPDK_LIBS_DISABLED |
| 137 | DPDK_DRIVERS_DISABLED := $(shell echo $(DPDK_DRIVERS_DISABLED) | tr -d '\\\t ') |
| 138 | DPDK_LIBS_DISABLED := $(shell echo $(DPDK_LIBS_DISABLED) | tr -d '\\\t ') |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 139 | |
Tom Jones | 5267b53 | 2024-02-01 16:09:20 +0000 | [diff] [blame] | 140 | SED=sed |
| 141 | ifeq ($shell(uname), FreeBSD) |
| 142 | SED=gsed |
| 143 | endif |
| 144 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 145 | HASH := \# |
| 146 | # post-meson-setup snippet to alter rte_build_config.h |
| 147 | define dpdk_config |
| 148 | if grep -q RTE_$(1) $(dpdk_src_dir)/config/rte_config.h ; then \ |
Tom Jones | 5267b53 | 2024-02-01 16:09:20 +0000 | [diff] [blame] | 149 | $(SED) -i -e 's/$(HASH)define RTE_$(1).*/$(HASH)define RTE_$(1) $(DPDK_$(1))/' \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 150 | $(dpdk_src_dir)/config/rte_config.h; \ |
| 151 | elif grep -q RTE_$(1) $(dpdk_build_dir)/rte_build_config.h ; then \ |
Tom Jones | 5267b53 | 2024-02-01 16:09:20 +0000 | [diff] [blame] | 152 | $(SED) -i -e 's/$(HASH)define RTE_$(1).*/$(HASH)define RTE_$(1) $(DPDK_$(1))/' \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 153 | $(dpdk_build_dir)/rte_build_config.h; \ |
| 154 | else \ |
| 155 | echo '$(HASH)define RTE_$(1) $(DPDK_$(1))' \ |
| 156 | >> $(dpdk_build_dir)/rte_build_config.h ; \ |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 157 | fi |
| 158 | endef |
| 159 | |
Mohammed Hawari | 1f799bc | 2020-09-18 21:47:04 +0200 | [diff] [blame] | 160 | define dpdk_config_def |
| 161 | if [[ "$(DPDK_$(1))" == "y" ]]; then \ |
| 162 | if ! grep -q "RTE_$(1)" $(dpdk_build_dir)/rte_build_config.h \ |
| 163 | $(dpdk_src_dir)/config/rte_config.h ; then \ |
| 164 | echo '$(HASH)define RTE_$(1) 1' \ |
| 165 | >> $(dpdk_build_dir)/rte_build_config.h ; \ |
| 166 | fi; \ |
| 167 | elif [[ "$(DPDK_$(1))" == "n" ]]; then \ |
Tom Jones | 5267b53 | 2024-02-01 16:09:20 +0000 | [diff] [blame] | 168 | $(SED) -i '/$(HASH)define RTE_$(1) .*/d' $(dpdk_build_dir)/rte_build_config.h \ |
Mohammed Hawari | 1f799bc | 2020-09-18 21:47:04 +0200 | [diff] [blame] | 169 | $(dpdk_src_dir)/config/rte_config.h ; \ |
| 170 | fi |
| 171 | endef |
| 172 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 173 | DPDK_MESON_ARGS = \ |
| 174 | --default-library static \ |
| 175 | --libdir lib \ |
| 176 | --prefix $(dpdk_install_dir) \ |
| 177 | -Dtests=false \ |
Xinyao Cai | efcf1be | 2023-04-27 09:29:44 +0800 | [diff] [blame] | 178 | -Denable_driver_sdk=true \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 179 | "-Ddisable_drivers=$(DPDK_DRIVERS_DISABLED)" \ |
| 180 | "-Ddisable_libs=$(DPDK_LIBS_DISABLED)" \ |
| 181 | -Db_pie=true \ |
| 182 | -Dmachine=$(DPDK_MACHINE) \ |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 183 | --buildtype=$(DPDK_BUILD_TYPE) \ |
Tom Jones | 2535bde | 2024-02-01 16:07:54 +0000 | [diff] [blame] | 184 | -Denable_kmods=false \ |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 185 | ${DPDK_MLX_CONFIG_FLAG} |
Mohammed Hawari | a6d5f24 | 2020-10-22 14:14:04 +0200 | [diff] [blame] | 186 | |
| 187 | PIP_DOWNLOAD_DIR = $(CURDIR)/downloads/ |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 188 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 189 | define dpdk_config_cmds |
| 190 | cd $(dpdk_build_dir) && \ |
Dave Wallace | 14b118b | 2022-10-04 23:48:44 -0400 | [diff] [blame] | 191 | echo "DPDK_MLX_DEFAULT=$(DPDK_MLX_DEFAULT)" > ../../../dpdk_mlx_default.sh && \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 192 | rm -rf ../dpdk-meson-venv && \ |
| 193 | mkdir -p ../dpdk-meson-venv && \ |
| 194 | python3 -m venv ../dpdk-meson-venv && \ |
| 195 | source ../dpdk-meson-venv/bin/activate && \ |
nucleo | cc22d38 | 2023-08-15 20:59:35 +0300 | [diff] [blame] | 196 | (if ! ls $(PIP_DOWNLOAD_DIR)meson* ; then pip3 download -d $(PIP_DOWNLOAD_DIR) -f $(DL_CACHE_DIR) meson==0.55.3 setuptools wheel pyelftools; fi) && \ |
| 197 | pip3 install --no-index --find-links=$(PIP_DOWNLOAD_DIR) meson==0.55.3 pyelftools && \ |
Mohammed Hawari | fe909a6 | 2020-11-20 18:37:14 +0100 | [diff] [blame] | 198 | PKG_CONFIG_PATH=$(dpdk_install_dir)/lib/pkgconfig meson setup $(dpdk_src_dir) \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 199 | $(dpdk_build_dir) \ |
| 200 | $(DPDK_MESON_ARGS) \ |
| 201 | | tee $(dpdk_config_log) && \ |
| 202 | deactivate && \ |
| 203 | echo "DPDK post meson configuration" && \ |
| 204 | echo "Altering rte_build_config.h" && \ |
Mohammed Hawari | 1f799bc | 2020-09-18 21:47:04 +0200 | [diff] [blame] | 205 | $(call dpdk_config,PKTMBUF_HEADROOM) && \ |
| 206 | $(call dpdk_config_def,USE_LIBBSD) |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 207 | endef |
BenoƮt Ganne | fe750c2 | 2019-03-25 11:41:34 +0100 | [diff] [blame] | 208 | |
Nick Brown | ae4ed32 | 2021-09-07 18:24:42 +0100 | [diff] [blame] | 209 | ifeq ("$(DPDK_VERBOSE)","1") |
| 210 | DPDK_VERBOSE_BUILD = --verbose |
| 211 | endif |
| 212 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 213 | define dpdk_build_cmds |
| 214 | cd $(dpdk_build_dir) && \ |
| 215 | source ../dpdk-meson-venv/bin/activate && \ |
Nick Brown | ae4ed32 | 2021-09-07 18:24:42 +0100 | [diff] [blame] | 216 | meson compile $(DPDK_VERBOSE_BUILD) -C . | tee $(dpdk_build_log) && \ |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 217 | deactivate |
| 218 | endef |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 219 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 220 | define dpdk_install_cmds |
| 221 | cd $(dpdk_build_dir) && \ |
| 222 | source ../dpdk-meson-venv/bin/activate && \ |
| 223 | meson install && \ |
| 224 | cd $(dpdk_install_dir)/lib && \ |
| 225 | echo "GROUP ( $$(ls librte*.a ) )" > libdpdk.a && \ |
| 226 | rm -rf librte*.so librte*.so.* dpdk/*/librte*.so dpdk/*/librte*.so.* && \ |
Mohammed Hawari | a6d5f24 | 2020-10-22 14:14:04 +0200 | [diff] [blame] | 227 | deactivate |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 228 | endef |
Damjan Marion | 561f273 | 2018-09-21 12:27:45 +0200 | [diff] [blame] | 229 | |
Mohammed Hawari | 4c4633c | 2020-09-15 14:05:11 +0200 | [diff] [blame] | 230 | $(eval $(call package,dpdk)) |