diff options
Diffstat (limited to 'drivers/net/mlx4/port.c')
-rw-r--r-- | drivers/net/mlx4/port.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index e2fdab42c4ce..0a057e5dc63b 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c | |||
@@ -258,6 +258,42 @@ out: | |||
258 | } | 258 | } |
259 | EXPORT_SYMBOL_GPL(mlx4_unregister_vlan); | 259 | EXPORT_SYMBOL_GPL(mlx4_unregister_vlan); |
260 | 260 | ||
261 | int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps) | ||
262 | { | ||
263 | struct mlx4_cmd_mailbox *inmailbox, *outmailbox; | ||
264 | u8 *inbuf, *outbuf; | ||
265 | int err; | ||
266 | |||
267 | inmailbox = mlx4_alloc_cmd_mailbox(dev); | ||
268 | if (IS_ERR(inmailbox)) | ||
269 | return PTR_ERR(inmailbox); | ||
270 | |||
271 | outmailbox = mlx4_alloc_cmd_mailbox(dev); | ||
272 | if (IS_ERR(outmailbox)) { | ||
273 | mlx4_free_cmd_mailbox(dev, inmailbox); | ||
274 | return PTR_ERR(outmailbox); | ||
275 | } | ||
276 | |||
277 | inbuf = inmailbox->buf; | ||
278 | outbuf = outmailbox->buf; | ||
279 | memset(inbuf, 0, 256); | ||
280 | memset(outbuf, 0, 256); | ||
281 | inbuf[0] = 1; | ||
282 | inbuf[1] = 1; | ||
283 | inbuf[2] = 1; | ||
284 | inbuf[3] = 1; | ||
285 | *(__be16 *) (&inbuf[16]) = cpu_to_be16(0x0015); | ||
286 | *(__be32 *) (&inbuf[20]) = cpu_to_be32(port); | ||
287 | |||
288 | err = mlx4_cmd_box(dev, inmailbox->dma, outmailbox->dma, port, 3, | ||
289 | MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C); | ||
290 | if (!err) | ||
291 | *caps = *(__be32 *) (outbuf + 84); | ||
292 | mlx4_free_cmd_mailbox(dev, inmailbox); | ||
293 | mlx4_free_cmd_mailbox(dev, outmailbox); | ||
294 | return err; | ||
295 | } | ||
296 | |||
261 | int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) | 297 | int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) |
262 | { | 298 | { |
263 | struct mlx4_cmd_mailbox *mailbox; | 299 | struct mlx4_cmd_mailbox *mailbox; |
@@ -273,7 +309,8 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) | |||
273 | ((u8 *) mailbox->buf)[3] = 6; | 309 | ((u8 *) mailbox->buf)[3] = 6; |
274 | ((__be16 *) mailbox->buf)[4] = cpu_to_be16(1 << 15); | 310 | ((__be16 *) mailbox->buf)[4] = cpu_to_be16(1 << 15); |
275 | ((__be16 *) mailbox->buf)[6] = cpu_to_be16(1 << 15); | 311 | ((__be16 *) mailbox->buf)[6] = cpu_to_be16(1 << 15); |
276 | } | 312 | } else |
313 | ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port]; | ||
277 | err = mlx4_cmd(dev, mailbox->dma, port, is_eth, MLX4_CMD_SET_PORT, | 314 | err = mlx4_cmd(dev, mailbox->dma, port, is_eth, MLX4_CMD_SET_PORT, |
278 | MLX4_CMD_TIME_CLASS_B); | 315 | MLX4_CMD_TIME_CLASS_B); |
279 | 316 | ||