Skip to content

Commit a5e12df

Browse files
Marcel Apfelbaumrolandd
authored andcommitted
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>
1 parent 97285b7 commit a5e12df

1 file changed

Lines changed: 38 additions & 1 deletion

File tree

  • drivers/infiniband/hw/mlx4

‎drivers/infiniband/hw/mlx4/main.c‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,12 @@ mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num)
181181

182182
static int ib_link_query_port(struct ib_device *ibdev, u8 port,
183183
struct ib_port_attr *props,
184+
struct ib_smp *in_mad,
184185
struct ib_smp *out_mad)
185186
{
187+
int ext_active_speed;
188+
int err;
189+
186190
props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
187191
props->lmc = out_mad->data[34] & 0x7;
188192
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,
203207
props->max_vl_num = out_mad->data[37] >> 4;
204208
props->init_type_reply = out_mad->data[41] >> 4;
205209

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+
206243
return 0;
207244
}
208245

@@ -274,7 +311,7 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
274311
goto out;
275312

276313
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) :
278315
eth_link_query_port(ibdev, port, props, out_mad);
279316

280317
out:

0 commit comments

Comments
 (0)