Skip to contentSkip to conversation

Optional counter statistics support

PATCH RESEND Superseded Mark Zhang 1 participant 4 messages Sep 22, 2021

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Mark Zhang

author
#0 lore raw

cover Optional counter statistics support

---------------------------------
Kernel patch is not accepted yet.
---------------------------------

Hi,

This is supplementary part of kernel series [1], which provides an extension to the rdma statistics tool that allows to set or list optional counters dynamically, using netlink.

Thanks

[1] https://www.spinics.net/lists/linux-rdma/msg105567.html

Neta Ostrovsky (3):
rdma: Update uapi headers
rdma: Add stat "mode" support
rdma: Add optional-counters set/unset support

 man/man8/rdma-statistic.8             |  55 +++++
 rdma/include/uapi/rdma/rdma_netlink.h |   3 +
 rdma/stat.c                           | 327 ++++++++++++++++++++++++++
 3 files changed, 385 insertions(+)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH RESEND 1/3 rdma: Update uapi headers

From: Neta Ostrovsky <[email protected]>

Update rdma_netlink.h file upto kernel commit

---
 rdma/include/uapi/rdma/rdma_netlink.h | 3 +++
 1 file changed, 3 insertions(+)
rdma/include/uapi/rdma/rdma_netlink.h +3 -0
index 37f583ee..fd347bc7 100644
@@ -549,6 +549,9 @@ enum rdma_nldev_attr {
 
 	RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK,	/* u8 */
 
+	RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX,	/* u32 */
+	RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC, /* u8 0 - disabled, 1 - enabled */
+
 	/*
 	 * Always the end
 	 */
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH RESEND 2/3 rdma: Add stat "mode" support

In reply to Mark Zhang

From: Neta Ostrovsky <[email protected]>

This patch introduces the "mode" command, which presents the enabled or supported (when the "supported" argument is available) optional counters.

An optional counter is a vendor-specific counter that may be dynamically enabled/disabled. This enhancement of hwcounters allows exposing of counters which are for example mutual exclusive and cannot be enabled at the same time, counters that might degrades performance, optional debug counters, etc.

Examples:
To present currently enabled optional counters on link rocep8s0f0/1:

    $ rdma statistic mode link rocep8s0f0/1
    link rocep8s0f0/1 optional-counters cc_rx_ce_pkts

To present supported optional counters on link rocep8s0f0/1:

    $ rdma statistic mode supported link rocep8s0f0/1
    link rocep8s0f0/1 supported optional-counters cc_rx_ce_pkts,cc_rx_cnp_pkts,cc_tx_cnp_pkts
---
 man/man8/rdma-statistic.8 |  23 ++++++
 rdma/stat.c               | 164 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 187 insertions(+)
man/man8/rdma-statistic.8 +23 -0
index 7160bcdf..885769bc 100644
@@ -58,6 +58,13 @@ rdma-statistic \- RDMA statistic counter configuration
 .RI "[ " COUNTER-ID " ]"
 .RI "[ " OBJECT-ID " ]"
 
+.ti -8
+.B rdma statistic
+.B mode
+.B "[" supported "]"
+.B link
+.RI "[ " DEV/PORT_INDEX " ]"
+
 .ti -8
 .IR COUNTER_SCOPE " := "
 .RB "{ " link " | " dev " }"
@@ -100,6 +107,10 @@ When unbound the statistics of this object are no longer available in this count
 - specifies the id of the counter to be bound.
 If this argument is omitted then a new counter will be allocated.
 
+.SS rdma statistic mode - Display the enabled optional counters for each link.
+
+.SS rdma statistic mode supported - Display the supported optional counters for each link.
+
 .SH "EXAMPLES"
 .PP
 rdma statistic show
@@ -186,6 +197,16 @@ rdma statistic show mr mrn 6
 .RS 4
 Dump a specific MR statistics with mrn 6. Dumps nothing if does not exists.
 .RE
+.PP
+rdma statistic mode link mlx5_2/1
+.RS 4
+Display the optional counters that was enabled on mlx5_2/1.
+.RE
+.PP
+rdma statistic mode supported link mlx5_2/1
+.RS 4
+Display the optional counters that mlx5_2/1 supports.
+.RE
 
 .SH SEE ALSO
 .BR rdma (8),
@@ -198,3 +219,5 @@ Dump a specific MR statistics with mrn 6. Dumps nothing if does not exists.
 Mark Zhang <[email protected]>
 .br
 Erez Alfasi <[email protected]>
+.br
+Neta Ostrovsky <[email protected]>
rdma/stat.c +164 -0

188 lines not on this page · raw message

Signature · 1 line
2.26.2
author
#3 lore raw

PATCH RESEND 3/3 rdma: Add optional-counters set/unset support

In reply to Mark Zhang

From: Neta Ostrovsky <[email protected]>

This patch provides an extension to the rdma statistics tool that allows to set/unset optional counters set dynamically, using new netlink commands.
Note that the optional counter statistic implementation is driver-specific and may impact the performance.

Examples:
To enable a set of optional counters on link rocep8s0f0/1:

    $ sudo rdma statistic set link rocep8s0f0/1 optional-counters cc_rx_ce_pkts,cc_rx_cnp_pkts
To disable all optional counters on link rocep8s0f0/1:
    $ sudo rdma statistic unset link rocep8s0f0/1 optional-counters
---
 man/man8/rdma-statistic.8 |  32 ++++++++
 rdma/stat.c               | 163 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 195 insertions(+)
man/man8/rdma-statistic.8 +32 -0
index 885769bc..198ce0bf 100644
@@ -65,6 +65,21 @@ rdma-statistic \- RDMA statistic counter configuration
 .B link
 .RI "[ " DEV/PORT_INDEX " ]"
 
+.ti -8
+.B rdma statistic
+.B set
+.B link
+.RI "[ " DEV/PORT_INDEX " ]"
+.B optional-counters
+.RI "[ " OPTIONAL-COUNTERS " ]"
+
+.ti -8
+.B rdma statistic
+.B unset
+.B link
+.RI "[ " DEV/PORT_INDEX " ]"
+.B optional-counters
+
 .ti -8
 .IR COUNTER_SCOPE " := "
 .RB "{ " link " | " dev " }"
@@ -111,6 +126,13 @@ If this argument is omitted then a new counter will be allocated.
 
 .SS rdma statistic mode supported - Display the supported optional counters for each link.
 
+.SS rdma statistic set - Enable a set of optional counters for a specific device/port.
+
+.I "OPTIONAL-COUNTERS"
+- specifies the name of the optional counters to enable. Optional counters that are not specified will be disabled. Note that optional counters are driver-specific.
+
+.SS rdma statistic unset - Disable all optional counters for a specific device/port.
+
 .SH "EXAMPLES"
 .PP
 rdma statistic show
@@ -207,6 +229,16 @@ rdma statistic mode supported link mlx5_2/1
 .RS 4
 Display the optional counters that mlx5_2/1 supports.
 .RE
+.PP
+rdma statistic set link mlx5_2/1 optional-counters cc-rx-ce-pkts,cc_rx_cnp_pkts
+.RS 4
+Enable the cc-rx-ce-pkts,cc_rx_cnp_pkts counters on device mlx5_2 port 1.
+.RE
+.PP
+rdma statistic unset link mlx5_2/1 optional-counters
+.RS 4
+Disable all the optional counters on device mlx5_2 port 1.
+.RE
 
 .SH SEE ALSO
 .BR rdma (8),
rdma/stat.c +163 -0

187 lines not on this page · raw message

Signature · 1 line
2.26.2