Skip to content

Commit

Permalink
mlx4: Sensing link type at device initialization
Browse files Browse the repository at this point in the history
When bringing the port up, performing a SENSE_PORT command
To try and check to which physical link type (IB or Ethernet) the physical
port is connected.
In case there is no valid link partner, the port will come up as its
supported default.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yevgeny Petrilin authored and davem330 committed Apr 8, 2011
1 parent 1b86a58 commit ab6dc30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions drivers/net/mlx4/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,10 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
}

for (port = 1; port <= dev->caps.num_ports; port++) {
enum mlx4_port_type port_type = 0;
mlx4_SENSE_PORT(dev, port, &port_type);
if (port_type)
dev->caps.port_type[port] = port_type;
ib_port_default_caps = 0;
err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps);
if (err)
Expand All @@ -958,6 +962,7 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
goto err_mcg_table_free;
}
}
mlx4_set_port_mask(dev);

return 0;

Expand Down
2 changes: 2 additions & 0 deletions drivers/net/mlx4/mlx4.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type);

void mlx4_handle_catas_err(struct mlx4_dev *dev);

int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port,
enum mlx4_port_type *type);
void mlx4_do_sense_ports(struct mlx4_dev *dev,
enum mlx4_port_type *stype,
enum mlx4_port_type *defaults);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/mlx4/sense.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

#include "mlx4.h"

static int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port,
enum mlx4_port_type *type)
int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port,
enum mlx4_port_type *type)
{
u64 out_param;
int err = 0;
Expand Down

0 comments on commit ab6dc30

Please sign in to comment.