diff --git a/SOURCES/0136-iscsiuio-Correct-the-handling-of-Multi-Function-mode.patch b/SOURCES/0136-iscsiuio-Correct-the-handling-of-Multi-Function-mode.patch new file mode 100644 index 0000000..f44c4e3 --- /dev/null +++ b/SOURCES/0136-iscsiuio-Correct-the-handling-of-Multi-Function-mode.patch @@ -0,0 +1,70 @@ +From 254ad4686ab8206b57f94ce13b0697cb9fc884b7 Mon Sep 17 00:00:00 2001 +From: Adheer Chandravanshi +Date: Tue, 16 Jun 2015 08:52:59 -0400 +Subject: [PATCH 136/160] iscsiuio: Correct the handling of Multi Function mode + +Handle the Multi Function mode correctly when dealing with bnx2x driver. + +Signed-off-by: Adheer Chandravanshi +--- + iscsiuio/src/unix/libs/bnx2x.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c +index 1495762..a364d76 100644 +--- a/iscsiuio/src/unix/libs/bnx2x.c ++++ b/iscsiuio/src/unix/libs/bnx2x.c +@@ -672,6 +672,9 @@ static int bnx2x_open(nic_t *nic) + uint32_t bus; + uint32_t slot; + uint32_t func; ++ uint32_t mode; ++ __u32 proto_offset; ++ __u32 ovtag_offset; + + /* Sanity Check: validate the parameters */ + if (nic == NULL) { +@@ -1002,9 +1005,11 @@ static int bnx2x_open(nic_t *nic) + mf_cfg_addr = bp->shmem_base + 0x7e4; + + /* shared_feat_cfg.config */ +- val = bnx2x_rd32(bp, bp->shmem_base + 0x354); +- /* SI mode */ +- if ((val & 0x700) == 0x300) { ++ mode = bnx2x_rd32(bp, bp->shmem_base + 0x354); ++ mode &= 0x700; ++ LOG_DEBUG(PFX "%s: mode = 0x%x", nic->log_name, mode); ++ switch (mode) { ++ case 0x300: /* SI mode */ + mac_offset = 0xe4 + (bp->func * 0x28) + 4; + val = bnx2x_rd32(bp, mf_cfg_addr + mac_offset); + mac[0] = (__u8) (val >> 8); +@@ -1027,9 +1032,13 @@ static int bnx2x_open(nic_t *nic) + rc = -ENOTSUP; + goto open_error; + } +- } else if ((val & 0x700) == 0) { +- __u32 proto_offset = 0x24 + (bp->func * 0x18); +- __u32 ovtag_offset = proto_offset + 0xc; ++ break; ++ ++ case 0x0: /* MF SD mode */ ++ case 0x500: ++ case 0x600: ++ proto_offset = 0x24 + (bp->func * 0x18); ++ ovtag_offset = proto_offset + 0xc; + + rc = -ENOTSUP; + val = bnx2x_rd32(bp, mf_cfg_addr + ovtag_offset); +@@ -1057,7 +1066,7 @@ static int bnx2x_open(nic_t *nic) + mac[4] = (__u8) (val >> 8); + mac[5] = (__u8) val; + memcpy(nic->mac_addr, mac, 6); +- ++ break; + } + } + SF: +-- +2.5.5 + diff --git a/SOURCES/0143-iscsiuio-Add-QLogic-Vendor-ID-to-support-newer-NX2-H.patch b/SOURCES/0143-iscsiuio-Add-QLogic-Vendor-ID-to-support-newer-NX2-H.patch new file mode 100644 index 0000000..7725eaa --- /dev/null +++ b/SOURCES/0143-iscsiuio-Add-QLogic-Vendor-ID-to-support-newer-NX2-H.patch @@ -0,0 +1,44 @@ +From be1c610b0b9d4598fcda35431d0cd3e70dc2e3bc Mon Sep 17 00:00:00 2001 +From: Adheer Chandravanshi +Date: Fri, 18 Sep 2015 05:15:50 -0400 +Subject: [PATCH 143/160] iscsiuio: Add QLogic Vendor ID to support newer NX2 + HBAs + +The newer 57840 NX2 HBAs have started using QLogic Vendor ID. +Adding the support for it. + +Signed-off-by: Adheer Chandravanshi +--- + iscsiuio/src/unix/libs/bnx2x.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c +index a364d76..c9e3436 100644 +--- a/iscsiuio/src/unix/libs/bnx2x.c ++++ b/iscsiuio/src/unix/libs/bnx2x.c +@@ -120,6 +120,7 @@ static const char brcm_57840_2_20[] = "QLogic NetXtreme II BCM57840 2x" + * PCI ID constants + ******************************************************************************/ + #define PCI_VENDOR_ID_BROADCOM 0x14e4 ++#define PCI_VENDOR_ID_QLOGIC 0x1077 + #define PCI_DEVICE_ID_NX2_57710 0x164e + #define PCI_DEVICE_ID_NX2_57711 0x164f + #define PCI_DEVICE_ID_NX2_57711E 0x1650 +@@ -194,6 +195,14 @@ static const struct pci_device_id bnx2x_pci_tbl[] = { + PCI_ANY_ID, PCI_ANY_ID, brcm_57840_MF}, + {PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_57840_VF, + PCI_ANY_ID, PCI_ANY_ID, brcm_57840_VF}, ++ {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_4_10, ++ PCI_ANY_ID, PCI_ANY_ID, brcm_57840_4_10}, ++ {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_2_20, ++ PCI_ANY_ID, PCI_ANY_ID, brcm_57840_2_20}, ++ {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_MF, ++ PCI_ANY_ID, PCI_ANY_ID, brcm_57840_MF}, ++ {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_VF, ++ PCI_ANY_ID, PCI_ANY_ID, brcm_57840_VF}, + }; + + static struct iro e1_iro[2] = { +-- +2.5.5 + diff --git a/SOURCES/0148-iscsiuio-Get-the-library-to-use-based-on-uio-sysfs-n.patch b/SOURCES/0148-iscsiuio-Get-the-library-to-use-based-on-uio-sysfs-n.patch new file mode 100644 index 0000000..b635a38 --- /dev/null +++ b/SOURCES/0148-iscsiuio-Get-the-library-to-use-based-on-uio-sysfs-n.patch @@ -0,0 +1,246 @@ +From 5fef43143c1a481ed38c5cf89ac951ed9d4b2b56 Mon Sep 17 00:00:00 2001 +From: Adheer Chandravanshi +Date: Mon, 28 Dec 2015 03:56:57 -0500 +Subject: [PATCH 148/160] iscsiuio: Get the library to use based on uio sysfs + name + +This makes iscsiuio more compatible with newer adapters by eliminating +the need to always update iscsiuio with the PCI IDs of the new adapter. + +Signed-off-by: Adheer Chandravanshi +--- + iscsiuio/src/unix/nic.c | 22 +++++++++++---- + iscsiuio/src/unix/nic.h | 6 ++-- + iscsiuio/src/unix/nic_id.c | 2 ++ + iscsiuio/src/unix/nic_utils.c | 65 ++++++++++++++++++++++++++++--------------- + 4 files changed, 66 insertions(+), 29 deletions(-) + +diff --git a/iscsiuio/src/unix/nic.c b/iscsiuio/src/unix/nic.c +index cd0c80a..0108191 100644 +--- a/iscsiuio/src/unix/nic.c ++++ b/iscsiuio/src/unix/nic.c +@@ -152,7 +152,6 @@ static int load_nic_library(nic_lib_handle_t *handle) + /* Validate the NIC library ops table to ensure that all the proper + * fields are filled */ + if ((handle->ops->lib_ops.get_library_name == NULL) || +- (handle->ops->lib_ops.get_pci_table == NULL) || + (handle->ops->lib_ops.get_library_version == NULL) || + (handle->ops->lib_ops.get_build_date == NULL) || + (handle->ops->lib_ops.get_transport_name == NULL)) { +@@ -247,7 +246,8 @@ int unload_all_nic_libraries() + return 0; + } + +-NIC_LIBRARY_EXIST_T does_nic_uio_name_exist(char *name) ++NIC_LIBRARY_EXIST_T does_nic_uio_name_exist(char *name, ++ nic_lib_handle_t **handle) + { + NIC_LIBRARY_EXIST_T rc; + nic_lib_handle_t *current; +@@ -263,6 +263,9 @@ NIC_LIBRARY_EXIST_T does_nic_uio_name_exist(char *name) + &uio_name_size); + + if (strncmp(name, uio_name, uio_name_size) == 0) { ++ if (handle) ++ *handle = current; ++ + rc = NIC_LIBRARY_EXSITS; + goto done; + } +@@ -277,7 +280,8 @@ done: + return rc; + } + +-NIC_LIBRARY_EXIST_T does_nic_library_exist(char *name) ++NIC_LIBRARY_EXIST_T does_nic_library_exist(char *name, ++ nic_lib_handle_t **handle) + { + NIC_LIBRARY_EXIST_T rc; + nic_lib_handle_t *current; +@@ -293,6 +297,9 @@ NIC_LIBRARY_EXIST_T does_nic_library_exist(char *name) + &library_name_size); + + if (strncmp(name, library_name, library_name_size) == 0) { ++ if (handle) ++ *handle = current; ++ + rc = NIC_LIBRARY_EXSITS; + goto done; + } +@@ -333,8 +340,13 @@ int find_nic_lib_using_pci_id(uint32_t vendor, uint32_t device, + uint32_t entries; + int i; + +- current->ops->lib_ops.get_pci_table(&pci_table, &entries); +- ++ if (current->ops->lib_ops.get_pci_table != NULL) { ++ current->ops->lib_ops.get_pci_table(&pci_table, ++ &entries); ++ } else { ++ current = current->next; ++ continue; ++ } + /* Sanity check the the pci table coming from the + * hardware library */ + if (entries > MAX_PCI_DEVICE_ENTRIES) { +diff --git a/iscsiuio/src/unix/nic.h b/iscsiuio/src/unix/nic.h +index 40ca546..ec15781 100644 +--- a/iscsiuio/src/unix/nic.h ++++ b/iscsiuio/src/unix/nic.h +@@ -355,8 +355,10 @@ typedef enum { + NIC_LIBRARY_DOESNT_EXIST = 2, + } NIC_LIBRARY_EXIST_T; + +-NIC_LIBRARY_EXIST_T does_nic_uio_name_exist(char *name); +-NIC_LIBRARY_EXIST_T does_nic_library_exist(char *name); ++NIC_LIBRARY_EXIST_T does_nic_uio_name_exist(char *name, ++ nic_lib_handle_t **handle); ++NIC_LIBRARY_EXIST_T does_nic_library_exist(char *name, ++ nic_lib_handle_t **handle); + + /******************************************************************************* + * Packet management utility functions +diff --git a/iscsiuio/src/unix/nic_id.c b/iscsiuio/src/unix/nic_id.c +index 6b2467c..6da0a38 100644 +--- a/iscsiuio/src/unix/nic_id.c ++++ b/iscsiuio/src/unix/nic_id.c +@@ -308,6 +308,7 @@ int find_set_nic_lib(nic_t *nic) + + nic_lib_handle_t *handle; + struct pci_device_id *pci_entry; ++ size_t name_size; + + rc = get_vendor(nic, &vendor); + if (rc != 0) { +@@ -357,6 +358,7 @@ int find_set_nic_lib(nic_t *nic) + + /* Prepare the NIC library op table */ + nic->ops = handle->ops; ++ (*nic->ops->lib_ops.get_library_name) (&nic->library_name, &name_size); + + return 0; + } +diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c +index d57cc4f..0daffd2 100644 +--- a/iscsiuio/src/unix/nic_utils.c ++++ b/iscsiuio/src/unix/nic_utils.c +@@ -700,6 +700,9 @@ int nic_verify_uio_sysfs_name(nic_t *nic) + uint32_t raw_size = 0; + char temp_path[sizeof(nic_uio_sysfs_name_tempate) + 8]; + int rc = 0; ++ nic_lib_handle_t *handle = NULL; ++ size_t name_size; ++ + + /* Build the path to determine uio name */ + snprintf(temp_path, sizeof(temp_path), +@@ -716,37 +719,43 @@ int nic_verify_uio_sysfs_name(nic_t *nic) + *raw_tmp = '\0'; + + /* If the nic library is not set then check if there is a library +- * which matches the library name */ ++ * which matches the uio sysfs name */ + if (nic->nic_library == NULL) { + NIC_LIBRARY_EXIST_T exist; + +- exist = does_nic_uio_name_exist(raw); ++ exist = does_nic_uio_name_exist(raw, &handle); + if (exist == NIC_LIBRARY_DOESNT_EXIST) { +- LOG_ERR(PFX "%s: could not find library: %s ", ++ LOG_ERR(PFX "%s: could not find library for uio name: %s", + nic->log_name, raw); +- rc = -EIO; ++ rc = -EINVAL; ++ goto error; + } ++ ++ /* fill the lib info */ ++ nic->nic_library = handle; ++ nic->ops = handle->ops; ++ (*nic->ops->lib_ops.get_library_name) (&nic->library_name, ++ &name_size); + } else { +- char *library_name; +- size_t library_name_size; ++ /* Get the uio sysfs name from the NIC library */ ++ (*nic->ops->lib_ops.get_uio_name) (&raw_tmp, &name_size); + +- /* Get the string name from the NIC library */ +- (*nic->ops->lib_ops.get_library_name) (&library_name, +- &library_name_size); +- +- if (strcmp(raw, library_name) != 0) { ++ if (strncmp(raw, raw_tmp, name_size) != 0) { + LOG_ERR(PFX "%s: uio names not equal: " + "expecting %s got %s from %s", +- nic->log_name, library_name, raw, temp_path); +- rc = -EIO; ++ nic->log_name, raw, raw_tmp, temp_path); ++ rc = -EINVAL; ++ goto error; + } + } + +- free(raw); +- +- LOG_INFO(PFX "%s: Verified is a cnic_uio device", nic->log_name); ++ LOG_INFO(PFX "%s: Verified uio name %s with library %s", ++ nic->log_name, raw, nic->library_name); + + error: ++ if (raw) ++ free(raw); ++ + return rc; + } + +@@ -844,28 +853,40 @@ void prepare_library(nic_t *nic) + { + int rc; + NIC_LIBRARY_EXIST_T exist; ++ nic_lib_handle_t *handle = NULL; + + nic_fill_name(nic); + + /* No assoicated library, we can skip it */ + if (nic->library_name != NULL) { + /* Check that we have the proper NIC library loaded */ +- exist = does_nic_library_exist(nic->library_name); ++ exist = does_nic_library_exist(nic->library_name, &handle); + if (exist == NIC_LIBRARY_DOESNT_EXIST) { + LOG_ERR(PFX "NIC library doesn't exists: %s", + nic->library_name); + goto error; ++ } else if (handle && (nic->nic_library == handle) && ++ (nic->ops == handle->ops)) { ++ LOG_INFO("%s: Have NIC library '%s'", ++ nic->log_name, nic->library_name); + } + } + +- /* Determine the NIC library to use based on the PCI Id */ +- rc = find_set_nic_lib(nic); ++ /* Verify the NIC library to use */ ++ rc = nic_verify_uio_sysfs_name(nic); + if (rc != 0) { +- LOG_ERR(PFX "%s: Couldn't find NIC library", nic->log_name); +- goto error; ++ /* Determine the NIC library to use based on the PCI Id */ ++ rc = find_set_nic_lib(nic); ++ if (rc != 0) { ++ LOG_ERR(PFX "%s: Couldn't find NIC library", ++ nic->log_name); ++ goto error; ++ } ++ + } + +- LOG_INFO("%s: found NIC '%s'", nic->log_name, nic->pci_id->device_name); ++ LOG_INFO("%s: found NIC with library '%s'", ++ nic->log_name, nic->library_name); + error: + return; + } +-- +2.5.5 + diff --git a/SOURCES/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch b/SOURCES/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch index e9b626e..51df4bf 100644 --- a/SOURCES/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +++ b/SOURCES/0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -16,7 +16,7 @@ index a090522..aef0c3d 100644 * some other maintainer could merge a patch without going through us */ -#define ISCSI_VERSION_STR "2.0-873" -+#define ISCSI_VERSION_STR "6.2.0.873-30" ++#define ISCSI_VERSION_STR "6.2.0.873-33" #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" #endif diff --git a/SPECS/iscsi-initiator-utils.spec b/SPECS/iscsi-initiator-utils.spec index d692b6c..48b4746 100644 --- a/SPECS/iscsi-initiator-utils.spec +++ b/SPECS/iscsi-initiator-utils.spec @@ -4,7 +4,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.%{open_iscsi_version}.%{open_iscsi_build} -Release: 32%{?dist} +Release: 33%{?dist}.1 Group: System Environment/Daemons License: GPLv2+ URL: http://www.open-iscsi.org @@ -98,6 +98,9 @@ Patch125: open-iscsi-2.0.873-125-iscsid-safe-session-logout.patch Patch126: open-iscsi-2.0.873-126-iscsid-don-t-re-read-config-file-for-every-session-l.patch Patch127: open-iscsi-2.0.873-fix-device-path-canonicalization-by-using-libmount-c.patch Patch128: open-iscsi-2.0-873-safe-logout-flashnode.patch +Patch136: 0136-iscsiuio-Correct-the-handling-of-Multi-Function-mode.patch +Patch137: 0143-iscsiuio-Add-QLogic-Vendor-ID-to-support-newer-NX2-H.patch +Patch138: 0148-iscsiuio-Get-the-library-to-use-based-on-uio-sysfs-n.patch # not (yet) upstream merged Patch130: 0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch @@ -152,7 +155,9 @@ Protocol networks. Summary: Userspace configuration daemon required for some iSCSI hardware Group: System Environment/Daemons License: BSD -Requires: %{name} = %{version}-%{release} +Requires: %{name} >= %{version} +Provides: installer-enhancement = 19.0 +Provides: kernel-modules = 3.10.0-327.el7.x86_64 %description iscsiuio The iscsiuio configuration daemon provides network configuration help @@ -278,28 +283,6 @@ fi %postun iscsiuio %systemd_postun -%triggerun -- iscsi-initiator-utils < 6.2.0.873-1 -# Save the current service runlevel info -# User must manually run systemd-sysv-convert --apply iscsid -# and systemd-sysv-convert --apply iscsi -# to migrate them to systemd targets -/usr/bin/systemd-sysv-convert --save iscsi >/dev/null 2>&1 ||: -/usr/bin/systemd-sysv-convert --save iscsid >/dev/null 2>&1 ||: - -# enable socket activation -/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || : -/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || : - -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del iscsid >/dev/null 2>&1 || : -/sbin/chkconfig --del iscsi >/dev/null 2>&1 || : -/bin/systemctl try-restart iscsid.service >/dev/null 2>&1 || : -/bin/systemctl try-restart iscsi.service >/dev/null 1>&1 || : - -%triggerun iscsiuio -- iscsi-initiator-utils < 6.2.0.873-1 -# enable socket activation -/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || : - %triggerun -- iscsi-initiator-utils < 6.2.0.873-22 # prior to 6.2.0.873-22 iscsi.service was missing a Wants=remote-fs-pre.target # this forces remote-fs-pre.target active if needed for a clean shutdown/reboot @@ -320,8 +303,7 @@ if [ $1 -gt 0 ]; then fi fi fi - -%triggerun -- iscsi-initiator-utils < 6.2.0.873-26 +# added in 6.2.0.873-26 if [ $1 -gt 0 ]; then systemctl start iscsi-shutdown.service >/dev/null 2>&1 || : fi @@ -370,6 +352,12 @@ fi %{_includedir}/libiscsi.h %changelog +* Tue May 03 2016 Chris Leech - 6.2.0.873-33 +- 1332179 added spec file Provides for 7.2.z package to support DUP request + +* Tue Apr 26 2016 Chris Leech - 6.2.0.873-33 +- 1275139 iscsiuio support for multi-function mode NetXtreme2 HBAs + * Fri Jul 24 2015 Chris Leech - 6.2.0.873-32 - 1235684 apply safe_logout setting to flashnode sessions as well but only when logging out by session id, not by flashnode index