diff options
author | Roland Dreier <roland@purestorage.com> | 2012-03-12 19:25:28 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-03-12 19:25:28 -0400 |
commit | 42872c7a5ed8d3ed49f51cb783978ca50369c564 (patch) | |
tree | 0deea7b61c163e6997a4634ab4ee310014984688 /drivers/infiniband | |
parent | d927d505c59a0c7353343174e6225c43c61fba6d (diff) | |
parent | db5a7a65c05867cb6ff5cb6d556a0edfce631d2d (diff) |
Merge branches 'misc' and 'mlx4' into for-next
Conflicts:
drivers/infiniband/hw/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/main.c
include/linux/mlx4/device.h
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 97 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 1 |
3 files changed, 55 insertions, 46 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 09eb1d19e72d..77c8cb4c5073 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -748,8 +748,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
748 | break; | 748 | break; |
749 | } | 749 | } |
750 | 750 | ||
751 | if (npolled) | 751 | mlx4_cq_set_ci(&cq->mcq); |
752 | mlx4_cq_set_ci(&cq->mcq); | ||
753 | 752 | ||
754 | spin_unlock_irqrestore(&cq->lock, flags); | 753 | spin_unlock_irqrestore(&cq->lock, flags); |
755 | 754 | ||
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index abce99ed565f..75d305629300 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -163,7 +163,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
163 | props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm; | 163 | props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm; |
164 | props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * | 164 | props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * |
165 | props->max_mcast_grp; | 165 | props->max_mcast_grp; |
166 | props->max_map_per_fmr = (1 << (32 - ilog2(dev->dev->caps.num_mpts))) - 1; | 166 | props->max_map_per_fmr = dev->dev->caps.max_fmr_maps; |
167 | 167 | ||
168 | out: | 168 | out: |
169 | kfree(in_mad); | 169 | kfree(in_mad); |
@@ -182,12 +182,27 @@ mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | static int ib_link_query_port(struct ib_device *ibdev, u8 port, | 184 | static int ib_link_query_port(struct ib_device *ibdev, u8 port, |
185 | struct ib_port_attr *props, | 185 | struct ib_port_attr *props) |
186 | struct ib_smp *in_mad, | ||
187 | struct ib_smp *out_mad) | ||
188 | { | 186 | { |
187 | struct ib_smp *in_mad = NULL; | ||
188 | struct ib_smp *out_mad = NULL; | ||
189 | int ext_active_speed; | 189 | int ext_active_speed; |
190 | int err; | 190 | int err = -ENOMEM; |
191 | |||
192 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); | ||
193 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); | ||
194 | if (!in_mad || !out_mad) | ||
195 | goto out; | ||
196 | |||
197 | init_query_mad(in_mad); | ||
198 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; | ||
199 | in_mad->attr_mod = cpu_to_be32(port); | ||
200 | |||
201 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, NULL, NULL, | ||
202 | in_mad, out_mad); | ||
203 | if (err) | ||
204 | goto out; | ||
205 | |||
191 | 206 | ||
192 | props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); | 207 | props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); |
193 | props->lmc = out_mad->data[34] & 0x7; | 208 | props->lmc = out_mad->data[34] & 0x7; |
@@ -238,8 +253,10 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
238 | if (out_mad->data[15] & 0x1) | 253 | if (out_mad->data[15] & 0x1) |
239 | props->active_speed = IB_SPEED_FDR10; | 254 | props->active_speed = IB_SPEED_FDR10; |
240 | } | 255 | } |
241 | 256 | out: | |
242 | return 0; | 257 | kfree(in_mad); |
258 | kfree(out_mad); | ||
259 | return err; | ||
243 | } | 260 | } |
244 | 261 | ||
245 | static u8 state_to_phys_state(enum ib_port_state state) | 262 | static u8 state_to_phys_state(enum ib_port_state state) |
@@ -248,32 +265,42 @@ static u8 state_to_phys_state(enum ib_port_state state) | |||
248 | } | 265 | } |
249 | 266 | ||
250 | static int eth_link_query_port(struct ib_device *ibdev, u8 port, | 267 | static int eth_link_query_port(struct ib_device *ibdev, u8 port, |
251 | struct ib_port_attr *props, | 268 | struct ib_port_attr *props) |
252 | struct ib_smp *out_mad) | ||
253 | { | 269 | { |
254 | struct mlx4_ib_iboe *iboe = &to_mdev(ibdev)->iboe; | 270 | |
271 | struct mlx4_ib_dev *mdev = to_mdev(ibdev); | ||
272 | struct mlx4_ib_iboe *iboe = &mdev->iboe; | ||
255 | struct net_device *ndev; | 273 | struct net_device *ndev; |
256 | enum ib_mtu tmp; | 274 | enum ib_mtu tmp; |
275 | struct mlx4_cmd_mailbox *mailbox; | ||
276 | int err = 0; | ||
277 | |||
278 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | ||
279 | if (IS_ERR(mailbox)) | ||
280 | return PTR_ERR(mailbox); | ||
281 | |||
282 | err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, port, 0, | ||
283 | MLX4_CMD_QUERY_PORT, MLX4_CMD_TIME_CLASS_B, | ||
284 | MLX4_CMD_WRAPPED); | ||
285 | if (err) | ||
286 | goto out; | ||
257 | 287 | ||
258 | props->active_width = IB_WIDTH_1X; | 288 | props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ? |
289 | IB_WIDTH_4X : IB_WIDTH_1X; | ||
259 | props->active_speed = IB_SPEED_QDR; | 290 | props->active_speed = IB_SPEED_QDR; |
260 | props->port_cap_flags = IB_PORT_CM_SUP; | 291 | props->port_cap_flags = IB_PORT_CM_SUP; |
261 | props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port]; | 292 | props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; |
262 | props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz; | 293 | props->max_msg_sz = mdev->dev->caps.max_msg_sz; |
263 | props->pkey_tbl_len = 1; | 294 | props->pkey_tbl_len = 1; |
264 | props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46)); | ||
265 | props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48)); | ||
266 | props->max_mtu = IB_MTU_4096; | 295 | props->max_mtu = IB_MTU_4096; |
267 | props->subnet_timeout = 0; | 296 | props->max_vl_num = 2; |
268 | props->max_vl_num = out_mad->data[37] >> 4; | ||
269 | props->init_type_reply = 0; | ||
270 | props->state = IB_PORT_DOWN; | 297 | props->state = IB_PORT_DOWN; |
271 | props->phys_state = state_to_phys_state(props->state); | 298 | props->phys_state = state_to_phys_state(props->state); |
272 | props->active_mtu = IB_MTU_256; | 299 | props->active_mtu = IB_MTU_256; |
273 | spin_lock(&iboe->lock); | 300 | spin_lock(&iboe->lock); |
274 | ndev = iboe->netdevs[port - 1]; | 301 | ndev = iboe->netdevs[port - 1]; |
275 | if (!ndev) | 302 | if (!ndev) |
276 | goto out; | 303 | goto out_unlock; |
277 | 304 | ||
278 | tmp = iboe_get_mtu(ndev->mtu); | 305 | tmp = iboe_get_mtu(ndev->mtu); |
279 | props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; | 306 | props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; |
@@ -281,41 +308,23 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
281 | props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ? | 308 | props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ? |
282 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 309 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
283 | props->phys_state = state_to_phys_state(props->state); | 310 | props->phys_state = state_to_phys_state(props->state); |
284 | 311 | out_unlock: | |
285 | out: | ||
286 | spin_unlock(&iboe->lock); | 312 | spin_unlock(&iboe->lock); |
287 | return 0; | 313 | out: |
314 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | ||
315 | return err; | ||
288 | } | 316 | } |
289 | 317 | ||
290 | static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port, | 318 | static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port, |
291 | struct ib_port_attr *props) | 319 | struct ib_port_attr *props) |
292 | { | 320 | { |
293 | struct ib_smp *in_mad = NULL; | 321 | int err; |
294 | struct ib_smp *out_mad = NULL; | ||
295 | int err = -ENOMEM; | ||
296 | |||
297 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); | ||
298 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); | ||
299 | if (!in_mad || !out_mad) | ||
300 | goto out; | ||
301 | 322 | ||
302 | memset(props, 0, sizeof *props); | 323 | memset(props, 0, sizeof *props); |
303 | 324 | ||
304 | init_query_mad(in_mad); | ||
305 | in_mad->attr_id = IB_SMP_ATTR_PORT_INFO; | ||
306 | in_mad->attr_mod = cpu_to_be32(port); | ||
307 | |||
308 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, NULL, NULL, in_mad, out_mad); | ||
309 | if (err) | ||
310 | goto out; | ||
311 | |||
312 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? | 325 | err = mlx4_ib_port_link_layer(ibdev, port) == IB_LINK_LAYER_INFINIBAND ? |
313 | ib_link_query_port(ibdev, port, props, in_mad, out_mad) : | 326 | ib_link_query_port(ibdev, port, props) : |
314 | eth_link_query_port(ibdev, port, props, out_mad); | 327 | eth_link_query_port(ibdev, port, props); |
315 | |||
316 | out: | ||
317 | kfree(in_mad); | ||
318 | kfree(out_mad); | ||
319 | 328 | ||
320 | return err; | 329 | return err; |
321 | } | 330 | } |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index aa2aefa4236c..3a7848966627 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1884,6 +1884,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1884 | wmb(); | 1884 | wmb(); |
1885 | 1885 | ||
1886 | if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx4_ib_opcode)) { | 1886 | if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx4_ib_opcode)) { |
1887 | *bad_wr = wr; | ||
1887 | err = -EINVAL; | 1888 | err = -EINVAL; |
1888 | goto out; | 1889 | goto out; |
1889 | } | 1890 | } |