aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/mlx4.h
diff options
context:
space:
mode:
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>2009-03-18 22:45:11 -0400
committerRoland Dreier <rolandd@cisco.com>2009-03-18 22:45:11 -0400
commit27bf91d6a0d5a9c7224e8687754249bba67dd4cf (patch)
tree55c253fa4438ea29d73f072a88dff5fb74e2ca4e /drivers/net/mlx4/mlx4.h
parent793730bfb6711d6d14629e63845c25a3c14d205e (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.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index e0213bad61c..5bd79c2b184 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
280struct 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
279struct mlx4_priv { 287struct 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
327extern struct workqueue_struct *mlx4_wq;
328
316u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap); 329u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap);
317void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj); 330void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj);
318u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align); 331u32 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
347void mlx4_start_catas_poll(struct mlx4_dev *dev); 360void mlx4_start_catas_poll(struct mlx4_dev *dev);
348void mlx4_stop_catas_poll(struct mlx4_dev *dev); 361void mlx4_stop_catas_poll(struct mlx4_dev *dev);
349int mlx4_catas_init(void); 362void mlx4_catas_init(void);
350void mlx4_catas_cleanup(void);
351int mlx4_restart_one(struct pci_dev *pdev); 363int mlx4_restart_one(struct pci_dev *pdev);
352int mlx4_register_device(struct mlx4_dev *dev); 364int mlx4_register_device(struct mlx4_dev *dev);
353void mlx4_unregister_device(struct mlx4_dev *dev); 365void 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
380void mlx4_handle_catas_err(struct mlx4_dev *dev); 392void mlx4_handle_catas_err(struct mlx4_dev *dev);
381 393
394void mlx4_do_sense_ports(struct mlx4_dev *dev,
395 enum mlx4_port_type *stype,
396 enum mlx4_port_type *defaults);
397void mlx4_start_sense(struct mlx4_dev *dev);
398void mlx4_stop_sense(struct mlx4_dev *dev);
399void mlx4_sense_init(struct mlx4_dev *dev);
400int mlx4_check_port_params(struct mlx4_dev *dev,
401 enum mlx4_port_type *port_type);
402int mlx4_change_port_types(struct mlx4_dev *dev,
403 enum mlx4_port_type *port_types);
404
382void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table); 405void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table);
383void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table); 406void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table);
384 407