diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-10-28 07:28:15 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-12-08 12:42:44 -0500 |
commit | a5e14ba334e202c58e45ef47414ec94c585c1a8c (patch) | |
tree | b04bac58103e9551d2107aa96295db010c5695a2 | |
parent | 533708867dd6388f643f12c87465b59e732d729d (diff) |
mlx4: Expose correct max_sge_rd limit
mlx4 devices (ConnectX-2, ConnectX-3) has a limitation
where rdma read work queue entries cannot exceed 512 bytes.
A rdma_read wqe needs to fit in 512 bytes:
- wqe control segment (16 bytes)
- rdma segment (16 bytes)
- scatter elements (16 bytes each)
So max_sge_rd should be: (512 - 16 - 16) / 16 = 30.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 2 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index f567160a4a56..97d6878f9938 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -456,7 +456,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
456 | props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; | 456 | props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; |
457 | props->max_sge = min(dev->dev->caps.max_sq_sg, | 457 | props->max_sge = min(dev->dev->caps.max_sq_sg, |
458 | dev->dev->caps.max_rq_sg); | 458 | dev->dev->caps.max_rq_sg); |
459 | props->max_sge_rd = props->max_sge; | 459 | props->max_sge_rd = MLX4_MAX_SGE_RD; |
460 | props->max_cq = dev->dev->quotas.cq; | 460 | props->max_cq = dev->dev->quotas.cq; |
461 | props->max_cqe = dev->dev->caps.max_cqes; | 461 | props->max_cqe = dev->dev->caps.max_cqes; |
462 | props->max_mr = dev->dev->quotas.mpt; | 462 | props->max_mr = dev->dev->quotas.mpt; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 7501626ab529..d3133be12d92 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -427,6 +427,17 @@ enum { | |||
427 | }; | 427 | }; |
428 | 428 | ||
429 | enum { | 429 | enum { |
430 | /* | ||
431 | * Max wqe size for rdma read is 512 bytes, so this | ||
432 | * limits our max_sge_rd as the wqe needs to fit: | ||
433 | * - ctrl segment (16 bytes) | ||
434 | * - rdma segment (16 bytes) | ||
435 | * - scatter elements (16 bytes each) | ||
436 | */ | ||
437 | MLX4_MAX_SGE_RD = (512 - 16 - 16) / 16 | ||
438 | }; | ||
439 | |||
440 | enum { | ||
430 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, | 441 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, |
431 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, | 442 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, |
432 | MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, | 443 | MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, |