#include <rdma/rdma_cma.h>
#include <infiniband/verbs.h>
-#define SMB_DIRECT_LISTENER_BACKLOG 100
+#define SMB_DIRECT_LISTENER_BACKLOG 5
//#define SMB_DIRECT_IO_MAX_DATA 8192
#define SMB_DIRECT_IO_MAX_DATA 1364
struct smb_direct_io;
struct smb_direct_listener {
- struct tevent_context *ev;
struct {
struct smb_direct_rdma_context context;
struct rdma_cm_id *cm_id;
static int smb_direct_connection_destructor(struct smb_direct_connection *c);
+#if 0
#undef DEBUG
#define DEBUG( _level, body ) do {\
int level = 5; \
&& (dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ )) \
&& (dbgtext body) ); \
} while(0)
-
+#endif
struct smb_direct_connection *smb_direct_connection_create(TALLOC_CTX *mem_ctx)
{
struct smb_direct_connection *c;
return NULL;
}
smb_set_close_on_exec(c->rdma.cm_channel->fd);
- set_blocking(c->rdma.cm_channel->fd, false);
+ //set_blocking(c->rdma.cm_channel->fd, false);
c->rdma.context.c = c;
return NT_STATUS_NO_MEMORY;
}
smb_set_close_on_exec(c->ibv.comp_channel->fd);
- set_blocking(c->ibv.comp_channel->fd, false);
+ //set_blocking(c->ibv.comp_channel->fd, false);
//DEBUG(0,("%s:%s: here...\n", __location__, __func__));
c->ibv.pd = ibv_alloc_pd(c->rdma.cm_id->verbs);
return NT_STATUS_NO_MEMORY;
}
smb_set_close_on_exec(l->rdma.cm_channel->fd);
- set_blocking(l->rdma.cm_channel->fd, false);
+ //set_blocking(l->rdma.cm_channel->fd, false);
l->rdma.context.l = l;
#if RDMA_USER_CM_MAX_ABI_VERSION >= 2
&l->rdma.cm_id,
&l->rdma.context);
#endif
+ //ret = rdma_create_ep(l->rdma.cm_channel, &l->rdma.cm_id, &l->rdma.context)
if (ret != 0) {
NTSTATUS status;
status = map_nt_error_from_unix_common(errno);
RSIVAL(ird_ord_hdr, 0, 0);
RSIVAL(ird_ord_hdr, 4, 16);
- DBG_DEBUG("RDMA_CM_EVENT_CONNECT_REQUEST\n");
+ DBG_ERR("RDMA_CM_EVENT_CONNECT_REQUEST\n");
conn_param = l->rdma.cm_event->param.conn;
// ZERO_STRUCT(conn_param);
c->rdma.cm_id = l->rdma.cm_event->id;
c->rdma.cm_id->context = &c->rdma.context;
- c->rdma.cm_id->channel = c->rdma.cm_channel;
+ //c->rdma.cm_id->channel = c->rdma.cm_channel;
+ ret = rdma_migrate_id(c->rdma.cm_id, c->rdma.cm_channel);
+ if (ret != 0) {
+ DBG_ERR("rdma_migrate_id failed [%s] result [%d]\n", strerror(errno), ret);
+ c->rdma.cm_id->context = NULL;
+ c->rdma.cm_id = NULL;
+ TALLOC_FREE(c);
+
+ rdma_reject(l->rdma.cm_event->id, NULL, 0);
+ /* wait for more */
+ break;
+ }
status = smb_direct_connection_complete_alloc(c);
if (!NT_STATUS_IS_OK(status)) {
c->l = l;
DLIST_ADD_END(l->ready, c);
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
- tevent_req_defer_callback(req, l->ev);
+ tevent_req_defer_callback(req, state->ev);
tevent_req_done(req);
}
break;
struct smb_direct_connection *c = NULL;
NTSTATUS status;
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
*_c = NULL;
*fd = -1;
if (laddr != NULL) {
if (tevent_req_is_nterror(req, &status)) {
tevent_req_received(req);
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
return status;
}
* in order to consume more connections
*/
if (l->ready == NULL) {
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
return NT_STATUS_NO_MORE_ENTRIES;
}
if (raddr != NULL) {
ZERO_STRUCTP(raddr);
}
+DEBUG(0,("%s:%s: here...\n", __location__, __func__));
*_c = talloc_move(mem_ctx, &c);
return NT_STATUS_OK;