Commit 9ca57e97 authored by Stefan Assmann's avatar Stefan Assmann Committed by Jeff Kirsher

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: default avatarStefan Assmann <sassmann@kpanic.de>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent b9118b72
...@@ -7674,6 +7674,10 @@ static int i40e_init_msix(struct i40e_pf *pf) ...@@ -7674,6 +7674,10 @@ static int i40e_init_msix(struct i40e_pf *pf)
int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps; int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps;
int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted); int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted);
if (!vectors_left) {
pf->num_vmdq_msix = 0;
pf->num_vmdq_qps = 0;
} else {
/* if we're short on vectors for what's desired, we limit /* if we're short on vectors for what's desired, we limit
* the queues per vmdq. If this is still more than are * the queues per vmdq. If this is still more than are
* available, the user will need to change the number of * available, the user will need to change the number of
...@@ -7687,6 +7691,7 @@ static int i40e_init_msix(struct i40e_pf *pf) ...@@ -7687,6 +7691,7 @@ static int i40e_init_msix(struct i40e_pf *pf)
v_budget += vmdq_vecs; v_budget += vmdq_vecs;
vectors_left -= vmdq_vecs; vectors_left -= vmdq_vecs;
} }
}
pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry),
GFP_KERNEL); GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment