From: leonidk Date: Sun, 5 Oct 2008 19:17:22 +0000 (+0000) Subject: [MLX4] fix in calculating of the number of HCA physical ports. [mlnx: 3277,3279] X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=2b5a5bc7eb1bee463abb9c3910acf89e9a8e6f29;p=~shefty%2Frdma-win.git [MLX4] fix in calculating of the number of HCA physical ports. [mlnx: 3277,3279] git-svn-id: svn://openib.tc.cornell.edu/gen1@1629 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mlx4/kernel/bus/drv/drv.c b/trunk/hw/mlx4/kernel/bus/drv/drv.c index 1f240c58..23b9ef75 100644 --- a/trunk/hw/mlx4/kernel/bus/drv/drv.c +++ b/trunk/hw/mlx4/kernel/bus/drv/drv.c @@ -236,7 +236,7 @@ Routine Description: // eventually we'll have all information about children in Registry // DriverEntry will read it into a Global storage and // this routine will create all the children on base on this info - number_of_ib_ports = mlx4_count_ib_ports(); + number_of_ib_ports = mlx4_count_ib_ports(mdev); ASSERT(number_of_ib_ports >=0 && number_of_ib_ports <=2); if(number_of_ib_ports > 0) { @@ -248,7 +248,7 @@ Routine Description: // Create ethernet ports if needed for (i = 0; i < MLX4_MAX_PORTS; i++) { - if(mlx4_is_eth_port(i)) { + if(mlx4_is_eth_port(mdev, i)) { status = __create_child(Device, ETH_HARDWARE_IDS, ETH_HARDWARE_DESCRIPTION, i+1 ); if (!NT_SUCCESS(status)) { MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (eth) failed with 0x%x\n", status)); diff --git a/trunk/hw/mlx4/kernel/bus/ib/main.c b/trunk/hw/mlx4/kernel/bus/ib/main.c index 447c80ae..d7f3861e 100644 --- a/trunk/hw/mlx4/kernel/bus/ib/main.c +++ b/trunk/hw/mlx4/kernel/bus/ib/main.c @@ -511,7 +511,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX); ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; - ibdev->ib_dev.phys_port_cnt = (u8)mlx4_count_ib_ports(); + ibdev->ib_dev.phys_port_cnt = (u8)mlx4_count_ib_ports(dev); ibdev->ib_dev.num_comp_vectors = 1; ibdev->ib_dev.dma_device = dev->pdev->dev; diff --git a/trunk/hw/mlx4/kernel/bus/net/main.c b/trunk/hw/mlx4/kernel/bus/net/main.c index 2c8554bd..3a1d92e5 100644 --- a/trunk/hw/mlx4/kernel/bus/net/main.c +++ b/trunk/hw/mlx4/kernel/bus/net/main.c @@ -121,25 +121,25 @@ static void mlx4_str2port_type(WCHAR **port_str, } } -int mlx4_count_ib_ports() +int mlx4_count_ib_ports(struct mlx4_dev *dev) { int i; int count = 0; for (i = 0; i < MLX4_MAX_PORTS; i++) { - if (g.mod_port_type[i] == MLX4_PORT_TYPE_IB) { + if (dev->caps.port_type[i+1] == MLX4_PORT_TYPE_IB) { count++; } } return count; } -BOOLEAN mlx4_is_eth_port(int port_number) +BOOLEAN mlx4_is_eth_port(struct mlx4_dev *dev, int port_number) { - if (g.mod_port_type[port_number] == MLX4_PORT_TYPE_IB) { - return FALSE; + if (dev->caps.port_type[port_number+1] == MLX4_PORT_TYPE_ETH) { + return TRUE; } - return TRUE; + return FALSE; } static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) diff --git a/trunk/hw/mlx4/kernel/bus/net/mlx4.h b/trunk/hw/mlx4/kernel/bus/net/mlx4.h index 244cc015..092c4abd 100644 --- a/trunk/hw/mlx4/kernel/bus/net/mlx4.h +++ b/trunk/hw/mlx4/kernel/bus/net/mlx4.h @@ -377,8 +377,8 @@ void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_event type, void mlx4_intf_init(); void mlx4_net_init(); -BOOLEAN mlx4_is_eth_port(int port_number); -int mlx4_count_ib_ports(); +BOOLEAN mlx4_is_eth_port(struct mlx4_dev *dev, int port_number); +int mlx4_count_ib_ports(struct mlx4_dev *dev); struct mlx4_dev_cap; struct mlx4_init_hca_param;