%define kmod_name ena %define kmod_vendor redhat %define kmod_rpm_name kmod-redhat-ena %define kmod_driver_version 2.1.0K_dup8.3 %define kmod_driver_epoch %{nil} %define kmod_rpm_release 0.1 %define kmod_kernel_version 4.18.0-240.el8 %define kmod_kernel_version_min %{nil} %define kmod_kernel_version_dep %{nil} %define kmod_kbuild_dir drivers/net/ethernet/amazon/ena %define kmod_dependencies %{nil} %define kmod_dist_build_deps %{nil} %define kmod_build_dependencies %{nil} %define kmod_devel_package 0 %define kmod_devel_src_paths %{nil} %define kmod_install_path extra/kmod-redhat-ena %define kernel_pkg kernel %define kernel_devel_pkg kernel-devel %define kernel_modules_pkg kernel-modules %{!?dist: %define dist .el8_3} %{!?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: 0001-net-ena-change-num_queues-to-num_io_queues-for-clari.patch Patch1: 0002-net-ena-multiple-queue-creation-related-cleanups.patch Patch2: 0003-net-ena-ethtool-get_channels-use-combined-only.patch Patch3: 0004-net-ena-make-ethtool-l-show-correct-max-number-of-qu.patch Patch4: 0005-net-ena-remove-redundant-print-of-number-of-queues.patch Patch5: 0006-net-ena-ethtool-support-set_channels-callback.patch Patch6: 0007-net-ena-fix-napi-handler-misbehavior-when-the-napi-b.patch Patch7: 0008-net-ena-implement-XDP-drop-support.patch Patch8: 0009-net-ena-Implement-XDP_TX-action.patch Patch9: 0010-net-ena-Add-first_interrupt-field-to-napi-struct.patch Patch10: 0011-net-ena-fix-default-tx-interrupt-moderation-interval.patch Patch11: 0012-net-ena-fix-issues-in-setting-interrupt-moderation-p.patch Patch12: 0013-net-ena-remove-set-but-not-used-variable-rx_ring.patch Patch13: 0014-net-ena-fix-potential-crash-when-rxfh-key-is-NULL.patch Patch14: 0015-net-ena-fix-uses-of-round_jiffies.patch Patch15: 0016-net-ena-add-missing-ethtool-TX-timestamping-indicati.patch Patch16: 0017-net-ena-fix-incorrect-default-RSS-key.patch Patch17: 0018-net-ena-rss-do-not-allocate-key-when-not-supported.patch Patch18: 0019-net-ena-rss-fix-failure-to-get-indirection-table.patch Patch19: 0020-net-ena-rss-store-hash-function-as-values-and-not-bi.patch Patch20: 0021-net-ena-fix-incorrectly-saving-queue-numbers-when-se.patch Patch21: 0022-net-ena-fix-corruption-of-dev_idx_to_host_tbl.patch Patch22: 0023-net-ena-make-ena-rxfh-support-ETH_RSS_HASH_NO_CHANGE.patch Patch23: 0024-net-ena-ethtool-use-correct-value-for-crc32-hash.patch Patch24: 0025-net-ena-ena-com.c-prevent-NULL-pointer-dereference.patch Patch25: 0026-net-ena-remove-set-but-not-used-variable-hash_key.patch Patch26: 0027-net-ena-ethtool-remove-redundant-non-zero-check-on-r.patch Patch27: 0030-net-ena-reject-unsupported-coalescing-params.patch Patch28: 0031-net-ena-ethtool-clean-up-minor-indentation-issue.patch Patch29: 0032-net-ena-fix-incorrect-setting-of-the-number-of-msix-.patch Patch30: 0033-net-ena-fix-request-of-incorrect-number-of-IRQ-vecto.patch Patch31: 0034-net-ena-avoid-memory-access-violation-by-validating-.patch Patch32: 0035-net-ena-fix-continuous-keep-alive-resets.patch Patch33: 0036-net-ena-Make-some-functions-static.patch Patch34: 0037-net-ena-Fix-build-warning-in-ena_xdp_set.patch Patch35: 0038-net-ena-avoid-unnecessary-admin-command-when-RSS-fun.patch Patch36: 0039-net-ena-fix-error-returning-in-ena_com_get_hash_func.patch Patch37: 0040-net-ena-allow-setting-the-hash-function-without-chan.patch Patch38: 0041-net-ena-change-default-RSS-hash-function-to-Toeplitz.patch Patch39: 0042-net-ena-changes-to-RSS-hash-key-allocation.patch Patch40: 0043-net-ena-remove-code-that-does-nothing.patch Patch41: 0044-net-ena-add-unmask-interrupts-statistics-to-ethtool.patch Patch42: 0045-net-ena-add-support-for-reporting-of-packet-drops.patch Patch43: 0046-net-ena-drop-superfluous-prototype.patch Patch44: 0047-net-ena-use-SHUTDOWN-as-reset-reason-when-closing-in.patch Patch45: 0048-net-ena-cosmetic-remove-unnecessary-spaces-and-tabs-.patch Patch46: 0049-net-ena-cosmetic-extract-code-to-ena_indirection_tab.patch Patch47: 0051-net-ena-add-support-for-the-rx-offset-feature.patch Patch48: 0052-net-ena-rename-ena_com_free_desc-to-make-API-more-un.patch Patch49: 0053-net-ena-use-explicit-variable-size-for-clarity.patch Patch50: 0054-net-ena-fix-ena_com_comp_status_to_errno-return-valu.patch Patch51: 0055-net-ena-simplify-ena_com_update_intr_delay_resolutio.patch Patch52: 0056-net-ena-cosmetic-rename-ena_update_tx-rx_rings_intr_.patch Patch53: 0057-net-ena-cosmetic-set-queue-sizes-to-u32-for-consiste.patch Patch54: 0058-net-ena-cosmetic-fix-spelling-and-grammar-mistakes-i.patch Patch55: 0059-net-ena-cosmetic-fix-line-break-issues.patch Patch56: 0060-net-ena-cosmetic-remove-unnecessary-code.patch Patch57: 0061-net-ena-cosmetic-code-reorderings.patch Patch58: 0062-net-ena-cosmetic-fix-spacing-issues.patch Patch59: 0063-net-ena-cosmetic-minor-code-changes.patch Patch60: 0064-net-ena-reduce-driver-load-time.patch Patch61: 0066-net-ena-xdp-XDP_TX-fix-memory-leak.patch Patch62: 0067-net-ena-xdp-update-napi-budget-for-DROP-and-ABORTED.patch Patch63: 0068-ena_netdev-use-generic-power-management.patch Patch64: 0069-net-ena-Fix-using-plain-integer-as-NULL-pointer-in-e.patch Patch65: 0070-net-ena-avoid-unnecessary-rearming-of-interrupt-vect.patch Patch66: 0071-net-ena-add-reserved-PCI-device-ID.patch Patch67: 0072-net-ena-cosmetic-satisfy-gcc-warning.patch Patch68: 0073-net-ena-cosmetic-change-ena_com_stats_admin-stats-to.patch Patch69: 0074-net-ena-add-support-for-traffic-mirroring.patch Patch70: 0075-net-ena-enable-support-of-rss-hash-key-and-function-.patch Patch71: 0076-net-ena-move-llq-configuration-from-ena_probe-to-ena.patch Patch72: 0077-net-ena-support-new-LLQ-acceleration-mode.patch Patch73: 0078-net-ena-Change-WARN_ON-expression-in-ena_del_napi_in.patch Patch74: 9000-version-bump.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-ena Version: %{kmod_driver_version} Release: %{kmod_rpm_release}%{?dist} %if "%{kmod_driver_epoch}" != "" Epoch: %{kmod_driver_epoch} %endif Summary: ena 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: aarch64 %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 >= 4.18.0-240.el8 Requires: kernel < 4.18.0-241.el8 %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 ena kernel module for Driver Update Program %if 0 %package -n kmod-redhat-ena-firmware Version: ENTER_FIRMWARE_VERSION Summary: ena 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-ena-firmware ena firmware for Driver Update Program %files -n kmod-redhat-ena-firmware %defattr(644,root,root,755) %{FIRMWARE_FILES} %endif # Development package %if 0%{kmod_devel_package} %package -n kmod-redhat-ena-devel Version: %{kmod_driver_version} Requires: kernel >= 4.18.0-240.el8 Requires: kernel < 4.18.0-241.el8 Summary: ena development files for Driver Update Program %description -n kmod-redhat-ena-devel ena development files for Driver Update Program %files -n kmod-redhat-ena-devel %defattr(644,root,root,755) /lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/ %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-ena-%{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 %doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt %prep %setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version} %patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 %patch15 -p1 %patch16 -p1 %patch17 -p1 %patch18 -p1 %patch19 -p1 %patch20 -p1 %patch21 -p1 %patch22 -p1 %patch23 -p1 %patch24 -p1 %patch25 -p1 %patch26 -p1 %patch27 -p1 %patch28 -p1 %patch29 -p1 %patch30 -p1 %patch31 -p1 %patch32 -p1 %patch33 -p1 %patch34 -p1 %patch35 -p1 %patch36 -p1 %patch37 -p1 %patch38 -p1 %patch39 -p1 %patch40 -p1 %patch41 -p1 %patch42 -p1 %patch43 -p1 %patch44 -p1 %patch45 -p1 %patch46 -p1 %patch47 -p1 %patch48 -p1 %patch49 -p1 %patch50 -p1 %patch51 -p1 %patch52 -p1 %patch53 -p1 %patch54 -p1 %patch55 -p1 %patch56 -p1 %patch57 -p1 %patch58 -p1 %patch59 -p1 %patch60 -p1 %patch61 -p1 %patch62 -p1 %patch63 -p1 %patch64 -p1 %patch65 -p1 %patch66 -p1 %patch67 -p1 %patch68 -p1 %patch69 -p1 %patch70 -p1 %patch71 -p1 %patch72 -p1 %patch73 -p1 %patch74 -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 %{nil}" \ 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_rpm_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/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/Module.symvers if [ -n "%{kmod_devel_src_paths}" ]; then for i in %{kmod_devel_src_paths}; do mkdir -p "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$(dirname "$i")" cp -rv "$PWD/source/$i" \ "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$i" done fi %endif %clean rm -rf $RPM_BUILD_ROOT %changelog * Mon Nov 23 2020 Eugene Syromiatnikov 2.1.0K_dup8.3-0.1 - bfcc924fa05e36abe7a039ac5ec2be581e20c288 - ena kernel module for Driver Update Program - Resolves: #bz1875784