aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMajd Dibbiny <majd@mellanox.com>2017-01-18 08:25:10 -0500
committerDoug Ledford <dledford@redhat.com>2017-02-14 11:41:09 -0500
commit23a6964e3adb0796e1633562a574839b92360cb6 (patch)
treeb9fb4d0763ab99f74d086b9f26be880f7b382a40
parent7c16f47779498650e9f11a395f8d63accedf35a3 (diff)
IB/mlx5: Add port counter support for Receive WQs
Counters weren't updated due to Receive WQs' traffic since the counter-id was not associated with the RQ. Added support for associating the q-counter-id with the Receive WQ. The attachment is done only when changing WQ's state from RESET to READY in modify-WQ command. FW support is required for the above, without this support Receive WQ counters will not count. Signed-off-by: Majd Dibbiny <majd@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/qp.c12
-rw-r--r--include/linux/mlx5/mlx5_ifc.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 5c7d655655bb..f395ee9d2fea 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -2429,7 +2429,7 @@ static int modify_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
2429 if (raw_qp_param->set_mask & MLX5_RAW_QP_MOD_SET_RQ_Q_CTR_ID) { 2429 if (raw_qp_param->set_mask & MLX5_RAW_QP_MOD_SET_RQ_Q_CTR_ID) {
2430 if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) { 2430 if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
2431 MLX5_SET64(modify_rq_in, in, modify_bitmask, 2431 MLX5_SET64(modify_rq_in, in, modify_bitmask,
2432 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_MODIFY_RQ_COUNTER_SET_ID); 2432 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID);
2433 MLX5_SET(rqc, rqc, counter_set_id, raw_qp_param->rq_q_ctr_id); 2433 MLX5_SET(rqc, rqc, counter_set_id, raw_qp_param->rq_q_ctr_id);
2434 } else 2434 } else
2435 pr_info_once("%s: RAW PACKET QP counters are not supported on current FW\n", 2435 pr_info_once("%s: RAW PACKET QP counters are not supported on current FW\n",
@@ -4910,6 +4910,16 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
4910 MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state); 4910 MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state);
4911 MLX5_SET(rqc, rqc, state, wq_state); 4911 MLX5_SET(rqc, rqc, state, wq_state);
4912 4912
4913 if (curr_wq_state == IB_WQS_RESET && wq_state == IB_WQS_RDY) {
4914 if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
4915 MLX5_SET64(modify_rq_in, in, modify_bitmask,
4916 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID);
4917 MLX5_SET(rqc, rqc, counter_set_id, dev->port->q_cnts.set_id);
4918 } else
4919 pr_info_once("%s: Receive WQ counters are not supported on current FW\n",
4920 dev->ib_dev.name);
4921 }
4922
4913 err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen); 4923 err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen);
4914 kvfree(in); 4924 kvfree(in);
4915 if (!err) 4925 if (!err)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 37327f6ba9cb..2d197d8a7025 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -4937,7 +4937,7 @@ struct mlx5_ifc_modify_rq_out_bits {
4937 4937
4938enum { 4938enum {
4939 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1, 4939 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1,
4940 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_MODIFY_RQ_COUNTER_SET_ID = 1ULL << 3, 4940 MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID = 1ULL << 3,
4941}; 4941};
4942 4942
4943struct mlx5_ifc_modify_rq_in_bits { 4943struct mlx5_ifc_modify_rq_in_bits {