]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[MTHCA] bugfix: in support of IB_SEND_OPT_FENCE flag in post_send methods
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 1 Aug 2006 10:14:58 +0000 (10:14 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 1 Aug 2006 10:14:58 +0000 (10:14 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@436 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/hw/mthca/kernel/mthca_doorbell.h
trunk/hw/mthca/kernel/mthca_qp.c
trunk/hw/mthca/user/mlnx_uvp_doorbell.h
trunk/hw/mthca/user/mlnx_uvp_qp.c

index e7a83f3ee2dabab7768b0ba14311ee75b1fab0b7..bd70b60d1b24764972eaab4e53ff0f5bb8619e65 100644 (file)
 #define MTHCA_CQ_DOORBELL      0x20
 #define MTHCA_EQ_DOORBELL      0x28
 
+enum {
+       MTHCA_SEND_DOORBELL_FENCE = 1 << 5
+};
+
 #if BITS_PER_LONG == 64
 /*
  * Assume that we can just write a 64-bit doorbell atomically.  s390
index b9734dff8cb8fa5a30e538dbc812d5f4447da275..6afc02a70aa4d1a5494bbd032fd086500e04b435 100644 (file)
@@ -1504,7 +1504,7 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       u32 f0 = 0;
+       u32 f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
        int ind;
        u8 op0 = 0;
        enum ib_wr_opcode opcode;
@@ -1516,10 +1516,6 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
 
        ind = qp->sq.next_ind;
 
-       /* prepare fence bit for the doorbell */
-       if (wr->send_opt & IB_SEND_OPT_FENCE)
-               f0 = 1 << 5;
-
        for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
                if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
                        HCA_PRINT(TRACE_LEVEL_ERROR,HCA_DBG_QP,("SQ %06x full (%u head, %u tail,"
@@ -1859,7 +1855,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       u32 f0 = 0;
+       u32 f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
        int ind;
        u8 op0 = 0;
        enum ib_wr_opcode opcode;
@@ -1871,10 +1867,6 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
 
        ind = qp->sq.head & (qp->sq.max - 1);
 
-       /* prepare fence bit for the doorbell */
-       if (wr->send_opt & IB_SEND_OPT_FENCE)
-               f0 = 1 << 5;
-
        for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
                if (unlikely(nreq == MTHCA_ARBEL_MAX_WQES_PER_SEND_DB)) {
                        nreq = 0;
@@ -1883,6 +1875,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct _ib_send_wr *wr,
                        doorbell[1] = cl_hton32((qp->qpn << 8) | size0);
                        qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB;
                        size0 = 0;
+                       f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 
                        /*
                         * Make sure that descriptors are written before
index d8741a7a16f196b2f0d39c60fe8a5d81dfb5dfed..7d1972539f88a4c8609cb2424a664d0091ec23a6 100644 (file)
 #ifndef DOORBELL_H
 #define DOORBELL_H
 
+enum {
+       MTHCA_SEND_DOORBELL_FENCE = 1 << 5
+};
+
 #if defined (_WIN64)
 
 
index 9f9f77193d45209bd65819bec98b152cde15efe7..7d3be013d762cd57231149ce790d4cc33c9b1563 100644 (file)
@@ -147,7 +147,7 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       uint32_t f0 = 0;
+       uint32_t f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
        int ind;
        int op0 = 0;
        enum ib_wr_opcode opcode;
@@ -166,10 +166,6 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
                goto err_busy;
        }
 
-       /* prepare fence bit for the doorbell */
-       if (wr->send_opt & IB_SEND_OPT_FENCE)
-               f0 = 1 << 5;
-
        for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
 
                if (mthca_wq_overflow(&qp->sq, nreq, to_mcq(qp->ibv_qp.send_cq))) {
@@ -536,7 +532,7 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
        int i;
        int size;
        int size0 = 0;
-       uint32_t f0 = 0;
+       uint32_t f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
        int ind;
        uint8_t op0 = 0;
        enum ib_wr_opcode opcode;
@@ -555,10 +551,6 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
                goto err_busy;
        }
 
-       /* prepare fence bit for the doorbell */
-       if (wr->send_opt & IB_SEND_OPT_FENCE)
-               f0 = 1 << 5;
-
        for (nreq = 0; wr; ++nreq, wr = wr->p_next) {
                if (unlikely(nreq == MTHCA_ARBEL_MAX_WQES_PER_SEND_DB)) {
                        nreq = 0;
@@ -568,6 +560,7 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct _ib_send_wr *wr,
                        doorbell[1] = cl_hton32((ibqp->qp_num << 8) | size0);
                        qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB;
                        size0 = 0;
+                       f0 = unlikely(wr->send_opt & IB_SEND_OPT_FENCE) ? MTHCA_SEND_DOORBELL_FENCE : 0;
 
                        /*
                         * Make sure that descriptors are written before