aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-03-14 03:32:26 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-04-22 06:29:53 -0400
commit90ef8d47cbb19df60f594e264498380251dae950 (patch)
tree525262011ef3657e60905ba002c97e909c0ec723 /drivers/net/ethernet/intel
parentc22e3c6c791221fc00b56e8a8250fa50f3724d3f (diff)
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>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 7dda8b22980d..2210ab247711 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3518,6 +3518,19 @@ static void i40e_napi_disable_all(struct i40e_vsi *vsi)
3518} 3518}
3519 3519
3520/** 3520/**
3521 * i40e_vsi_close - Shut down a VSI
3522 * @vsi: the vsi to be quelled
3523 **/
3524static void i40e_vsi_close(struct i40e_vsi *vsi)
3525{
3526 if (!test_and_set_bit(__I40E_DOWN, &vsi->state))
3527 i40e_down(vsi);
3528 i40e_vsi_free_irq(vsi);
3529 i40e_vsi_free_tx_resources(vsi);
3530 i40e_vsi_free_rx_resources(vsi);
3531}
3532
3533/**
3521 * i40e_quiesce_vsi - Pause a given VSI 3534 * i40e_quiesce_vsi - Pause a given VSI
3522 * @vsi: the VSI being paused 3535 * @vsi: the VSI being paused
3523 **/ 3536 **/
@@ -3530,8 +3543,7 @@ static void i40e_quiesce_vsi(struct i40e_vsi *vsi)
3530 if (vsi->netdev && netif_running(vsi->netdev)) { 3543 if (vsi->netdev && netif_running(vsi->netdev)) {
3531 vsi->netdev->netdev_ops->ndo_stop(vsi->netdev); 3544 vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
3532 } else { 3545 } else {
3533 set_bit(__I40E_DOWN, &vsi->state); 3546 i40e_vsi_close(vsi);
3534 i40e_down(vsi);
3535 } 3547 }
3536} 3548}
3537 3549
@@ -4383,14 +4395,7 @@ static int i40e_close(struct net_device *netdev)
4383 struct i40e_netdev_priv *np = netdev_priv(netdev); 4395 struct i40e_netdev_priv *np = netdev_priv(netdev);
4384 struct i40e_vsi *vsi = np->vsi; 4396 struct i40e_vsi *vsi = np->vsi;
4385 4397
4386 if (test_and_set_bit(__I40E_DOWN, &vsi->state)) 4398 i40e_vsi_close(vsi);
4387 return 0;
4388
4389 i40e_down(vsi);
4390 i40e_vsi_free_irq(vsi);
4391
4392 i40e_vsi_free_tx_resources(vsi);
4393 i40e_vsi_free_rx_resources(vsi);
4394 4399
4395 return 0; 4400 return 0;
4396} 4401}
@@ -7075,11 +7080,7 @@ int i40e_vsi_release(struct i40e_vsi *vsi)
7075 unregister_netdev(vsi->netdev); 7080 unregister_netdev(vsi->netdev);
7076 } 7081 }
7077 } else { 7082 } else {
7078 if (!test_and_set_bit(__I40E_DOWN, &vsi->state)) 7083 i40e_vsi_close(vsi);
7079 i40e_down(vsi);
7080 i40e_vsi_free_irq(vsi);
7081 i40e_vsi_free_tx_resources(vsi);
7082 i40e_vsi_free_rx_resources(vsi);
7083 } 7084 }
7084 i40e_vsi_disable_irq(vsi); 7085 i40e_vsi_disable_irq(vsi);
7085 } 7086 }