mlx5dv_query_port(3) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | USAGE | ARGUMENTS | RETURN VALUE | EXAMPLE | COLOPHON

mlx5dv_query_port(3)                                 mlx5dv_query_port(3)

NAME         top

       mlx5dv_query_port - Query non standard attributes of IB device
       port.

SYNOPSIS         top

              #include <infiniband/mlx5dv.h>

              int mlx5dv_query_port(struct ibv_context *context,
                            uint32_t port_num,
                            struct mlx5dv_port *info);

DESCRIPTION         top

       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.

USAGE         top

       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         top

       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 query flags stores
              the valid filled attributes.

              MLX5DV_QUERY_PORT_VPORT: The vport number of that port.

              MLX5DV_QUERY_PORT_VPORT_VHCA_ID: The VHCA ID of vport_num.

              MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID: The E-Switch owner of
              vport_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 of vport_num.

       vport  The VPORT number of that port.

       vport_vhca_id
              The VHCA ID of vport_num.

       rsvd0  A reserved field.  Not to be used.

       esw_owner_vhca_id
              The E-Switch owner of vport_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         top

       returns 0 on success, or the value of errno on failure (which
       indicates the failure reason).

EXAMPLE         top

              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);
              }

       Mark Bloch ⟨mbloch@nvidia.com⟩

COLOPHON         top

       This page is part of the rdma-core (RDMA Core Userspace Libraries
       and Daemons) project.  Information about the project can be found
       at ⟨https://github.com/linux-rdma/rdma-core⟩.  If you have a bug
       report for this manual page, send it to
       linux-rdma@vger.kernel.org.  This page was obtained from the
       project's upstream Git repository
       ⟨https://github.com/linux-rdma/rdma-core.git⟩ on 2025-08-11.  (At
       that time, the date of the most recent commit that was found in
       the repository was 2025-08-04.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there is
       a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       man-pages@man7.org

                                                     mlx5dv_query_port(3)