diff options
author | Vladislav Zolotarov <vladz@broadcom.com> | 2010-04-18 21:14:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-19 16:17:09 -0400 |
commit | 1ac218c83fbfc6bcdbef36b38f79d0ee08420285 (patch) | |
tree | ccab0f2bcf64228b3028c182bfcfebf78fd518a9 /drivers | |
parent | dea7aab1923a9ee81c5cafaa4bd47266abf30186 (diff) |
bnx2x: Fixed MSI-X enabling flow
Try to enable less MSI-X vectors if initial request has failed.
Author: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bnx2x.h | 18 | ||||
-rw-r--r-- | drivers/net/bnx2x_main.c | 28 |
2 files changed, 38 insertions, 8 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index ceb8a42b945c..081953005b84 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -24,16 +24,25 @@ | |||
24 | #define BCM_VLAN 1 | 24 | #define BCM_VLAN 1 |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define BNX2X_MULTI_QUEUE | ||
28 | |||
29 | #define BNX2X_NEW_NAPI | ||
30 | |||
31 | |||
32 | |||
27 | #if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) | 33 | #if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) |
28 | #define BCM_CNIC 1 | 34 | #define BCM_CNIC 1 |
29 | #include "cnic_if.h" | 35 | #include "cnic_if.h" |
30 | #endif | 36 | #endif |
31 | 37 | ||
32 | #define BNX2X_MULTI_QUEUE | ||
33 | |||
34 | #define BNX2X_NEW_NAPI | ||
35 | |||
36 | 38 | ||
39 | #ifdef BCM_CNIC | ||
40 | #define BNX2X_MIN_MSIX_VEC_CNT 3 | ||
41 | #define BNX2X_MSIX_VEC_FP_START 2 | ||
42 | #else | ||
43 | #define BNX2X_MIN_MSIX_VEC_CNT 2 | ||
44 | #define BNX2X_MSIX_VEC_FP_START 1 | ||
45 | #endif | ||
37 | 46 | ||
38 | #include <linux/mdio.h> | 47 | #include <linux/mdio.h> |
39 | #include "bnx2x_reg.h" | 48 | #include "bnx2x_reg.h" |
@@ -862,7 +871,6 @@ struct bnx2x { | |||
862 | #endif | 871 | #endif |
863 | #define INT_MODE_INTx 1 | 872 | #define INT_MODE_INTx 1 |
864 | #define INT_MODE_MSI 2 | 873 | #define INT_MODE_MSI 2 |
865 | #define INT_MODE_MSIX 3 | ||
866 | 874 | ||
867 | int tx_ring_size; | 875 | int tx_ring_size; |
868 | 876 | ||
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index ad440c8616a5..23528deaf98d 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -7418,7 +7418,31 @@ static int bnx2x_enable_msix(struct bnx2x *bp) | |||
7418 | 7418 | ||
7419 | rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], | 7419 | rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], |
7420 | BNX2X_NUM_QUEUES(bp) + offset); | 7420 | BNX2X_NUM_QUEUES(bp) + offset); |
7421 | if (rc) { | 7421 | |
7422 | /* | ||
7423 | * reconfigure number of tx/rx queues according to available | ||
7424 | * MSI-X vectors | ||
7425 | */ | ||
7426 | if (rc >= BNX2X_MIN_MSIX_VEC_CNT) { | ||
7427 | /* vectors available for FP */ | ||
7428 | int fp_vec = rc - BNX2X_MSIX_VEC_FP_START; | ||
7429 | |||
7430 | DP(NETIF_MSG_IFUP, | ||
7431 | "Trying to use less MSI-X vectors: %d\n", rc); | ||
7432 | |||
7433 | rc = pci_enable_msix(bp->pdev, &bp->msix_table[0], rc); | ||
7434 | |||
7435 | if (rc) { | ||
7436 | DP(NETIF_MSG_IFUP, | ||
7437 | "MSI-X is not attainable rc %d\n", rc); | ||
7438 | return rc; | ||
7439 | } | ||
7440 | |||
7441 | bp->num_queues = min(bp->num_queues, fp_vec); | ||
7442 | |||
7443 | DP(NETIF_MSG_IFUP, "New queue configuration set: %d\n", | ||
7444 | bp->num_queues); | ||
7445 | } else if (rc) { | ||
7422 | DP(NETIF_MSG_IFUP, "MSI-X is not attainable rc %d\n", rc); | 7446 | DP(NETIF_MSG_IFUP, "MSI-X is not attainable rc %d\n", rc); |
7423 | return rc; | 7447 | return rc; |
7424 | } | 7448 | } |
@@ -7841,8 +7865,6 @@ static int bnx2x_set_num_queues(struct bnx2x *bp) | |||
7841 | bp->num_queues = 1; | 7865 | bp->num_queues = 1; |
7842 | DP(NETIF_MSG_IFUP, "set number of queues to 1\n"); | 7866 | DP(NETIF_MSG_IFUP, "set number of queues to 1\n"); |
7843 | break; | 7867 | break; |
7844 | |||
7845 | case INT_MODE_MSIX: | ||
7846 | default: | 7868 | default: |
7847 | /* Set number of queues according to bp->multi_mode value */ | 7869 | /* Set number of queues according to bp->multi_mode value */ |
7848 | bnx2x_set_num_queues_msix(bp); | 7870 | bnx2x_set_num_queues_msix(bp); |