From 2e2de413ce7e36c5ad288aea196271b28e852c57 Mon Sep 17 00:00:00 2001 From: Peter Georg Date: Aug 11 2021 16:00:52 +0000 Subject: Initial version --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2c037a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/lpfc-4.18.0-305.el8.tar.xz diff --git a/.kmod-lpfc.metadata b/.kmod-lpfc.metadata new file mode 100644 index 0000000..6f936ab --- /dev/null +++ b/.kmod-lpfc.metadata @@ -0,0 +1 @@ +de9f815f89072314f73e33dc1c215212d27441a0 SOURCES/lpfc-4.18.0-305.el8.tar.xz diff --git a/SOURCES/0001-add-deprecated-ids.patch b/SOURCES/0001-add-deprecated-ids.patch new file mode 100644 index 0000000..1d7014f --- /dev/null +++ b/SOURCES/0001-add-deprecated-ids.patch @@ -0,0 +1,381 @@ +--- a/src/lpfc_attr.c ++++ b/src/lpfc_attr.c +@@ -7266,6 +7266,12 @@ + switch (phba->pcidev->device) { + case PCI_DEVICE_ID_SKYHAWK: + case PCI_DEVICE_ID_SKYHAWK_VF: ++ case PCI_DEVICE_ID_LANCER_FCOE: ++ case PCI_DEVICE_ID_LANCER_FCOE_VF: ++ case PCI_DEVICE_ID_ZEPHYR_DCSP: ++ case PCI_DEVICE_ID_HORNET: ++ case PCI_DEVICE_ID_TIGERSHARK: ++ case PCI_DEVICE_ID_TOMCAT: + phba->hba_flag |= HBA_FCOE_MODE; + break; + default: +--- a/src/lpfc_els.c ++++ b/src/lpfc_els.c +@@ -3859,6 +3859,15 @@ + case IOSTAT_LOCAL_REJECT: + switch ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK)) { + case IOERR_LOOP_OPEN_FAILURE: ++ if (cmd == ELS_CMD_FLOGI) { ++ if (PCI_DEVICE_ID_HORNET == ++ phba->pcidev->device) { ++ phba->fc_topology = LPFC_TOPOLOGY_LOOP; ++ phba->pport->fc_myDID = 0; ++ phba->alpa_map[0] = 0; ++ phba->alpa_map[1] = 0; ++ } ++ } + if (cmd == ELS_CMD_PLOGI && cmdiocb->retry == 0) + delay = 1000; + retry = 1; +--- a/src/lpfc_hw.h ++++ b/src/lpfc_hw.h +@@ -1569,24 +1569,54 @@ + + /* Start FireFly Register definitions */ + #define PCI_VENDOR_ID_EMULEX 0x10df ++#define PCI_DEVICE_ID_FIREFLY 0x1ae5 ++#define PCI_DEVICE_ID_PROTEUS_VF 0xe100 ++#define PCI_DEVICE_ID_BALIUS 0xe131 ++#define PCI_DEVICE_ID_PROTEUS_PF 0xe180 + #define PCI_DEVICE_ID_LANCER_FC 0xe200 ++#define PCI_DEVICE_ID_LANCER_FC_VF 0xe208 + #define PCI_DEVICE_ID_LANCER_FCOE 0xe260 ++#define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268 + #define PCI_DEVICE_ID_LANCER_G6_FC 0xe300 + #define PCI_DEVICE_ID_LANCER_G7_FC 0xf400 + #define PCI_DEVICE_ID_SAT_SMB 0xf011 + #define PCI_DEVICE_ID_SAT_MID 0xf015 ++#define PCI_DEVICE_ID_RFLY 0xf095 ++#define PCI_DEVICE_ID_PFLY 0xf098 ++#define PCI_DEVICE_ID_LP101 0xf0a1 ++#define PCI_DEVICE_ID_TFLY 0xf0a5 ++#define PCI_DEVICE_ID_BSMB 0xf0d1 + #define PCI_DEVICE_ID_BMID 0xf0d5 + #define PCI_DEVICE_ID_ZSMB 0xf0e1 + #define PCI_DEVICE_ID_ZMID 0xf0e5 ++#define PCI_DEVICE_ID_NEPTUNE 0xf0f5 ++#define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6 ++#define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7 + #define PCI_DEVICE_ID_SAT 0xf100 + #define PCI_DEVICE_ID_SAT_SCSP 0xf111 + #define PCI_DEVICE_ID_SAT_DCSP 0xf112 + #define PCI_DEVICE_ID_FALCON 0xf180 ++#define PCI_DEVICE_ID_SUPERFLY 0xf700 ++#define PCI_DEVICE_ID_DRAGONFLY 0xf800 ++#define PCI_DEVICE_ID_CENTAUR 0xf900 ++#define PCI_DEVICE_ID_PEGASUS 0xf980 ++#define PCI_DEVICE_ID_THOR 0xfa00 ++#define PCI_DEVICE_ID_VIPER 0xfb00 ++#define PCI_DEVICE_ID_LP10000S 0xfc00 ++#define PCI_DEVICE_ID_LP11000S 0xfc10 ++#define PCI_DEVICE_ID_LPE11000S 0xfc20 + #define PCI_DEVICE_ID_SAT_S 0xfc40 ++#define PCI_DEVICE_ID_PROTEUS_S 0xfc50 ++#define PCI_DEVICE_ID_HELIOS 0xfd00 ++#define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11 ++#define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12 + #define PCI_DEVICE_ID_ZEPHYR 0xfe00 ++#define PCI_DEVICE_ID_HORNET 0xfe05 + #define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11 + #define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12 + #define PCI_VENDOR_ID_SERVERENGINE 0x19a2 ++#define PCI_DEVICE_ID_TIGERSHARK 0x0704 ++#define PCI_DEVICE_ID_TOMCAT 0x0714 + #define PCI_DEVICE_ID_SKYHAWK 0x0724 + #define PCI_DEVICE_ID_SKYHAWK_VF 0x072c + +@@ -4205,11 +4235,16 @@ + static inline int + lpfc_is_LC_HBA(unsigned short device) + { +- if ((device == PCI_DEVICE_ID_BMID) || ++ if ((device == PCI_DEVICE_ID_TFLY) || ++ (device == PCI_DEVICE_ID_PFLY) || ++ (device == PCI_DEVICE_ID_LP101) || ++ (device == PCI_DEVICE_ID_BMID) || ++ (device == PCI_DEVICE_ID_BSMB) || + (device == PCI_DEVICE_ID_ZMID) || + (device == PCI_DEVICE_ID_ZSMB) || + (device == PCI_DEVICE_ID_SAT_MID) || +- (device == PCI_DEVICE_ID_SAT_SMB)) ++ (device == PCI_DEVICE_ID_SAT_SMB) || ++ (device == PCI_DEVICE_ID_RFLY)) + return 1; + else + return 0; +--- a/src/lpfc_ids.h ++++ b/src/lpfc_ids.h +@@ -24,10 +24,44 @@ + #include + + const struct pci_device_id lpfc_id_table[] = { ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_FIREFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_THOR, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PEGASUS, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_CENTAUR, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_DRAGONFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SUPERFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_RFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_SCSP, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_DCSP, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_SCSP, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_DCSP, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HORNET, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_SCSP, + PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_DCSP, +@@ -36,6 +70,16 @@ + PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_TFLY, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP101, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP10000S, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP11000S, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT, + PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_MID, +@@ -48,10 +92,28 @@ + PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_S, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PROTEUS_VF, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PROTEUS_PF, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PROTEUS_S, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TIGERSHARK, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_SERVERENGINE, PCI_DEVICE_ID_TOMCAT, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_FALCON, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BALIUS, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_FC, + PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_FCOE, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_FC_VF, ++ PCI_ANY_ID, PCI_ANY_ID, }, ++ {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_FCOE_VF, ++ PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G6_FC, + PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G7_FC, +--- a/src/lpfc_init.c ++++ b/src/lpfc_init.c +@@ -2362,9 +2362,83 @@ + vp = &phba->vpd; + + switch (dev_id) { ++ case PCI_DEVICE_ID_FIREFLY: ++ m = (typeof(m)){"LP6000", "PCI", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_SUPERFLY: ++ if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) ++ m = (typeof(m)){"LP7000", "PCI", ""}; ++ else ++ m = (typeof(m)){"LP7000E", "PCI", ""}; ++ m.function = "Obsolete, Unsupported Fibre Channel Adapter"; ++ break; ++ case PCI_DEVICE_ID_DRAGONFLY: ++ m = (typeof(m)){"LP8000", "PCI", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_CENTAUR: ++ if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) ++ m = (typeof(m)){"LP9002", "PCI", ""}; ++ else ++ m = (typeof(m)){"LP9000", "PCI", ""}; ++ m.function = "Obsolete, Unsupported Fibre Channel Adapter"; ++ break; ++ case PCI_DEVICE_ID_RFLY: ++ m = (typeof(m)){"LP952", "PCI", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_PEGASUS: ++ m = (typeof(m)){"LP9802", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_THOR: ++ m = (typeof(m)){"LP10000", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_VIPER: ++ m = (typeof(m)){"LPX1000", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_PFLY: ++ m = (typeof(m)){"LP982", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_TFLY: ++ m = (typeof(m)){"LP1050", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_HELIOS: ++ m = (typeof(m)){"LP11000", "PCI-X2", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_HELIOS_SCSP: ++ m = (typeof(m)){"LP11000-SP", "PCI-X2", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_HELIOS_DCSP: ++ m = (typeof(m)){"LP11002-SP", "PCI-X2", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_NEPTUNE: ++ m = (typeof(m)){"LPe1000", "PCIe", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_NEPTUNE_SCSP: ++ m = (typeof(m)){"LPe1000-SP", "PCIe", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_NEPTUNE_DCSP: ++ m = (typeof(m)){"LPe1002-SP", "PCIe", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; + case PCI_DEVICE_ID_BMID: + m = (typeof(m)){"LP1150", "PCI-X2", "Fibre Channel Adapter"}; + break; ++ case PCI_DEVICE_ID_BSMB: ++ m = (typeof(m)){"LP111", "PCI-X2", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; + case PCI_DEVICE_ID_ZEPHYR: + m = (typeof(m)){"LPe11000", "PCIe", "Fibre Channel Adapter"}; + break; +@@ -2381,6 +2455,22 @@ + case PCI_DEVICE_ID_ZSMB: + m = (typeof(m)){"LPe111", "PCIe", "Fibre Channel Adapter"}; + break; ++ case PCI_DEVICE_ID_LP101: ++ m = (typeof(m)){"LP101", "PCI-X", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_LP10000S: ++ m = (typeof(m)){"LP10000-S", "PCI", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_LP11000S: ++ m = (typeof(m)){"LP11000-S", "PCI-X2", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_LPE11000S: ++ m = (typeof(m)){"LPe11000-S", "PCIe", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; + case PCI_DEVICE_ID_SAT: + m = (typeof(m)){"LPe12000", "PCIe", "Fibre Channel Adapter"}; + break; +@@ -2399,17 +2489,54 @@ + case PCI_DEVICE_ID_SAT_S: + m = (typeof(m)){"LPe12000-S", "PCIe", "Fibre Channel Adapter"}; + break; ++ case PCI_DEVICE_ID_HORNET: ++ m = (typeof(m)){"LP21000", "PCIe", ++ "Obsolete, Unsupported FCoE Adapter"}; ++ GE = 1; ++ break; ++ case PCI_DEVICE_ID_PROTEUS_VF: ++ m = (typeof(m)){"LPev12000", "PCIe IOV", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_PROTEUS_PF: ++ m = (typeof(m)){"LPev12000", "PCIe IOV", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_PROTEUS_S: ++ m = (typeof(m)){"LPemv12002-S", "PCIe IOV", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; ++ case PCI_DEVICE_ID_TIGERSHARK: ++ oneConnect = 1; ++ m = (typeof(m)){"OCe10100", "PCIe", "FCoE"}; ++ break; ++ case PCI_DEVICE_ID_TOMCAT: ++ oneConnect = 1; ++ m = (typeof(m)){"OCe11100", "PCIe", "FCoE"}; ++ break; + case PCI_DEVICE_ID_FALCON: + m = (typeof(m)){"LPSe12002-ML1-E", "PCIe", + "EmulexSecure Fibre"}; + break; ++ case PCI_DEVICE_ID_BALIUS: ++ m = (typeof(m)){"LPVe12002", "PCIe Shared I/O", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; + case PCI_DEVICE_ID_LANCER_FC: + m = (typeof(m)){"LPe16000", "PCIe", "Fibre Channel Adapter"}; + break; ++ case PCI_DEVICE_ID_LANCER_FC_VF: ++ m = (typeof(m)){"LPe16000", "PCIe", ++ "Obsolete, Unsupported Fibre Channel Adapter"}; ++ break; + case PCI_DEVICE_ID_LANCER_FCOE: + oneConnect = 1; ++ m = (typeof(m)){"OCe15100", "PCIe", "FCoE"}; ++ break; ++ case PCI_DEVICE_ID_LANCER_FCOE_VF: ++ oneConnect = 1; + m = (typeof(m)){"OCe15100", "PCIe", +- "Obsolete, Unsupported FCoE Adapter"}; ++ "Obsolete, Unsupported FCoE"}; + break; + case PCI_DEVICE_ID_LANCER_G6_FC: + m = (typeof(m)){"LPe32000", "PCIe", "Fibre Channel Adapter"}; +@@ -6232,6 +6359,13 @@ + if (rc) + return -ENODEV; + ++ if (phba->pcidev->device == PCI_DEVICE_ID_HORNET) { ++ phba->menlo_flag |= HBA_MENLO_SUPPORT; ++ /* check for menlo minimum sg count */ ++ if (phba->cfg_sg_seg_cnt < LPFC_DEFAULT_MENLO_SG_SEG_CNT) ++ phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT; ++ } ++ + if (!phba->sli.sli3_ring) + phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, + sizeof(struct lpfc_sli_ring), diff --git a/SPECS/kmod-lpfc.spec b/SPECS/kmod-lpfc.spec new file mode 100644 index 0000000..ff76bb8 --- /dev/null +++ b/SPECS/kmod-lpfc.spec @@ -0,0 +1,210 @@ +%global pkg lpfc + +%global kernel_version_min 4.18.0-305.el8 + +# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"` +# Otherwise the latest installed kernel-devel version later than +# %%{kernel_version_min} will be used. + +%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1) + +%if "%{kernel_version_latest}" != "" +%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}} +%endif + +%global _use_internal_dependency_generator 0 +%global __find_requires %{nil} +%global __find_provides /usr/lib/rpm/find-provides + +%global debug_package %{nil} + +%global __spec_install_post \ + %{?__debug_package:%{__debug_install_post}} \ + %{__arch_install_post} \ + %{__os_install_post} \ + %{__mod_compress_install_post} + +%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\; + + +Name: kmod-%{pkg} +Version: 4.18.0 +Release: 305%{?dist} +Summary: Emulex LightPulse Fibre Channel SCSI (%{pkg}) driver + +License: GPLv2 +URL: https://www.kernel.org/ + +Source0: %{pkg}-%{kernel_version_min}.tar.xz +Patch1: 0001-add-deprecated-ids.patch + +ExclusiveArch: x86_64 aarch64 + +BuildRequires: elfutils-libelf-devel +BuildRequires: gcc +BuildRequires: kmod +BuildRequires: make +BuildRequires: redhat-rpm-config +BuildRequires: xz + +%{!?kernel_version: +BuildRequires: kernel-devel >= %{kernel_version_min} +} + +%{?kernel_version: +BuildRequires: kernel-devel = %{kernel_version} +BuildRequires: kernel-devel-uname-r = %{kernel_version}.%{_arch} + +Requires: kernel-core = %{kernel_version} +Requires: kernel-core-uname-r = %{kernel_version}.%{_arch} +Requires: kernel-modules = %{kernel_version} +Requires: kernel-modules-uname-r = %{kernel_version}.%{_arch} + +Provides: installonlypkg(kernel-module) +Provides: %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release} +} + +Requires(post): /usr/sbin/depmod +Requires(postun): /usr/sbin/depmod + +Requires(post): /usr/bin/dracut +Requires(postun): /usr/bin/dracut + + +%description +This package provides the Emulex LightPulse Fibre Channel SCSI (%{pkg}) driver. +Compared to the in-kernel driver this driver re-enables support for some +deprecated adapters. + +BladeEngine 2 (BE2) devices: +- 0x19A2:0x0704: Emulex OneConnect Tigershark FCoE + +BladeEngine 3 (BE3) devices: +- 0x19A2:0x0714: Emulex OneConnect Tomcat FCoE + +Fibre Channel (FC) devices: +- 0x10DF:0x1AE5: FIREFLY +- 0x10DF:0xE100: PROTEUS VF +- 0x10DF:0xE131: BALIUS +- 0x10DF:0xE180: PROTEUS PF +- 0x10DF:0xF095: RFLY +- 0x10DF:0xF098: PFLY +- 0x10DF:0xF0A1: LP101 +- 0x10DF:0xF0A5: TFLY +- 0x10DF:0xF0D1: BSMB +- 0x10DF:0xF0F5: NEPTUNE +- 0x10DF:0xF0F6: NEPTUNE SCSP +- 0x10DF:0xF0F7: NEPTUNE DCSP +- 0x10DF:0xF700: SUPERFLY +- 0x10DF:0xF800: DRAGONFLY +- 0x10DF:0xF900: CENTAUR +- 0x10DF:0xF980: PEGASUS +- 0x10DF:0xFA00: THOR +- 0x10DF:0xFB00: VIPER +- 0x10DF:0xFC00: LP10000S +- 0x10DF:0xFC10: LP11000S +- 0x10DF:0xFC20: LPE11000S +- 0x10DF:0xFC50: PROTEUS S +- 0x10DF:0xFD00: HELIOS +- 0x10DF:0xFD11: HELIOS SCSP +- 0x10DF:0xFD12: HELIOS DCSP +- 0x10DF:0xFE05: HORNET + +Lancer FCoE CNA devices: +- 0x10DF:0xE208: LANCER_FC_VF +- 0x10DF:0xE260: Emulex OneConnect OCe15102-FM/OCe15104-FM/OCm15108-F-P +- 0x10DF:0xE268: LANCER_FCOE_VF + + +%prep +%autosetup -p1 -n %{pkg}-%{kernel_version_min} + + +%build +pushd src +%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules +popd + + +%install +%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko + +# Make .ko objects temporarily executable for automatic stripping +find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+ + + +%clean +%{__rm} -rf %{buildroot} + + +%post +mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods +touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} + + +%preun +mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods +touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} + + +%postun +if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ] +then + if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ] + then + /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch} + fi + + if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ] + then + if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch} + then + if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + then + mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img + else + rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + fi + fi + fi + + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} + rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods +fi + + +%posttrans +if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ] +then + if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ] + then + /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch} + fi + + if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ] + then + if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch} + then + if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + then + mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img + else + rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + fi + fi + fi + + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} + rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods +fi + + +%files +%defattr(644,root,root,755) +/lib/modules/%{kernel_version}.%{_arch} +%license COPYING + + +%changelog +* Wed Aug 11 2021 Peter Georg - 4.18.0-305 +- Initial version