]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sif: LSO, test/adjust attr in create_qp,test stencil-size in send
authorHans Westgaard Ry <hans.westgaard.ry@oracle.com>
Mon, 13 Jun 2016 11:17:58 +0000 (13:17 +0200)
committerKnut Omang <knut.omang@oracle.com>
Sun, 3 Jul 2016 14:01:46 +0000 (16:01 +0200)
We need to test that we can add an sge for the LSO stencil
subtracting 1 from max number of supported sge.  The
attr.max_sge is incremented to get correct allocation of sge
with the extra entry for the LSO stencil.

We assumpe that the size of LSO headers/stencils is <= 64
adjusting max_inlinesize. The actual size is tested when
work-requests are posted.

Signed-off-by: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
Reviewed-by: Knut Omang <knut.omang@oracle.com>
drivers/infiniband/hw/sif/sif_qp.c
drivers/infiniband/hw/sif/sif_sndrcv.c

index b23aaf3e2c7baf1bc195f28e80ca4c8e6010884d..8cb4a1b267909b1879ce1c1a5483ba3c66e5cdb4 100644 (file)
@@ -188,9 +188,13 @@ struct sif_qp *create_qp(struct sif_dev *sdev,
        max_sge =
                sif_attr->qp_type == PSIF_QP_TRANSPORT_UD ? SIF_SW_MAX_UD_SEND_SGE : SIF_HW_MAX_SEND_SGE;
 
+       /* We need to be able to add sge for stencil with LSO */
+       max_sge -= !!(flags & IB_QP_CREATE_IPOIB_UD_LSO);
+
        if (init_attr->cap.max_send_sge > max_sge) {
-               sif_log(sdev, SIF_INFO, "illegal max send sge %d, SIF only supports %d",
-                       init_attr->cap.max_send_sge, max_sge);
+               sif_log(sdev, SIF_INFO, "illegal max send sge %d, SIF only supports %d %s",
+                       init_attr->cap.max_send_sge, max_sge,
+                       flags & IB_QP_CREATE_IPOIB_UD_LSO ? "with LSO" : "");
                return ERR_PTR(-EINVAL);
        }
 
@@ -235,13 +239,15 @@ struct sif_qp *create_qp(struct sif_dev *sdev,
         * 64 bytes of inline-buffering.
         */
        min_tso_inline = 64;
-       if ((flags & IB_QP_CREATE_IPOIB_UD_LSO) &&
-               init_attr->cap.max_inline_data < min_tso_inline) {
-               sif_log(sdev, SIF_INFO,
-                       "Create LSO QP; qp_%d max_sge %d inline_size %d qp_type %d; modifying max_inline_size to %d",
-                       index, init_attr->cap.max_send_sge, init_attr->cap.max_inline_data,
-                       init_attr->qp_type, min_tso_inline);
-               init_attr->cap.max_inline_data = min_tso_inline;
+       if (flags & IB_QP_CREATE_IPOIB_UD_LSO) {
+               if (init_attr->cap.max_inline_data < min_tso_inline) {
+                       sif_log(sdev, SIF_INFO,
+                               "Create LSO QP; qp_%d max_sge %d inline_size %d qp_type %d; modifying max_inline_size to %d",
+                               index, init_attr->cap.max_send_sge, init_attr->cap.max_inline_data,
+                               init_attr->qp_type, min_tso_inline);
+                       init_attr->cap.max_inline_data = min_tso_inline;
+               }
+               init_attr->cap.max_send_sge ++;
        }
 
        if (init_attr->qp_type == IB_QPT_RC || init_attr->qp_type == IB_QPT_XRC_INI) {
index 0ebe73d3fefddb0ef8996bd1faee81cfb09c24b2..71402a948888b01ed7079a14f385b9ea2fb5020b 100644 (file)
@@ -1049,6 +1049,12 @@ static int prep_send_lso(struct sif_qp *qp, struct ib_send_wr *wr, struct psif_c
 
        ud_hlen = wr->wr.ud.hlen;
        wqe->wr.details.send.ud.mss = wr->wr.ud.mss;
+       /* Check if stencil is larger than max_inline_data */
+       if (ud_hlen > qp->max_inline_data) {
+               sif_log(sdev, SIF_INFO, "attempt to post lso wr with too big header  %d > %d",
+                       ud_hlen, qp->max_inline_data);
+               return -EINVAL;
+       }
 
        la->addr   = get_sqe_dma(sq, sqe_seq) + sq->sgl_offset;
        la->lkey = sq->sg_mr->index;