rping: ignore flushed completions
authorHariprasad S <hariprasad@chelsio.com>
Thu, 6 Nov 2014 09:12:57 +0000 (14:42 +0530)
committerSean Hefty <sean.hefty@intel.com>
Fri, 14 Nov 2014 18:48:11 +0000 (10:48 -0800)
Based on original work by Steve Wise <steve@opengridcomputing.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
examples/rping.c

index f0414de..58b642e 100644 (file)
@@ -277,15 +277,20 @@ static int rping_cq_event_handler(struct rping_cb *cb)
        struct ibv_wc wc;
        struct ibv_recv_wr *bad_wr;
        int ret;
+       int flushed = 0;
 
        while ((ret = ibv_poll_cq(cb->cq, 1, &wc)) == 1) {
                ret = 0;
 
                if (wc.status) {
-                       if (wc.status != IBV_WC_WR_FLUSH_ERR)
-                               fprintf(stderr,
-                                       "cq completion failed status %d\n",
-                                       wc.status);
+                       if (wc.status == IBV_WC_WR_FLUSH_ERR) {
+                               flushed = 1;
+                               continue;
+
+                       }
+                       fprintf(stderr,
+                               "cq completion failed status %d\n",
+                               wc.status);
                        ret = -1;
                        goto error;
                }
@@ -334,7 +339,7 @@ static int rping_cq_event_handler(struct rping_cb *cb)
                fprintf(stderr, "poll error %d\n", ret);
                goto error;
        }
-       return 0;
+       return flushed;
 
 error:
        cb->state = ERROR;