From: leonidk Date: Wed, 23 Apr 2008 12:08:02 +0000 (+0000) Subject: [MLX4] a little improvement in user calls checks X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d46949c24ea8716a22cff6a4f78037c68b183749;p=~shefty%2Frdma-win.git [MLX4] a little improvement in user calls checks git-svn-id: svn://openib.tc.cornell.edu/gen1@1065 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/ConnectX/hw/mlx4/kernel/hca/verbs.c b/branches/ConnectX/hw/mlx4/kernel/hca/verbs.c index 7d593cac..4993715c 100644 --- a/branches/ConnectX/hw/mlx4/kernel/hca/verbs.c +++ b/branches/ConnectX/hw/mlx4/kernel/hca/verbs.c @@ -176,7 +176,7 @@ struct ib_cq *ibv_create_cq(struct ib_device *p_ibdev, struct ibv_create_cq *p_req; struct ibv_create_cq_resp *p_resp = NULL; - if ( p_umv_buf && p_umv_buf->command) { + if ( p_uctx && p_umv_buf && p_umv_buf->p_inout_buf ) { // prepare user parameters p_req = (struct ibv_create_cq*)(void*)p_umv_buf->p_inout_buf; p_resp = (struct ibv_create_cq_resp*)(void*) @@ -262,7 +262,7 @@ static char *__print_qtype(enum ib_qp_type qtype) struct ib_qp *ibv_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *qp_init_attr, - struct ib_ucontext *context, ci_umv_buf_t* const p_umv_buf) + struct ib_ucontext *p_uctx, ci_umv_buf_t* const p_umv_buf) { int err; struct ib_qp *p_ib_qp; @@ -272,7 +272,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd, HCA_ENTER(HCA_DBG_QP); - if ( p_umv_buf ) { + if ( p_uctx && p_umv_buf && p_umv_buf->command ) { // prepare user parameters p_req = (struct ibv_create_qp*)(void*)p_umv_buf->p_inout_buf; p_resp = (struct ibv_create_qp_resp*)(void*)p_umv_buf->p_inout_buf; @@ -296,7 +296,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd, p_ib_qp->send_cq = qp_init_attr->send_cq; p_ib_qp->recv_cq = qp_init_attr->recv_cq; p_ib_qp->srq = qp_init_attr->srq; - p_ib_qp->p_uctx = context; + p_ib_qp->p_uctx = p_uctx; p_ib_qp->event_handler = qp_init_attr->event_handler; p_ib_qp->qp_context = qp_init_attr->qp_context; p_ib_qp->qp_type = qp_init_attr->qp_type; @@ -305,8 +305,8 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd, atomic_inc(&qp_init_attr->recv_cq->usecnt); if (qp_init_attr->srq) atomic_inc(&qp_init_attr->srq->usecnt); - if (context) - atomic_inc(&context->x.usecnt); + if (p_uctx) + atomic_inc(&p_uctx->x.usecnt); HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_QP ,("pdn %d, usecnt %d, pd_handle %p, ctx %p \n", ((struct mlx4_ib_pd*)pd)->pdn, pd->usecnt, pd, pd->p_uctx)); @@ -321,7 +321,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd, ) ); // fill results for user - if (context && p_umv_buf && p_umv_buf->p_inout_buf) { + if (p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) { struct mlx4_ib_qp *p_mib_qp = (struct mlx4_ib_qp *)p_ib_qp; p_resp->qp_handle = (__u64)(ULONG_PTR)p_ib_qp; p_resp->qpn = p_mib_qp->mqp.qpn; @@ -384,7 +384,7 @@ int ib_destroy_qp(struct ib_qp *qp) struct ib_srq *ibv_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *srq_init_attr, - struct ib_ucontext *context, ci_umv_buf_t* const p_umv_buf) + struct ib_ucontext *p_uctx, ci_umv_buf_t* const p_umv_buf) { int err; struct ib_srq *p_ib_srq; @@ -392,7 +392,7 @@ struct ib_srq *ibv_create_srq(struct ib_pd *pd, struct ibv_create_srq *p_req = NULL; struct ibv_create_srq_resp *p_resp= NULL; - if ( p_umv_buf && p_umv_buf->command) { + if ( p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) { // prepare user parameters p_req = (struct ibv_create_srq*)(void*)p_umv_buf->p_inout_buf; p_resp = (struct ibv_create_srq_resp*)(void*)p_umv_buf->p_inout_buf; @@ -412,13 +412,13 @@ struct ib_srq *ibv_create_srq(struct ib_pd *pd, // fill results p_ib_srq->device = pd->device; p_ib_srq->pd = pd; - p_ib_srq->p_uctx = context; + p_ib_srq->p_uctx = p_uctx; p_ib_srq->event_handler = srq_init_attr->event_handler; p_ib_srq->srq_context = srq_init_attr->srq_context; atomic_inc(&pd->usecnt); atomic_set(&p_ib_srq->usecnt, 0); - if (context) - atomic_inc(&context->x.usecnt); + if (p_uctx) + atomic_inc(&p_uctx->x.usecnt); HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_QP ,("PD%d use cnt %d, pd_handle %p, ctx %p \n", ((struct mlx4_ib_pd*)pd)->pdn, pd->usecnt, pd, pd->p_uctx)); @@ -427,7 +427,7 @@ struct ib_srq *ibv_create_srq(struct ib_pd *pd, pd->p_uctx, p_ib_srq, ((struct mlx4_ib_srq*)p_ib_srq)->msrq.srqn ) ); // fill results for user - if (context && p_umv_buf && p_umv_buf->p_inout_buf) { + if (p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) { struct mlx4_ib_srq* p_mib_srq = (struct mlx4_ib_srq*)p_ib_srq; p_resp->srq_handle = (__u64)(ULONG_PTR)p_ib_srq; p_resp->max_wr = p_mib_srq->msrq.max - 1;