Commit 01d9bd79 authored by Thomas Falcon's avatar Thomas Falcon Committed by David S. Miller

ibmvnic: Reorganize device close

Introduce a function to halt network operations and clean up any
unused or outstanding socket buffers. Then, during device close,
disable backing adapter before halting all queues and performing
cleanup. This ensures all backing device operations will be
stopped before the driver cleans up shared resources.
Signed-off-by: default avatarThomas Falcon <tlfalcon@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f873866a
...@@ -1143,14 +1143,11 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter) ...@@ -1143,14 +1143,11 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter)
} }
} }
static int __ibmvnic_close(struct net_device *netdev) static void ibmvnic_cleanup(struct net_device *netdev)
{ {
struct ibmvnic_adapter *adapter = netdev_priv(netdev); struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int rc = 0;
int i; int i;
adapter->state = VNIC_CLOSING;
/* ensure that transmissions are stopped if called by do_reset */ /* ensure that transmissions are stopped if called by do_reset */
if (adapter->resetting) if (adapter->resetting)
netif_tx_disable(netdev); netif_tx_disable(netdev);
...@@ -1168,10 +1165,6 @@ static int __ibmvnic_close(struct net_device *netdev) ...@@ -1168,10 +1165,6 @@ static int __ibmvnic_close(struct net_device *netdev)
} }
} }
rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
if (rc)
return rc;
if (adapter->rx_scrq) { if (adapter->rx_scrq) {
for (i = 0; i < adapter->req_rx_queues; i++) { for (i = 0; i < adapter->req_rx_queues; i++) {
if (adapter->rx_scrq[i]->irq) { if (adapter->rx_scrq[i]->irq) {
...@@ -1183,8 +1176,20 @@ static int __ibmvnic_close(struct net_device *netdev) ...@@ -1183,8 +1176,20 @@ static int __ibmvnic_close(struct net_device *netdev)
} }
clean_rx_pools(adapter); clean_rx_pools(adapter);
clean_tx_pools(adapter); clean_tx_pools(adapter);
adapter->state = VNIC_CLOSED; }
static int __ibmvnic_close(struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int rc = 0;
adapter->state = VNIC_CLOSING;
rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
if (rc)
return rc; return rc;
ibmvnic_cleanup(netdev);
adapter->state = VNIC_CLOSED;
return 0;
} }
static int ibmvnic_close(struct net_device *netdev) static int ibmvnic_close(struct net_device *netdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment