From patchwork Wed Jul 16 18:05:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 370837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B47C614008B for ; Thu, 17 Jul 2014 04:09:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965680AbaGPSFF (ORCPT ); Wed, 16 Jul 2014 14:05:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54967 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965602AbaGPSFA (ORCPT ); Wed, 16 Jul 2014 14:05:00 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6GI4tdU005424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Jul 2014 14:04:56 -0400 Received: from dhcp-26-207.brq.redhat.com (dhcp-26-192.brq.redhat.com [10.34.26.192]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6GI4ocN008425; Wed, 16 Jul 2014 14:04:54 -0400 From: Alexander Gordeev To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Anil Gurumurthy , Vijaya Mohan Guvva , linux-scsi@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 RESEND 02/23] bfa: Do not call pci_enable_msix() after it failed once Date: Wed, 16 Jul 2014 20:05:06 +0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Function pci_enable_msix() should not be called in case it threw a negative errno from a previous call. Signed-off-by: Alexander Gordeev Cc: Anil Gurumurthy Cc: Vijaya Mohan Guvva Cc: linux-scsi@vger.kernel.org Cc: linux-pci@vger.kernel.org Acked-by: Anil Gurumurthy --- drivers/scsi/bfa/bfad.c | 48 ++++++++++++++++++++++------------------------ 1 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 7593b7c..bb93180 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -1235,33 +1235,31 @@ bfad_setup_intr(struct bfad_s *bfad) (bfa_asic_id_cb(pdev->device) && !msix_disable_cb)) { error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); - if (error) { - /* In CT1 & CT2, try to allocate just one vector */ - if (bfa_asic_id_ctc(pdev->device)) { - printk(KERN_WARNING "bfa %s: trying one msix " - "vector failed to allocate %d[%d]\n", - bfad->pci_name, bfad->nvec, error); - bfad->nvec = 1; - error = pci_enable_msix(bfad->pcidev, + /* In CT1 & CT2, try to allocate just one vector */ + if (error > 0 && bfa_asic_id_ctc(pdev->device)) { + printk(KERN_WARNING "bfa %s: trying one msix " + "vector failed to allocate %d[%d]\n", + bfad->pci_name, bfad->nvec, error); + bfad->nvec = 1; + error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); - } + } - /* - * Only error number of vector is available. - * We don't have a mechanism to map multiple - * interrupts into one vector, so even if we - * can try to request less vectors, we don't - * know how to associate interrupt events to - * vectors. Linux doesn't duplicate vectors - * in the MSIX table for this case. - */ - if (error) { - printk(KERN_WARNING "bfad%d: " - "pci_enable_msix failed (%d), " - "use line based.\n", - bfad->inst_no, error); - goto line_based; - } + /* + * Only error number of vector is available. + * We don't have a mechanism to map multiple + * interrupts into one vector, so even if we + * can try to request less vectors, we don't + * know how to associate interrupt events to + * vectors. Linux doesn't duplicate vectors + * in the MSIX table for this case. + */ + if (error) { + printk(KERN_WARNING "bfad%d: " + "pci_enable_msix failed (%d), " + "use line based.\n", + bfad->inst_no, error); + goto line_based; } /* Disable INTX in MSI-X mode */