From: sleybo Date: Thu, 15 Feb 2007 07:39:49 +0000 (+0000) Subject: [MTHCA]bug fixes: X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=fb019cc32c4ac3fb599778ed0e6095cd4165ed10;p=~shefty%2Frdma-win.git [MTHCA]bug fixes: 1. Read the right length in atomic cqes (only 8 bytes) 2. Zero few structures before using 3. name change in the spinlock macros git-svn-id: svn://openib.tc.cornell.edu/gen1@593 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mthca/kernel/mt_spinlock.h b/trunk/hw/mthca/kernel/mt_spinlock.h index 111d02aa..57f3ea5a 100644 --- a/trunk/hw/mthca/kernel/mt_spinlock.h +++ b/trunk/hw/mthca/kernel/mt_spinlock.h @@ -18,7 +18,7 @@ typedef struct { #ifdef SUPPORT_SPINLOCK_ISR static inline void -spin_lock_isr_setint( +spin_lock_setint( IN spinlock_t* const l, IN PKINTERRUPT p_int_obj ) { @@ -26,7 +26,7 @@ spin_lock_isr_setint( l->p_int_obj = p_int_obj; } -static inline void spin_lock_isr_init( +static inline void spin_lock_irq_init( IN spinlock_t* const l, IN PKINTERRUPT int_obj ) @@ -36,7 +36,7 @@ static inline void spin_lock_isr_init( } static inline unsigned long -spin_lock_isr( +spin_lock_irq( IN spinlock_t* const l) { MT_ASSERT( l ); @@ -45,7 +45,7 @@ spin_lock_isr( } static inline void -spin_unlock_isr( +spin_unlock_irq( IN spinlock_t* const p_spinlock ) { MT_ASSERT( p_spinlock ); diff --git a/trunk/hw/mthca/kernel/mthca_cq.c b/trunk/hw/mthca/kernel/mthca_cq.c index 6030097b..c64bc0b9 100644 --- a/trunk/hw/mthca/kernel/mthca_cq.c +++ b/trunk/hw/mthca/kernel/mthca_cq.c @@ -540,11 +540,11 @@ static inline int mthca_poll_one(struct mthca_dev *dev, break; case MTHCA_OPCODE_ATOMIC_CS: entry->wc_type = IB_WC_COMPARE_SWAP; - entry->length = cl_ntoh32(cqe->byte_cnt); + entry->length = MTHCA_BYTES_PER_ATOMIC_COMPL; break; case MTHCA_OPCODE_ATOMIC_FA: entry->wc_type = IB_WC_FETCH_ADD; - entry->length = cl_ntoh32(cqe->byte_cnt); + entry->length = MTHCA_BYTES_PER_ATOMIC_COMPL; break; case MTHCA_OPCODE_BIND_MW: entry->wc_type = IB_WC_MW_BIND; diff --git a/trunk/hw/mthca/kernel/mthca_dev.h b/trunk/hw/mthca/kernel/mthca_dev.h index 07a3a2f0..dc7767d5 100644 --- a/trunk/hw/mthca/kernel/mthca_dev.h +++ b/trunk/hw/mthca/kernel/mthca_dev.h @@ -96,6 +96,10 @@ enum { MTHCA_NUM_EQ }; +enum { + MTHCA_BYTES_PER_ATOMIC_COMPL = 8 +}; + enum mthca_wr_opcode{ MTHCA_OPCODE_NOP = 0x00, MTHCA_OPCODE_RDMA_WRITE = 0x08, diff --git a/trunk/hw/mthca/kernel/mthca_main.c b/trunk/hw/mthca/kernel/mthca_main.c index fe8829cc..f918ecdb 100644 --- a/trunk/hw/mthca/kernel/mthca_main.c +++ b/trunk/hw/mthca/kernel/mthca_main.c @@ -612,6 +612,7 @@ static int mthca_init_arbel(struct mthca_dev *mdev) if (mdev->mthca_flags & MTHCA_FLAG_SRQ) profile.num_srq = dev_lim.max_srqs; + RtlZeroMemory( &init_hca, sizeof(init_hca)); icm_size = mthca_make_profile(mdev, &profile, &dev_lim, &init_hca); if ((int) icm_size < 0) { err = (int)icm_size; diff --git a/trunk/hw/mthca/kernel/mthca_qp.c b/trunk/hw/mthca/kernel/mthca_qp.c index a07b4da6..cd1d2910 100644 --- a/trunk/hw/mthca/kernel/mthca_qp.c +++ b/trunk/hw/mthca/kernel/mthca_qp.c @@ -1087,12 +1087,15 @@ static int mthca_alloc_memfree(struct mthca_dev *dev, qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, qp->qpn, &qp->rq.db); if (qp->rq.db_index < 0) - return ret; + return qp->rq.db_index; qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, qp->qpn, &qp->sq.db); - if (qp->sq.db_index < 0) + if (qp->sq.db_index < 0){ mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); + return qp->sq.db_index; + } + } return ret; diff --git a/trunk/hw/mthca/user/mlnx_uvp.c b/trunk/hw/mthca/user/mlnx_uvp.c index 0c19bc56..2e36bb62 100644 --- a/trunk/hw/mthca/user/mlnx_uvp.c +++ b/trunk/hw/mthca/user/mlnx_uvp.c @@ -152,7 +152,7 @@ struct ibv_context *mthca_alloc_context(struct ibv_get_context_resp *resp_p) int i; /* allocate context */ - context = cl_malloc(sizeof *context); + context = cl_zalloc(sizeof *context); if (!context) return NULL; diff --git a/trunk/hw/mthca/user/mlnx_uvp.h b/trunk/hw/mthca/user/mlnx_uvp.h index f0c1d438..00e18b6e 100644 --- a/trunk/hw/mthca/user/mlnx_uvp.h +++ b/trunk/hw/mthca/user/mlnx_uvp.h @@ -50,7 +50,8 @@ enum mthca_hca_type { }; enum { - MTHCA_CQ_ENTRY_SIZE = 0x20 + MTHCA_CQ_ENTRY_SIZE = 0x20, + MTHCA_BYTES_PER_ATOMIC_COMPL = 0x8 }; enum { diff --git a/trunk/hw/mthca/user/mlnx_uvp_cq.c b/trunk/hw/mthca/user/mlnx_uvp_cq.c index 7a181290..ebbf426d 100644 --- a/trunk/hw/mthca/user/mlnx_uvp_cq.c +++ b/trunk/hw/mthca/user/mlnx_uvp_cq.c @@ -379,11 +379,11 @@ static inline int mthca_poll_one(struct mthca_cq *cq, break; case MTHCA_OPCODE_ATOMIC_CS: entry->wc_type = IB_WC_COMPARE_SWAP; - entry->length = cl_ntoh32(cqe->byte_cnt); + entry->length = MTHCA_BYTES_PER_ATOMIC_COMPL; break; case MTHCA_OPCODE_ATOMIC_FA: entry->wc_type = IB_WC_FETCH_ADD; - entry->length = cl_ntoh32(cqe->byte_cnt); + entry->length = MTHCA_BYTES_PER_ATOMIC_COMPL; break; case MTHCA_OPCODE_BIND_MW: entry->wc_type = IB_WC_MW_BIND; diff --git a/trunk/hw/mthca/user/mlnx_uvp_qp.c b/trunk/hw/mthca/user/mlnx_uvp_qp.c index 51d12292..4cbca73a 100644 --- a/trunk/hw/mthca/user/mlnx_uvp_qp.c +++ b/trunk/hw/mthca/user/mlnx_uvp_qp.c @@ -306,7 +306,7 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr, if (wr->send_opt & IB_SEND_OPT_INLINE) { if (wr->num_ds) { struct mthca_inline_seg *seg = (struct mthca_inline_seg *)wqe; - int s = 0; + uint32_t s = 0; wqe += sizeof *seg; for (i = 0; i < (int)wr->num_ds; ++i) { @@ -314,7 +314,7 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr, s += sge->length; - if (s > qp->max_inline_data) { + if (s > (uint32_t)qp->max_inline_data) { ret = -1; if (bad_wr) *bad_wr = wr; @@ -704,7 +704,7 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr, if (wr->send_opt & IB_SEND_OPT_INLINE) { if (wr->num_ds) { struct mthca_inline_seg *seg = (struct mthca_inline_seg *)wqe; - int s = 0; + uint32_t s = 0; wqe += sizeof *seg; for (i = 0; i < (int)wr->num_ds; ++i) { @@ -712,7 +712,7 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr, s += sge->length; - if (s > qp->max_inline_data) { + if (s > (uint32_t)qp->max_inline_data) { ret = -1; if (bad_wr) *bad_wr = wr; diff --git a/trunk/hw/mthca/user/mlnx_uvp_verbs.c b/trunk/hw/mthca/user/mlnx_uvp_verbs.c index 445b2838..264c60eb 100644 --- a/trunk/hw/mthca/user/mlnx_uvp_verbs.c +++ b/trunk/hw/mthca/user/mlnx_uvp_verbs.c @@ -48,7 +48,7 @@ struct ibv_pd *mthca_alloc_pd(struct ibv_context *context, struct ibv_alloc_pd_r { struct mthca_pd *pd; - pd = cl_malloc(sizeof *pd); + pd = cl_zalloc(sizeof *pd); if (!pd) goto err_malloc; @@ -106,7 +106,7 @@ struct ibv_cq *mthca_create_cq_pre(struct ibv_context *context, int *p_cqe, if (*p_cqe > 131072) goto exit; - cq = cl_malloc(sizeof *cq); + cq = cl_zalloc(sizeof *cq); if (!cq) goto exit; @@ -285,7 +285,7 @@ struct ibv_qp *mthca_create_qp_pre(struct ibv_pd *pd, goto exit; } - qp = cl_malloc(sizeof *qp); + qp = cl_zalloc(sizeof *qp); if (!qp) { UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,("cl_malloc failed (%d)\n",ret)); goto err_nomem;