diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-06-18 11:15:02 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-06-18 11:15:02 -0400 |
commit | 5ae2a7a836be660ff1621cce1c46930f19200589 (patch) | |
tree | 655b94b9a016cec92f319761afe6bb3000f5f4fa /drivers/infiniband/hw/mlx4/main.c | |
parent | 082dee3216c99a838af40be403799f60bcea2e97 (diff) |
IB/mlx4: Handle FW command interface rev 3
Upcoming firmware introduces command interface revision 3, which
changes the way port capabilities are queried and set. Update the
driver to handle both the new and old command interfaces by adding a
new MLX4_FLAG_OLD_PORT_CMDS that it is set after querying the firmware
interface revision and then using the correct interface based on the
setting of the flag.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/main.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 402f3a20ec0a..1095c82b38c2 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -125,7 +125,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
125 | props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay; | 125 | props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay; |
126 | props->atomic_cap = dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_ATOMIC ? | 126 | props->atomic_cap = dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_ATOMIC ? |
127 | IB_ATOMIC_HCA : IB_ATOMIC_NONE; | 127 | IB_ATOMIC_HCA : IB_ATOMIC_NONE; |
128 | props->max_pkeys = dev->dev->caps.pkey_table_len; | 128 | props->max_pkeys = dev->dev->caps.pkey_table_len[1]; |
129 | props->max_mcast_grp = dev->dev->caps.num_mgms + dev->dev->caps.num_amgms; | 129 | props->max_mcast_grp = dev->dev->caps.num_mgms + dev->dev->caps.num_amgms; |
130 | props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm; | 130 | props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm; |
131 | props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * | 131 | props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * |
@@ -168,9 +168,9 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port, | |||
168 | props->state = out_mad->data[32] & 0xf; | 168 | props->state = out_mad->data[32] & 0xf; |
169 | props->phys_state = out_mad->data[33] >> 4; | 169 | props->phys_state = out_mad->data[33] >> 4; |
170 | props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20)); | 170 | props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20)); |
171 | props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len; | 171 | props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port]; |
172 | props->max_msg_sz = 0x80000000; | 172 | props->max_msg_sz = 0x80000000; |
173 | props->pkey_tbl_len = to_mdev(ibdev)->dev->caps.pkey_table_len; | 173 | props->pkey_tbl_len = to_mdev(ibdev)->dev->caps.pkey_table_len[port]; |
174 | props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46)); | 174 | props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46)); |
175 | props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48)); | 175 | props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48)); |
176 | props->active_width = out_mad->data[31] & 0xf; | 176 | props->active_width = out_mad->data[31] & 0xf; |
@@ -280,8 +280,14 @@ static int mlx4_SET_PORT(struct mlx4_ib_dev *dev, u8 port, int reset_qkey_viols, | |||
280 | return PTR_ERR(mailbox); | 280 | return PTR_ERR(mailbox); |
281 | 281 | ||
282 | memset(mailbox->buf, 0, 256); | 282 | memset(mailbox->buf, 0, 256); |
283 | *(u8 *) mailbox->buf = !!reset_qkey_viols << 6; | 283 | |
284 | ((__be32 *) mailbox->buf)[2] = cpu_to_be32(cap_mask); | 284 | if (dev->dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
285 | *(u8 *) mailbox->buf = !!reset_qkey_viols << 6; | ||
286 | ((__be32 *) mailbox->buf)[2] = cpu_to_be32(cap_mask); | ||
287 | } else { | ||
288 | ((u8 *) mailbox->buf)[3] = !!reset_qkey_viols; | ||
289 | ((__be32 *) mailbox->buf)[1] = cpu_to_be32(cap_mask); | ||
290 | } | ||
285 | 291 | ||
286 | err = mlx4_cmd(dev->dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, | 292 | err = mlx4_cmd(dev->dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, |
287 | MLX4_CMD_TIME_CLASS_B); | 293 | MLX4_CMD_TIME_CLASS_B); |