---
name: "ibv_query_gid_ex"
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_ex"
---

# ibv\_query\_gid\_ex(3)

Query an InfiniBand port’s GID table entry

## NAME

ibv\_query\_gid\_ex - Query an InfiniBand port’s GID table entry

## SYNOPSIS

-

  ```
  #include <infiniband/verbs.h>
  int ibv_query_gid_ex(struct ibv_context *context,
                       uint32_t port_num,
                       uint32_t gid_index,
                       struct ibv_gid_entry *entry,
                       uint32_t flags);
  ```

## DESCRIPTION

**ibv\_query\_gid\_ex()** returns the GID entry at *entry* for *gid\_index* of port *port\_num* for device context *context*.

## ARGUMENTS

- *context*

  The context of the device to query.

- *port\_num*

  The number of port to query its GID table.

- *gid\_index*

  The index of the GID table entry to query.

- \## *entry* Argument

  An ibv\_gid\_entry struct, as defined in \<infiniband/verbs.h\>.

-

  ```
  struct ibv_gid_entry {
          union ibv_gid gid;
          uint32_t gid_index;
          uint32_t port_num;
          uint32_t gid_type;
          uint32_t ndev_ifindex;
  };
  ```

-

  ```
  *gid*
  ```

: The GID entry.

-

  ```
  *gid_index*
  ```

: The GID table index of this entry.

-

  ```
  *port_num*
  ```

: The port number that this GID belongs to.

-

  ```
  *gid_type*
  ```

: enum ibv\_gid\_type, can be one of IBV\_GID\_TYPE\_IB, IBV\_GID\_TYPE\_ROCE\_V1 or IBV\_GID\_TYPE\_ROCE\_V2.

-

  ```
  *ndev_ifindex*
  ```

: The interface index of the net device associated with this GID. It is 0 if there is no net device associated with it.

- *flags*

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

## RETURN VALUE

**ibv\_query\_gid\_ex()** returns 0 on success or errno value on error.

## ERRORS

- ENODATA

  *gid\_index* is within the GID table size of port *port\_num* but there is no data in this index.

## SEE ALSO

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

## AUTHOR

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