2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 06:04:14 +08:00

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: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
Shannon Nelson 2014-03-14 07:32:26 +00:00 committed by Jeff Kirsher
parent c22e3c6c79
commit 90ef8d47cb

View File

@ -3517,6 +3517,19 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi)
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
* @vsi: the VSI being paused
@ -3530,8 +3543,7 @@ static void i40e_quiesce_vsi(struct i40e_vsi *vsi)
if (vsi->netdev && netif_running(vsi->netdev)) {
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
} else {
set_bit(__I40E_DOWN, &vsi->state);
i40e_down(vsi);
i40e_vsi_close(vsi);
}
}
@ -4383,14 +4395,7 @@ static int i40e_close(struct net_device *netdev)
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_vsi *vsi = np->vsi;
if (test_and_set_bit(__I40E_DOWN, &vsi->state))
return 0;
i40e_down(vsi);
i40e_vsi_free_irq(vsi);
i40e_vsi_free_tx_resources(vsi);
i40e_vsi_free_rx_resources(vsi);
i40e_vsi_close(vsi);
return 0;
}
@ -7075,11 +7080,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
unregister_netdev(vsi->netdev);
}
} else {
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_vsi_close(vsi);
}
i40e_vsi_disable_irq(vsi);
}