diff options
author | Haggai Abramovsky <hagaya@mellanox.com> | 2016-01-14 12:12:58 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-01-21 12:01:08 -0500 |
commit | f72300c56c3bedac5fdb22cdc90f6633dc858c84 (patch) | |
tree | 19c88374ce5a680782969d8410c7fa54b2e57feb | |
parent | cfb5e088e26ae0e12064171f645ed022cf6d55b9 (diff) |
IB/mlx5: Expose CQE version to user-space
Per user context, work with CQE version that both the user-space
and the kernel support. Report this CQE version via the response of
the alloc_ucontext command.
Signed-off-by: Haggai Abramovsky <hagaya@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 15 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/user.h | 8 |
2 files changed, 18 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index f82336699c3e..829c37c95d60 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -869,7 +869,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
869 | if (req.total_num_uuars == 0) | 869 | if (req.total_num_uuars == 0) |
870 | return ERR_PTR(-EINVAL); | 870 | return ERR_PTR(-EINVAL); |
871 | 871 | ||
872 | if (req.comp_mask) | 872 | if (req.comp_mask || req.reserved0 || req.reserved1 || req.reserved2) |
873 | return ERR_PTR(-EOPNOTSUPP); | 873 | return ERR_PTR(-EOPNOTSUPP); |
874 | 874 | ||
875 | if (reqlen > sizeof(req) && | 875 | if (reqlen > sizeof(req) && |
@@ -892,6 +892,9 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
892 | resp.max_send_wqebb = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); | 892 | resp.max_send_wqebb = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); |
893 | resp.max_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); | 893 | resp.max_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz); |
894 | resp.max_srq_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); | 894 | resp.max_srq_recv_wr = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); |
895 | resp.cqe_version = min_t(__u8, | ||
896 | (__u8)MLX5_CAP_GEN(dev->mdev, cqe_version), | ||
897 | req.max_cqe_version); | ||
895 | resp.response_length = min(offsetof(typeof(resp), response_length) + | 898 | resp.response_length = min(offsetof(typeof(resp), response_length) + |
896 | sizeof(resp.response_length), udata->outlen); | 899 | sizeof(resp.response_length), udata->outlen); |
897 | 900 | ||
@@ -945,8 +948,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
945 | resp.tot_uuars = req.total_num_uuars; | 948 | resp.tot_uuars = req.total_num_uuars; |
946 | resp.num_ports = MLX5_CAP_GEN(dev->mdev, num_ports); | 949 | resp.num_ports = MLX5_CAP_GEN(dev->mdev, num_ports); |
947 | 950 | ||
948 | if (field_avail(typeof(resp), reserved2, udata->outlen)) | 951 | if (field_avail(typeof(resp), cqe_version, udata->outlen)) |
949 | resp.response_length += sizeof(resp.reserved2); | 952 | resp.response_length += sizeof(resp.cqe_version); |
950 | 953 | ||
951 | if (field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) { | 954 | if (field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) { |
952 | resp.comp_mask |= | 955 | resp.comp_mask |= |
@@ -954,7 +957,9 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
954 | resp.hca_core_clock_offset = | 957 | resp.hca_core_clock_offset = |
955 | offsetof(struct mlx5_init_seg, internal_timer_h) % | 958 | offsetof(struct mlx5_init_seg, internal_timer_h) % |
956 | PAGE_SIZE; | 959 | PAGE_SIZE; |
957 | resp.response_length += sizeof(resp.hca_core_clock_offset); | 960 | resp.response_length += sizeof(resp.hca_core_clock_offset) + |
961 | sizeof(resp.reserved2) + | ||
962 | sizeof(resp.reserved3); | ||
958 | } | 963 | } |
959 | 964 | ||
960 | err = ib_copy_to_udata(udata, &resp, resp.response_length); | 965 | err = ib_copy_to_udata(udata, &resp, resp.response_length); |
@@ -965,6 +970,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
965 | uuari->num_low_latency_uuars = req.num_low_latency_uuars; | 970 | uuari->num_low_latency_uuars = req.num_low_latency_uuars; |
966 | uuari->uars = uars; | 971 | uuari->uars = uars; |
967 | uuari->num_uars = num_uars; | 972 | uuari->num_uars = num_uars; |
973 | context->cqe_version = resp.cqe_version; | ||
974 | |||
968 | return &context->ibucontext; | 975 | return &context->ibucontext; |
969 | 976 | ||
970 | out_uars: | 977 | out_uars: |
diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h index 5bf0935f0cb5..41f0525e825c 100644 --- a/drivers/infiniband/hw/mlx5/user.h +++ b/drivers/infiniband/hw/mlx5/user.h | |||
@@ -69,6 +69,10 @@ struct mlx5_ib_alloc_ucontext_req_v2 { | |||
69 | __u32 num_low_latency_uuars; | 69 | __u32 num_low_latency_uuars; |
70 | __u32 flags; | 70 | __u32 flags; |
71 | __u32 comp_mask; | 71 | __u32 comp_mask; |
72 | __u8 max_cqe_version; | ||
73 | __u8 reserved0; | ||
74 | __u16 reserved1; | ||
75 | __u32 reserved2; | ||
72 | }; | 76 | }; |
73 | 77 | ||
74 | enum mlx5_ib_alloc_ucontext_resp_mask { | 78 | enum mlx5_ib_alloc_ucontext_resp_mask { |
@@ -89,7 +93,9 @@ struct mlx5_ib_alloc_ucontext_resp { | |||
89 | __u16 reserved1; | 93 | __u16 reserved1; |
90 | __u32 comp_mask; | 94 | __u32 comp_mask; |
91 | __u32 response_length; | 95 | __u32 response_length; |
92 | __u32 reserved2; | 96 | __u8 cqe_version; |
97 | __u8 reserved2; | ||
98 | __u16 reserved3; | ||
93 | __u64 hca_core_clock_offset; | 99 | __u64 hca_core_clock_offset; |
94 | }; | 100 | }; |
95 | 101 | ||