mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
ice: Sanitize ice_ena_vsi and ice_dis_vsi
1. ndo_open and ndo_stop are implemented by ice_open and ice_stop respectively. When enabling/disabling VSIs, just call ice_open/ice_stop instead of ndo_open/ndo_stop. 2. Rework logic around rtnl_lock/rtnl_unlock 3. In ice_ena_vsi, remove an unnecessary stack variable and return 0 instead of err when __ICE_NEEDS_RESTART is not set. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
2935824873
commit
f27db2e65e
1 changed files with 11 additions and 13 deletions
|
@ -436,13 +436,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi, bool locked)
|
|||
|
||||
if (vsi->type == ICE_VSI_PF && vsi->netdev) {
|
||||
if (netif_running(vsi->netdev)) {
|
||||
if (!locked) {
|
||||
if (!locked)
|
||||
rtnl_lock();
|
||||
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
|
||||
|
||||
ice_stop(vsi->netdev);
|
||||
|
||||
if (!locked)
|
||||
rtnl_unlock();
|
||||
} else {
|
||||
vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
|
||||
}
|
||||
} else {
|
||||
ice_vsi_close(vsi);
|
||||
}
|
||||
|
@ -3654,21 +3654,19 @@ static int ice_ena_vsi(struct ice_vsi *vsi, bool locked)
|
|||
int err = 0;
|
||||
|
||||
if (!test_bit(__ICE_NEEDS_RESTART, vsi->state))
|
||||
return err;
|
||||
return 0;
|
||||
|
||||
clear_bit(__ICE_NEEDS_RESTART, vsi->state);
|
||||
|
||||
if (vsi->netdev && vsi->type == ICE_VSI_PF) {
|
||||
struct net_device *netd = vsi->netdev;
|
||||
|
||||
if (netif_running(vsi->netdev)) {
|
||||
if (locked) {
|
||||
err = netd->netdev_ops->ndo_open(netd);
|
||||
} else {
|
||||
if (!locked)
|
||||
rtnl_lock();
|
||||
err = netd->netdev_ops->ndo_open(netd);
|
||||
|
||||
err = ice_open(vsi->netdev);
|
||||
|
||||
if (!locked)
|
||||
rtnl_unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue