summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYonatan Cohen <yonatanc@mellanox.com>2018-05-27 13:42:33 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-05-30 00:18:38 +0300
commit572f46bf947c3eeca8d16518e0fb70f9250b4416 (patch)
treeb490bbb6dec7e3b7eabc3a5748747736ffa96f86 /drivers
parentab741b2eed3e456cebd2240d4c9c6be003d5ae72 (diff)
downloadlinux-572f46bf947c3eeca8d16518e0fb70f9250b4416.tar.xz
IB/mlx5: Refactor CQE compression response
Refactor CQE compression response to be fully set only when it`s really supported. There is no change from user perspective because anyway resp.cqe_comp_caps.max_num was set to zero. Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com>W Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/mlx5/main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index daa919e5a442..029c310a0dd1 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -983,13 +983,17 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
}
if (field_avail(typeof(resp), cqe_comp_caps, uhw->outlen)) {
- resp.cqe_comp_caps.max_num =
- MLX5_CAP_GEN(dev->mdev, cqe_compression) ?
- MLX5_CAP_GEN(dev->mdev, cqe_compression_max_num) : 0;
- resp.cqe_comp_caps.supported_format =
- MLX5_IB_CQE_RES_FORMAT_HASH |
- MLX5_IB_CQE_RES_FORMAT_CSUM;
resp.response_length += sizeof(resp.cqe_comp_caps);
+
+ if (MLX5_CAP_GEN(dev->mdev, cqe_compression)) {
+ resp.cqe_comp_caps.max_num =
+ MLX5_CAP_GEN(dev->mdev,
+ cqe_compression_max_num);
+
+ resp.cqe_comp_caps.supported_format =
+ MLX5_IB_CQE_RES_FORMAT_HASH |
+ MLX5_IB_CQE_RES_FORMAT_CSUM;
+ }
}
if (field_avail(typeof(resp), packet_pacing_caps, uhw->outlen) &&