diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-02 14:09:50 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-02 14:09:50 -0500 |
commit | a64d31baed104be25305e9c71585d3ea4ee9a418 (patch) | |
tree | 470e3c59ef39f38bcd69f8fef7dba8f76afbec53 /drivers/net/mlx4 | |
parent | 1c39194878c09bd88ffc9c9d4c2f01c3397c7aed (diff) | |
parent | 061e41fdb5047b1fb161e89664057835935ca1d2 (diff) |
Merge branch 'linus' into cpus4096
Conflicts:
kernel/trace/ring_buffer.c
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r-- | drivers/net/mlx4/main.c | 8 | ||||
-rw-r--r-- | drivers/net/mlx4/mlx4.h | 1 | ||||
-rw-r--r-- | drivers/net/mlx4/port.c | 39 |
3 files changed, 47 insertions, 1 deletions
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 468921b8f4b6..90a0281d15ea 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -753,6 +753,7 @@ static int mlx4_setup_hca(struct mlx4_dev *dev) | |||
753 | struct mlx4_priv *priv = mlx4_priv(dev); | 753 | struct mlx4_priv *priv = mlx4_priv(dev); |
754 | int err; | 754 | int err; |
755 | int port; | 755 | int port; |
756 | __be32 ib_port_default_caps; | ||
756 | 757 | ||
757 | err = mlx4_init_uar_table(dev); | 758 | err = mlx4_init_uar_table(dev); |
758 | if (err) { | 759 | if (err) { |
@@ -852,6 +853,13 @@ static int mlx4_setup_hca(struct mlx4_dev *dev) | |||
852 | } | 853 | } |
853 | 854 | ||
854 | for (port = 1; port <= dev->caps.num_ports; port++) { | 855 | for (port = 1; port <= dev->caps.num_ports; port++) { |
856 | ib_port_default_caps = 0; | ||
857 | err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps); | ||
858 | if (err) | ||
859 | mlx4_warn(dev, "failed to get port %d default " | ||
860 | "ib capabilities (%d). Continuing with " | ||
861 | "caps = 0\n", port, err); | ||
862 | dev->caps.ib_port_def_cap[port] = ib_port_default_caps; | ||
855 | err = mlx4_SET_PORT(dev, port); | 863 | err = mlx4_SET_PORT(dev, port); |
856 | if (err) { | 864 | if (err) { |
857 | mlx4_err(dev, "Failed to set port %d, aborting\n", | 865 | mlx4_err(dev, "Failed to set port %d, aborting\n", |
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 56a2e213fe62..34c909deaff3 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
@@ -385,5 +385,6 @@ void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table); | |||
385 | void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table); | 385 | void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table); |
386 | 386 | ||
387 | int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port); | 387 | int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port); |
388 | int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps); | ||
388 | 389 | ||
389 | #endif /* MLX4_H */ | 390 | #endif /* MLX4_H */ |
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 | ||