The pingpong test programs don't check the return value from
ibv_pool_cq() properly.  Here is a patch to fix them.


Index: rc_pingpong.c
===================================================================
--- rc_pingpong.c       (revision 4412)
+++ rc_pingpong.c       (working copy)
@@ -644,13 +644,12 @@
 
                        do {
                                ne = ibv_poll_cq(ctx->cq, 2, wc);
+                               if (ne < 0) {
+                                       fprintf(stderr, "poll CQ failed %d\n", 
ne);
+                                       return 1;
+                               }
                        } while (!use_event && ne < 1);
 
-                       if (ne < 0) {
-                               fprintf(stderr, "poll CQ failed %d\n", ne);
-                               return 1;
-                       }
-
                        for (i = 0; i < ne; ++i) {
                                if (wc[i].status != IBV_WC_SUCCESS) {
                                        fprintf(stderr, "Failed status %d for 
wr_id %d\n",
Index: srq_pingpong.c
===================================================================
--- srq_pingpong.c      (revision 4412)
+++ srq_pingpong.c      (working copy)
@@ -720,13 +720,12 @@
 
                        do {
                                ne = ibv_poll_cq(ctx->cq, 2, wc);
+                               if (ne < 0) {
+                                       fprintf(stderr, "poll CQ failed %d\n", 
ne);
+                                       return 1;
+                               }
                        } while (!use_event && ne < 1);
 
-                       if (ne < 0) {
-                               fprintf(stderr, "poll CQ failed %d\n", ne);
-                               return 1;
-                       }
-
                        for (i = 0; i < ne; ++i) {
                                if (wc[i].status != IBV_WC_SUCCESS) {
                                        fprintf(stderr, "Failed status %d for 
wr_id %d\n",
Index: uc_pingpong.c
===================================================================
--- uc_pingpong.c       (revision 4412)
+++ uc_pingpong.c       (working copy)
@@ -632,13 +632,12 @@
 
                        do {
                                ne = ibv_poll_cq(ctx->cq, 2, wc);
+                               if (ne < 0) {
+                                       fprintf(stderr, "poll CQ failed %d\n", 
ne);
+                                       return 1;
+                               }
                        } while (!use_event && ne < 1);
 
-                       if (ne < 0) {
-                               fprintf(stderr, "poll CQ failed %d\n", ne);
-                               return 1;
-                       }
-
                        for (i = 0; i < ne; ++i) {
                                if (wc[i].status != IBV_WC_SUCCESS) {
                                        fprintf(stderr, "Failed status %d for 
wr_id %d\n",
Index: ud_pingpong.c
===================================================================
--- ud_pingpong.c       (revision 4412)
+++ ud_pingpong.c       (working copy)
@@ -640,13 +640,12 @@
 
                        do {
                                ne = ibv_poll_cq(ctx->cq, 2, wc);
+                               if (ne < 0) {
+                                       fprintf(stderr, "poll CQ failed %d\n", 
ne);
+                                       return 1;
+                               }
                        } while (!use_event && ne < 1);
 
-                       if (ne < 0) {
-                               fprintf(stderr, "poll CQ failed %d\n", ne);
-                               return 1;
-                       }
-
                        for (i = 0; i < ne; ++i) {
                                if (wc[i].status != IBV_WC_SUCCESS) {
                                        fprintf(stderr, "Failed status %d for 
wr_id %d\n",

-- 
Ralph Campbell <[EMAIL PROTECTED]>

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to