IB/mlx5: Support congestion related counters
Subsystems (3)
PATCH v2 1/1 IB/mlx5: Support congestion related counters
From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patch adds support to query the congestion related hardware counters through new command and links them with other hw counters being available in hw_counters sysfs location.
In order to reuse existing infrastructure it renames related q_counter data structures to more generic counters to reflect q_counters and congestion counters and maybe some other counters in the future.
New hardware counters:
* rp_cnp_handled - CNP packets handled by the reaction point
* rp_cnp_ignored - CNP packets ignored by the reaction point
* np_cnp_sent - CNP packets sent by notification point to respond to
CE marked RoCE packets
* np_ecn_marked_roce_packets - CE marked RoCE packets received by notification point
It also avoids returning ENOSYS which is specific for invalid system call and produces the following checkpatch.pl warning.
WARNING: ENOSYS means 'invalid syscall nr' and nothing else
+ return -ENOSYS;
---
Changes from v1:
* Fix kbuild error, which was result of me sending wrong patch.
* Convert all congestion counters (*_cnp_*) to be in singular form, like most of other counters (Q counters).
Changes from v0:
* Fix overflow issue in access to congestion counters
--- drivers/infiniband/hw/mlx5/cmd.c | 11 +++ drivers/infiniband/hw/mlx5/cmd.h | 2 + drivers/infiniband/hw/mlx5/main.c | 172 ++++++++++++++++++++++++----------- drivers/infiniband/hw/mlx5/mlx5_ib.h | 7 +- drivers/infiniband/hw/mlx5/qp.c | 7 +- include/linux/mlx5/mlx5_ifc.h | 18 ++-- 6 files changed, 150 insertions(+), 67 deletions(-)
drivers/infiniband/hw/mlx5/cmd.c +11 -0
@@ -46,3 +46,14 @@ int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey) null_mkey);return err; } + +int mlx5_cmd_query_cong_counter (struct mlx5_core_dev *dev, +bool reset,void *out,int out_size) +{ +u32 in[MLX5_ST_SZ_DW (query_cong_statistics_in)] = { }; + +MLX5_SET (query_cong_statistics_in, in, opcode, +MLX5_CMD_OP_QUERY_CONG_STATISTICS ); +MLX5_SET (query_cong_statistics_in, in, clear, reset); +return mlx5_cmd_exec (dev, in,sizeof (in), out, out_size); +}
drivers/infiniband/hw/mlx5/cmd.h +2 -0
@@ -37,4 +37,6 @@#include <linux/mlx5/driver.h> int mlx5_cmd_null_mkey (struct mlx5_core_dev *dev,u32 *null_mkey); +int mlx5_cmd_query_cong_counter (struct mlx5_core_dev *dev, +bool reset,void *out,int out_size);#endif /* MLX5_IB_CMD_H */
drivers/infiniband/hw/mlx5/main.c +120 -52
312 lines not on this page · raw message
drivers/infiniband/hw/mlx5/mlx5_ib.h +4 -3
@@ -595,15 +595,16 @@ struct mlx5_ib_resources {struct mutex mutex; }; -struct mlx5_ib_q_counters { +struct mlx5_ib_counters {const char **names;size_t *offsets; -u32 num_counters; +u32 num_q_counters; +u32 num_cong_counters;u16 set_id; };struct mlx5_ib_port { -struct mlx5_ib_q_counters q_cnts; +struct mlx5_ib_counters cnts; };struct mlx5_roce {
drivers/infiniband/hw/mlx5/qp.c +4 -3
@@ -2798,7 +2798,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, qp->port) - 1; mibport = &dev->port[port_num]; context->qp_counter_set_usr_page |= -cpu_to_be32 ((u32)(mibport->q_cnts.set_id) <<24 ); +cpu_to_be32 ((u32)(mibport->cnts.set_id) <<24 ); }if (!ibqp->uobject && cur_state ==IB_QPS_RESET && new_state ==IB_QPS_INIT )
@@ -2826,7 +2826,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, raw_qp_param.operation = op;if (cur_state ==IB_QPS_RESET && new_state ==IB_QPS_INIT ) { - raw_qp_param.rq_q_ctr_id = mibport->q_cnts.set_id; + raw_qp_param.rq_q_ctr_id = mibport->cnts.set_id; raw_qp_param.set_mask |=MLX5_RAW_QP_MOD_SET_RQ_Q_CTR_ID ; }
@@ -4964,7 +4964,8 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,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); +MLX5_SET (rqc, rqc, counter_set_id, + dev->port->cnts.set_id); }else pr_info_once ("%s: Receive WQ counters are not supported on current FW\n" , dev->ib_dev.name);
include/linux/mlx5/mlx5_ifc.h +9 -9
@@ -4623,17 +4623,17 @@ struct mlx5_ifc_query_cong_statistics_out_bits {u8 reserved_at_40[0x40 ]; -u8 cur_flows[0x20 ]; +u8 rp_cur_flows[0x20 ];u8 sum_flows[0x20 ]; -u8 cnp_ignored_high[0x20 ]; +u8 rp_cnp_ignored_high[0x20 ]; -u8 cnp_ignored_low[0x20 ]; +u8 rp_cnp_ignored_low[0x20 ]; -u8 cnp_handled_high[0x20 ]; +u8 rp_cnp_handled_high[0x20 ]; -u8 cnp_handled_low[0x20 ]; +u8 rp_cnp_handled_low[0x20 ];u8 reserved_at_140[0x100 ];
@@ -4643,13 +4643,13 @@ struct mlx5_ifc_query_cong_statistics_out_bits {u8 accumulators_period[0x20 ]; -u8 ecn_marked_roce_packets_high[0x20 ]; +u8 np_ecn_marked_roce_packets_high[0x20 ]; -u8 ecn_marked_roce_packets_low[0x20 ]; +u8 np_ecn_marked_roce_packets_low[0x20 ]; -u8 cnps_sent_high[0x20 ]; +u8 np_cnp_sent_high[0x20 ]; -u8 cnps_sent_low[0x20 ]; +u8 np_cnp_sent_low[0x20 ];u8 reserved_at_320[0x560 ]; };
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170416042929.18294-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Doug Ledford
AppliedQuoted 25 lines · Leon Romanovsky
From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patch adds support to query the congestion related hardware counters
through new command and links them with other hw counters being available
inhw_counterssysfs location.In order to reuse existing infrastructure it renames related
q_counter
data structures to more generic counters to reflectq_countersand congestion counters and maybe some other counters in the future.New hardware counters:
*rp_cnp_handled- CNP packets handled by the reaction point
*rp_cnp_ignored- CNP packets ignored by the reaction point
* np_cnp_sent - CNP packets sent by notification point to respond to
CE marked RoCE packets
*np_ecn_marked_roce_packets- CE marked RoCE packets received by notification pointIt also avoids returning ENOSYS which is specific for invalid system call and produces the following checkpatch.pl warning.
Quoted 7 lines
WARNING: ENOSYS means 'invalid syscall nr' and nothing else + return
-ENOSYS;
Thanks, applied.
Signature · 9 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html