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>
This commit is contained in:

committed by
Doug Ledford

parent
7c16f47779
commit
23a6964e3a
@@ -2429,7 +2429,7 @@ static int modify_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
|
|||||||
if (raw_qp_param->set_mask & MLX5_RAW_QP_MOD_SET_RQ_Q_CTR_ID) {
|
if (raw_qp_param->set_mask & MLX5_RAW_QP_MOD_SET_RQ_Q_CTR_ID) {
|
||||||
if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
|
if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
|
||||||
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
||||||
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_MODIFY_RQ_COUNTER_SET_ID);
|
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID);
|
||||||
MLX5_SET(rqc, rqc, counter_set_id, raw_qp_param->rq_q_ctr_id);
|
MLX5_SET(rqc, rqc, counter_set_id, raw_qp_param->rq_q_ctr_id);
|
||||||
} else
|
} else
|
||||||
pr_info_once("%s: RAW PACKET QP counters are not supported on current FW\n",
|
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,
|
|||||||
MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state);
|
MLX5_SET(modify_rq_in, in, rq_state, curr_wq_state);
|
||||||
MLX5_SET(rqc, rqc, state, wq_state);
|
MLX5_SET(rqc, rqc, state, wq_state);
|
||||||
|
|
||||||
|
if (curr_wq_state == IB_WQS_RESET && wq_state == IB_WQS_RDY) {
|
||||||
|
if (MLX5_CAP_GEN(dev->mdev, modify_rq_counter_set_id)) {
|
||||||
|
MLX5_SET64(modify_rq_in, in, modify_bitmask,
|
||||||
|
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID);
|
||||||
|
MLX5_SET(rqc, rqc, counter_set_id, dev->port->q_cnts.set_id);
|
||||||
|
} else
|
||||||
|
pr_info_once("%s: Receive WQ counters are not supported on current FW\n",
|
||||||
|
dev->ib_dev.name);
|
||||||
|
}
|
||||||
|
|
||||||
err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen);
|
err = mlx5_core_modify_rq(dev->mdev, rwq->core_qp.qpn, in, inlen);
|
||||||
kvfree(in);
|
kvfree(in);
|
||||||
if (!err)
|
if (!err)
|
||||||
|
@@ -4937,7 +4937,7 @@ struct mlx5_ifc_modify_rq_out_bits {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1,
|
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD = 1ULL << 1,
|
||||||
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_MODIFY_RQ_COUNTER_SET_ID = 1ULL << 3,
|
MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_RQ_COUNTER_SET_ID = 1ULL << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mlx5_ifc_modify_rq_in_bits {
|
struct mlx5_ifc_modify_rq_in_bits {
|
||||||
|
Reference in New Issue
Block a user