mlx5dv_query_port(3)
π NAME π
okay so this is the manual page for mlx5dv_query_port(3), and itβs literally here to Query non standard attributes of IB device port. Thatβs the whole vibe check.
β¨ SYNOPSIS β¨
#include <infiniband/mlx5dv.h>
int mlx5dv_query_port(struct ibv_context *context,
uint32_t port_num,
struct mlx5dv_port *info);
πΈ DESCRIPTION πΈ
Query port info which can be used for some device commands over the DEVX interface and when directly accessing the hardware resources.
A function that lets a user query hardware and configuration attributes associated with the port. iconic, honestly.
π USAGE π
A user should provide the port number to query. On successful query flags will store a subset of the requested attributes which are supported/relevant for that port.
π¦ ARGUMENTS π¦
contextβ RDMA device context to work on.port_numβ Port number to query.
πΎ info πΎ
Stores the returned attributes from the kernel.
struct mlx5dv_port {
uint64_t flags;
uint16_t vport;
uint16_t vport_vhca_id;
uint16_t esw_owner_vhca_id;
uint16_t rsvd0;
uint64_t vport_steering_icm_rx;
uint64_t vport_steering_icm_tx;
struct mlx5dv_reg reg_c0;
};
flagsβ Bit field of attributes; on successful queryflagsstores the valid filled attributes.MLX5DV_QUERY_PORT_VPORTβ The vport number of that port.MLX5DV_QUERY_PORT_VPORT_VHCA_IDβ The VHCA ID ofvport_num.MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_IDβ The E-Switch owner ofvport_num.MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RXβ The ICM RX address when directing traffic.MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TXβ The ICM TX address when directing traffic.MLX5DV_QUERY_PORT_VPORT_REG_C0β Register C0 value used to identify egress ofvport_num.
vportβ The VPORT number of that port.vport_vhca_idβ The VHCA ID ofvport_num.rsvd0β A reserved field. Not to be used. do not touch, bestie.esw_owner_vhca_idβ The E-Switch owner ofvport_num.vport_steering_ica_rxβ The ICM RX address when directing traffic.vport_steering_icm_txβ The ICM TX address when directing traffic.
π§ reg_c0 π§
Register C0 value used to identify traffic of vport_num.
struct mlx5dv_reg {
uint32_t value;
uint32_t mask;
};
valueβ The value that should be used as match.maskβ The mask that should be used when matching.
π RETURN VALUE π
returns 0 on success, or the value of errno on failure (which indicates the failure reason).
π₯ EXAMPLE π₯
for (i = 1; i <= ports; i++) {
ret = mlx5dv_query_port(context, i, &port_info);
if (ret) {
printf("Error querying port %d\n", i);
break;
}
printf("Port: %d:\n", i);
if (port_info.flags & MLX5DV_QUERY_PORT_VPORT)
printf("\tvport_num: 0x%x\n", port_info.vport_num);
if (port_info.flags & MLX5DV_QUERY_PORT_VPORT_REG_C0)
printf("\treg_c0: val: 0x%x mask: 0x%x\n",
port_info.reg_c0.value,
port_info.reg_c0.mask);
}
Author credit, because we stan: Mark Bloch <mbloch@nvidia.com>.
okay bestie, thatβs the whole page β footer sign-off: mlx5dv_query_port(3), and since the page doesnβt list a separate date or source/version line, thatβs the cute end, periodt π
π
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms