RDMA/counter: Add optional counter support
authorAharon Landau <aharonl@nvidia.com>
Fri, 8 Oct 2021 12:24:32 +0000 (15:24 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Oct 2021 15:48:05 +0000 (12:48 -0300)
commit5e2ddd1e598273d77f653c70df96fc417a2d0a85
tree5e9f9d4e2d2a48dfa3f598fcfd93a8ef5305d830
parent0dc89684605e8b60af645988d3e0d80a57b6e937
RDMA/counter: Add optional counter support

An optional counter is a driver-specific counter that may be dynamically
enabled/disabled.  This enhancement allows drivers to expose counters
which are, for example, mutually exclusive and cannot be enabled at the
same time, counters that might degrades performance, optional debug
counters, etc.

Optional counters are marked with IB_STAT_FLAG_OPTIONAL flag. They are not
exported in sysfs, and must be at the end of all stats, otherwise the
attr->show() in sysfs would get wrong indexes for hwcounters that are
behind optional counters.

Link: https://lore.kernel.org/r/20211008122439.166063-7-markzhang@nvidia.com
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Signed-off-by: Neta Ostrovsky <netao@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/counters.c
drivers/infiniband/core/device.c
drivers/infiniband/core/sysfs.c
include/rdma/ib_verbs.h
include/rdma/rdma_counter.h