]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
IB/mlx5: Initialize mlx5_ib_qp signature-related members
authorSagi Grimberg <sagig@mellanox.com>
Sun, 23 Feb 2014 12:19:07 +0000 (14:19 +0200)
committerRoland Dreier <roland@purestorage.com>
Fri, 7 Mar 2014 19:26:49 +0000 (11:26 -0800)
If user requested signature enable we initialize relevant mlx5_ib_qp
members.  We mark the qp as sig_enable and we increase the effective
SQ size, but still limit the user max_send_wr to original size
computed.  We also allow the create_qp routine to accept sig_enable
create flag.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/qp.c
include/linux/mlx5/qp.h

index 79c4f14c4d3ef61f156e7e156324e89518132e80..e438f08899ae16a8b42eb99689e6e454307dccd7 100644 (file)
@@ -189,6 +189,9 @@ struct mlx5_ib_qp {
 
        int                     create_type;
        u32                     pa_lkey;
+
+       /* Store signature errors */
+       bool                    signature_en;
 };
 
 struct mlx5_ib_cq_buf {
index 7dfe8a1c84cff141a2bee714e6367f5500334390..01999f3744fb6234b97e73834d30356e0c9c1396 100644 (file)
@@ -256,8 +256,11 @@ static int calc_send_wqe(struct ib_qp_init_attr *attr)
        }
 
        size += attr->cap.max_send_sge * sizeof(struct mlx5_wqe_data_seg);
-
-       return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB);
+       if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN &&
+           ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB) < MLX5_SIG_WQE_SIZE)
+                       return MLX5_SIG_WQE_SIZE;
+       else
+               return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB);
 }
 
 static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,
@@ -284,6 +287,9 @@ static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,
                sizeof(struct mlx5_wqe_inline_seg);
        attr->cap.max_inline_data = qp->max_inline_data;
 
+       if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN)
+               qp->signature_en = true;
+
        wq_size = roundup_pow_of_two(attr->cap.max_send_wr * wqe_size);
        qp->sq.wqe_cnt = wq_size / MLX5_SEND_WQE_BB;
        if (qp->sq.wqe_cnt > dev->mdev.caps.max_wqes) {
@@ -665,7 +671,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
        int err;
 
        uuari = &dev->mdev.priv.uuari;
-       if (init_attr->create_flags)
+       if (init_attr->create_flags & ~IB_QP_CREATE_SIGNATURE_EN)
                return -EINVAL;
 
        if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR)
index d51eff7135490d301a08b6c1f39105712f563256..152756eaa8a305955ff4813601d989b5ff96bd51 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/mlx5/driver.h>
 
 #define MLX5_INVALID_LKEY      0x100
+#define MLX5_SIG_WQE_SIZE      (MLX5_SEND_WQE_BB * 5)
 
 enum mlx5_qp_optpar {
        MLX5_QP_OPTPAR_ALT_ADDR_PATH            = 1 << 0,