IBV_ATTACH_COUNTERS_POINT_FLOW(3)
β¨ NAME β¨
ibv_attach_counters_point_flow β the way you attach one individual counter definition to a flow object, bestie π
(this is from the ibv_attac...oint_flow(3) page, Libibverbs Programmer's Manual, if you were wondering π«Ά)
πΈ SYNOPSIS πΈ
#include <infiniband/verbs.h>
int ibv_attach_counters_point_flow(struct ibv_counters *counters,
struct ibv_counter_attach_attr *counter_attach_attr,
struct ibv_flow *flow);
π¦ DESCRIPTION π¦
Okay so listen π β counters point is a whole family of APIs, and what they do is attach an individual counter description definition to a verb object at a specific index location. That's it, that's the vibe.
Here's the tea on when your counters object actually starts collecting values: only after it is bound to the verb object resource. Not before. No cap. β
A static attach can be created when you pass NULL instead of the reference to the verbs object (like, for a flow, you'd provide NULL instead of the flow). In that case this counters object will only start collecting values after it is bound to the verbs resource β and for flow, that moment is when you reference the counters handle while creating a flow with ibv_create_flow(). iykyk π
Once an ibv_counters is bound statically to a verbs resource, no additional attach is allowed till the counter object is not bound to any verb object. Lowkey important, don't skip this one π
The counter_desc argument specifies which counter value should be collected β it's defined in verbs.h as one of the enum ibv_counter_description options.
Wanna know if a specific counter_desc value is supported on a specific verbs object? Just check the return value for success, or for the ENOTSUP errno. Vibe check complete β
Also β attaching a counters handle to multiple objects of the same type will accumulate the values into a single index. For example: creating several ibv_flow(s) with the same ibv_counters handle will collect the values from all relevant flows into the relevant index location when reading the values from ibv_read_counters(). And setting the index more than once with different or same counter_desc will aggregate the values from all relevant counters into the relevant index location. Basically it all pools together, iconic π
The runtime values of counters can be read from the hardware by calling ibv_read_counters(). π§
π ARGUMENTS π
countersβ Existing counters to attach new counter point on.counter_attach_attrβ Anibv_counter_attach_attrstruct, as defined inverbs.h.flowβ Existing flow to attach a new counters point on (in static mode it must beNULL).
π counter_attach_attr Argument
struct ibv_counter_attach_attr {
enum ibv_counter_description counter_desc;
uint32_t index;
uint32_t comp_mask;
};
π counter_desc Argument
enum ibv_counter_description {
IBV_COUNTER_PACKETS,
IBV_COUNTER_BYTES,
};
indexβ Desired location of the specific counter at the counters object. πcomp_maskβ Bitmask specifying what fields in the structure are valid.
π₯ RETURN VALUE π₯
ibv_attach_counters_point_flow() returns 0 on success, or the value of errno on failure (which indicates the failure reason). Periodt.
π ERRORS π
EINVALβ invalid argument(s) passed πENOTSUPβcounter_descis not supported on the requested objectEBUSYβ the counter object is already bound to a flow, additional attach calls is not allowed (valid for static attach only)ENOMEMβ not enough memory
π NOTES π
Counter values in each index location are cleared upon creation when calling ibv_create_counters(). Attaching counters points will only increase these values accordingly. So like, don't be surprised when they start at zero, bestie π
β EXAMPLE β
An example of use of ibv_attach_counters_point_flow() is shown in ibv_read_counters.
π SEE ALSO π
ibv_create_counters, ibv_destroy_counters, ibv_read_counters, ibv_create_flow
π AUTHORS π
- Raed Salem
<raeds@mellanox.com> - Alex Rosenbaum
<alexr@mellanox.com>
k bye bestie, go forth and attach those counter points π
β¨ β this page is from libibverbs, dated 2018-04-02, and the original is ibv_attac...oint_flow(3). Mwah π«Ά
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms