Commit 8a9eb7d3 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: rework fdir setup and teardown

Use the newer i40e_vsi_open() and i40e_vsi_close() in the FDIR VSI
lifetime.  This makes sure we're using standard methods for all the
VSI open and close paths.  This also fixes a memory leak of the
FDIR queue buffer info structs across a reset.

Change-ID: I1b60a1b08ab923afe4f49810c2c7844d850e19b9
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 8276f757
...@@ -4335,6 +4335,11 @@ int i40e_vsi_open(struct i40e_vsi *vsi) ...@@ -4335,6 +4335,11 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
vsi->num_queue_pairs); vsi->num_queue_pairs);
if (err) if (err)
goto err_set_queues; goto err_set_queues;
} else if (vsi->type == I40E_VSI_FDIR) {
snprintf(int_name, sizeof(int_name) - 1, "%s-fdir",
dev_driver_string(&pf->pdev->dev));
err = i40e_vsi_request_irq(vsi, int_name);
} else { } else {
err = EINVAL; err = EINVAL;
goto err_setup_rx; goto err_setup_rx;
...@@ -5269,8 +5274,7 @@ static int i40e_vsi_clear(struct i40e_vsi *vsi); ...@@ -5269,8 +5274,7 @@ static int i40e_vsi_clear(struct i40e_vsi *vsi);
static void i40e_fdir_sb_setup(struct i40e_pf *pf) static void i40e_fdir_sb_setup(struct i40e_pf *pf)
{ {
struct i40e_vsi *vsi; struct i40e_vsi *vsi;
bool new_vsi = false; int i;
int err, i;
if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED)) if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
return; return;
...@@ -5290,47 +5294,12 @@ static void i40e_fdir_sb_setup(struct i40e_pf *pf) ...@@ -5290,47 +5294,12 @@ static void i40e_fdir_sb_setup(struct i40e_pf *pf)
pf->vsi[pf->lan_vsi]->seid, 0); pf->vsi[pf->lan_vsi]->seid, 0);
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, "Couldn't create FDir VSI\n"); dev_info(&pf->pdev->dev, "Couldn't create FDir VSI\n");
goto err_vsi; pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
} return;
new_vsi = true;
} }
i40e_vsi_setup_irqhandler(vsi, i40e_fdir_clean_ring);
err = i40e_vsi_setup_tx_resources(vsi);
if (err)
goto err_setup_tx;
err = i40e_vsi_setup_rx_resources(vsi);
if (err)
goto err_setup_rx;
if (new_vsi) {
char int_name[IFNAMSIZ + 9];
err = i40e_vsi_configure(vsi);
if (err)
goto err_setup_rx;
snprintf(int_name, sizeof(int_name) - 1, "%s-fdir",
dev_driver_string(&pf->pdev->dev));
err = i40e_vsi_request_irq(vsi, int_name);
if (err)
goto err_setup_rx;
err = i40e_up_complete(vsi);
if (err)
goto err_up_complete;
clear_bit(__I40E_NEEDS_RESTART, &vsi->state);
} }
return; i40e_vsi_setup_irqhandler(vsi, i40e_fdir_clean_ring);
err_up_complete:
i40e_down(vsi);
i40e_vsi_free_irq(vsi);
err_setup_rx:
i40e_vsi_free_rx_resources(vsi);
err_setup_tx:
i40e_vsi_free_tx_resources(vsi);
err_vsi:
pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
i40e_vsi_clear(vsi);
} }
/** /**
...@@ -8184,6 +8153,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8184,6 +8153,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
u16 link_status; u16 link_status;
int err = 0; int err = 0;
u32 len; u32 len;
u32 i;
err = pci_enable_device_mem(pdev); err = pci_enable_device_mem(pdev);
if (err) if (err)
...@@ -8373,6 +8343,13 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8373,6 +8343,13 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err); dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err);
goto err_vsis; goto err_vsis;
} }
/* if FDIR VSI was set up, start it now */
for (i = 0; i < pf->hw.func_caps.num_vsis; i++) {
if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
i40e_vsi_open(pf->vsi[i]);
break;
}
}
/* The main driver is (mostly) up and happy. We need to set this state /* The main driver is (mostly) up and happy. We need to set this state
* before setting up the misc vector or we get a race and the vector * before setting up the misc vector or we get a race and the vector
......
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