diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d10142 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/i40e-redhat-2.8.10_k_dup7.7.tar.bz2 diff --git a/.kmod-redhat-i40e.metadata b/.kmod-redhat-i40e.metadata new file mode 100644 index 0000000..a2a63d6 --- /dev/null +++ b/.kmod-redhat-i40e.metadata @@ -0,0 +1 @@ +445baf5a93bf83da1c63f71ac667658ae38fd06c SOURCES/i40e-redhat-2.8.10_k_dup7.7.tar.bz2 diff --git a/SOURCES/0000-netdrv-i40e-Add-support-for-X710-device.patch b/SOURCES/0000-netdrv-i40e-Add-support-for-X710-device.patch new file mode 100644 index 0000000..3f4cd93 --- /dev/null +++ b/SOURCES/0000-netdrv-i40e-Add-support-for-X710-device.patch @@ -0,0 +1,44 @@ +From 0e32866f4ae64bf3a06d789603e3d428dc2a7dad Mon Sep 17 00:00:00 2001 +From: Stefan Assmann +Date: Mon, 30 Sep 2019 08:34:07 -0400 +Subject: [PATCH] [netdrv] i40e: Add support for X710 device + +Message-id: <20190930083407.29024-1-sassmann@redhat.com> +Patchwork-id: 275434 +O-Subject: [RHEL7.8 PATCH] i40e: Add support for X710 device +Bugzilla: 1711843 +RH-Acked-by: Kamal Heib +RH-Acked-by: Dean Nelson +RH-Acked-by: Gopal Tiwari + +From: Mariusz Stachura + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1711843 +Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23769134 +Testing: Will be done by Dell, Red Hat does not have this device. + +Add I40E_DEV_ID_10G_BASE_T_BC to i40e_pci_tbl + +Signed-off-by: Mariusz Stachura +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher + +Signed-off-by: Stefan Assmann +(cherry picked from commit f78787f3635230cc2f72947a54050043fb137db0) +Signed-off-by: Jan Stancek +--- + drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + + 1 file changed, 1 insertion(+) + +Index: src/drivers/net/ethernet/intel/i40e/i40e_main.c +=================================================================== +--- src.orig/drivers/net/ethernet/intel/i40e/i40e_main.c 2019-11-26 14:27:07.390914770 +0100 ++++ src/drivers/net/ethernet/intel/i40e/i40e_main.c 2019-11-26 14:29:14.133383144 +0100 +@@ -69,6 +69,7 @@ + {PCI_VDEVICE(INTEL, I40E_DEV_ID_QSFP_C), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T4), 0}, ++ {PCI_VDEVICE(INTEL, I40E_DEV_ID_10G_BASE_T_BC), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_KX_X722), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_QSFP_X722), 0}, + {PCI_VDEVICE(INTEL, I40E_DEV_ID_SFP_X722), 0}, diff --git a/SOURCES/0001-netdrv-i40e-enable-X710-support.patch b/SOURCES/0001-netdrv-i40e-enable-X710-support.patch new file mode 100644 index 0000000..091876a --- /dev/null +++ b/SOURCES/0001-netdrv-i40e-enable-X710-support.patch @@ -0,0 +1,63 @@ +From 6680ff47e1398d1ede99fb703853d5bcff6ea92f Mon Sep 17 00:00:00 2001 +From: Stefan Assmann +Date: Wed, 6 Nov 2019 13:04:55 -0500 +Subject: [PATCH] [netdrv] i40e: enable X710 support + +Message-id: <20191106130455.27305-1-sassmann@redhat.com> +Patchwork-id: 283508 +O-Subject: [RHEL7.8 PATCH] i40e: enable X710 support +Bugzilla: 1764987 +RH-Acked-by: David Arcari +RH-Acked-by: Dean Nelson +RH-Acked-by: John Linville +RH-Acked-by: Ken Cox + +From: Alice Michael + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1764987 +Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=24507533 +Testing: Build test only, we don't have the hardware yet. + +The I40E_DEV_ID_10G_BASE_T_BC device id was added previously, +but was not enabled in all the appropriate places. Adding it +to enable it's use. + +Signed-off-by: Alice Michael +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher + +Signed-off-by: Stefan Assmann +(cherry picked from commit 3df5b9a6a9ec3c1e4431bf1db3426b54dc92dd91) +Signed-off-by: Jan Stancek +--- + drivers/net/ethernet/intel/i40e/i40e_common.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: src/drivers/net/ethernet/intel/i40e/i40e_common.c +=================================================================== +--- src.orig/drivers/net/ethernet/intel/i40e/i40e_common.c 2019-11-26 14:23:19.956074291 +0100 ++++ src/drivers/net/ethernet/intel/i40e/i40e_common.c 2019-11-26 14:30:29.655662234 +0100 +@@ -28,6 +28,7 @@ + case I40E_DEV_ID_QSFP_C: + case I40E_DEV_ID_10G_BASE_T: + case I40E_DEV_ID_10G_BASE_T4: ++ case I40E_DEV_ID_10G_BASE_T_BC: + case I40E_DEV_ID_20G_KR2: + case I40E_DEV_ID_20G_KR2_A: + case I40E_DEV_ID_25G_B: +@@ -4837,6 +4838,7 @@ + break; + case I40E_DEV_ID_10G_BASE_T: + case I40E_DEV_ID_10G_BASE_T4: ++ case I40E_DEV_ID_10G_BASE_T_BC: + case I40E_DEV_ID_10G_BASE_T_X722: + case I40E_DEV_ID_25G_B: + case I40E_DEV_ID_25G_SFP28: +@@ -4873,6 +4875,7 @@ + break; + case I40E_DEV_ID_10G_BASE_T: + case I40E_DEV_ID_10G_BASE_T4: ++ case I40E_DEV_ID_10G_BASE_T_BC: + case I40E_DEV_ID_10G_BASE_T_X722: + case I40E_DEV_ID_25G_B: + case I40E_DEV_ID_25G_SFP28: diff --git a/SOURCES/9000-bump-version.patch b/SOURCES/9000-bump-version.patch new file mode 100644 index 0000000..5e1f274 --- /dev/null +++ b/SOURCES/9000-bump-version.patch @@ -0,0 +1,13 @@ +Index: src/drivers/net/ethernet/intel/i40e/i40e_main.c +=================================================================== +--- src.orig/drivers/net/ethernet/intel/i40e/i40e_main.c 2019-11-26 14:29:14.133383144 +0100 ++++ src/drivers/net/ethernet/intel/i40e/i40e_main.c 2019-11-26 14:33:26.364315257 +0100 +@@ -23,7 +23,7 @@ + static const char i40e_driver_string[] = + "Intel(R) Ethernet Connection XL710 Network Driver"; + +-#define DRV_KERN "-k" ++#define DRV_KERN "-k_dup7.7" + + #define DRV_VERSION_MAJOR 2 + #define DRV_VERSION_MINOR 8 diff --git a/SOURCES/9001-add-I40E_DEV_ID_10G_BASE_T_BC-devid.patch b/SOURCES/9001-add-I40E_DEV_ID_10G_BASE_T_BC-devid.patch new file mode 100644 index 0000000..913a902 --- /dev/null +++ b/SOURCES/9001-add-I40E_DEV_ID_10G_BASE_T_BC-devid.patch @@ -0,0 +1,12 @@ +Index: src/drivers/net/ethernet/intel/i40e/i40e_devids.h +=================================================================== +--- src.orig/drivers/net/ethernet/intel/i40e/i40e_devids.h 2019-11-26 17:00:49.307569912 +0100 ++++ src/drivers/net/ethernet/intel/i40e/i40e_devids.h 2019-11-26 17:02:26.602894669 +0100 +@@ -18,6 +18,7 @@ + #define I40E_DEV_ID_10G_BASE_T4 0x1589 + #define I40E_DEV_ID_25G_B 0x158A + #define I40E_DEV_ID_25G_SFP28 0x158B ++#define I40E_DEV_ID_10G_BASE_T_BC 0x15FF + #define I40E_DEV_ID_KX_X722 0x37CE + #define I40E_DEV_ID_QSFP_X722 0x37CF + #define I40E_DEV_ID_SFP_X722 0x37D0 diff --git a/SPECS/i40e.spec b/SPECS/i40e.spec new file mode 100644 index 0000000..d193a49 --- /dev/null +++ b/SPECS/i40e.spec @@ -0,0 +1,289 @@ +%define kmod_name i40e +%define kmod_vendor redhat +%define kmod_driver_version 2.8.10_k_dup7.7 +%define kmod_driver_epoch %{nil} +%define kmod_rpm_release 2 +%define kmod_kernel_version 3.10.0-1062.el7 +%define kmod_kernel_version_min %{nil} +%define kmod_kernel_version_dep %{nil} +%define kmod_kbuild_dir drivers/net/ethernet/intel/i40e +%define kmod_dependencies %{nil} +%define kmod_dist_build_deps %{nil} +%define kmod_build_dependencies %{nil} +%define kmod_devel_package 1 +%define kmod_install_path extra/kmod-redhat-i40e +%define kernel_pkg kernel +%define kernel_devel_pkg kernel-devel +%define kernel_modules_pkg kernel-modules + +%{!?dist: %define dist .el7_7} +%{!?make_build: %define make_build make} + +%if "%{kmod_kernel_version_dep}" == "" +%define kmod_kernel_version_dep %{kmod_kernel_version} +%endif + +%if "%{kmod_dist_build_deps}" == "" +%if (0%{?rhel} > 7) || (0%{?centos} > 7) +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod +%else +%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists +%endif +%endif + +Source0: %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2 +# Source code patches +Patch0: 0000-netdrv-i40e-Add-support-for-X710-device.patch +Patch1: 0001-netdrv-i40e-enable-X710-support.patch +Patch2: 9000-bump-version.patch +Patch3: 9001-add-I40E_DEV_ID_10G_BASE_T_BC-devid.patch + +%define findpat %( echo "%""P" ) +%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms +%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release} +%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi ) +%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups +%define kver_state_dir %{dup_state_dir}/kver +%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch) +%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules + +Name: kmod-redhat-i40e +Version: %{kmod_driver_version} +Release: %{kmod_rpm_release}%{?dist} +%if "%{kmod_driver_epoch}" != "" +Epoch: %{kmod_driver_epoch} +%endif +Summary: i40e kernel module for Driver Update Program +Group: System/Kernel +License: GPLv2 +URL: https://www.kernel.org/ +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildRequires: %kernel_devel_pkg = %kmod_kernel_version +%if "%{kmod_dist_build_deps}" != "" +BuildRequires: %{kmod_dist_build_deps} +%endif +ExclusiveArch: x86_64 +%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch) + +%global _use_internal_dependency_generator 0 +%if "%{?kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires(post): %{sbindir}/weak-modules +Requires(postun): %{sbindir}/weak-modules +Requires: kernel >= 3.10.0-1062.el7 + +Requires: kernel < 3.10.0-1063.el7 +%if 0 +Requires: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION +%endif +%if "%{kmod_build_dependencies}" != "" +BuildRequires: %{kmod_build_dependencies} +%endif +%if "%{kmod_dependencies}" != "" +Requires: %{kmod_dependencies} +%endif +# if there are multiple kmods for the same driver from different vendors, +# they should conflict with each other. +Conflicts: kmod-%{kmod_name} + +%description +i40e kernel module for Driver Update Program + +%if 0 + +%package -n kmod-redhat-i40e-firmware +Version: ENTER_FIRMWARE_VERSION +Summary: i40e firmware for Driver Update Program +Provides: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION +%if "%{kmod_kernel_version_min}" != "" +Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu} +%else +Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu} +%endif +%description -n kmod-redhat-i40e-firmware +i40e firmware for Driver Update Program + + +%files -n kmod-redhat-i40e-firmware +%defattr(644,root,root,755) +%{FIRMWARE_FILES} + +%endif + +# Development package +%if 0%{kmod_devel_package} +%package -n kmod-redhat-i40e-devel +Version: %{kmod_driver_version} +Requires: kernel >= 3.10.0-1062.el7 + +Requires: kernel < 3.10.0-1063.el7 +Summary: i40e development files for Driver Update Program + +%description -n kmod-redhat-i40e-devel +i40e development files for Driver Update Program + + +%files -n kmod-redhat-i40e-devel +%defattr(644,root,root,755) +/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers +%endif + +%post +modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') ) +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs + +mkdir -p "%{kver_state_dir}" +touch "%{kver_state_file}" + +exit 0 + +%posttrans +# We have to re-implement part of weak-modules here because it doesn't allow +# calling initramfs regeneration separately +if [ -f "%{kver_state_file}" ]; then + kver_base="%{kmod_kernel_version_dep}" + kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*) + + for k_dir in $kvers; do + k="${k_dir#/lib/modules/}" + + tmp_initramfs="/boot/initramfs-$k.tmp" + dst_initramfs="/boot/initramfs-$k.img" + + # The same check as in weak-modules: we assume that the kernel present + # if the symvers file exists. + if [ -e "/boot/symvers-$k.gz" ]; then + /usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1 + cmp -s "$tmp_initramfs" "$dst_initramfs" + if [ "$?" = 1 ]; then + mv "$tmp_initramfs" "$dst_initramfs" + else + rm -f "$tmp_initramfs" + fi + fi + done + + rm -f "%{kver_state_file}" + rmdir "%{kver_state_dir}" 2> /dev/null +fi + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%preun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + mkdir -p "%{kver_state_dir}" + touch "%{kver_state_file}" +fi + +mkdir -p "%{dup_state_dir}" +rpm -ql kmod-redhat-i40e-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \ + grep '\.ko$' > "%{dup_module_list}" + +%postun +if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then + initramfs_opt="--no-initramfs" +else + initramfs_opt="" +fi + +modules=( $(cat "%{dup_module_list}") ) +rm -f "%{dup_module_list}" +printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt + +rmdir "%{dup_state_dir}" 2> /dev/null + +exit 0 + +%files +%defattr(644,root,root,755) +/lib/modules/%{kmod_kernel_version}.%(arch) +/etc/depmod.d/%{kmod_name}.conf +/usr/share/doc/kmod-%{kmod_name}/greylist.txt + +%prep +%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version} + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +set -- * +mkdir source +mv "$@" source/ +mkdir obj + +%build +rm -rf obj +cp -r source obj + +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \ + NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi" \ + EXTRA_CFLAGS="%{nil}" \ + %{nil} +# mark modules executable so that strip-to-file can strip them +find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' + + +whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}" +for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do + # update depmod.conf + module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//') + if [ -z "$module_weak_path" ]; then + module_weak_path=%{name} + else + module_weak_path=%{name}/$module_weak_path + fi + echo "override $(echo $modules | sed 's/.*\///')" \ + "$(echo "%{kmod_kernel_version_dep}" | + sed 's/\.[^\.]*$//; + s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \ + "weak-updates/$module_weak_path" >> source/depmod.conf + + # update greylist + nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do + grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist + done +done +sort -u source/greylist | uniq > source/greylist.txt + +%install +export INSTALL_MOD_PATH=$RPM_BUILD_ROOT +export INSTALL_MOD_DIR=%{kmod_install_path} +PWD_PATH="$PWD" +%if "%{workaround_no_pwd_rel_path}" != "1" +PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD") +%endif +make -C %{kernel_source} modules_install \ + M=$PWD_PATH/obj/%{kmod_kbuild_dir} +# Cleanup unnecessary kernel-generated module dependency files. +find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \; + +install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf +install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt +%if 0 +%{FIRMWARE_FILES_INSTALL} +%endif +%if 0%{kmod_devel_package} +install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%changelog +* Tue Jan 07 2020 Eugene Syromiatnikov 2.8.10_k_dup7.7-2 +- Rebuild due to issues with brew environment + +* Fri Dec 20 2019 Eugene Syromiatnikov 2.8.10_k_dup7.7-1 +- c45db7d2f34d6fad924c20443f73147dca7f6e29 +- i40e kernel module for Driver Update Program +- Resolves: #bz1784768