libcli/smb/smb_direct.c
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Oct 2016 08:15:27 +0000 (10:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:19 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index 762c06989733caa98f9d455c21f6ff61fdfd6c4e..0f036372b014066550b14b08ca10c9bb4064f32d 100644 (file)
@@ -587,6 +587,7 @@ smb_direct_connection_debug_credits(c, "POST_SEND", io, __location__, __func__);
 //                     c->state.receive_credits += granted;
 //             }
 
+               io->send_wr.sg_list = io->sge;
                if (io->data_length > 0) {
                        data_offset = SMB_DIRECT_DATA_OFFSET;
                        io->sge[0].length = data_offset;
@@ -1281,10 +1282,10 @@ static void smb_direct_connection_negotiate_connect_ibv_handler(struct tevent_co
                if (tevent_req_nomem(neg_recv, req)) {
                        return;
                }
-               neg_recv->sge[0].addr = (uint64_t) (uintptr_t) neg_recv->data;
-               neg_recv->sge[0].length = sizeof(neg_recv->data);
-               neg_recv->sge[0].lkey = neg_recv->data_mr->lkey;
-               neg_recv->recv_wr.sg_list = neg_recv->sge;
+               //neg_recv->sge[0].addr = (uint64_t) (uintptr_t) neg_recv->data;
+               //neg_recv->sge[0].length = sizeof(neg_recv->data);
+               //neg_recv->sge[0].lkey = neg_recv->data_mr->lkey;
+               neg_recv->recv_wr.sg_list = &neg_recv->sge[1];
                neg_recv->recv_wr.num_sge = 1;
 
                neg_send = smb_direct_io_create(c);
@@ -1298,12 +1299,12 @@ static void smb_direct_connection_negotiate_connect_ibv_handler(struct tevent_co
                SIVAL(neg_send->data, 0x08, c->state.max_send_size);
                SIVAL(neg_send->data, 0x0C, c->state.max_receive_size);
                SIVAL(neg_send->data, 0x10, c->state.max_fragmented_size);
-               neg_send->sge[0].addr = (uint64_t) (uintptr_t) neg_send->data;
-               neg_send->sge[0].length = 0x14;
-               neg_send->sge[0].lkey = neg_send->data_mr->lkey;
-               neg_send->send_wr.opcode = IBV_WR_SEND;
-               neg_send->send_wr.send_flags = IBV_SEND_SIGNALED;
-               neg_send->send_wr.sg_list = neg_send->sge;
+               //neg_send->sge[0].addr = (uint64_t) (uintptr_t) neg_send->data;
+               neg_send->sge[1].length = 0x14;
+               //neg_send->sge[0].lkey = neg_send->data_mr->lkey;
+               //neg_send->send_wr.opcode = IBV_WR_SEND;
+               //neg_send->send_wr.send_flags = IBV_SEND_SIGNALED;
+               neg_send->send_wr.sg_list = &neg_send->sge[1];
                neg_send->send_wr.num_sge = 1;
 
                errno = 0;
@@ -1649,10 +1650,10 @@ static struct tevent_req *smb_direct_connection_negotiate_accept_send(
        if (tevent_req_nomem(neg_recv, req)) {
                return tevent_req_post(req, ev);
        }
-       neg_recv->sge[0].addr = (uint64_t) (uintptr_t) neg_recv->data;
-       neg_recv->sge[0].length = sizeof(neg_recv->data);
-       neg_recv->sge[0].lkey = neg_recv->data_mr->lkey;
-       neg_recv->recv_wr.sg_list = neg_recv->sge;
+       //neg_recv->sge[0].addr = (uint64_t) (uintptr_t) neg_recv->data;
+       neg_recv->sge[1].length = sizeof(neg_recv->data);
+       //neg_recv->sge[0].lkey = neg_recv->data_mr->lkey;
+       neg_recv->recv_wr.sg_list = &neg_recv->sge[1];
        neg_recv->recv_wr.num_sge = 1;
 
        ret = ibv_post_recv(c->ibv.qp, &neg_recv->recv_wr, &bad_recv_wr);
@@ -1957,16 +1958,15 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
                neg_send = c->s2r.idle;
                DLIST_REMOVE(c->s2r.idle, neg_send);
 
-               SSVAL(neg_send->data, 0x00, 0x0100);
-               SSVAL(neg_send->data, 0x02, 0x0100);
-               SSVAL(neg_send->data, 0x04, 0x0100);
-               SSVAL(neg_send->data, 0x06, 0x0000);
-
                credits_granted = c->state.receive_posted;
                credits_granted -= c->state.receive_credits;
                credits_granted = MIN(credits_granted, c->state.receive_credit_target);
                c->state.receive_credits += credits_granted;
 
+               SSVAL(neg_send->data, 0x00, 0x0100);
+               SSVAL(neg_send->data, 0x02, 0x0100);
+               SSVAL(neg_send->data, 0x04, 0x0100);
+               SSVAL(neg_send->data, 0x06, 0x0000);
                SSVAL(neg_send->data, 0x08, c->state.send_credit_target);
                SSVAL(neg_send->data, 0x0a, credits_granted);
                SIVAL(neg_send->data, 0x0c, NT_STATUS_V(NT_STATUS_OK));
@@ -1975,12 +1975,8 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
                SIVAL(neg_send->data, 0x18, c->state.max_receive_size);
                SIVAL(neg_send->data, 0x1c, c->state.max_fragmented_size);
 
-               neg_send->sge[0].addr = (uint64_t) (uintptr_t) neg_send->data;
-               neg_send->sge[0].length = 0x20;
-               neg_send->sge[0].lkey = neg_send->data_mr->lkey;
-               neg_send->send_wr.opcode = IBV_WR_SEND;
-               neg_send->send_wr.send_flags = IBV_SEND_SIGNALED;
-               neg_send->send_wr.sg_list = neg_send->sge;
+               neg_send->sge[1].length = 0x20;
+               neg_send->send_wr.sg_list = &neg_send->sge[1];
                neg_send->send_wr.num_sge = 1;
 
                smb_direct_connection_debug_credits(c, "NEGOTIATE_ACCEPT", NULL, __location__, __FUNCTION__);