Commit 11694e8d authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

test/env_dpdk: add starting version for DPDK patches



There are cases that we might want to apply different
patches to DPDK the same copy of the headers. This
depends on which DPDK is currently tested against.

To support that, the patches should be prepended
with first DPDK version that it applies.

Next patch in series will add new patch for DPDK 23.07,
yet the header copies will remain the same - DPDK 22.11.
Then particular patch will be applied when testing
DPDK 23.07 or later.

Change-Id: I365fabfd161fd09f72fc5e8fbe1ccefa99648e4c
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19360


Reviewed-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 30b534c9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ rather than system installed ones.
In rare cases there might be a need to apply a specific workaround for
particular DPDK PCI API version. Then a patch should be added in
`spdk_root/scripts/env_dpdk/<ver>` where ver is the matching DPDK version.
Filename for any patch within that directory should start with first DPDK version
that it applies to, only latest patch is used.

## Flow for adding support for new DPDK PCI API version

+12 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ source "$rootdir/scripts/common.sh"

set -e
shopt -s extglob
shopt -s nullglob

mode=${1:-check} # check or fix

@@ -41,9 +42,19 @@ done

for header in "${target_headers[@]}"; do
	dpdk_file="$dpdk_dir/$(git -C "$dpdk_dir" ls-files "*/$header")"
	patch_dir="$scriptdir/$target_ver"
	patch_versions=("$patch_dir/"+([0-9]).+([0-9])-$header.patch)
	patch_versions=("${patch_versions[@]#"$patch_dir/"}")
	patch_versions=("${patch_versions[@]%-$header.patch*}")

	# Patch file version matches to versions equal or greater than
	# their creation.
	while read -r ver; do
		ge "$dpdk_ver" "$ver" && patch_version=$ver && break
	done < <(printf "%s\n" "${patch_versions[@]}" | sort -Vru)

	# Patch DPDK header with any workarounds necessary
	patch_file="$scriptdir/$target_ver/$header.patch"
	patch_file="$patch_dir/$patch_version-$header.patch"
	if [[ -s $patch_file ]]; then
		dpdk_header=$(patch -s "$dpdk_file" "$patch_file" -o - | sed "$use_local_includes")
	else