---
name: "ibv_query_pkey"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/ibv_query_pkey"
---

# ibv\_query\_pkey(3)

query an InfiniBand port’s P\_Key table

## NAME

ibv\_query\_pkey - query an InfiniBand port’s P\_Key table

## SYNOPSIS

-

  ```
  #include <infiniband/verbs.h>
  int ibv_query_pkey(struct ibv_context *context,
                     uint8_t port_num,
                     int index,
                     uint16_t *pkey);
  ```

## DESCRIPTION

**ibv\_query\_pkey()** returns the P\_Key value (in network byte order) in entry *index* of port *port\_num* for device context *context* through the pointer *pkey*.

## RETURN VALUE

**ibv\_query\_pkey()** returns 0 on success, and -1 on error.

## SEE ALSO

[**ibv\_open\_device**(3)](/ibv_open_device/3.md), [**ibv\_query\_device**(3)](/ibv_query_device/3.md), [**ibv\_query\_gid**(3)](/ibv_query_gid/3.md), [**ibv\_query\_port**(3)](/ibv_query_port/3.md)

## AUTHOR

Dotan Barak ⟨dotanba@gmail.com⟩\\c
