return err;
}
----- ------static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
----- ------ struct ib_port_attr *props)
+++++ ++++++static enum rdma_link_layer
+++++ ++++++mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num)
{
----- ------ struct ib_smp *in_mad = NULL;
----- ------ struct ib_smp *out_mad = NULL;
----- ------ int err = -ENOMEM;
----- -- ---
----- -- --- in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
----- -- --- out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
----- -- --- if (!in_mad || !out_mad)
----- -- --- goto out;
----- -- ---
----- -- --- memset(props, 0, sizeof *props);
----- -- ---
----- -- --- init_query_mad(in_mad);
----- -- --- in_mad->attr_id = IB_SMP_ATTR_PORT_INFO;
----- -- --- in_mad->attr_mod = cpu_to_be32(port);
+++++ ++++++ struct mlx4_dev *dev = to_mdev(device)->dev;
- in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
- out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
- if (!in_mad || !out_mad)
- goto out;
-
- memset(props, 0, sizeof *props);
-
- init_query_mad(in_mad);
- in_mad->attr_id = IB_SMP_ATTR_PORT_INFO;
- in_mad->attr_mod = cpu_to_be32(port);
-
----- ------ err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, NULL, NULL, in_mad, out_mad);
----- ------ if (err)
----- ------ goto out;
+++++ ++++++ return dev->caps.port_mask & (1 << (port_num - 1)) ?
+++++ ++++++ IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
+++++ ++++++}
+++++ ++++++static int ib_link_query_port(struct ib_device *ibdev, u8 port,
+++++ ++++++ struct ib_port_attr *props,
+++++ ++++++ struct ib_smp *out_mad)
+++++ ++++++{
props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
props->lmc = out_mad->data[34] & 0x7;
props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18));