]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MTHCA]bug fixes:
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 15 Feb 2007 07:39:49 +0000 (07:39 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 15 Feb 2007 07:39:49 +0000 (07:39 +0000)
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

trunk/hw/mthca/kernel/mt_spinlock.h
trunk/hw/mthca/kernel/mthca_cq.c
trunk/hw/mthca/kernel/mthca_dev.h
trunk/hw/mthca/kernel/mthca_main.c
trunk/hw/mthca/kernel/mthca_qp.c
trunk/hw/mthca/user/mlnx_uvp.c
trunk/hw/mthca/user/mlnx_uvp.h
trunk/hw/mthca/user/mlnx_uvp_cq.c
trunk/hw/mthca/user/mlnx_uvp_qp.c
trunk/hw/mthca/user/mlnx_uvp_verbs.c

index 111d02aa554ff36ecf4986064bcdde887788bffb..57f3ea5a34ed6dd0d58fb43a7f388e7560fdd15a 100644 (file)
@@ -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 );
index 6030097bab5613cd6960775d4d7272371e05fa89..c64bc0b95e6c718907e54baf98819cb61867ff6f 100644 (file)
@@ -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;
index 07a3a2f0d0877074f7d9ec6abdfec45494aece62..dc7767d555b57ed39c7b32356a41ced84feb9a48 100644 (file)
@@ -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,
index fe8829ccec57ef69222e69ab444d9167d27b4aa1..f918ecdbf88d8474d233c6fde52a50f6f85e1fa4 100644 (file)
@@ -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;
index a07b4da687ef923be07f9f2c7515cbe5e9e9034a..cd1d29103020fa2a3f7a2c00e9a6da0521791ba2 100644 (file)
@@ -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;
index 0c19bc5652ecd12f573cb94fc5a259e44658813d..2e36bb62f463f784043225fcd7403d1deee80efb 100644 (file)
@@ -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;
 
index f0c1d438f2e53246d3ff45f4376d91b199a5043e..00e18b6e06d32fd4727c7aca664392fa7ed33725 100644 (file)
@@ -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 {
index 7a1812907040492f2189acfd9ed149d41c9e49da..ebbf426d0be4d4caed41c6da9980be71b980ca2c 100644 (file)
@@ -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;
index 51d12292430166087a88f62ca4b36a1f135e1b1a..4cbca73a637ad2ff56f02bea16a9108ec76d4f36 100644 (file)
@@ -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;
index 445b283890730c348fc3f8b07578dcc3b228a547..264c60eb53d82842d17570ad069f9c2d7f961358 100644 (file)
@@ -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;