diff options
author | Achiad Shochat <achiad@mellanox.com> | 2015-12-23 11:47:20 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-12-23 12:07:37 -0500 |
commit | 9efa75254593d6ca3ae54bac8153f47e1a7cbcda (patch) | |
tree | 7f9b3f4dc8f4bf126813eabcf715c4b5f280c296 | |
parent | 0de60af649533ad8d9aaeab1df710e6a728d45ea (diff) |
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 <achiad@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/vport.c | 62 | ||||
-rw-r--r-- | include/linux/mlx5/mlx5_ifc.h | 10 | ||||
-rw-r--r-- | include/linux/mlx5/vport.h | 5 |
3 files changed, 76 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c index 245ff4a03dd6..ecb274ae9a81 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c | |||
@@ -103,6 +103,68 @@ void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr) | |||
103 | } | 103 | } |
104 | EXPORT_SYMBOL(mlx5_query_nic_vport_mac_address); | 104 | EXPORT_SYMBOL(mlx5_query_nic_vport_mac_address); |
105 | 105 | ||
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 | |||
106 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, | 168 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, |
107 | u8 port_num, u16 vf_num, u16 gid_index, | 169 | u8 port_num, u16 vf_num, u16 gid_index, |
108 | union ib_gid *gid) | 170 | union ib_gid *gid) |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 1565324eb620..49b34c6466ac 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -2141,7 +2141,15 @@ struct mlx5_ifc_nic_vport_context_bits { | |||
2141 | u8 reserved_0[0x1f]; | 2141 | u8 reserved_0[0x1f]; |
2142 | u8 roce_en[0x1]; | 2142 | u8 roce_en[0x1]; |
2143 | 2143 | ||
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]; | ||
2145 | 2153 | ||
2146 | u8 reserved_2[0x5]; | 2154 | u8 reserved_2[0x5]; |
2147 | u8 allowed_list_type[0x3]; | 2155 | u8 allowed_list_type[0x3]; |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 4c9ac604cccd..dfb2d9497d2d 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
@@ -37,6 +37,11 @@ | |||
37 | 37 | ||
38 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod); | 38 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod); |
39 | void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr); | 39 | 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); | ||
40 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, | 45 | int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport, |
41 | u8 port_num, u16 vf_num, u16 gid_index, | 46 | u8 port_num, u16 vf_num, u16 gid_index, |
42 | union ib_gid *gid); | 47 | union ib_gid *gid); |