]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[S390] qdio: EQBS retry after CCQ 96
authorJan Glauber <jang@linux.vnet.ibm.com>
Mon, 24 Oct 2011 09:47:55 +0000 (11:47 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 24 Oct 2011 09:47:36 +0000 (11:47 +0200)
Running under z/VM with QIOASSIST enabled, qdio queues could stall if EQBS
did not extract all SBAL states. Add an instant retry for EQBS and, if the
retry fails, set up a timer to ensure outstanding SBALs are processed later.

While at it, optimize qdio_do_eqbs and qdio_do_sqbs to eliminate 3 jumps on
the hot path.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/qdio_main.c

index e82d9367dff454600e4ae70b2fd368062efeeea4..980034191df138dd7b3ede51d0dbc9f5146081eb 100644 (file)
@@ -100,9 +100,12 @@ static inline int qdio_check_ccq(struct qdio_q *q, unsigned int ccq)
        /* all done or next buffer state different */
        if (ccq == 0 || ccq == 32)
                return 0;
-       /* not all buffers processed */
-       if (ccq == 96 || ccq == 97)
+       /* no buffer processed */
+       if (ccq == 97)
                return 1;
+       /* not all buffers processed */
+       if (ccq == 96)
+               return 2;
        /* notify devices immediately */
        DBF_ERROR("%4x ccq:%3d", SCH_NO(q), ccq);
        return -EIO;
@@ -122,10 +125,8 @@ static inline int qdio_check_ccq(struct qdio_q *q, unsigned int ccq)
 static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
                        int start, int count, int auto_ack)
 {
+       int rc, tmp_count = count, tmp_start = start, nr = q->nr, retried = 0;
        unsigned int ccq = 0;
-       int tmp_count = count, tmp_start = start;
-       int nr = q->nr;
-       int rc;
 
        BUG_ON(!q->irq_ptr->sch_token);
        qperf_inc(q, eqbs);
@@ -136,29 +137,34 @@ again:
        ccq = do_eqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count,
                      auto_ack);
        rc = qdio_check_ccq(q, ccq);
-
-       /* At least one buffer was processed, return and extract the remaining
-        * buffers later.
-        */
-       if ((ccq == 96) && (count != tmp_count)) {
-               qperf_inc(q, eqbs_partial);
-               return (count - tmp_count);
-       }
+       if (!rc)
+               return count - tmp_count;
 
        if (rc == 1) {
                DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS again:%2d", ccq);
                goto again;
        }
 
-       if (rc < 0) {
-               DBF_ERROR("%4x EQBS ERROR", SCH_NO(q));
-               DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
-               q->handler(q->irq_ptr->cdev,
-                          QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
-                          0, -1, -1, q->irq_ptr->int_parm);
-               return 0;
+       if (rc == 2) {
+               BUG_ON(tmp_count == count);
+               qperf_inc(q, eqbs_partial);
+               DBF_DEV_EVENT(DBF_WARN, q->irq_ptr, "EQBS part:%02x",
+                       tmp_count);
+               /*
+                * Retry once, if that fails bail out and process the
+                * extracted buffers before trying again.
+                */
+               if (!retried++)
+                       goto again;
+               else
+                       return count - tmp_count;
        }
-       return count - tmp_count;
+
+       DBF_ERROR("%4x EQBS ERROR", SCH_NO(q));
+       DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
+       q->handler(q->irq_ptr->cdev, QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
+                  0, -1, -1, q->irq_ptr->int_parm);
+       return 0;
 }
 
 /**
@@ -191,21 +197,22 @@ static int qdio_do_sqbs(struct qdio_q *q, unsigned char state, int start,
 again:
        ccq = do_sqbs(q->irq_ptr->sch_token, state, nr, &tmp_start, &tmp_count);
        rc = qdio_check_ccq(q, ccq);
-       if (rc == 1) {
+       if (!rc) {
+               WARN_ON(tmp_count);
+               return count - tmp_count;
+       }
+
+       if (rc == 1 || rc == 2) {
                DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq);
                qperf_inc(q, sqbs_partial);
                goto again;
        }
-       if (rc < 0) {
-               DBF_ERROR("%4x SQBS ERROR", SCH_NO(q));
-               DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
-               q->handler(q->irq_ptr->cdev,
-                          QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
-                          0, -1, -1, q->irq_ptr->int_parm);
-               return 0;
-       }
-       WARN_ON(tmp_count);
-       return count - tmp_count;
+
+       DBF_ERROR("%4x SQBS ERROR", SCH_NO(q));
+       DBF_ERROR("%3d%3d%2d", count, tmp_count, nr);
+       q->handler(q->irq_ptr->cdev, QDIO_ERROR_ACTIVATE_CHECK_CONDITION,
+                  0, -1, -1, q->irq_ptr->int_parm);
+       return 0;
 }
 
 /* returns number of examined buffers and their common state in *state */
@@ -786,10 +793,6 @@ static void __qdio_outbound_processing(struct qdio_q *q)
                if (!pci_out_supported(q) && !qdio_outbound_q_done(q))
                        goto sched;
 
-       /* bail out for HiperSockets unicast queues */
-       if (queue_type(q) == QDIO_IQDIO_QFMT && !multicast_outbound(q))
-               return;
-
        if ((queue_type(q) == QDIO_IQDIO_QFMT) &&
            (atomic_read(&q->nr_buf_used)) > QDIO_IQDIO_POLL_LVL)
                goto sched;
@@ -799,8 +802,8 @@ static void __qdio_outbound_processing(struct qdio_q *q)
 
        /*
         * Now we know that queue type is either qeth without pci enabled
-        * or HiperSockets multicast. Make sure buffer switch from PRIMED to
-        * EMPTY is noticed and outbound_handler is called after some time.
+        * or HiperSockets. Make sure buffer switch from PRIMED to EMPTY
+        * is noticed and outbound_handler is called after some time.
         */
        if (qdio_outbound_q_done(q))
                del_timer(&q->u.out.timer);