return c;
}
-static struct smb_direct_connection *smb_direct_connection_complete_alloc(struct smb_direct_connection *c)
+struct smb_direct_connection *smb_direct_connection_complete_alloc(struct smb_direct_connection *c)
{
int ret;
uint16_t i;
}
state->c = c;
-DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
talloc_set_destructor(state, smb_direct_connection_rdma_connect_state_destructor);
c->rdma.fde_channel = tevent_add_fd(ev, c,
return NT_STATUS_OK;
}
+struct smb_direct_connection *smb_direct_connection_listener(
+ TALLOC_CTX *mem_ctx,
+ struct rdma_cm_id *cm_id)
+{
+ struct smb_direct_connection *c;
+ int sfd[2];
+ int ret;
+ //uint16_t i;
+
+ c = talloc_zero(mem_ctx, struct smb_direct_connection);
+ if (c == NULL) {
+ return NULL;
+ }
+ c->sock.fd = -1;
+ c->sock.tmp_fd = -1;
+//DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+ talloc_set_destructor(c, smb_direct_connection_destructor);
+
+ c->state.max_send_size = 1364;
+ c->state.max_receive_size = SMB_DIRECT_IO_MAX_DATA;
+ c->state.max_fragmented_size = 1048576;
+ c->state.max_read_write_size = 0;
+ c->state.receive_credit_max = 10;//255;
+ c->state.send_credit_target = 255;
+ c->state.keep_alive_internal = 5;
+
+ ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sfd);
+ if (ret == -1) {
+ int saved_errno = errno;
+ TALLOC_FREE(c);
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+ errno = saved_errno;
+ return NULL;
+ }
+ c->sock.tmp_fd = sfd[0];
+ c->sock.fd = sfd[1];
+
+DEBUG(0,("%s:%s: sock.fd[%d] sock.tmp_fd[%d]\n",
+ __location__, __func__, c->sock.fd, c->sock.tmp_fd));
+
+ smb_set_close_on_exec(c->sock.tmp_fd);
+ smb_set_close_on_exec(c->sock.fd);
+ set_blocking(c->sock.fd, false);
+
+ c->rdma.cm_channel = rdma_create_event_channel();
+ if (c->rdma.cm_channel == NULL) {
+ TALLOC_FREE(c);
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+ return NULL;
+ }
+ smb_set_close_on_exec(c->rdma.cm_channel->fd);
+ set_blocking(c->rdma.cm_channel->fd, false);
+
+ c->rdma.cm_id = cm_id;
+
+ return c;
+}
+
#endif /* SMB_TRANSPORT_ENABLE_RDMA */
#define _LIBCLI_SMB_SMB_DIRECT_H_
struct smb_direct_connection;
+struct rdma_cm_id;
//Hack...
extern struct smb_direct_connection *smb_direct_conn;
struct smb_direct_connection *smb_direct_connection_create(TALLOC_CTX *mem_ctx);
+struct smb_direct_connection *smb_direct_connection_listener(TALLOC_CTX *mem_ctx,
+ struct rdma_cm_id *cm_id);
+struct smb_direct_connection *smb_direct_connection_complete_alloc(struct smb_direct_connection *c);
struct tevent_req *smb_direct_connection_connect_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,