| 1 | --- |
| 2 | date: 2018-07-16 |
| 3 | footer: libibverbs |
| 4 | header: "Libibverbs Programmer's Manual" |
| 5 | layout: page |
| 6 | license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md' |
| 7 | section: 3 |
| 8 | title: IBV_GET_PKEY_INDEX |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_get_pkey_index - obtain the index in the P_Key table of a P_Key |
| 14 | |
| 15 | # SYNOPSIS |
| 16 | |
| 17 | ```c |
| 18 | #include <infiniband/verbs.h> |
| 19 | |
| 20 | int ibv_get_pkey_index(struct ibv_context *context, |
| 21 | uint8_t port_num, |
| 22 | __be16 pkey); |
| 23 | ``` |
| 24 | |
| 25 | # DESCRIPTION |
| 26 | |
| 27 | Every InfiniBand HCA maintains a P_Key table for each of its ports that is |
| 28 | indexed by an integer and with a P_Key in each element. Certain InfiniBand |
| 29 | data structures that work with P_Keys expect a P_Key index, e.g. **struct |
| 30 | ibv_qp_attr** and **struct ib_mad_addr**. Hence the function |
| 31 | **ibv_get_pkey_index()** that accepts a P_Key in network byte order and that |
| 32 | returns an index in the P_Key table as result. |
| 33 | |
| 34 | # RETURN VALUE |
| 35 | |
| 36 | **ibv_get_pkey_index()** returns the P_Key index on success, and -1 on error. |
| 37 | |
| 38 | # SEE ALSO |
| 39 | |
| 40 | **ibv_open_device**(3), |
| 41 | **ibv_query_device**(3), |
| 42 | **ibv_query_gid**(3), |
| 43 | **ibv_query_pkey**(3), |
| 44 | **ibv_query_port**(3) |
| 45 | |
| 46 | # AUTHOR |
| 47 | |
| 48 | Bart Van Assche <[email protected]> |