Commit 90ef8d47 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: abstract the close path for better netdev vsis

Abstract out the vsi close actions into a single function so they
can be used correctly for both netdev and non-netdev based VSIs.

Change-ID: I59e3d115fcb20e614a09477281b7787dd340d276
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 c22e3c6c
...@@ -3517,6 +3517,19 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi) ...@@ -3517,6 +3517,19 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi)
napi_disable(&vsi->q_vectors[q_idx]->napi); napi_disable(&vsi->q_vectors[q_idx]->napi);
} }
/**
* i40e_vsi_close - Shut down a VSI
* @vsi: the vsi to be quelled
**/
static void i40e_vsi_close(struct i40e_vsi *vsi)
{
if (!test_and_set_bit(__I40E_DOWN, &vsi->state))
i40e_down(vsi);
i40e_vsi_free_irq(vsi);
i40e_vsi_free_tx_resources(vsi);
i40e_vsi_free_rx_resources(vsi);
}
/** /**
* i40e_quiesce_vsi - Pause a given VSI * i40e_quiesce_vsi - Pause a given VSI
* @vsi: the VSI being paused * @vsi: the VSI being paused
...@@ -3530,8 +3543,7 @@ static void i40e_quiesce_vsi(struct i40e_vsi *vsi) ...@@ -3530,8 +3543,7 @@ static void i40e_quiesce_vsi(struct i40e_vsi *vsi)
if (vsi->netdev && netif_running(vsi->netdev)) { if (vsi->netdev && netif_running(vsi->netdev)) {
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
} else { } else {
set_bit(__I40E_DOWN, &vsi->state); i40e_vsi_close(vsi);
i40e_down(vsi);
} }
} }
...@@ -4383,14 +4395,7 @@ static int i40e_close(struct net_device *netdev) ...@@ -4383,14 +4395,7 @@ static int i40e_close(struct net_device *netdev)
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
if (test_and_set_bit(__I40E_DOWN, &vsi->state)) i40e_vsi_close(vsi);
return 0;
i40e_down(vsi);
i40e_vsi_free_irq(vsi);
i40e_vsi_free_tx_resources(vsi);
i40e_vsi_free_rx_resources(vsi);
return 0; return 0;
} }
...@@ -7075,11 +7080,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi) ...@@ -7075,11 +7080,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
unregister_netdev(vsi->netdev); unregister_netdev(vsi->netdev);
} }
} else { } else {
if (!test_and_set_bit(__I40E_DOWN, &vsi->state)) i40e_vsi_close(vsi);
i40e_down(vsi);
i40e_vsi_free_irq(vsi);
i40e_vsi_free_tx_resources(vsi);
i40e_vsi_free_rx_resources(vsi);
} }
i40e_vsi_disable_irq(vsi); i40e_vsi_disable_irq(vsi);
} }
......
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