RDMA/i40iw: Fixes for WQE alignment
authorShiraz Saleem <shiraz.saleem@intel.com>
Fri, 22 Apr 2016 19:14:23 +0000 (14:14 -0500)
committerDoug Ledford <dledford@redhat.com>
Thu, 28 Apr 2016 20:32:54 +0000 (16:32 -0400)
Invalidation after every WQE write is changed to invalidate
only if required. NOPs are padded so that WQE writes are
aligned to 64B boundary.

Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Faisal Latif <faisal.latif@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw_d.h
drivers/infiniband/hw/i40iw/i40iw_uk.c

index e8951a71cc1342a1f3314fa35365dd3b69fb43ab..bd942da91a2797dcfac81dbadd4aa6dbc32b3643 100644 (file)
@@ -1512,6 +1512,8 @@ enum i40iw_alignment {
        I40IW_SD_BUF_ALIGNMENT =        0x100
 };
 
+#define I40IW_WQE_SIZE_64      64
+
 #define I40IW_QP_WQE_MIN_SIZE  32
 #define I40IW_QP_WQE_MAX_SIZE  128
 
index 9e3a700d5a2de72c86bc3790b20f1175ee5642de..6e0e3272e57f501d6f2aab4675dd1563fec01942 100644 (file)
@@ -162,6 +162,17 @@ u64 *i40iw_qp_get_next_send_wqe(struct i40iw_qp_uk *qp,
                if (!*wqe_idx)
                        qp->swqe_polarity = !qp->swqe_polarity;
        }
+
+       if (((*wqe_idx & 3) == 1) && (wqe_size == I40IW_WQE_SIZE_64)) {
+               i40iw_nop_1(qp);
+               I40IW_RING_MOVE_HEAD(qp->sq_ring, ret_code);
+               if (ret_code)
+                       return NULL;
+               *wqe_idx = I40IW_RING_GETCURRENT_HEAD(qp->sq_ring);
+               if (!*wqe_idx)
+                       qp->swqe_polarity = !qp->swqe_polarity;
+       }
+
        for (i = 0; i < wqe_size / I40IW_QP_WQE_MIN_SIZE; i++) {
                I40IW_RING_MOVE_HEAD(qp->sq_ring, ret_code);
                if (ret_code)
@@ -172,8 +183,11 @@ u64 *i40iw_qp_get_next_send_wqe(struct i40iw_qp_uk *qp,
 
        peek_head = I40IW_RING_GETCURRENT_HEAD(qp->sq_ring);
        wqe_0 = qp->sq_base[peek_head].elem;
-       if (peek_head & 0x3)
-               wqe_0[3] = LS_64(!qp->swqe_polarity, I40IWQPSQ_VALID);
+
+       if (((peek_head & 3) == 1) || ((peek_head & 3) == 3)) {
+               if (RS_64(wqe_0[3], I40IWQPSQ_VALID) != !qp->swqe_polarity)
+                       wqe_0[3] = LS_64(!qp->swqe_polarity, I40IWQPSQ_VALID);
+       }
 
        qp->sq_wrtrk_array[*wqe_idx].wrid = wr_id;
        qp->sq_wrtrk_array[*wqe_idx].wr_len = total_size;