.\" Automatically generated by Pandoc 1.19.2.4
.\"
.TH "ibv_create_counters" "3" "2018\-04\-02" "libibverbs" "Libibverbs Programmer\[aq]s Manual"
.hy
.SH NAME
.PP
\f[B]ibv_create_counters\f[], \f[B]ibv_destroy_counters\f[] \- Create or
destroy a counters handle
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <infiniband/verbs.h>

struct\ ibv_counters\ *
ibv_create_counters(struct\ ibv_context\ *context,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ ibv_counters_init_attr\ *init_attr);

int\ ibv_destroy_counters(struct\ ibv_counters\ *counters);
\f[]
.fi
.SH DESCRIPTION
.PP
\f[B]ibv_create_counters\f[]() creates a new counters handle for the
RDMA device context.
.PP
An ibv_counters handle can be attached to a verbs resource (e.g.: QP,
WQ, Flow) statically when these are created.
.PP
For example attach an ibv_counters statically to a Flow (struct
ibv_flow) during creation of a new Flow by calling
\f[B]ibv_create_flow()\f[].
.PP
Counters are cleared upon creation and values will be monotonically
increasing.
.PP
\f[B]ibv_destroy_counters\f[]() releases the counters handle, user
should detach the counters object before destroying it.
.SH ARGUMENTS
.TP
.B \f[I]context\f[]
RDMA device context to create the counters on.
.RS
.RE
.TP
.B \f[I]init_attr\f[]
Is an ibv_counters_init_attr struct, as defined in verbs.h.
.RS
.RE
.SS \f[I]init_attr\f[] Argument
.IP
.nf
\f[C]
struct\ ibv_counters_init_attr\ {
\ \ \ \ int\ comp_mask;
};
\f[]
.fi
.TP
.B \f[I]comp_mask\f[]
Bitmask specifying what fields in the structure are valid.
.RS
.RE
.SH RETURN VALUE
.PP
\f[B]ibv_create_counters\f[]() returns a pointer to the allocated
ibv_counters object, or NULL if the request fails (and sets errno to
indicate the failure reason)
.PP
\f[B]ibv_destroy_counters\f[]() returns 0 on success, or the value of
errno on failure (which indicates the failure reason)
.SH ERRORS
.TP
.B EOPNOTSUPP
\f[B]ibv_create_counters\f[]() is not currently supported on this device
(ENOSYS may sometimes be returned by old versions of libibverbs).
.RS
.RE
.TP
.B ENOMEM
\f[B]ibv_create_counters\f[]() could not create ibv_counters object, not
enough memory
.RS
.RE
.TP
.B EINVAL
invalid parameter supplied \f[B]ibv_destroy_counters\f[]()
.RS
.RE
.SH EXAMPLE
.PP
An example of use of ibv_counters is shown in \f[B]ibv_read_counters\f[]
.SH SEE ALSO
.PP
\f[B]ibv_attach_counters_point_flow\f[], \f[B]ibv_read_counters\f[],
\f[B]ibv_create_flow\f[]
.SH AUTHORS
.PP
Raed Salem <raeds@mellanox.com>
.PP
Alex Rosenbaum <alexr@mellanox.com>
