From patchwork Thu Feb 20 16:47:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 3688871 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 14FD79F2EC for ; Thu, 20 Feb 2014 16:47:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E525020122 for ; Thu, 20 Feb 2014 16:47:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD2602015A for ; Thu, 20 Feb 2014 16:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753981AbaBTQrI (ORCPT ); Thu, 20 Feb 2014 11:47:08 -0500 Received: from cmexedge2.ext.emulex.com ([138.239.224.100]:57368 "EHLO CMEXEDGE2.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753683AbaBTQrI (ORCPT ); Thu, 20 Feb 2014 11:47:08 -0500 Received: from CMEXHTCAS2.ad.emulex.com (138.239.115.218) by CMEXEDGE2.ext.emulex.com (138.239.224.100) with Microsoft SMTP Server (TLS) id 14.3.174.1; Thu, 20 Feb 2014 08:47:59 -0800 Received: from [192.168.211.238] (138.239.79.32) by smtp.emulex.com (138.239.115.208) with Microsoft SMTP Server id 14.3.174.1; Thu, 20 Feb 2014 08:47:03 -0800 Subject: Re: [PATCH 12/22] lpfc: Use pci_enable_msix_range() From: James Smart Reply-To: To: CC: , , , Date: Thu, 20 Feb 2014 11:47:02 -0500 Organization: X-Mailer: Evolution 3.4.4 (3.4.4-2.fc17) MIME-Version: 1.0 Message-ID: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Alexander, I've reworked this patch to layer on top of our rev 8.3.45 patches that were just posted to linux-scsi. There were some conflicts due to new additions. Additionally, there were two other uses of pci_enable_msiXXX that needed to be addressed. The changes in this patch also address the change requested by: "[PATCH 11/22] lpfc: Remove superfluous call to pci_disable_msix()" To avoid creating merge conflicts - either by your patches going in then scsi git tree trying to merge or by scsi git tree going in and your patches trying to merge - I recommend that you eliminate your lpfc patches from the kernel and apply the patch below once scsi git with the updated lpfc driver has actually merged. -- james s Revised patch: As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces. CC: Alexander Gordeev Cc: linux-scsi@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: James Smart --- lpfc_init.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c --- a/drivers/scsi/lpfc/lpfc_init.c 2014-02-19 16:23:07.260097013 -0500 +++ b/drivers/scsi/lpfc/lpfc_init.c 2014-02-20 11:39:20.348203354 -0500 @@ -8100,8 +8100,8 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba * @phba: pointer to lpfc hba data structure. * * This routine is invoked to enable the MSI-X interrupt vectors to device - * with SLI-3 interface specs. The kernel function pci_enable_msix() is - * called to enable the MSI-X vectors. Note that pci_enable_msix(), once + * with SLI-3 interface specs. The kernel function pci_enable_msix_range() is + * called to enable the MSI-X vectors. Note that pci_enable_msix_range(), once * invoked, enables either all or nothing, depending on the current * availability of PCI vector resources. The device driver is responsible * for calling the individual request_irq() to register each MSI-X vector @@ -8126,12 +8126,12 @@ lpfc_sli_enable_msix(struct lpfc_hba *ph phba->msix_entries[i].entry = i; /* Configure MSI-X capability structure */ - rc = pci_enable_msix(phba->pcidev, phba->msix_entries, - ARRAY_SIZE(phba->msix_entries)); - if (rc) { + rc = pci_enable_msix_range(phba->pcidev, phba->msix_entries, + LPFC_MSIX_VECTORS, LPFC_MSIX_VECTORS); + if (rc < 0) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0420 PCI enable MSI-X failed (%d)\n", rc); - goto msi_fail_out; + goto vec_fail_out; } for (i = 0; i < LPFC_MSIX_VECTORS; i++) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, @@ -8209,6 +8209,8 @@ irq_fail_out: msi_fail_out: /* Unconfigure MSI-X capability structure */ pci_disable_msix(phba->pcidev); + +vec_fail_out: return rc; } @@ -8238,8 +8240,8 @@ lpfc_sli_disable_msix(struct lpfc_hba *p * @phba: pointer to lpfc hba data structure. * * This routine is invoked to enable the MSI interrupt mode to device with - * SLI-3 interface spec. The kernel function pci_enable_msi() is called to - * enable the MSI vector. The device driver is responsible for calling the + * SLI-3 interface spec. The kernel function pci_enable_msi_range() is called + * to enable the MSI vector. The device driver is responsible for calling the * request_irq() to register MSI vector with a interrupt the handler, which * is done in this function. * @@ -8252,8 +8254,8 @@ lpfc_sli_enable_msi(struct lpfc_hba *phb { int rc; - rc = pci_enable_msi(phba->pcidev); - if (!rc) + rc = pci_enable_msi_range(phba->pcidev, 1, 1); + if (rc > 0) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0462 PCI enable MSI mode success.\n"); else { @@ -8692,17 +8694,15 @@ lpfc_sli4_enable_msix(struct lpfc_hba *p phba->sli4_hba.msix_entries[index].entry = index; vectors++; } -enable_msix_vectors: - rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries, - vectors); - if (rc > 1) { - vectors = rc; - goto enable_msix_vectors; - } else if (rc) { + + rc = pci_enable_msix_range(phba->pcidev, phba->sli4_hba.msix_entries, + 2, vectors); + if (rc < 0) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0484 PCI enable MSI-X failed (%d)\n", rc); goto msi_fail_out; } + vectors = rc; /* Log MSI-X vector assignment */ for (index = 0; index < vectors; index++) @@ -8764,9 +8764,10 @@ cfg_fail_out: &phba->sli4_hba.fcp_eq_hdl[index]); } -msi_fail_out: /* Unconfigure MSI-X capability structure */ pci_disable_msix(phba->pcidev); + +msi_fail_out: return rc; } @@ -8804,7 +8805,7 @@ lpfc_sli4_disable_msix(struct lpfc_hba * * @phba: pointer to lpfc hba data structure. * * This routine is invoked to enable the MSI interrupt mode to device with - * SLI-4 interface spec. The kernel function pci_enable_msi() is called + * SLI-4 interface spec. The kernel function pci_enable_msi_range() is called * to enable the MSI vector. The device driver is responsible for calling * the request_irq() to register MSI vector with a interrupt the handler, * which is done in this function. @@ -8818,8 +8819,8 @@ lpfc_sli4_enable_msi(struct lpfc_hba *ph { int rc, index; - rc = pci_enable_msi(phba->pcidev); - if (!rc) + rc = pci_enable_msi_range(phba->pcidev, 1, 1); + if (rc > 0) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0487 PCI enable MSI mode success.\n"); else {