Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Raed Salem and committed by
Leon Romanovsky
51d7a538 d9a5a644

+14
+14
include/rdma/ib_verbs.h
··· 2187 2187 atomic_t usecnt; 2188 2188 }; 2189 2189 2190 + enum ib_read_counters_flags { 2191 + /* prefer read values from driver cache */ 2192 + IB_READ_COUNTERS_ATTR_PREFER_CACHED = 1 << 0, 2193 + }; 2194 + 2195 + struct ib_counters_read_attr { 2196 + u64 *counters_buff; 2197 + u32 ncounters; 2198 + u32 flags; /* use enum ib_read_counters_flags */ 2199 + }; 2200 + 2190 2201 struct uverbs_attr_bundle; 2191 2202 2192 2203 struct ib_device { ··· 2472 2461 struct ib_counters * (*create_counters)(struct ib_device *device, 2473 2462 struct uverbs_attr_bundle *attrs); 2474 2463 int (*destroy_counters)(struct ib_counters *counters); 2464 + int (*read_counters)(struct ib_counters *counters, 2465 + struct ib_counters_read_attr *counters_read_attr, 2466 + struct uverbs_attr_bundle *attrs); 2475 2467 2476 2468 /** 2477 2469 * rdma netdev operation