From: Shahed Shaikh <shahed.shaikh@qlogic.com>
To: Alexander Gordeev <agordeev@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Dept-HSG Linux NIC Dev <Dept-HSGLinuxNICDev@qlogic.com>,
netdev <netdev@vger.kernel.org>,
linux-pci <linux-pci@vger.kernel.org>
Subject: RE: [PATCH] qlcnic: Fix MSI-X initialization code
Date: Tue, 15 Apr 2014 12:06:58 +0000 [thread overview]
Message-ID: <262CB373A6D1F14F9B81E82F74F77D5A46F910CF@avmb2.qlogic.org> (raw)
In-Reply-To: <1397554634-26795-1-git-send-email-agordeev@redhat.com>
> -----Original Message-----
> From: Alexander Gordeev [mailto:agordeev@redhat.com]
> Sent: Tuesday, April 15, 2014 3:07 PM
> To: linux-kernel
> Cc: Alexander Gordeev; Shahed Shaikh; Dept-HSG Linux NIC Dev; netdev;
> linux-pci
> Subject: [PATCH] qlcnic: Fix MSI-X initialization code
>
> Function qlcnic_setup_tss_rss_intr() might enter endless loop in case
> pci_enable_msix() contiguously returns a positive number of MSI-Xs that
> could have been allocated.
> Besides, the function contains 'err = -EIO;' assignment that never could be
> reached. This update fixes the aforementioned issues.
>
> Cc: Shahed Shaikh <shahed.shaikh@qlogic.com>
> Cc: Dept-HSGLinuxNICDev@qlogic.com
> Cc: netdev@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
>
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Thanks,
Shahed
> ---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 28 ++++++++++++-------
> --
> 1 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index 309d056..2e615d5 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -670,7 +670,7 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter
> *adapter)
> else
> num_msix += adapter->drv_tx_rings;
>
> - if (adapter->drv_rss_rings > 0)
> + if (adapter->drv_rss_rings > 0)
> num_msix += adapter->drv_rss_rings;
> else
> num_msix += adapter->drv_sds_rings;
> @@ -686,19 +686,15 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter
> *adapter)
> return -ENOMEM;
> }
>
> -restore:
> for (vector = 0; vector < num_msix; vector++)
> adapter->msix_entries[vector].entry = vector;
>
> +restore:
> err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> - if (err == 0) {
> - adapter->ahw->num_msix = num_msix;
> - if (adapter->drv_tss_rings > 0)
> - adapter->drv_tx_rings = adapter->drv_tss_rings;
> + if (err > 0) {
> + if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
> + return -ENOSPC;
>
> - if (adapter->drv_rss_rings > 0)
> - adapter->drv_sds_rings = adapter->drv_rss_rings;
> - } else {
> netdev_info(adapter->netdev,
> "Unable to allocate %d MSI-X vectors, Available
> vectors %d\n",
> num_msix, err);
> @@ -716,12 +712,20 @@ restore:
> "Restoring %d Tx, %d SDS rings for total %d
> vectors.\n",
> adapter->drv_tx_rings, adapter->drv_sds_rings,
> num_msix);
> - goto restore;
>
> - err = -EIO;
> + goto restore;
> + } else if (err < 0) {
> + return err;
> }
>
> - return err;
> + adapter->ahw->num_msix = num_msix;
> + if (adapter->drv_tss_rings > 0)
> + adapter->drv_tx_rings = adapter->drv_tss_rings;
> +
> + if (adapter->drv_rss_rings > 0)
> + adapter->drv_sds_rings = adapter->drv_rss_rings;
> +
> + return 0;
> }
>
> int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix)
> --
> 1.7.7.6
next prev parent reply other threads:[~2014-04-15 12:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 9:37 Alexander Gordeev
2014-04-15 12:06 ` Shahed Shaikh [this message]
2014-04-15 19:15 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=262CB373A6D1F14F9B81E82F74F77D5A46F910CF@avmb2.qlogic.org \
--to=shahed.shaikh@qlogic.com \
--cc=Dept-HSGLinuxNICDev@qlogic.com \
--cc=agordeev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®