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

# mlx5dv\_query\_qp\_lag\_port(3)

Query the lag port information of a given QP

## NAME

mlx5dv\_query\_qp\_lag\_port - Query the lag port information of a given QP

## SYNOPSIS

-

  ```
  #include <infiniband/mlx5dv.h>
  int mlx5dv_query_qp_lag_port(struct ibv_qp *qp, uint8_t *port_num,
                   uint8_t *active_port_num);
  ```

## DESCRIPTION

This API returns the configured and active port num of a given QP in mlx5 devices.

The active port num indicates which port that the QP sends traffic out in a LAG configuration.

The num\_lag\_ports field of struct mlx5dv\_context greater than 1 means LAG is supported on this device.

## ARGUMENTS

- *qp*

  The ibv\_qp object to issue the action on.

- *port\_num*

  The configured port num of the QP.

- *active\_port\_num*

  The current port num of the QP, which may different from the configured value because of the bonding status.

## RETURN VALUE

0 on success; EOPNOTSUPP if not in LAG mode, or other errno value on other failures.

## SEE ALSO

*[mlx5dv\_modify\_qp\_lag\_port(3)](/mlx5dv_modify_qp_lag_port/3.md)*

## AUTHOR

Aharon Landau ⟨aharonl@mellanox.com⟩\\c
