diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-06 10:49:34 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-06 10:49:34 +0100 |
commit | 700ea5e0e0dd70420a04e703ff264cc133834cba (patch) | |
tree | d217b0d90d014953ea10ab7d88809660d2da8a64 /drivers/scsi/snic | |
parent | [media] media: ti-vpe: vpe: allow use of user specified stride (diff) | |
parent | Linux 4.11-rc1 (diff) | |
download | linux-700ea5e0e0dd70420a04e703ff264cc133834cba.tar.xz linux-700ea5e0e0dd70420a04e703ff264cc133834cba.zip |
Merge tag 'v4.11-rc1' into patchwork
Linux 4.11-rc1
* tag 'v4.11-rc1': (10730 commits)
Linux 4.11-rc1
strparser: destroy workqueue on module exit
Documentation/sphinx: fix primary_domain configuration
docs: Fix htmldocs build failure
doc/ko_KR/memory-barriers: Update control-dependencies section
pcieaer doc: update the link
Documentation: Update path to sysrq.txt
sfc: fix IPID endianness in TSOv2
sfc: avoid max() in array size
rds: remove unnecessary returned value check
rxrpc: Fix potential NULL-pointer exception
nfp: correct DMA direction in XDP DMA sync
nfp: don't tell FW about the reserved buffer space
net: ethernet: bgmac: mac address change bug
net: ethernet: bgmac: init sequence bug
xen-netback: don't vfree() queues under spinlock
xen-netback: keep a local pointer for vif in backend_disconnect()
netfilter: nf_tables: don't call nfnetlink_set_err() if nfnetlink_send() fails
netfilter: nft_set_rbtree: incorrect assumption on lower interval lookups
netfilter: nf_conntrack_sip: fix wrong memory initialisation
...
Diffstat (limited to 'drivers/scsi/snic')
-rw-r--r-- | drivers/scsi/snic/snic.h | 1 | ||||
-rw-r--r-- | drivers/scsi/snic/snic_isr.c | 48 |
2 files changed, 19 insertions, 30 deletions
diff --git a/drivers/scsi/snic/snic.h b/drivers/scsi/snic/snic.h index 8ed778d4dbb9..de0ab5fc8474 100644 --- a/drivers/scsi/snic/snic.h +++ b/drivers/scsi/snic/snic.h @@ -299,7 +299,6 @@ struct snic { /* pci related */ struct pci_dev *pdev; - struct msix_entry msix_entry[SNIC_MSIX_INTR_MAX]; struct snic_msix_entry msix[SNIC_MSIX_INTR_MAX]; /* io related info */ diff --git a/drivers/scsi/snic/snic_isr.c b/drivers/scsi/snic/snic_isr.c index f552003128c6..d859501e4ccd 100644 --- a/drivers/scsi/snic/snic_isr.c +++ b/drivers/scsi/snic/snic_isr.c @@ -93,7 +93,7 @@ snic_free_intr(struct snic *snic) /* ONLY interrupt mode MSIX is supported */ for (i = 0; i < ARRAY_SIZE(snic->msix); i++) { if (snic->msix[i].requested) { - free_irq(snic->msix_entry[i].vector, + free_irq(pci_irq_vector(snic->pdev, i), snic->msix[i].devid); } } @@ -134,7 +134,7 @@ snic_request_intr(struct snic *snic) snic->msix[SNIC_MSIX_ERR_NOTIFY].devid = snic; for (i = 0; i < ARRAY_SIZE(snic->msix); i++) { - ret = request_irq(snic->msix_entry[i].vector, + ret = request_irq(pci_irq_vector(snic->pdev, i), snic->msix[i].isr, 0, snic->msix[i].devname, @@ -158,47 +158,37 @@ snic_set_intr_mode(struct snic *snic) { unsigned int n = ARRAY_SIZE(snic->wq); unsigned int m = SNIC_CQ_IO_CMPL_MAX; - unsigned int i; + unsigned int vecs = n + m + 1; /* * We need n WQs, m CQs, and n+m+1 INTRs * (last INTR is used for WQ/CQ errors and notification area */ - BUILD_BUG_ON((ARRAY_SIZE(snic->wq) + SNIC_CQ_IO_CMPL_MAX) > ARRAY_SIZE(snic->intr)); - SNIC_BUG_ON(ARRAY_SIZE(snic->msix_entry) < (n + m + 1)); - - for (i = 0; i < (n + m + 1); i++) - snic->msix_entry[i].entry = i; - - if (snic->wq_count >= n && snic->cq_count >= (n + m)) { - if (!pci_enable_msix(snic->pdev, - snic->msix_entry, - (n + m + 1))) { - snic->wq_count = n; - snic->cq_count = n + m; - snic->intr_count = n + m + 1; - snic->err_intr_offset = SNIC_MSIX_ERR_NOTIFY; - - SNIC_ISR_DBG(snic->shost, - "Using MSI-X Interrupts\n"); - svnic_dev_set_intr_mode(snic->vdev, - VNIC_DEV_INTR_MODE_MSIX); - - return 0; - } - } - svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_UNKNOWN); + if (snic->wq_count < n || snic->cq_count < n + m) + goto fail; + if (pci_alloc_irq_vectors(snic->pdev, vecs, vecs, PCI_IRQ_MSIX) < 0) + goto fail; + + snic->wq_count = n; + snic->cq_count = n + m; + snic->intr_count = vecs; + snic->err_intr_offset = SNIC_MSIX_ERR_NOTIFY; + + SNIC_ISR_DBG(snic->shost, "Using MSI-X Interrupts\n"); + svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_MSIX); + return 0; +fail: + svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_UNKNOWN); return -EINVAL; } /* end of snic_set_intr_mode */ void snic_clear_intr_mode(struct snic *snic) { - pci_disable_msix(snic->pdev); - + pci_free_irq_vectors(snic->pdev); svnic_dev_set_intr_mode(snic->vdev, VNIC_DEV_INTR_MODE_INTX); } |