From 74e1022faed8462d2ae4d97e6d7ad27e49cf60a8 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: May 09 2024 05:41:05 +0000 Subject: Install the driver of physical device for a SR-IOV virtual device Related: https://issues.redhat.com/browse/RHEL-7028 Conflict: None Upstream Status: git@github.com:rhkdump/kdump-utils.git commit 7a8edc8de67dccae23b01461bc3b17c0ad42aa5f Author: Coiby Xu Date: Wed Sep 27 09:31:39 2023 +0800 Install the driver of physical device for a SR-IOV virtual device Currently, network dumping failed over a NIC that is a Single Root I/O Virtualization (SR-IOV) virtual device. Usually the driver of the virtual device won't specify the dependency on the driver of the physical device. So to fix this issue, the driver of the physical device needs to be found and installed as well. Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers") Signed-off-by: Coiby Xu Signed-off-by: Coiby Xu --- diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 454e8b0..6af8f3b 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -391,6 +391,14 @@ _get_hpyerv_physical_driver() { _get_nic_driver "$_physical_nic" } +_get_physical_function_driver() { + local _physfn_dir=/sys/class/net/"$1"/device/physfn + + if [[ -e "$_physfn_dir" ]]; then + basename "$(readlink -f "$_physfn_dir"/driver)" + fi +} + kdump_install_nic_driver() { local _netif _driver _drivers @@ -418,6 +426,9 @@ kdump_install_nic_driver() { fi _drivers+=("$_driver") + # For a Single Root I/O Virtualization (SR-IOV) virtual device, + # the driver of physical device needs to be installed as well + _drivers+=("$(_get_physical_function_driver "$_netif")") done [[ -n ${_drivers[*]} ]] || return