Commit 958a3e3b authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: fixup legacy interrupt handling

There were a number of little bugs in the error handling of irq setup, most of
which ended up panicing the kernel, and are addressed by this patch, along with
a couple formatting issues.

Legacy interrupts (including MSI) are used only in the case of failure to
allocate MSI-X interrupts.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 13c60b99
...@@ -4615,7 +4615,8 @@ static void i40e_fdir_setup(struct i40e_pf *pf) ...@@ -4615,7 +4615,8 @@ static void i40e_fdir_setup(struct i40e_pf *pf)
bool new_vsi = false; bool new_vsi = false;
int err, i; int err, i;
if (!(pf->flags & (I40E_FLAG_FDIR_ENABLED|I40E_FLAG_FDIR_ATR_ENABLED))) if (!(pf->flags & (I40E_FLAG_FDIR_ENABLED |
I40E_FLAG_FDIR_ATR_ENABLED)))
return; return;
pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE; pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE;
...@@ -5435,7 +5436,8 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf) ...@@ -5435,7 +5436,8 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf)
if (pf->flags & I40E_FLAG_MSIX_ENABLED) { if (pf->flags & I40E_FLAG_MSIX_ENABLED) {
err = i40e_init_msix(pf); err = i40e_init_msix(pf);
if (err) { if (err) {
pf->flags &= ~(I40E_FLAG_RSS_ENABLED | pf->flags &= ~(I40E_FLAG_MSIX_ENABLED |
I40E_FLAG_RSS_ENABLED |
I40E_FLAG_MQ_ENABLED | I40E_FLAG_MQ_ENABLED |
I40E_FLAG_DCB_ENABLED | I40E_FLAG_DCB_ENABLED |
I40E_FLAG_SRIOV_ENABLED | I40E_FLAG_SRIOV_ENABLED |
...@@ -5450,14 +5452,17 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf) ...@@ -5450,14 +5452,17 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf)
if (!(pf->flags & I40E_FLAG_MSIX_ENABLED) && if (!(pf->flags & I40E_FLAG_MSIX_ENABLED) &&
(pf->flags & I40E_FLAG_MSI_ENABLED)) { (pf->flags & I40E_FLAG_MSI_ENABLED)) {
dev_info(&pf->pdev->dev, "MSIX not available, trying MSI\n");
err = pci_enable_msi(pf->pdev); err = pci_enable_msi(pf->pdev);
if (err) { if (err) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev, "MSI init failed - %d\n", err);
"MSI init failed (%d), trying legacy.\n", err);
pf->flags &= ~I40E_FLAG_MSI_ENABLED; pf->flags &= ~I40E_FLAG_MSI_ENABLED;
} }
} }
if (!(pf->flags & (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED)))
dev_info(&pf->pdev->dev, "MSIX and MSI not available, falling back to Legacy IRQ\n");
/* track first vector for misc interrupts */ /* track first vector for misc interrupts */
err = i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT-1); err = i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT-1);
} }
...@@ -6110,8 +6115,9 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi) ...@@ -6110,8 +6115,9 @@ static int i40e_vsi_setup_vectors(struct i40e_vsi *vsi)
goto vector_setup_out; goto vector_setup_out;
} }
vsi->base_vector = i40e_get_lump(pf, pf->irq_pile, if (vsi->num_q_vectors)
vsi->num_q_vectors, vsi->idx); vsi->base_vector = i40e_get_lump(pf, pf->irq_pile,
vsi->num_q_vectors, vsi->idx);
if (vsi->base_vector < 0) { if (vsi->base_vector < 0) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"failed to get q tracking for VSI %d, err=%d\n", "failed to get q tracking for VSI %d, err=%d\n",
......
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