mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
This commit is contained in:
parent
2a2336f822
commit
7ff93f8b7e
9 changed files with 266 additions and 11 deletions
|
|
@ -298,7 +298,7 @@ int mlx4_ib_mad_init(struct mlx4_ib_dev *dev)
|
|||
int p, q;
|
||||
int ret;
|
||||
|
||||
for (p = 0; p < dev->dev->caps.num_ports; ++p)
|
||||
for (p = 0; p < dev->num_ports; ++p)
|
||||
for (q = 0; q <= 1; ++q) {
|
||||
agent = ib_register_mad_agent(&dev->ib_dev, p + 1,
|
||||
q ? IB_QPT_GSI : IB_QPT_SMI,
|
||||
|
|
@ -314,7 +314,7 @@ int mlx4_ib_mad_init(struct mlx4_ib_dev *dev)
|
|||
return 0;
|
||||
|
||||
err:
|
||||
for (p = 0; p < dev->dev->caps.num_ports; ++p)
|
||||
for (p = 0; p < dev->num_ports; ++p)
|
||||
for (q = 0; q <= 1; ++q)
|
||||
if (dev->send_agent[p][q])
|
||||
ib_unregister_mad_agent(dev->send_agent[p][q]);
|
||||
|
|
@ -327,7 +327,7 @@ void mlx4_ib_mad_cleanup(struct mlx4_ib_dev *dev)
|
|||
struct ib_mad_agent *agent;
|
||||
int p, q;
|
||||
|
||||
for (p = 0; p < dev->dev->caps.num_ports; ++p) {
|
||||
for (p = 0; p < dev->num_ports; ++p) {
|
||||
for (q = 0; q <= 1; ++q) {
|
||||
agent = dev->send_agent[p][q];
|
||||
dev->send_agent[p][q] = NULL;
|
||||
|
|
|
|||
|
|
@ -574,7 +574,10 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
|
|||
ibdev->ib_dev.owner = THIS_MODULE;
|
||||
ibdev->ib_dev.node_type = RDMA_NODE_IB_CA;
|
||||
ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey;
|
||||
ibdev->ib_dev.phys_port_cnt = dev->caps.num_ports;
|
||||
ibdev->num_ports = 0;
|
||||
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
|
||||
ibdev->num_ports++;
|
||||
ibdev->ib_dev.phys_port_cnt = ibdev->num_ports;
|
||||
ibdev->ib_dev.num_comp_vectors = 1;
|
||||
ibdev->ib_dev.dma_device = &dev->pdev->dev;
|
||||
|
||||
|
|
@ -691,7 +694,7 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr)
|
|||
struct mlx4_ib_dev *ibdev = ibdev_ptr;
|
||||
int p;
|
||||
|
||||
for (p = 1; p <= dev->caps.num_ports; ++p)
|
||||
for (p = 1; p <= ibdev->num_ports; ++p)
|
||||
mlx4_CLOSE_PORT(dev, p);
|
||||
|
||||
mlx4_ib_mad_cleanup(ibdev);
|
||||
|
|
@ -706,6 +709,10 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
|
|||
enum mlx4_dev_event event, int port)
|
||||
{
|
||||
struct ib_event ibev;
|
||||
struct mlx4_ib_dev *ibdev = to_mdev((struct ib_device *) ibdev_ptr);
|
||||
|
||||
if (port > ibdev->num_ports)
|
||||
return;
|
||||
|
||||
switch (event) {
|
||||
case MLX4_DEV_EVENT_PORT_UP:
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ struct mlx4_ib_ah {
|
|||
struct mlx4_ib_dev {
|
||||
struct ib_device ib_dev;
|
||||
struct mlx4_dev *dev;
|
||||
int num_ports;
|
||||
void __iomem *uar_map;
|
||||
|
||||
struct mlx4_uar priv_uar;
|
||||
|
|
|
|||
Loading…
Reference in a new issue