]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MLX4] a little improvement in user calls checks
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Apr 2008 12:08:02 +0000 (12:08 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Apr 2008 12:08:02 +0000 (12:08 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@1065 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/ConnectX/hw/mlx4/kernel/hca/verbs.c

index 7d593cac4d0758646c4e20bf3c1a49e8598d11f7..4993715c397c9e3c50fa1dd642b7808110b06be2 100644 (file)
@@ -176,7 +176,7 @@ struct ib_cq *ibv_create_cq(struct ib_device *p_ibdev,
        struct ibv_create_cq *p_req;\r
        struct ibv_create_cq_resp *p_resp = NULL;\r
 \r
-       if ( p_umv_buf  && p_umv_buf->command) {\r
+       if ( p_uctx && p_umv_buf && p_umv_buf->p_inout_buf ) {\r
                // prepare user parameters\r
                p_req = (struct ibv_create_cq*)(void*)p_umv_buf->p_inout_buf;\r
                p_resp = (struct ibv_create_cq_resp*)(void*)\r
@@ -262,7 +262,7 @@ static char *__print_qtype(enum ib_qp_type qtype)
 \r
 struct ib_qp *ibv_create_qp(struct ib_pd *pd,\r
        struct ib_qp_init_attr *qp_init_attr,\r
-       struct ib_ucontext *context, ci_umv_buf_t* const p_umv_buf)\r
+       struct ib_ucontext *p_uctx, ci_umv_buf_t* const p_umv_buf)\r
 {\r
        int err;\r
        struct ib_qp *p_ib_qp;\r
@@ -272,7 +272,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd,
 \r
        HCA_ENTER(HCA_DBG_QP);\r
 \r
-       if ( p_umv_buf ) {\r
+       if ( p_uctx && p_umv_buf && p_umv_buf->command ) {\r
                // prepare user parameters\r
                p_req = (struct ibv_create_qp*)(void*)p_umv_buf->p_inout_buf;\r
                p_resp = (struct ibv_create_qp_resp*)(void*)p_umv_buf->p_inout_buf;\r
@@ -296,7 +296,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd,
        p_ib_qp->send_cq                        = qp_init_attr->send_cq;\r
        p_ib_qp->recv_cq                        = qp_init_attr->recv_cq;\r
        p_ib_qp->srq                            = qp_init_attr->srq;\r
-       p_ib_qp->p_uctx                                 = context;\r
+       p_ib_qp->p_uctx                                 = p_uctx;\r
        p_ib_qp->event_handler                  = qp_init_attr->event_handler;\r
        p_ib_qp->qp_context                     = qp_init_attr->qp_context;\r
        p_ib_qp->qp_type                                = qp_init_attr->qp_type;\r
@@ -305,8 +305,8 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd,
        atomic_inc(&qp_init_attr->recv_cq->usecnt);\r
        if (qp_init_attr->srq)\r
                atomic_inc(&qp_init_attr->srq->usecnt);\r
-       if (context)\r
-               atomic_inc(&context->x.usecnt);\r
+       if (p_uctx)\r
+               atomic_inc(&p_uctx->x.usecnt);\r
                HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_QP ,("pdn %d, usecnt %d, pd_handle %p, ctx %p \n", \r
                        ((struct mlx4_ib_pd*)pd)->pdn, pd->usecnt, pd, pd->p_uctx));\r
 \r
@@ -321,7 +321,7 @@ struct ib_qp *ibv_create_qp(struct ib_pd *pd,
                ) );\r
 \r
        // fill results for user\r
-       if (context && p_umv_buf && p_umv_buf->p_inout_buf) {\r
+       if (p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) {\r
                struct mlx4_ib_qp *p_mib_qp = (struct mlx4_ib_qp *)p_ib_qp;\r
                p_resp->qp_handle = (__u64)(ULONG_PTR)p_ib_qp;\r
                p_resp->qpn = p_mib_qp->mqp.qpn;\r
@@ -384,7 +384,7 @@ int ib_destroy_qp(struct ib_qp *qp)
 \r
 struct ib_srq *ibv_create_srq(struct ib_pd *pd,\r
        struct ib_srq_init_attr *srq_init_attr,\r
-       struct ib_ucontext *context, ci_umv_buf_t* const p_umv_buf)\r
+       struct ib_ucontext *p_uctx, ci_umv_buf_t* const p_umv_buf)\r
 {\r
        int err;\r
        struct ib_srq *p_ib_srq;\r
@@ -392,7 +392,7 @@ struct ib_srq *ibv_create_srq(struct ib_pd *pd,
        struct ibv_create_srq *p_req = NULL;\r
        struct ibv_create_srq_resp *p_resp= NULL;\r
 \r
-       if ( p_umv_buf  && p_umv_buf->command) {\r
+       if ( p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) {\r
                // prepare user parameters\r
                p_req = (struct ibv_create_srq*)(void*)p_umv_buf->p_inout_buf;\r
                p_resp = (struct ibv_create_srq_resp*)(void*)p_umv_buf->p_inout_buf;\r
@@ -412,13 +412,13 @@ struct ib_srq *ibv_create_srq(struct ib_pd *pd,
        // fill results\r
        p_ib_srq->device                        = pd->device;\r
        p_ib_srq->pd                            = pd;\r
-       p_ib_srq->p_uctx                                = context;\r
+       p_ib_srq->p_uctx                                = p_uctx;\r
        p_ib_srq->event_handler                 = srq_init_attr->event_handler;\r
        p_ib_srq->srq_context                   = srq_init_attr->srq_context;\r
        atomic_inc(&pd->usecnt);\r
        atomic_set(&p_ib_srq->usecnt, 0);\r
-       if (context)\r
-               atomic_inc(&context->x.usecnt);\r
+       if (p_uctx)\r
+               atomic_inc(&p_uctx->x.usecnt);\r
                HCA_PRINT(TRACE_LEVEL_INFORMATION ,HCA_DBG_QP ,("PD%d use cnt %d, pd_handle %p, ctx %p \n", \r
                        ((struct mlx4_ib_pd*)pd)->pdn, pd->usecnt, pd, pd->p_uctx));\r
 \r
@@ -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 ) );\r
 \r
        // fill results for user\r
-       if (context && p_umv_buf && p_umv_buf->p_inout_buf) {\r
+       if (p_uctx && p_umv_buf && p_umv_buf->p_inout_buf) {\r
                struct mlx4_ib_srq* p_mib_srq = (struct mlx4_ib_srq*)p_ib_srq;\r
                p_resp->srq_handle = (__u64)(ULONG_PTR)p_ib_srq;\r
                p_resp->max_wr = p_mib_srq->msrq.max - 1;\r