Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-04-04 18:06:46 -07:00
6 changed files with 71 additions and 23 deletions

View File

@@ -7,4 +7,4 @@ obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o
obj-$(CONFIG_TCM_QLA2XXX) += tcm_qla2xxx.o
ccflags-y += -I$(src)/../../../include/scst/
ccflags-y += $(call cc-option,-Wno-format-truncation)
ccflags-y += $(call cc-option,-Wno-stringop-truncation)

View File

@@ -45,10 +45,6 @@
#include "qla_def.h"
#include "scst_qla2xxx.h"
extern struct mutex qla_tgt_mutex;
extern struct list_head qla_tgt_glist;
size_t qlt_add_vtarget(u64 port_name, u64 node_name, u64 parent_host)
{
struct Scsi_Host *shost = NULL;

View File

@@ -1528,7 +1528,6 @@ static int sqa_init_scst_tgt(struct scsi_qla_host *vha)
return res;
}
extern struct list_head qla_tgt_glist;
static void sqa_get_target_list(void)
{
struct qla_tgt *tgt;

View File

@@ -3423,21 +3423,15 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id)
/* <linux/pci.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \
(defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 7)
/*
* See also commit aff171641d18 ("PCI: Provide sensible IRQ vector alloc/free
* routines") # v4.8.
*/
/**
* pci_irq_vector - return Linux IRQ number of a device vector
* @dev: PCI device to operate on
* @nr: device-relative interrupt vector index (0-based).
*/
static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
{
return dev->irq + nr;
}
#define HAVE_PCI_IRQ_VECTOR 1
#else
#define HAVE_PCI_IRQ_VECTOR 0
#endif
struct qla_init_msix_entry {
@@ -3457,6 +3451,28 @@ static const struct qla_init_msix_entry qla82xx_msix_entries[] = {
{ "qla2xxx (rsp_q)", qla82xx_msix_rsp_q },
};
#if !HAVE_PCI_IRQ_VECTOR
static void
qla24xx_disable_msix(struct qla_hw_data *ha)
{
int i;
struct qla_msix_entry *qentry;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
for (i = 0; i < ha->msix_count; i++) {
qentry = &ha->msix_entries[i];
if (qentry->have_irq)
free_irq(qentry->vector, qentry->handle);
}
pci_disable_msix(ha->pdev);
kfree(ha->msix_entries);
ha->msix_entries = NULL;
ha->flags.msix_enabled = 0;
ql_dbg(ql_dbg_init, vha, 0x0042,
"Disabled the MSI.\n");
}
#endif
static int
qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
{
@@ -3478,7 +3494,9 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
for (i = 0; i < ha->msix_count; i++)
entries[i].entry = i;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
if (QLA_TGT_MODE_ENABLED() && (ql2xenablemsix != 0) &&
IS_ATIO_MSIX_CAPABLE(ha)) {
min_vecs++;
@@ -3495,6 +3513,8 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
}
#endif
WARN_ON_ONCE(min_vecs > ha->msix_count);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL_MAJOR)
ret = pci_enable_msix(ha->pdev, entries, ha->msix_count);
if (ret) {
@@ -3515,7 +3535,8 @@ msix_failed:
ha->msix_count, ret);
goto msix_out;
}
ha->max_rsp_queues = ha->msix_count - 1;
} else {
ret = ha->msix_count;
}
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
ret = pci_enable_msix_range(ha->pdev,
@@ -3534,10 +3555,6 @@ msix_failed:
&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, "
@@ -3583,8 +3600,13 @@ msix_failed:
for (i = 0; i < ha->msix_count; i++) {
qentry = &ha->msix_entries[i];
#if HAVE_PCI_IRQ_VECTOR
qentry->vector = pci_irq_vector(ha->pdev, i);
qentry->entry = i;
#else
qentry->vector = entries[i].vector;
qentry->entry = entries[i].entry;
#endif
qentry->have_irq = 0;
qentry->in_use = 0;
qentry->handle = NULL;
@@ -3659,6 +3681,9 @@ msix_register_fail:
ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
msix_out:
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
kfree(entries);
#endif
return ret;
}
@@ -3772,6 +3797,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
goto free_irqs;
rsp = ha->rsp_q_map[0];
#if HAVE_PCI_IRQ_VECTOR
if (ha->flags.msix_enabled) {
struct qla_msix_entry *qentry;
int i;
@@ -3791,6 +3817,15 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
} else {
free_irq(pci_irq_vector(ha->pdev, 0), rsp);
}
#else
if (ha->flags.msix_enabled)
qla24xx_disable_msix(ha);
else if (ha->flags.msi_enabled) {
free_irq(ha->pdev->irq, rsp);
pci_disable_msi(ha->pdev);
} else
free_irq(ha->pdev->irq, rsp);
#endif
free_irqs:
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)

View File

@@ -1043,6 +1043,9 @@ struct qla_tgt_prm {
extern struct qla_tgt_data qla_target;
extern struct mutex qla_tgt_mutex;
extern struct list_head qla_tgt_glist;
/*
* Function prototypes for qla_target.c logic used by qla2xxx LLD code.

View File

@@ -815,6 +815,21 @@ static inline long get_user_pages_backport(unsigned long start,
#define get_user_pages get_user_pages_backport
#endif
/* <linux/mempoool.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
/*
* See also commit 4e3ca3e033d1 ("mm/mempool: allow NULL `pool' pointer in
* mempool_destroy()") # v4.3.
*/
static inline void mempool_destroy_backport(mempool_t *pool)
{
if (pool)
mempool_destroy(pool);
}
#define mempool_destroy mempool_destroy_backport
#endif
/* <linux/mm.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \