aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/nic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/sfc/nic.c')
-rw-r--r--drivers/net/ethernet/sfc/nic.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index deb0ee04fe70..7c52691e9d26 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -721,7 +721,7 @@ static bool efx_check_tx_flush_complete(struct efx_nic *efx)
721/* Flush all the transmit queues, and continue flushing receive queues until 721/* Flush all the transmit queues, and continue flushing receive queues until
722 * they're all flushed. Wait for the DRAIN events to be recieved so that there 722 * they're all flushed. Wait for the DRAIN events to be recieved so that there
723 * are no more RX and TX events left on any channel. */ 723 * are no more RX and TX events left on any channel. */
724int efx_nic_flush_queues(struct efx_nic *efx) 724static int efx_farch_do_flush(struct efx_nic *efx)
725{ 725{
726 unsigned timeout = msecs_to_jiffies(5000); /* 5s for all flushes and drains */ 726 unsigned timeout = msecs_to_jiffies(5000); /* 5s for all flushes and drains */
727 struct efx_channel *channel; 727 struct efx_channel *channel;
@@ -729,8 +729,6 @@ int efx_nic_flush_queues(struct efx_nic *efx)
729 struct efx_tx_queue *tx_queue; 729 struct efx_tx_queue *tx_queue;
730 int rc = 0; 730 int rc = 0;
731 731
732 efx->type->prepare_flush(efx);
733
734 efx_for_each_channel(channel, efx) { 732 efx_for_each_channel(channel, efx) {
735 efx_for_each_channel_tx_queue(tx_queue, channel) { 733 efx_for_each_channel_tx_queue(tx_queue, channel) {
736 atomic_inc(&efx->drain_pending); 734 atomic_inc(&efx->drain_pending);
@@ -791,7 +789,32 @@ int efx_nic_flush_queues(struct efx_nic *efx)
791 atomic_set(&efx->rxq_flush_outstanding, 0); 789 atomic_set(&efx->rxq_flush_outstanding, 0);
792 } 790 }
793 791
794 efx->type->finish_flush(efx); 792 return rc;
793}
794
795int efx_farch_fini_dmaq(struct efx_nic *efx)
796{
797 struct efx_channel *channel;
798 struct efx_tx_queue *tx_queue;
799 struct efx_rx_queue *rx_queue;
800 int rc = 0;
801
802 /* Do not attempt to write to the NIC during EEH recovery */
803 if (efx->state != STATE_RECOVERY) {
804 /* Only perform flush if DMA is enabled */
805 if (efx->pci_dev->is_busmaster) {
806 efx->type->prepare_flush(efx);
807 rc = efx_farch_do_flush(efx);
808 efx->type->finish_flush(efx);
809 }
810
811 efx_for_each_channel(channel, efx) {
812 efx_for_each_channel_rx_queue(rx_queue, channel)
813 efx_nic_fini_rx(rx_queue);
814 efx_for_each_channel_tx_queue(tx_queue, channel)
815 efx_nic_fini_tx(tx_queue);
816 }
817 }
795 818
796 return rc; 819 return rc;
797} 820}