Skip to content

Commit

Permalink
IB/core: Make device counter infrastructure dynamic
Browse files Browse the repository at this point in the history
In practice, each RDMA device has a unique set of counters that the
hardware implements.  Having a central set of counters that they must
all adhere to is limiting and causes many useful counters to not be
available.

Therefore we create a dynamic counter registration infrastructure.

The driver must implement a stats structure allocation routine, in
which the driver must place the directory name it wants, a list of
names for all of the counters, an array of u64 counters themselves,
plus a few generic configuration options.

We then implement a core routine to create a sysfs file for each
of the named stats elements, and a core routine to retrieve the
stats when any of the sysfs attribute files are read.

To avoid excessive beating on the stats generation routine in the
drivers, the core code also caches the stats for a short period of
time so that someone attempting to read all of the stats in a
given device's directory will not result in a stats generation
call per file read.

Future work will attempt to standardize just the shared stats
elements, and possibly add a method to get the stats via netlink
in addition to sysfs.

Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Mark Bloch <[email protected]>
Reviewed-by: Steve Wise <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
[ Add caching, make structure names more informative, add i40iw support,
  other significant rewrites from the original patch ]
  • Loading branch information
Christoph Lameter authored and dledford committed May 26, 2016
1 parent 8779e76 commit b40f475
Show file tree
Hide file tree
Showing 6 changed files with 590 additions and 264 deletions.
12 changes: 12 additions & 0 deletions Documentation/infiniband/sysfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ SYSFS FILES
ports/1/pkeys/10 contains the value at index 10 in port 1's P_Key
table.

There is an optional "hw_counters" subdirectory that may be under either
the parent device or the port subdirectories or both. If present,
there are a list of counters provided by the hardware. They may match
some of the counters in the counters directory, but they often include
many other counters. In addition to the various counters, there will
be a file named "lifespan" that configures how frequently the core
should update the counters when they are being accessed (counters are
not updated if they are not being accessed). The lifespan is in milli-
seconds and defaults to 10 unless set to something else by the driver.
Users may echo a value between 0 - 10000 to the lifespan file to set
the length of time between updates in milliseconds.

MTHCA

The Mellanox HCA driver also creates the files:
Expand Down
Loading

0 comments on commit b40f475

Please sign in to comment.