diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx4/main.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index fbe1973f77b0..fa643f4f4e28 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -816,7 +816,7 @@ static void update_gids_task(struct work_struct *work) | |||
816 | memcpy(gw->dev->iboe.gid_table[gw->port - 1], gw->gids, sizeof gw->gids); | 816 | memcpy(gw->dev->iboe.gid_table[gw->port - 1], gw->gids, sizeof gw->gids); |
817 | event.device = &gw->dev->ib_dev; | 817 | event.device = &gw->dev->ib_dev; |
818 | event.element.port_num = gw->port; | 818 | event.element.port_num = gw->port; |
819 | event.event = IB_EVENT_LID_CHANGE; | 819 | event.event = IB_EVENT_GID_CHANGE; |
820 | ib_dispatch_event(&event); | 820 | ib_dispatch_event(&event); |
821 | } | 821 | } |
822 | 822 | ||
@@ -1098,11 +1098,21 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
1098 | if (init_node_data(ibdev)) | 1098 | if (init_node_data(ibdev)) |
1099 | goto err_map; | 1099 | goto err_map; |
1100 | 1100 | ||
1101 | for (i = 0; i < ibdev->num_ports; ++i) { | ||
1102 | if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) == | ||
1103 | IB_LINK_LAYER_ETHERNET) { | ||
1104 | err = mlx4_counter_alloc(ibdev->dev, &ibdev->counters[i]); | ||
1105 | if (err) | ||
1106 | ibdev->counters[i] = -1; | ||
1107 | } else | ||
1108 | ibdev->counters[i] = -1; | ||
1109 | } | ||
1110 | |||
1101 | spin_lock_init(&ibdev->sm_lock); | 1111 | spin_lock_init(&ibdev->sm_lock); |
1102 | mutex_init(&ibdev->cap_mask_mutex); | 1112 | mutex_init(&ibdev->cap_mask_mutex); |
1103 | 1113 | ||
1104 | if (ib_register_device(&ibdev->ib_dev, NULL)) | 1114 | if (ib_register_device(&ibdev->ib_dev, NULL)) |
1105 | goto err_map; | 1115 | goto err_counter; |
1106 | 1116 | ||
1107 | if (mlx4_ib_mad_init(ibdev)) | 1117 | if (mlx4_ib_mad_init(ibdev)) |
1108 | goto err_reg; | 1118 | goto err_reg; |
@@ -1132,6 +1142,10 @@ err_notif: | |||
1132 | err_reg: | 1142 | err_reg: |
1133 | ib_unregister_device(&ibdev->ib_dev); | 1143 | ib_unregister_device(&ibdev->ib_dev); |
1134 | 1144 | ||
1145 | err_counter: | ||
1146 | for (; i; --i) | ||
1147 | mlx4_counter_free(ibdev->dev, ibdev->counters[i - 1]); | ||
1148 | |||
1135 | err_map: | 1149 | err_map: |
1136 | iounmap(ibdev->uar_map); | 1150 | iounmap(ibdev->uar_map); |
1137 | 1151 | ||
@@ -1160,7 +1174,8 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | |||
1160 | ibdev->iboe.nb.notifier_call = NULL; | 1174 | ibdev->iboe.nb.notifier_call = NULL; |
1161 | } | 1175 | } |
1162 | iounmap(ibdev->uar_map); | 1176 | iounmap(ibdev->uar_map); |
1163 | 1177 | for (p = 0; p < ibdev->num_ports; ++p) | |
1178 | mlx4_counter_free(ibdev->dev, ibdev->counters[p]); | ||
1164 | mlx4_foreach_port(p, dev, MLX4_PORT_TYPE_IB) | 1179 | mlx4_foreach_port(p, dev, MLX4_PORT_TYPE_IB) |
1165 | mlx4_CLOSE_PORT(dev, p); | 1180 | mlx4_CLOSE_PORT(dev, p); |
1166 | 1181 | ||