diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2008-10-22 18:38:42 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-10-22 18:38:42 -0400 |
commit | 7ff93f8b7ecbc36e7ffc5c11a61643821c1bfee5 (patch) | |
tree | 4b38e1ead8b27a480cc766f6927dccf5b63793ae /drivers/infiniband/hw/mlx4 | |
parent | 2a2336f8228292b8197f4187e54b0748903e6645 (diff) |
mlx4_core: Multiple port type support
Multi-protocol adapters support different port types. Each consumer
of mlx4_core queries for supported port types; in particular mlx4_ib
can no longer assume that all physical ports belong to it. Port type
is configured through a sysfs interface. When the type of a port is
changed, all mlx4 interfaces are unregistered, and then registered
again with the new port types.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r-- | drivers/infiniband/hw/mlx4/mad.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 11 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/mlx4_ib.h | 1 |
3 files changed, 13 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index cdca3a511e1c..606f1e2ef284 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -298,7 +298,7 @@ int mlx4_ib_mad_init(struct mlx4_ib_dev *dev) | |||
298 | int p, q; | 298 | int p, q; |
299 | int ret; | 299 | int ret; |
300 | 300 | ||
301 | for (p = 0; p < dev->dev->caps.num_ports; ++p) | 301 | for (p = 0; p < dev->num_ports; ++p) |
302 | for (q = 0; q <= 1; ++q) { | 302 | for (q = 0; q <= 1; ++q) { |
303 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, | 303 | agent = ib_register_mad_agent(&dev->ib_dev, p + 1, |
304 | q ? IB_QPT_GSI : IB_QPT_SMI, | 304 | q ? IB_QPT_GSI : IB_QPT_SMI, |
@@ -314,7 +314,7 @@ int mlx4_ib_mad_init(struct mlx4_ib_dev *dev) | |||
314 | return 0; | 314 | return 0; |
315 | 315 | ||
316 | err: | 316 | err: |
317 | for (p = 0; p < dev->dev->caps.num_ports; ++p) | 317 | for (p = 0; p < dev->num_ports; ++p) |
318 | for (q = 0; q <= 1; ++q) | 318 | for (q = 0; q <= 1; ++q) |
319 | if (dev->send_agent[p][q]) | 319 | if (dev->send_agent[p][q]) |
320 | ib_unregister_mad_agent(dev->send_agent[p][q]); | 320 | ib_unregister_mad_agent(dev->send_agent[p][q]); |
@@ -327,7 +327,7 @@ void mlx4_ib_mad_cleanup(struct mlx4_ib_dev *dev) | |||
327 | struct ib_mad_agent *agent; | 327 | struct ib_mad_agent *agent; |
328 | int p, q; | 328 | int p, q; |
329 | 329 | ||
330 | for (p = 0; p < dev->dev->caps.num_ports; ++p) { | 330 | for (p = 0; p < dev->num_ports; ++p) { |
331 | for (q = 0; q <= 1; ++q) { | 331 | for (q = 0; q <= 1; ++q) { |
332 | agent = dev->send_agent[p][q]; | 332 | agent = dev->send_agent[p][q]; |
333 | dev->send_agent[p][q] = NULL; | 333 | dev->send_agent[p][q] = NULL; |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index a3c2851c0545..2e80f8f47b02 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -574,7 +574,10 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
574 | ibdev->ib_dev.owner = THIS_MODULE; | 574 | ibdev->ib_dev.owner = THIS_MODULE; |
575 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; | 575 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; |
576 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; | 576 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; |
577 | ibdev->ib_dev.phys_port_cnt = dev->caps.num_ports; | 577 | ibdev->num_ports = 0; |
578 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
579 | ibdev->num_ports++; | ||
580 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; | ||
578 | ibdev->ib_dev.num_comp_vectors = 1; | 581 | ibdev->ib_dev.num_comp_vectors = 1; |
579 | ibdev->ib_dev.dma_device = &dev->pdev->dev; | 582 | ibdev->ib_dev.dma_device = &dev->pdev->dev; |
580 | 583 | ||
@@ -691,7 +694,7 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | |||
691 | struct mlx4_ib_dev *ibdev = ibdev_ptr; | 694 | struct mlx4_ib_dev *ibdev = ibdev_ptr; |
692 | int p; | 695 | int p; |
693 | 696 | ||
694 | for (p = 1; p <= dev->caps.num_ports; ++p) | 697 | for (p = 1; p <= ibdev->num_ports; ++p) |
695 | mlx4_CLOSE_PORT(dev, p); | 698 | mlx4_CLOSE_PORT(dev, p); |
696 | 699 | ||
697 | mlx4_ib_mad_cleanup(ibdev); | 700 | mlx4_ib_mad_cleanup(ibdev); |
@@ -706,6 +709,10 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, | |||
706 | enum mlx4_dev_event event, int port) | 709 | enum mlx4_dev_event event, int port) |
707 | { | 710 | { |
708 | struct ib_event ibev; | 711 | struct ib_event ibev; |
712 | struct mlx4_ib_dev *ibdev = to_mdev((struct ib_device *) ibdev_ptr); | ||
713 | |||
714 | if (port > ibdev->num_ports) | ||
715 | return; | ||
709 | 716 | ||
710 | switch (event) { | 717 | switch (event) { |
711 | case MLX4_DEV_EVENT_PORT_UP: | 718 | case MLX4_DEV_EVENT_PORT_UP: |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index 6e2b0dc21b61..9974e886b8de 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -162,6 +162,7 @@ struct mlx4_ib_ah { | |||
162 | struct mlx4_ib_dev { | 162 | struct mlx4_ib_dev { |
163 | struct ib_device ib_dev; | 163 | struct ib_device ib_dev; |
164 | struct mlx4_dev *dev; | 164 | struct mlx4_dev *dev; |
165 | int num_ports; | ||
165 | void __iomem *uar_map; | 166 | void __iomem *uar_map; |
166 | 167 | ||
167 | struct mlx4_uar priv_uar; | 168 | struct mlx4_uar priv_uar; |