提交 90ef8d47 编写于 作者: S Shannon Nelson 提交者: 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: NShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: NCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: NKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 c22e3c6c
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册