try to get next ... fails
authorStefan Metzmacher <metze@samba.org>
Thu, 29 Sep 2016 08:02:46 +0000 (10:02 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:06 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index d5099316b667c92af82f69837a42eccdaa9b53cb..46075d8fad65e73b839636d09a253f96c956783a 100644 (file)
@@ -1625,6 +1625,7 @@ static void smb_direct_connection_ibv_handler(struct tevent_context *ev,
        uint16_t flags;
        uint32_t data_offset;
        struct smb_direct_io *io = NULL;
+       struct smb_direct_io *io_next = NULL;
 
        errno = 0;
        ret = ibv_get_cq_event(c->ibv.comp_channel,
@@ -1693,11 +1694,18 @@ static void smb_direct_connection_ibv_handler(struct tevent_context *ev,
        io = talloc_get_type_abort((void *)(uintptr_t)wc.wr_id,
                                   struct smb_direct_io);
 
+ process_next:
        switch (wc.opcode) {
        case IBV_WC_SEND:
-               DEBUG(0,("%s:%s: GOT SEND[%p] data_length[%u] remaining_length[%u] ret[%d] errno[%d]\n",
-                       __location__, __FUNCTION__, io,
+               DEBUG(0,("%s:%s: GOT SEND[%p] next[%p] data_length[%u] remaining_length[%u] ret[%d] errno[%d]\n",
+                       __location__, __FUNCTION__, io, io->send_wr.next,
                        (unsigned)io->data_length, (unsigned)io->remaining_length, ret, errno));
+               if (io->send_wr.next != NULL) {
+                       io_next = talloc_get_type_abort(
+                                  (void *)(uintptr_t)io->send_wr.next->wr_id,
+                                  struct smb_direct_io);
+               }
+
                DLIST_REMOVE(c->s2r.posted, io);
                DLIST_ADD_END(c->s2r.idle, io);
 
@@ -1710,11 +1718,21 @@ static void smb_direct_connection_ibv_handler(struct tevent_context *ev,
                        smb_direct_connection_disconnect(c, status);
                        return;
                }
+               if (io_next != NULL) {
+                       io = io_next;
+                       io_next = NULL;
+                       goto process_next;
+               }
                return;
 
        case IBV_WC_RECV:
-               DEBUG(0,("%s:%s: GOT RECV[%p] ret[%d] errno[%d]\n",
-                       __location__, __FUNCTION__, io, ret, errno));
+               DEBUG(0,("%s:%s: GOT RECV[%p] next[%p] ret[%d] errno[%d]\n",
+                       __location__, __FUNCTION__, io, io->recv_wr.next, ret, errno));
+               if (io->recv_wr.next != NULL) {
+                       io_next = talloc_get_type_abort(
+                                  (void *)(uintptr_t)io->recv_wr.next->wr_id,
+                                  struct smb_direct_io);
+               }
                if (wc.byte_len > c->state.max_receive_size) {
                        status = NT_STATUS_INVALID_NETWORK_RESPONSE;
                        DEBUG(0,("%s:%s: wc.byte_len[%u/0x%x] max_receive_size[%u/0x%x] ret[%d] errno[%d] status[%s]\n",
@@ -1782,6 +1800,11 @@ smb_direct_connection_debug_credits(c, __location__, __func__);
                                smb_direct_connection_disconnect(c, status);
                                return;
                        }
+                       if (io_next != NULL) {
+                               io = io_next;
+                               io_next = NULL;
+                               goto process_next;
+                       }
                        return;
                } else if (data_offset == 0x18) {
                        if (io->data_length > (c->state.max_receive_size - data_offset)) {
@@ -1900,6 +1923,12 @@ smb_direct_connection_debug_credits(c, __location__, __func__);
                        smb_direct_connection_disconnect(c, status);
                        return;
                }
+
+               if (io_next != NULL) {
+                       io = io_next;
+                       io_next = NULL;
+                       goto process_next;
+               }
                return;
 
        case IBV_WC_RDMA_READ: