sfc: Fix two causes of flush failure
[pandora-kernel.git] / drivers / net / ethernet / sfc / nic.c
index 3edfbaf..9cca2a6 100644 (file)
@@ -1261,13 +1261,27 @@ int efx_nic_flush_queues(struct efx_nic *efx)
                        }
                        efx_for_each_possible_channel_tx_queue(tx_queue, channel) {
                                if (tx_queue->initialised &&
-                                   tx_queue->flushed != FLUSH_DONE)
-                                       ++tx_pending;
+                                   tx_queue->flushed != FLUSH_DONE) {
+                                       efx_oword_t txd_ptr_tbl;
+
+                                       efx_reado_table(efx, &txd_ptr_tbl,
+                                                       FR_BZ_TX_DESC_PTR_TBL,
+                                                       tx_queue->queue);
+                                       if (EFX_OWORD_FIELD(txd_ptr_tbl,
+                                                           FRF_AZ_TX_DESCQ_FLUSH) ||
+                                           EFX_OWORD_FIELD(txd_ptr_tbl,
+                                                           FRF_AZ_TX_DESCQ_EN))
+                                               ++tx_pending;
+                                       else
+                                               tx_queue->flushed = FLUSH_DONE;
+                               }
                        }
                }
 
-               if (rx_pending == 0 && tx_pending == 0)
+               if (rx_pending == 0 && tx_pending == 0) {
+                       efx->type->finish_flush(efx);
                        return 0;
+               }
 
                msleep(EFX_FLUSH_INTERVAL);
                efx_poll_flush_events(efx);
@@ -1293,6 +1307,7 @@ int efx_nic_flush_queues(struct efx_nic *efx)
                }
        }
 
+       efx->type->finish_flush(efx);
        return -ETIMEDOUT;
 }