.\" Automatically generated by Pandoc 2.5
.\"
.TH "ibv_create_counters" "3" "2018\-04\-02" "libibverbs" "Libibverbs Programmer\[cq]s Manual"
.hy
.SH NAME
.PP
\f[B]ibv_create_counters\f[R], \f[B]ibv_destroy_counters\f[R] \- 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[R]
.fi
.SH DESCRIPTION
.PP
\f[B]ibv_create_counters\f[R]() 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[R].
.PP
Counters are cleared upon creation and values will be monotonically
increasing.
.PP
\f[B]ibv_destroy_counters\f[R]() releases the counters handle, user
should detach the counters object before destroying it.
.SH ARGUMENTS
.TP
.B \f[I]context\f[R]
RDMA device context to create the counters on.
.TP
.B \f[I]init_attr\f[R]
Is an ibv_counters_init_attr struct, as defined in verbs.h.
.SS \f[I]init_attr\f[R] Argument
.IP
.nf
\f[C]
struct ibv_counters_init_attr {
    int comp_mask;
};
\f[R]
.fi
.TP
.B \f[I]comp_mask\f[R]
Bitmask specifying what fields in the structure are valid.
.SH RETURN VALUE
.PP
\f[B]ibv_create_counters\f[R]() 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[R]() 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[R]() is not currently supported on this
device (ENOSYS may sometimes be returned by old versions of libibverbs).
.TP
.B ENOMEM
\f[B]ibv_create_counters\f[R]() could not create ibv_counters object,
not enough memory
.TP
.B EINVAL
invalid parameter supplied \f[B]ibv_destroy_counters\f[R]()
.SH EXAMPLE
.PP
An example of use of ibv_counters is shown in
\f[B]ibv_read_counters\f[R]
.SH SEE ALSO
.PP
\f[B]ibv_attach_counters_point_flow\f[R], \f[B]ibv_read_counters\f[R],
\f[B]ibv_create_flow\f[R]
.SH AUTHORS
.PP
Raed Salem <raeds@mellanox.com>
.PP
Alex Rosenbaum <alexr@mellanox.com>
