[ofa-general] [PATCH 10/16] ib/mlx4: Add creation flags to mlx4 QPs
Eli Cohen
eli at mellanox.co.il
Wed Jan 16 08:38:09 PST 2008
Add creation flags to mlx4 QPs
The core passes creation flags and mlx4 saves them for later
reference.
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
drivers/infiniband/hw/mlx4/mlx4_ib.h | 5 +++++
drivers/infiniband/hw/mlx4/qp.c | 12 +++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index 2869765..39bc060 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -110,6 +110,10 @@ struct mlx4_ib_wq {
unsigned tail;
};
+enum qp_flags {
+ MLX4_QP_LSO = 1 << 0
+};
+
struct mlx4_ib_qp {
struct ib_qp ibqp;
struct mlx4_qp mqp;
@@ -133,6 +137,7 @@ struct mlx4_ib_qp {
u8 resp_depth;
u8 sq_no_prefetch;
u8 state;
+ u32 flags;
};
struct mlx4_ib_srq {
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index ca7cd04..a04e931 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -238,9 +238,12 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
return 0;
}
-static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
- enum ib_qp_type type, struct mlx4_ib_qp *qp)
+static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_init_attr *init_attr,
+ struct mlx4_ib_qp *qp)
{
+ struct ib_qp_cap *cap = &init_attr->cap;
+ enum ib_qp_type type = init_attr->qp_type;
+
/* Sanity check SQ size before proceeding */
if (cap->max_send_wr > dev->dev->caps.max_wqes ||
cap->max_send_sge > dev->dev->caps.max_sq_sg ||
@@ -256,6 +259,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
cap->max_send_sge + 2 > dev->dev->caps.max_sq_sg)
return -EINVAL;
+ if (init_attr->create_flags & QP_CREATE_LSO)
+ qp->flags |= MLX4_QP_LSO;
+
qp->sq.wqe_shift = ilog2(roundup_pow_of_two(max(cap->max_send_sge *
sizeof (struct mlx4_wqe_data_seg),
cap->max_inline_data +
@@ -371,7 +377,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
} else {
qp->sq_no_prefetch = 0;
- err = set_kernel_sq_size(dev, &init_attr->cap, init_attr->qp_type, qp);
+ err = set_kernel_sq_size(dev, init_attr, qp);
if (err)
goto err;
--
1.5.3.8
More information about the general
mailing list