| NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | SEE ALSO | AUTHOR | COLOPHON | |
|  | 
IBV_GET_PKEY_INDEX(3) Libibverbs Programmer’s ManualIBV_GET_PKEY_INDEX(3)
       ibv_get_pkey_index - obtain the index in the P_Key table of a
       P_Key
              #include <infiniband/verbs.h>
              int ibv_get_pkey_index(struct ibv_context *context,
                                     uint8_t port_num,
                                     __be16 pkey);
       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. struct ibv_qp_attr and struct ib_mad_addr.
       Hence the function ibv_get_pkey_index() that accepts a P_Key in
       network byte order and that returns an index in the P_Key table as
       result.
       ibv_get_pkey_index() returns the P_Key index on success, and -1 on
       error.
       ibv_open_device(3), ibv_query_device(3), ibv_query_gid(3),
       ibv_query_pkey(3), ibv_query_port(3)
       Bart Van Assche ⟨bvanassche@acm.org⟩
       This page is part of the rdma-core (RDMA Core Userspace Libraries
       and Daemons) project.  Information about the project can be found
       at ⟨https://github.com/linux-rdma/rdma-core⟩.  If you have a bug
       report for this manual page, send it to
       linux-rdma@vger.kernel.org.  This page was obtained from the
       project's upstream Git repository
       ⟨https://github.com/linux-rdma/rdma-core.git⟩ on 2025-08-11.  (At
       that time, the date of the most recent commit that was found in
       the repository was 2025-08-04.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there is
       a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       man-pages@man7.org
libibverbs                      2018-07-16          IBV_GET_PKEY_INDEX(3)