1mlx5dv_query_port(3) mlx5dv_query_port(3)
2
3
4
6 mlx5dv_query_port - Query non standard attributes of IB device port.
7
9 #include <infiniband/mlx5dv.h>
10
11 int mlx5dv_query_port(struct ibv_context *context,
12 uint32_t port_num,
13 struct mlx5dv_port *info);
14
16 Query port info which can be used for some device commands over the DE‐
17 VX interface and when directly accessing the hardware resources.
18
19 A function that lets a user query hardware and configuration attributes
20 associated with the port.
21
23 A user should provide the port number to query. On successful query
24 flags will store a subset of the requested attributes which are sup‐
25 ported/relevant for that port.
26
28 context
29 RDMA device context to work on.
30
31 port_num
32 Port number to query.
33
34 ## info
35 Stores the returned attributes from the kernel.
36
37 struct mlx5dv_port {
38 uint64_t flags;
39 uint16_t vport;
40 uint16_t vport_vhca_id;
41 uint16_t esw_owner_vhca_id;
42 uint16_t rsvd0;
43 uint64_t vport_steering_icm_rx;
44 uint64_t vport_steering_icm_tx;
45 struct mlx5dv_reg reg_c0;
46 };
47
48 flags Bit field of attributes, on successful query flags stores the
49 valid filled attributes.
50
51 MLX5DV_QUERY_PORT_VPORT: The vport number of that port.
52
53 MLX5DV_QUERY_PORT_VPORT_VHCA_ID: The VHCA ID of vport_num.
54
55 MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID: The E-Switch owner of
56 vport_num.
57
58 MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_RX: The ICM RX address when
59 directing traffic.
60
61 MLX5DV_QUERY_PORT_VPORT_STEERING_ICM_TX: The ICM TX address when
62 directing traffic.
63
64 MLX5DV_QUERY_PORT_VPORT_REG_C0: Register C0 value used to iden‐
65 tify egress of vport_num.
66
67 vport The VPORT number of that port.
68
69 vport_vhca_id
70 The VHCA ID of vport_num.
71
72 rsvd0 A reserved field. Not to be used.
73
74 esw_owner_vhca_id
75 The E-Switch owner of vport_num.
76
77 vport_steering_ica_rx
78 The ICM RX address when directing traffic.
79
80 vport_steering_icm_tx
81 The ICM TX address when directing traffic.
82
83 ## reg_c0
84 Register C0 value used to identify traffic of vport_num.
85
86 struct mlx5dv_reg {
87 uint32_t value;
88 uint32_t mask;
89 };
90
91 value The value that should be used as match.
92
93 mask The mask that should be used when matching.
94
96 returns 0 on success, or the value of errno on failure (which indicates
97 the failure reason).
98
100 for (i = 1; i <= ports; i++) {
101 ret = mlx5dv_query_port(context, i, &port_info);
102 if (ret) {
103 printf("Error querying port %d\n", i);
104 break;
105 }
106
107 printf("Port: %d:\n", i);
108
109 if (port_info.flags & MLX5DV_QUERY_PORT_VPORT)
110 printf("\tvport_num: 0x%x\n", port_info.vport_num);
111
112 if (port_info.flags & MLX5DV_QUERY_PORT_VPORT_REG_C0)
113 printf("\treg_c0: val: 0x%x mask: 0x%x\n",
114 port_info.reg_c0.value,
115 port_info.reg_c0.mask);
116 }
117
118 Mark Bloch <mbloch@nvidia.com>
119
120
121
122 mlx5dv_query_port(3)