diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2008-10-22 18:38:42 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-10-22 18:38:42 -0400 |
commit | 7ff93f8b7ecbc36e7ffc5c11a61643821c1bfee5 (patch) | |
tree | 4b38e1ead8b27a480cc766f6927dccf5b63793ae /drivers/net/mlx4/port.c | |
parent | 2a2336f8228292b8197f4187e54b0748903e6645 (diff) |
mlx4_core: Multiple port type support
Multi-protocol adapters support different port types. Each consumer
of mlx4_core queries for supported port types; in particular mlx4_ib
can no longer assume that all physical ports belong to it. Port type
is configured through a sysfs interface. When the type of a port is
changed, all mlx4 interfaces are unregistered, and then registered
again with the new port types.
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4/port.c')
-rw-r--r-- | drivers/net/mlx4/port.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 8644f3d978ee..e2fdab42c4ce 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c | |||
@@ -257,3 +257,26 @@ out: | |||
257 | mutex_unlock(&table->mutex); | 257 | mutex_unlock(&table->mutex); |
258 | } | 258 | } |
259 | EXPORT_SYMBOL_GPL(mlx4_unregister_vlan); | 259 | EXPORT_SYMBOL_GPL(mlx4_unregister_vlan); |
260 | |||
261 | int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) | ||
262 | { | ||
263 | struct mlx4_cmd_mailbox *mailbox; | ||
264 | int err; | ||
265 | u8 is_eth = dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH; | ||
266 | |||
267 | mailbox = mlx4_alloc_cmd_mailbox(dev); | ||
268 | if (IS_ERR(mailbox)) | ||
269 | return PTR_ERR(mailbox); | ||
270 | |||
271 | memset(mailbox->buf, 0, 256); | ||
272 | if (is_eth) { | ||
273 | ((u8 *) mailbox->buf)[3] = 6; | ||
274 | ((__be16 *) mailbox->buf)[4] = cpu_to_be16(1 << 15); | ||
275 | ((__be16 *) mailbox->buf)[6] = cpu_to_be16(1 << 15); | ||
276 | } | ||
277 | err = mlx4_cmd(dev, mailbox->dma, port, is_eth, MLX4_CMD_SET_PORT, | ||
278 | MLX4_CMD_TIME_CLASS_B); | ||
279 | |||
280 | mlx4_free_cmd_mailbox(dev, mailbox); | ||
281 | return err; | ||
282 | } | ||