diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2009-03-18 22:45:11 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2009-03-18 22:45:11 -0400 |
commit | 27bf91d6a0d5a9c7224e8687754249bba67dd4cf (patch) | |
tree | 55c253fa4438ea29d73f072a88dff5fb74e2ca4e /drivers/net/mlx4/eq.c | |
parent | 793730bfb6711d6d14629e63845c25a3c14d205e (diff) |
mlx4_core: Add link type autosensing
When a port's link is down (except to driver restart) and the port is
configured for auto sensing, we try to sense port link type (Ethernet
or InfiniBand) in order to determine how to initialize the port. If
the port type needs to be changed, all mlx4 for the device interfaces
are unregistered and then registered again with the new port
types. Sensing is done with intervals of 3 seconds.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4/eq.c')
-rw-r--r-- | drivers/net/mlx4/eq.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c index 2c19bff7cbab..8830dcb92ec8 100644 --- a/drivers/net/mlx4/eq.c +++ b/drivers/net/mlx4/eq.c | |||
@@ -163,6 +163,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq) | |||
163 | int cqn; | 163 | int cqn; |
164 | int eqes_found = 0; | 164 | int eqes_found = 0; |
165 | int set_ci = 0; | 165 | int set_ci = 0; |
166 | int port; | ||
166 | 167 | ||
167 | while ((eqe = next_eqe_sw(eq))) { | 168 | while ((eqe = next_eqe_sw(eq))) { |
168 | /* | 169 | /* |
@@ -203,11 +204,16 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq) | |||
203 | break; | 204 | break; |
204 | 205 | ||
205 | case MLX4_EVENT_TYPE_PORT_CHANGE: | 206 | case MLX4_EVENT_TYPE_PORT_CHANGE: |
206 | mlx4_dispatch_event(dev, | 207 | port = be32_to_cpu(eqe->event.port_change.port) >> 28; |
207 | eqe->subtype == MLX4_PORT_CHANGE_SUBTYPE_ACTIVE ? | 208 | if (eqe->subtype == MLX4_PORT_CHANGE_SUBTYPE_DOWN) { |
208 | MLX4_DEV_EVENT_PORT_UP : | 209 | mlx4_dispatch_event(dev, MLX4_DEV_EVENT_PORT_DOWN, |
209 | MLX4_DEV_EVENT_PORT_DOWN, | 210 | port); |
210 | be32_to_cpu(eqe->event.port_change.port) >> 28); | 211 | mlx4_priv(dev)->sense.do_sense_port[port] = 1; |
212 | } else { | ||
213 | mlx4_dispatch_event(dev, MLX4_DEV_EVENT_PORT_UP, | ||
214 | port); | ||
215 | mlx4_priv(dev)->sense.do_sense_port[port] = 0; | ||
216 | } | ||
211 | break; | 217 | break; |
212 | 218 | ||
213 | case MLX4_EVENT_TYPE_CQ_ERROR: | 219 | case MLX4_EVENT_TYPE_CQ_ERROR: |