Skip to content

Commit

Permalink
qlcnic: Fix SR-IOV configuration
Browse files Browse the repository at this point in the history
o Interface needs to be brought down and up while configuring SR-IOV.
  Protect interface up/down using rtnl_lock()/rtnl_unlock()

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manish Chopra authored and David S. Miller committed Oct 1, 2013
1 parent 7167cf0 commit 1ed98ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;

rtnl_lock();
if (netif_running(netdev))
__qlcnic_down(adapter, netdev);

Expand All @@ -407,12 +408,15 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter)
/* After disabling SRIOV re-init the driver in default mode
configure opmode based on op_mode of function
*/
if (qlcnic_83xx_configure_opmode(adapter))
if (qlcnic_83xx_configure_opmode(adapter)) {
rtnl_unlock();
return -EIO;
}

if (netif_running(netdev))
__qlcnic_up(adapter, netdev);

rtnl_unlock();
return 0;
}

Expand Down Expand Up @@ -533,6 +537,7 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs)
return -EIO;
}

rtnl_lock();
if (netif_running(netdev))
__qlcnic_down(adapter, netdev);

Expand All @@ -555,6 +560,7 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs)
__qlcnic_up(adapter, netdev);

error:
rtnl_unlock();
return err;
}

Expand Down

0 comments on commit 1ed98ed

Please sign in to comment.