net/sfc: handle already flushed Rx queue gracefully
authorAndrew Rybchenko <arybchenko@solarflare.com>
Sat, 27 May 2017 07:55:32 +0000 (08:55 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 12 Jun 2017 09:41:27 +0000 (10:41 +0100)
Rx queue may be already flushed because of previous Rx error or
MC reboot.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc_rx.c

index 122b657..325f32a 100644 (file)
@@ -529,6 +529,7 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
        struct sfc_rxq *rxq;
        unsigned int retry_count;
        unsigned int wait_count;
+       int rc;
 
        rxq = sa->rxq_info[sw_index].rxq;
        SFC_ASSERT(rxq->state & SFC_RXQ_STARTED);
@@ -541,8 +542,10 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
             ((rxq->state & SFC_RXQ_FLUSHED) == 0) &&
             (retry_count < SFC_RX_QFLUSH_ATTEMPTS);
             ++retry_count) {
-               if (efx_rx_qflush(rxq->common) != 0) {
-                       rxq->state |= SFC_RXQ_FLUSH_FAILED;
+               rc = efx_rx_qflush(rxq->common);
+               if (rc != 0) {
+                       rxq->state |= (rc == EALREADY) ?
+                               SFC_RXQ_FLUSHED : SFC_RXQ_FLUSH_FAILED;
                        break;
                }
                rxq->state &= ~SFC_RXQ_FLUSH_FAILED;