qla2x00t-32gbit: Backport to kernel v4.8

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8106 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-03-29 01:43:54 +00:00
parent 849adf540b
commit c03a1817ad
2 changed files with 32 additions and 2 deletions

View File

@@ -3446,7 +3446,20 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
int min_vecs = QLA_BASE_VECTORS;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
struct msix_entry *entries;
entries = kcalloc(ha->msix_count, sizeof(struct msix_entry),
GFP_KERNEL);
if (!entries) {
ql_log(ql_log_warn, vha, 0x00bc,
"Failed to allocate memory for msix_entry.\n");
return -ENOMEM;
}
for (i = 0; i < ha->msix_count; i++)
entries[i].entry = i;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (QLA_TGT_MODE_ENABLED() && (ql2xenablemsix != 0) &&
IS_ATIO_MSIX_CAPABLE(ha)) {
min_vecs++;
@@ -3463,7 +3476,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
ret = pci_enable_msix_range(ha->pdev,
entries, min_vecs, ha->msix_count);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
ret = pci_alloc_irq_vectors(ha->pdev, min_vecs, ha->msix_count,
PCI_IRQ_MSIX);
#else
@@ -3477,6 +3493,10 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
&desc);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
kfree(entries);
#endif
if (ret < 0) {
ql_log(ql_log_fatal, vha, 0x00c7,
"MSI-X: Failed to enable support, "
@@ -3653,7 +3673,11 @@ skip_msix:
!IS_QLA27XX(ha))
goto skip_msi;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
ret = pci_enable_msi(ha->pdev);
#else
ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI);
#endif
if (!ret) {
ql_dbg(ql_dbg_init, vha, 0x0038,
"MSI: Enabled.\n");
@@ -3727,7 +3751,11 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
}
free_irqs:
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
;
#else
pci_free_irq_vectors(ha->pdev);
#endif
}
int qla25xx_request_irq(struct qla_hw_data *ha, struct qla_qpair *qpair,

View File

@@ -13,7 +13,9 @@
#include <linux/mutex.h>
#include <linux/kobject.h>
#include <linux/slab.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
#include <linux/blk-mq-pci.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/refcount.h>
#endif