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/mlx4.h | |
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/mlx4.h')
-rw-r--r-- | drivers/net/mlx4/mlx4.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index e0213bad61c7..5bd79c2b184f 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
41 | #include <linux/radix-tree.h> | 41 | #include <linux/radix-tree.h> |
42 | #include <linux/timer.h> | 42 | #include <linux/timer.h> |
43 | #include <linux/workqueue.h> | ||
43 | 44 | ||
44 | #include <linux/mlx4/device.h> | 45 | #include <linux/mlx4/device.h> |
45 | #include <linux/mlx4/driver.h> | 46 | #include <linux/mlx4/driver.h> |
@@ -276,6 +277,13 @@ struct mlx4_port_info { | |||
276 | struct mlx4_vlan_table vlan_table; | 277 | struct mlx4_vlan_table vlan_table; |
277 | }; | 278 | }; |
278 | 279 | ||
280 | struct mlx4_sense { | ||
281 | struct mlx4_dev *dev; | ||
282 | u8 do_sense_port[MLX4_MAX_PORTS + 1]; | ||
283 | u8 sense_allowed[MLX4_MAX_PORTS + 1]; | ||
284 | struct delayed_work sense_poll; | ||
285 | }; | ||
286 | |||
279 | struct mlx4_priv { | 287 | struct mlx4_priv { |
280 | struct mlx4_dev dev; | 288 | struct mlx4_dev dev; |
281 | 289 | ||
@@ -305,6 +313,7 @@ struct mlx4_priv { | |||
305 | struct mlx4_uar driver_uar; | 313 | struct mlx4_uar driver_uar; |
306 | void __iomem *kar; | 314 | void __iomem *kar; |
307 | struct mlx4_port_info port[MLX4_MAX_PORTS + 1]; | 315 | struct mlx4_port_info port[MLX4_MAX_PORTS + 1]; |
316 | struct mlx4_sense sense; | ||
308 | struct mutex port_mutex; | 317 | struct mutex port_mutex; |
309 | }; | 318 | }; |
310 | 319 | ||
@@ -313,6 +322,10 @@ static inline struct mlx4_priv *mlx4_priv(struct mlx4_dev *dev) | |||
313 | return container_of(dev, struct mlx4_priv, dev); | 322 | return container_of(dev, struct mlx4_priv, dev); |
314 | } | 323 | } |
315 | 324 | ||
325 | #define MLX4_SENSE_RANGE (HZ * 3) | ||
326 | |||
327 | extern struct workqueue_struct *mlx4_wq; | ||
328 | |||
316 | u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap); | 329 | u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap); |
317 | void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj); | 330 | void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj); |
318 | u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align); | 331 | u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align); |
@@ -346,8 +359,7 @@ void mlx4_cleanup_mcg_table(struct mlx4_dev *dev); | |||
346 | 359 | ||
347 | void mlx4_start_catas_poll(struct mlx4_dev *dev); | 360 | void mlx4_start_catas_poll(struct mlx4_dev *dev); |
348 | void mlx4_stop_catas_poll(struct mlx4_dev *dev); | 361 | void mlx4_stop_catas_poll(struct mlx4_dev *dev); |
349 | int mlx4_catas_init(void); | 362 | void mlx4_catas_init(void); |
350 | void mlx4_catas_cleanup(void); | ||
351 | int mlx4_restart_one(struct pci_dev *pdev); | 363 | int mlx4_restart_one(struct pci_dev *pdev); |
352 | int mlx4_register_device(struct mlx4_dev *dev); | 364 | int mlx4_register_device(struct mlx4_dev *dev); |
353 | void mlx4_unregister_device(struct mlx4_dev *dev); | 365 | void mlx4_unregister_device(struct mlx4_dev *dev); |
@@ -379,6 +391,17 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type); | |||
379 | 391 | ||
380 | void mlx4_handle_catas_err(struct mlx4_dev *dev); | 392 | void mlx4_handle_catas_err(struct mlx4_dev *dev); |
381 | 393 | ||
394 | void mlx4_do_sense_ports(struct mlx4_dev *dev, | ||
395 | enum mlx4_port_type *stype, | ||
396 | enum mlx4_port_type *defaults); | ||
397 | void mlx4_start_sense(struct mlx4_dev *dev); | ||
398 | void mlx4_stop_sense(struct mlx4_dev *dev); | ||
399 | void mlx4_sense_init(struct mlx4_dev *dev); | ||
400 | int mlx4_check_port_params(struct mlx4_dev *dev, | ||
401 | enum mlx4_port_type *port_type); | ||
402 | int mlx4_change_port_types(struct mlx4_dev *dev, | ||
403 | enum mlx4_port_type *port_types); | ||
404 | |||
382 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table); | 405 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table); |
383 | void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table); | 406 | void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table); |
384 | 407 | ||