diff options
author | Stefan Assmann <sassmann@kpanic.de> | 2016-09-19 07:37:49 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2016-10-03 22:07:43 -0400 |
commit | 9ca57e97a75780a7f9b8e93e83ab1e36dbfd9846 (patch) | |
tree | 0a5f590b1a7110550b01b8f0451c76acb9b48d52 /drivers/net | |
parent | b9118b7221ebb12156d2b08d4d5647bc6076d6bb (diff) |
i40e: check if vectors are already depleted when doing VMDq allocation
During MSI-X vector allocation for VMDq, a check for "no vectors left"
was missing, add it. This prevents more vectors to be allocated than
available.
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 8176596932be..66d2ca0194f6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -7674,18 +7674,23 @@ static int i40e_init_msix(struct i40e_pf *pf) | |||
7674 | int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps; | 7674 | int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps; |
7675 | int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted); | 7675 | int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted); |
7676 | 7676 | ||
7677 | /* if we're short on vectors for what's desired, we limit | 7677 | if (!vectors_left) { |
7678 | * the queues per vmdq. If this is still more than are | 7678 | pf->num_vmdq_msix = 0; |
7679 | * available, the user will need to change the number of | 7679 | pf->num_vmdq_qps = 0; |
7680 | * queues/vectors used by the PF later with the ethtool | 7680 | } else { |
7681 | * channels command | 7681 | /* if we're short on vectors for what's desired, we limit |
7682 | */ | 7682 | * the queues per vmdq. If this is still more than are |
7683 | if (vmdq_vecs < vmdq_vecs_wanted) | 7683 | * available, the user will need to change the number of |
7684 | pf->num_vmdq_qps = 1; | 7684 | * queues/vectors used by the PF later with the ethtool |
7685 | pf->num_vmdq_msix = pf->num_vmdq_qps; | 7685 | * channels command |
7686 | */ | ||
7687 | if (vmdq_vecs < vmdq_vecs_wanted) | ||
7688 | pf->num_vmdq_qps = 1; | ||
7689 | pf->num_vmdq_msix = pf->num_vmdq_qps; | ||
7686 | 7690 | ||
7687 | v_budget += vmdq_vecs; | 7691 | v_budget += vmdq_vecs; |
7688 | vectors_left -= vmdq_vecs; | 7692 | vectors_left -= vmdq_vecs; |
7693 | } | ||
7689 | } | 7694 | } |
7690 | 7695 | ||
7691 | pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), | 7696 | pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), |