.\" Automatically generated by Pandoc 1.19.2.4
.\"
.TH "IBV_GET_PKEY_INDEX" "3" "2018\-07\-16" "libibverbs" "Libibverbs Programmer\[aq]s Manual"
.hy
.SH NAME
.PP
ibv_get_pkey_index \- obtain the index in the P_Key table of a P_Key
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <infiniband/verbs.h>

int\ ibv_get_pkey_index(struct\ ibv_context\ *context,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8_t\ port_num,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ __be16\ pkey);
\f[]
.fi
.SH DESCRIPTION
.PP
Every InfiniBand HCA maintains a P_Key table for each of its ports that
is indexed by an integer and with a P_Key in each element.
Certain InfiniBand data structures that work with P_Keys expect a P_Key
index, e.g.
\f[B]struct ibv_qp_attr\f[] and \f[B]struct ib_mad_addr\f[].
Hence the function \f[B]ibv_get_pkey_index()\f[] that accepts a P_Key in
network byte order and that returns an index in the P_Key table as
result.
.SH RETURN VALUE
.PP
\f[B]ibv_get_pkey_index()\f[] returns the P_Key index on success, and
\-1 on error.
.SH SEE ALSO
.PP
\f[B]ibv_open_device\f[](3), \f[B]ibv_query_device\f[](3),
\f[B]ibv_query_gid\f[](3), \f[B]ibv_query_pkey\f[](3),
\f[B]ibv_query_port\f[](3)
.SH AUTHOR
.PP
Bart Van Assche <bvanassche@acm.org>
