[ofw] [bus] Fix bug when board contains only one port only

Tzachi Dar tzachid at mellanox.co.il
Sun Nov 15 10:03:53 PST 2009


signed off by: urih
 
Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c
===================================================================
--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 4839)
+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 4840)
@@ -657,12 +657,12 @@
  int err = 0;
 
     
-    for (i = 1; i <= MLX4_MAX_PORTS; ++i)
+    for (i = 1; i <= dev->caps.num_ports; ++i)
     {
         dev->caps.port_state[i] = MLX4_PORT_ENABLED;
     }
     
-    for (i = 1; i <= MLX4_MAX_PORTS; ++i)
+    for (i = 1; i <= dev->caps.num_ports; ++i)
     {
         err = query_port_state(dev, i);
         if (err)
Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c
===================================================================
--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c (revision 4839)
+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c (revision 4840)
@@ -136,7 +136,7 @@
  int i;
  int count = 0;
 
- for (i = 0; i < MLX4_MAX_PORTS; i++) {
+ for (i = 0; i < dev->caps.num_ports; i++) {
   if (dev->caps.port_type[i+1] == MLX4_PORT_TYPE_IB) {
    count++;
   }
Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c
===================================================================
--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 4839)
+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 4840)
@@ -235,7 +235,7 @@
  number_of_ib_ports = mlx4_count_ib_ports(mdev);
  ASSERT(number_of_ib_ports >=0 && number_of_ib_ports <=2);
 
- for (i = 1; i <= MLX4_MAX_PORTS; i++) {
+ for (i = 1; i <= mdev->caps.num_ports; i++) {
         if (mlx4_is_enabled_port(mdev, i)) {
             if(mlx4_is_eth_port(mdev, i)) {
                 status = __create_child(Device, ETH_HARDWARE_IDS,
ETH_HARDWARE_DESCRIPTION, i);

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20091115/3ef7ef76/attachment.html>


More information about the ofw mailing list