Commit 51d7a538 authored by Raed Salem's avatar Raed Salem Committed by Leon Romanovsky

IB/core: Introduce counters read verb

The user supplies counters instance and a reference to an output array of
uint64_t.  The driver reads the hardware counters values and writes them
to the output index location in the user supplied array.  All counters
values are represented as uint64_t types.

To be able to successfully read the data the counters must be first bound
to an IB object.

Downstream patches will present binding method for flow counters.
Reviewed-by: default avatarYishai Hadas <yishaih@mellanox.com>
Signed-off-by: default avatarRaed Salem <raeds@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent d9a5a644
...@@ -2187,6 +2187,17 @@ struct ib_counters { ...@@ -2187,6 +2187,17 @@ struct ib_counters {
atomic_t usecnt; atomic_t usecnt;
}; };
enum ib_read_counters_flags {
/* prefer read values from driver cache */
IB_READ_COUNTERS_ATTR_PREFER_CACHED = 1 << 0,
};
struct ib_counters_read_attr {
u64 *counters_buff;
u32 ncounters;
u32 flags; /* use enum ib_read_counters_flags */
};
struct uverbs_attr_bundle; struct uverbs_attr_bundle;
struct ib_device { struct ib_device {
...@@ -2461,6 +2472,9 @@ struct ib_device { ...@@ -2461,6 +2472,9 @@ struct ib_device {
struct ib_counters * (*create_counters)(struct ib_device *device, struct ib_counters * (*create_counters)(struct ib_device *device,
struct uverbs_attr_bundle *attrs); struct uverbs_attr_bundle *attrs);
int (*destroy_counters)(struct ib_counters *counters); int (*destroy_counters)(struct ib_counters *counters);
int (*read_counters)(struct ib_counters *counters,
struct ib_counters_read_attr *counters_read_attr,
struct uverbs_attr_bundle *attrs);
/** /**
* rdma netdev operation * rdma netdev operation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment