Skip to content

Commit 9efa752

Browse files
Achiad Shochatdledford
authored andcommitted
net/mlx5_core: Introduce access functions to query vport RoCE fields
Introduce access functions to query NIC vport system_image_guid, node_guid and qkey_viol_cntr. Signed-off-by: Achiad Shochat <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 0de60af commit 9efa752

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/vport.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,68 @@ void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr)
103103
}
104104
EXPORT_SYMBOL(mlx5_query_nic_vport_mac_address);
105105

106+
int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
107+
u64 *system_image_guid)
108+
{
109+
u32 *out;
110+
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
111+
112+
out = mlx5_vzalloc(outlen);
113+
if (!out)
114+
return -ENOMEM;
115+
116+
mlx5_query_nic_vport_context(mdev, out, outlen);
117+
118+
*system_image_guid = MLX5_GET64(query_nic_vport_context_out, out,
119+
nic_vport_context.system_image_guid);
120+
121+
kfree(out);
122+
123+
return 0;
124+
}
125+
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid);
126+
127+
int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
128+
{
129+
u32 *out;
130+
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
131+
132+
out = mlx5_vzalloc(outlen);
133+
if (!out)
134+
return -ENOMEM;
135+
136+
mlx5_query_nic_vport_context(mdev, out, outlen);
137+
138+
*node_guid = MLX5_GET64(query_nic_vport_context_out, out,
139+
nic_vport_context.node_guid);
140+
141+
kfree(out);
142+
143+
return 0;
144+
}
145+
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_node_guid);
146+
147+
int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
148+
u16 *qkey_viol_cntr)
149+
{
150+
u32 *out;
151+
int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
152+
153+
out = mlx5_vzalloc(outlen);
154+
if (!out)
155+
return -ENOMEM;
156+
157+
mlx5_query_nic_vport_context(mdev, out, outlen);
158+
159+
*qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
160+
nic_vport_context.qkey_violation_counter);
161+
162+
kfree(out);
163+
164+
return 0;
165+
}
166+
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_qkey_viol_cntr);
167+
106168
int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
107169
u8 port_num, u16 vf_num, u16 gid_index,
108170
union ib_gid *gid)

include/linux/mlx5/mlx5_ifc.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,15 @@ struct mlx5_ifc_nic_vport_context_bits {
21412141
u8 reserved_0[0x1f];
21422142
u8 roce_en[0x1];
21432143

2144-
u8 reserved_1[0x760];
2144+
u8 reserved_1[0x120];
2145+
2146+
u8 system_image_guid[0x40];
2147+
u8 port_guid[0x40];
2148+
u8 node_guid[0x40];
2149+
2150+
u8 reserved_5[0x140];
2151+
u8 qkey_violation_counter[0x10];
2152+
u8 reserved_6[0x430];
21452153

21462154
u8 reserved_2[0x5];
21472155
u8 allowed_list_type[0x3];

include/linux/mlx5/vport.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737

3838
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod);
3939
void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr);
40+
int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
41+
u64 *system_image_guid);
42+
int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
43+
int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
44+
u16 *qkey_viol_cntr);
4045
int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
4146
u8 port_num, u16 vf_num, u16 gid_index,
4247
union ib_gid *gid);

0 commit comments

Comments
 (0)