aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodong Wang <bodong@mellanox.com>2016-12-01 06:43:13 -0500
committerDoug Ledford <dledford@redhat.com>2016-12-13 13:39:50 -0500
commitd949167d68b304c0a00331cf33ef49a29b65d85f (patch)
tree88e16c2330da162bfdb5d7fd75dbdd29d3cf67da
parentca5b91d63192ceaa41a6145f8c923debb64c71fa (diff)
IB/mlx5: Report mlx5 packet pacing capabilities when querying device
Enable mlx5 based hardware to report packet pacing capabilities from kernel to user space. Packet pacing allows to limit the rate to any number between the maximum and minimum, based on user settings. The capabilities are exposed to user space through query_device by uhw. The following capabilities are reported: 1. The maximum and minimum rate limit in kbps supported by packet pacing. 2. Bitmap showing which QP types are supported by packet pacing operation. Signed-off-by: Bodong Wang <bodong@mellanox.com> Reviewed-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/mlx5/main.c13
-rw-r--r--include/uapi/rdma/mlx5-abi.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8b013f8b832a..6c194000903d 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -693,6 +693,19 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
693 resp.response_length += sizeof(resp.cqe_comp_caps); 693 resp.response_length += sizeof(resp.cqe_comp_caps);
694 } 694 }
695 695
696 if (field_avail(typeof(resp), packet_pacing_caps, uhw->outlen)) {
697 if (MLX5_CAP_QOS(mdev, packet_pacing) &&
698 MLX5_CAP_GEN(mdev, qos)) {
699 resp.packet_pacing_caps.qp_rate_limit_max =
700 MLX5_CAP_QOS(mdev, packet_pacing_max_rate);
701 resp.packet_pacing_caps.qp_rate_limit_min =
702 MLX5_CAP_QOS(mdev, packet_pacing_min_rate);
703 resp.packet_pacing_caps.supported_qpts |=
704 1 << IB_QPT_RAW_PACKET;
705 }
706 resp.response_length += sizeof(resp.packet_pacing_caps);
707 }
708
696 if (uhw->outlen) { 709 if (uhw->outlen) {
697 err = ib_copy_to_udata(uhw, &resp, resp.response_length); 710 err = ib_copy_to_udata(uhw, &resp, resp.response_length);
698 711
diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h
index 3ebf3db24c34..fae6cdaeb56d 100644
--- a/include/uapi/rdma/mlx5-abi.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -136,12 +136,25 @@ struct mlx5_ib_cqe_comp_caps {
136 __u32 supported_format; /* enum mlx5_ib_cqe_comp_res_format */ 136 __u32 supported_format; /* enum mlx5_ib_cqe_comp_res_format */
137}; 137};
138 138
139struct mlx5_packet_pacing_caps {
140 __u32 qp_rate_limit_min;
141 __u32 qp_rate_limit_max; /* In kpbs */
142
143 /* Corresponding bit will be set if qp type from
144 * 'enum ib_qp_type' is supported, e.g.
145 * supported_qpts |= 1 << IB_QPT_RAW_PACKET
146 */
147 __u32 supported_qpts;
148 __u32 reserved;
149};
150
139struct mlx5_ib_query_device_resp { 151struct mlx5_ib_query_device_resp {
140 __u32 comp_mask; 152 __u32 comp_mask;
141 __u32 response_length; 153 __u32 response_length;
142 struct mlx5_ib_tso_caps tso_caps; 154 struct mlx5_ib_tso_caps tso_caps;
143 struct mlx5_ib_rss_caps rss_caps; 155 struct mlx5_ib_rss_caps rss_caps;
144 struct mlx5_ib_cqe_comp_caps cqe_comp_caps; 156 struct mlx5_ib_cqe_comp_caps cqe_comp_caps;
157 struct mlx5_packet_pacing_caps packet_pacing_caps;
145 __u32 mlx5_ib_support_multi_pkt_send_wqes; 158 __u32 mlx5_ib_support_multi_pkt_send_wqes;
146 __u32 reserved; 159 __u32 reserved;
147}; 160};