diff options
author | Marcel Apfelbaum <marcela@dev.mellanox.co.il> | 2011-10-03 12:04:20 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-10-28 14:36:16 -0400 |
commit | a5e12dff757b562bbecd6a2359fdc4c43d4d97de (patch) | |
tree | 1a0a922fec52b6169a449949cd0483e46e138271 | |
parent | 97285b78174423e5576b2e06aa45f64df009da5b (diff) |
IB/mlx4: Configure extended active speeds
Set the extended active speeds based on the hardware configuration.
Signed-off-by: Marcel Apfelbaum <marcela@dev.mellanox.co.il>
Reviewed-by: Hal Rosenstock <hal@mellanox.com>
[ Move FDR-10 handling into ib_link_query_port(). - Roland ]
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index fa643f4f4e28..4e5b654e6375 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -181,8 +181,12 @@ mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num) | |||
181 | 181 | ||
182 | static int ib_link_query_port(struct ib_device *ibdev, u8 port, | 182 | static int ib_link_query_port(struct ib_device *ibdev, u8 port, |
183 | struct ib_port_attr *props, | 183 | struct ib_port_attr *props, |
184 | struct ib_smp *in_mad, | ||
184 | struct ib_smp *out_mad) | 185 | struct ib_smp *out_mad) |
185 | { | 186 | { |
187 | int ext_active_speed; | ||
188 | int err; | ||
189 | |||
186 | props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); | 190 | props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); |
187 | props->lmc = out_mad->data[34] & 0x7; | 191 | props->lmc = out_mad->data[34] & 0x7; |
188 | props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18)); | 192 | props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18)); |
@@ -203,6 +207,39 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
203 | props->max_vl_num = out_mad->data[37] >> 4; | 207 | props->max_vl_num = out_mad->data[37] >> 4; |
204 | props->init_type_reply = out_mad->data[41] >> 4; | 208 | props->init_type_reply = out_mad->data[41] >> 4; |
205 | 209 | ||
210 | /* Check if extended speeds (EDR/FDR/...) are supported */ | ||
211 | if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) { | ||
212 | ext_active_speed = out_mad->data[62] >> 4; | ||
213 | |||
214 | switch (ext_active_speed) { | ||
215 | case 1: | ||
216 | props->active_speed = 16; /* FDR */ | ||
217 | break; | ||
218 | case 2: | ||
219 | props->active_speed = 32; /* EDR */ | ||
220 | break; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | /* If reported active speed is QDR, check if is FDR-10 */ | ||
225 | if (props->active_speed == 4) { | ||
226 | if (to_mdev(ibdev)->dev->caps.ext_port_cap[port] & | ||
227 | MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO) { | ||
228 | init_query_mad(in_mad); | ||
229 | in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO; | ||
230 | in_mad->attr_mod = cpu_to_be32(port); | ||
231 | |||
232 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, | ||
233 | NULL, NULL, in_mad, out_mad); | ||
234 | if (err) | ||
235 | return err; | ||
236 | |||
237 | /* Checking LinkSpeedActive for FDR-10 */ | ||
238 | if (out_mad->data[15] & 0x1) | ||
239 | props->active_speed = 8; | ||
240 | } | ||
241 | } | ||
242 | |||
206 | return 0; | 243 | return 0; |
207 | } | 244 | } |
208 | 245 | ||
@@ -274,7 +311,7 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port, | |||
274 | goto out; | 311 | goto out; |
275 | 312 | ||
276 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? | 313 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? |
277 | ib_link_query_port(ibdev, port, props, out_mad) : | 314 | ib_link_query_port(ibdev, port, props, in_mad, out_mad) : |
278 | eth_link_query_port(ibdev, port, props, out_mad); | 315 | eth_link_query_port(ibdev, port, props, out_mad); |
279 | 316 | ||
280 | out: | 317 | out: |