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

# ibv\_query\_gid\_table(3)

query an InfiniBand device’s GID table

## NAME

ibv\_query\_gid\_table - query an InfiniBand device’s GID table

## SYNOPSIS

-

  ```
  #include <infiniband/verbs.h>
  ssize_t ibv_query_gid_table(struct ibv_context *context,
                              struct ibv_gid_entry *entries,
                              size_t max_entries,
                              uint32_t flags);
  ```

## DESCRIPTION

**ibv\_query\_gid\_table()** returns the valid GID table entries of the RDMA device context *context* at the pointer *entries*.

A caller must allocate *entries* array for the GID table entries it desires to query. This API returns only valid GID table entries.

A caller must pass non zero number of entries at *max\_entries* that corresponds to the size of *entries* array.

*entries* array must be allocated such that it can contain all the valid GID table entries of the device. If there are more valid GID entries than the provided value of *max\_entries* and *entries* array, the call will fail. For example, if an RDMA device *context* has a total of 10 valid GID entries, *entries* should be allocated for at least 10 entries, and *max\_entries* should be set appropriately.

## ARGUMENTS

- *context*

  The context of the device to query.

- *entries*

  Array of ibv\_gid\_entry structs where the GID entries are returned. Please see [**ibv\_query\_gid\_ex**(3)](/ibv_query_gid_ex/3.md) man page for *ibv\_gid\_entry*.

- *max\_entries*

  Maximum number of entries that can be returned.

- *flags*

  Extra fields to query post *entries-\>ndev\_ifindex*, for now must be 0.

## RETURN VALUE

**ibv\_query\_gid\_table()** returns the number of entries that were read on success or negative errno value on error. Number of entries returned is \<= max\_entries.

## SEE ALSO

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

## AUTHOR

Parav Pandit ⟨parav@nvidia.com⟩\\c
