tangled
alpha
login
or
join now
tjh.dev
/
kernel
Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1
fork
atom
overview
issues
pulls
pipelines
Merge branches 'ehca' and 'mlx4' into for-linus
Roland Dreier
17 years ago
b0f43dcc
7ec4f463
+53
-1
5 changed files
expand all
collapse all
unified
split
drivers
infiniband
hw
mlx4
cq.c
net
mlx4
main.c
mlx4.h
port.c
include
linux
mlx4
device.h
+5
drivers/infiniband/hw/mlx4/cq.c
···
343
343
{
344
344
struct mlx4_ib_dev *dev = to_mdev(ibcq->device);
345
345
struct mlx4_ib_cq *cq = to_mcq(ibcq);
346
346
+
struct mlx4_mtt mtt;
346
347
int outst_cqe;
347
348
int err;
348
349
···
377
376
goto out;
378
377
}
379
378
379
379
+
mtt = cq->buf.mtt;
380
380
+
380
381
err = mlx4_cq_resize(dev->dev, &cq->mcq, entries, &cq->resize_buf->buf.mtt);
381
382
if (err)
382
383
goto err_buf;
383
384
385
385
+
mlx4_mtt_cleanup(dev->dev, &mtt);
384
386
if (ibcq->uobject) {
385
387
cq->buf = cq->resize_buf->buf;
386
388
cq->ibcq.cqe = cq->resize_buf->cqe;
···
410
406
goto out;
411
407
412
408
err_buf:
409
409
+
mlx4_mtt_cleanup(dev->dev, &cq->resize_buf->buf.mtt);
413
410
if (!ibcq->uobject)
414
411
mlx4_ib_free_cq_buf(dev, &cq->resize_buf->buf,
415
412
cq->resize_buf->cqe);
+8
drivers/net/mlx4/main.c
···
753
753
struct mlx4_priv *priv = mlx4_priv(dev);
754
754
int err;
755
755
int port;
756
756
+
__be32 ib_port_default_caps;
756
757
757
758
err = mlx4_init_uar_table(dev);
758
759
if (err) {
···
853
852
}
854
853
855
854
for (port = 1; port <= dev->caps.num_ports; port++) {
855
855
+
ib_port_default_caps = 0;
856
856
+
err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps);
857
857
+
if (err)
858
858
+
mlx4_warn(dev, "failed to get port %d default "
859
859
+
"ib capabilities (%d). Continuing with "
860
860
+
"caps = 0\n", port, err);
861
861
+
dev->caps.ib_port_def_cap[port] = ib_port_default_caps;
856
862
err = mlx4_SET_PORT(dev, port);
857
863
if (err) {
858
864
mlx4_err(dev, "Failed to set port %d, aborting\n",
+1
drivers/net/mlx4/mlx4.h
···
385
385
void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table);
386
386
387
387
int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port);
388
388
+
int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps);
388
389
389
390
#endif /* MLX4_H */
+38
-1
drivers/net/mlx4/port.c
···
258
258
}
259
259
EXPORT_SYMBOL_GPL(mlx4_unregister_vlan);
260
260
261
261
+
int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
262
262
+
{
263
263
+
struct mlx4_cmd_mailbox *inmailbox, *outmailbox;
264
264
+
u8 *inbuf, *outbuf;
265
265
+
int err;
266
266
+
267
267
+
inmailbox = mlx4_alloc_cmd_mailbox(dev);
268
268
+
if (IS_ERR(inmailbox))
269
269
+
return PTR_ERR(inmailbox);
270
270
+
271
271
+
outmailbox = mlx4_alloc_cmd_mailbox(dev);
272
272
+
if (IS_ERR(outmailbox)) {
273
273
+
mlx4_free_cmd_mailbox(dev, inmailbox);
274
274
+
return PTR_ERR(outmailbox);
275
275
+
}
276
276
+
277
277
+
inbuf = inmailbox->buf;
278
278
+
outbuf = outmailbox->buf;
279
279
+
memset(inbuf, 0, 256);
280
280
+
memset(outbuf, 0, 256);
281
281
+
inbuf[0] = 1;
282
282
+
inbuf[1] = 1;
283
283
+
inbuf[2] = 1;
284
284
+
inbuf[3] = 1;
285
285
+
*(__be16 *) (&inbuf[16]) = cpu_to_be16(0x0015);
286
286
+
*(__be32 *) (&inbuf[20]) = cpu_to_be32(port);
287
287
+
288
288
+
err = mlx4_cmd_box(dev, inmailbox->dma, outmailbox->dma, port, 3,
289
289
+
MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C);
290
290
+
if (!err)
291
291
+
*caps = *(__be32 *) (outbuf + 84);
292
292
+
mlx4_free_cmd_mailbox(dev, inmailbox);
293
293
+
mlx4_free_cmd_mailbox(dev, outmailbox);
294
294
+
return err;
295
295
+
}
296
296
+
261
297
int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
262
298
{
263
299
struct mlx4_cmd_mailbox *mailbox;
···
309
273
((u8 *) mailbox->buf)[3] = 6;
310
274
((__be16 *) mailbox->buf)[4] = cpu_to_be16(1 << 15);
311
275
((__be16 *) mailbox->buf)[6] = cpu_to_be16(1 << 15);
312
312
-
}
276
276
+
} else
277
277
+
((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
313
278
err = mlx4_cmd(dev, mailbox->dma, port, is_eth, MLX4_CMD_SET_PORT,
314
279
MLX4_CMD_TIME_CLASS_B);
315
280
+1
include/linux/mlx4/device.h
···
179
179
int num_ports;
180
180
int vl_cap[MLX4_MAX_PORTS + 1];
181
181
int ib_mtu_cap[MLX4_MAX_PORTS + 1];
182
182
+
__be32 ib_port_def_cap[MLX4_MAX_PORTS + 1];
182
183
u64 def_mac[MLX4_MAX_PORTS + 1];
183
184
int eth_mtu_cap[MLX4_MAX_PORTS + 1];
184
185
int gid_table_len[MLX4_MAX_PORTS + 1];