aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Fontenot <nfont@linux.vnet.ibm.com>2017-05-03 14:05:02 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-03 11:33:05 -0400
commit46293b940fede04f90aab18d4bfecc5bd942cf3a (patch)
tree7908f79db0c53e269a6f9de3b6745b5d4d55138c
parentb41b83e9a784576b2bcc33bce447f7ce78fb265d (diff)
ibmvnic: Wait for any pending scrqs entries at driver close
When closing the ibmvnic driver we need to wait for any pending sub crq entries to ensure they are handled. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 2297cf2390e1..a312bc1fee6d 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -743,23 +743,6 @@ static int ibmvnic_open(struct net_device *netdev)
743 return rc; 743 return rc;
744} 744}
745 745
746static void disable_sub_crqs(struct ibmvnic_adapter *adapter)
747{
748 int i;
749
750 if (adapter->tx_scrq) {
751 for (i = 0; i < adapter->req_tx_queues; i++)
752 if (adapter->tx_scrq[i])
753 disable_irq(adapter->tx_scrq[i]->irq);
754 }
755
756 if (adapter->rx_scrq) {
757 for (i = 0; i < adapter->req_rx_queues; i++)
758 if (adapter->rx_scrq[i])
759 disable_irq(adapter->rx_scrq[i]->irq);
760 }
761}
762
763static void clean_tx_pools(struct ibmvnic_adapter *adapter) 746static void clean_tx_pools(struct ibmvnic_adapter *adapter)
764{ 747{
765 struct ibmvnic_tx_pool *tx_pool; 748 struct ibmvnic_tx_pool *tx_pool;
@@ -797,15 +780,39 @@ static int __ibmvnic_close(struct net_device *netdev)
797 adapter->state = VNIC_CLOSING; 780 adapter->state = VNIC_CLOSING;
798 netif_tx_stop_all_queues(netdev); 781 netif_tx_stop_all_queues(netdev);
799 782
800 clean_tx_pools(adapter);
801 disable_sub_crqs(adapter);
802
803 if (adapter->napi) { 783 if (adapter->napi) {
804 for (i = 0; i < adapter->req_rx_queues; i++) 784 for (i = 0; i < adapter->req_rx_queues; i++)
805 napi_disable(&adapter->napi[i]); 785 napi_disable(&adapter->napi[i]);
806 } 786 }
807 787
788 clean_tx_pools(adapter);
789
790 if (adapter->tx_scrq) {
791 for (i = 0; i < adapter->req_tx_queues; i++)
792 if (adapter->tx_scrq[i]->irq)
793 disable_irq(adapter->tx_scrq[i]->irq);
794 }
795
808 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN); 796 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
797 if (rc)
798 return rc;
799
800 if (adapter->rx_scrq) {
801 for (i = 0; i < adapter->req_rx_queues; i++) {
802 int retries = 10;
803
804 while (pending_scrq(adapter, adapter->rx_scrq[i])) {
805 retries--;
806 mdelay(100);
807
808 if (retries == 0)
809 break;
810 }
811
812 if (adapter->rx_scrq[i]->irq)
813 disable_irq(adapter->rx_scrq[i]->irq);
814 }
815 }
809 816
810 adapter->state = VNIC_CLOSED; 817 adapter->state = VNIC_CLOSED;
811 return rc; 818 return rc;