libcli/smb/smb_direct.c move a bit
authorStefan Metzmacher <metze@samba.org>
Fri, 30 Sep 2016 08:05:12 +0000 (10:05 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:11 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index 7ca5a62cb5f983b82f985323fb46643126cf17fd..1d3bc6c404ee65ce66f917795c57cf2a23760d04 100644 (file)
@@ -59,8 +59,8 @@ struct smb_direct_connection {
        } sock;
        struct {
                struct smb_direct_rdma_context context;
-               struct rdma_cm_id *cm_id;
                struct rdma_event_channel *cm_channel;
+               struct rdma_cm_id *cm_id;
                struct tevent_fd *fde_channel;
                enum rdma_cm_event_type expected_event;
                struct rdma_cm_event *cm_event;
@@ -264,6 +264,13 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
 
        c->rdma.context.c = c;
 
+       c->ibv.init_attr.cap.max_send_wr = c->state.send_credit_target; // more for RDMA READ/WRITE??
+       c->ibv.init_attr.cap.max_recv_wr = c->state.receive_credit_max; // more for RDMA READ/WRITE??
+       c->ibv.init_attr.cap.max_recv_sge = 2;
+       c->ibv.init_attr.cap.max_send_sge = 2;
+       c->ibv.init_attr.qp_type = IBV_QPT_RC;
+       c->ibv.init_attr.sq_sig_all = 1;
+
 //DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        return c;
 }
@@ -273,13 +280,6 @@ NTSTATUS smb_direct_connection_complete_alloc(struct smb_direct_connection *c)
        int ret;
        uint16_t i;
 
-//DEBUG(0,("%s:%s: here...\n", __location__, __func__));
-       c->ibv.pd = ibv_alloc_pd(c->rdma.cm_id->verbs);
-       if (c->ibv.pd == NULL) {
-DEBUG(0,("%s:%s: here...\n", __location__, __func__));
-               return NT_STATUS_NO_MEMORY;
-       }
-
        c->ibv.comp_channel = ibv_create_comp_channel(c->rdma.cm_id->verbs);
        if (c->ibv.comp_channel == NULL) {
 DEBUG(0,("%s:%s: here...\n", __location__, __func__));
@@ -288,12 +288,12 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
        smb_set_close_on_exec(c->ibv.comp_channel->fd);
        set_blocking(c->ibv.comp_channel->fd, false);
 
-       c->ibv.init_attr.cap.max_send_wr = c->state.send_credit_target; // more for RDMA READ/WRITE??
-       c->ibv.init_attr.cap.max_recv_wr = c->state.receive_credit_max; // more for RDMA READ/WRITE??
-       c->ibv.init_attr.cap.max_recv_sge = 2;
-       c->ibv.init_attr.cap.max_send_sge = 2;
-       c->ibv.init_attr.qp_type = IBV_QPT_RC;
-       c->ibv.init_attr.sq_sig_all = 1;
+//DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+       c->ibv.pd = ibv_alloc_pd(c->rdma.cm_id->verbs);
+       if (c->ibv.pd == NULL) {
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+               return NT_STATUS_NO_MEMORY;
+       }
 
        c->ibv.send_cq = ibv_create_cq(c->rdma.cm_id->verbs,
                                       c->ibv.init_attr.cap.max_send_wr,
@@ -770,7 +770,6 @@ static void smb_direct_connection_rdma_connect_handler(struct tevent_context *ev
        int ret;
 
        errno = 0;
-
        ret = rdma_get_cm_event(c->rdma.cm_channel,
                                &c->rdma.cm_event);
        if (ret != 0) {
@@ -1059,7 +1058,6 @@ static void smb_direct_connection_negotiate_connect_rdma_handler(struct tevent_c
        int ret;
 
        errno = 0;
-
        ret = rdma_get_cm_event(c->rdma.cm_channel,
                                &c->rdma.cm_event);
        if (ret != 0) {