Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. |
Jack Morgenstein | 51a379d | 2008-07-25 10:32:52 -0700 | [diff] [blame] | 3 | * Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved. |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 4 | * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved. |
| 5 | * |
| 6 | * This software is available to you under a choice of one of two |
| 7 | * licenses. You may choose to be licensed under the terms of the GNU |
| 8 | * General Public License (GPL) Version 2, available from the file |
| 9 | * COPYING in the main directory of this source tree, or the |
| 10 | * OpenIB.org BSD license below: |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or |
| 13 | * without modification, are permitted provided that the following |
| 14 | * conditions are met: |
| 15 | * |
| 16 | * - Redistributions of source code must retain the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer. |
| 19 | * |
| 20 | * - Redistributions in binary form must reproduce the above |
| 21 | * copyright notice, this list of conditions and the following |
| 22 | * disclaimer in the documentation and/or other materials |
| 23 | * provided with the distribution. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 | * SOFTWARE. |
| 33 | */ |
| 34 | |
| 35 | #include <linux/mlx4/cmd.h> |
Eli Cohen | c57e20dcf | 2009-09-24 11:03:03 -0700 | [diff] [blame] | 36 | #include <linux/cache.h> |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 37 | |
| 38 | #include "fw.h" |
| 39 | #include "icm.h" |
| 40 | |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 41 | enum { |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 42 | MLX4_COMMAND_INTERFACE_MIN_REV = 2, |
| 43 | MLX4_COMMAND_INTERFACE_MAX_REV = 3, |
| 44 | MLX4_COMMAND_INTERFACE_NEW_PORT_CMDS = 3, |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 47 | extern void __buggy_use_of_MLX4_GET(void); |
| 48 | extern void __buggy_use_of_MLX4_PUT(void); |
| 49 | |
Jack Morgenstein | 51f5f0e | 2008-07-22 14:19:37 -0700 | [diff] [blame] | 50 | static int enable_qos; |
| 51 | module_param(enable_qos, bool, 0444); |
| 52 | MODULE_PARM_DESC(enable_qos, "Enable Quality of Service support in the HCA (default: off)"); |
| 53 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 54 | #define MLX4_GET(dest, source, offset) \ |
| 55 | do { \ |
| 56 | void *__p = (char *) (source) + (offset); \ |
| 57 | switch (sizeof (dest)) { \ |
| 58 | case 1: (dest) = *(u8 *) __p; break; \ |
| 59 | case 2: (dest) = be16_to_cpup(__p); break; \ |
| 60 | case 4: (dest) = be32_to_cpup(__p); break; \ |
| 61 | case 8: (dest) = be64_to_cpup(__p); break; \ |
| 62 | default: __buggy_use_of_MLX4_GET(); \ |
| 63 | } \ |
| 64 | } while (0) |
| 65 | |
| 66 | #define MLX4_PUT(dest, source, offset) \ |
| 67 | do { \ |
| 68 | void *__d = ((char *) (dest) + (offset)); \ |
| 69 | switch (sizeof(source)) { \ |
| 70 | case 1: *(u8 *) __d = (source); break; \ |
| 71 | case 2: *(__be16 *) __d = cpu_to_be16(source); break; \ |
| 72 | case 4: *(__be32 *) __d = cpu_to_be32(source); break; \ |
| 73 | case 8: *(__be64 *) __d = cpu_to_be64(source); break; \ |
| 74 | default: __buggy_use_of_MLX4_PUT(); \ |
| 75 | } \ |
| 76 | } while (0) |
| 77 | |
| 78 | static void dump_dev_cap_flags(struct mlx4_dev *dev, u32 flags) |
| 79 | { |
| 80 | static const char *fname[] = { |
| 81 | [ 0] = "RC transport", |
| 82 | [ 1] = "UC transport", |
| 83 | [ 2] = "UD transport", |
Roland Dreier | ea98054 | 2007-10-09 19:59:13 -0700 | [diff] [blame] | 84 | [ 3] = "XRC transport", |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 85 | [ 4] = "reliable multicast", |
| 86 | [ 5] = "FCoIB support", |
| 87 | [ 6] = "SRQ support", |
| 88 | [ 7] = "IPoIB checksum offload", |
| 89 | [ 8] = "P_Key violation counter", |
| 90 | [ 9] = "Q_Key violation counter", |
| 91 | [10] = "VMM", |
Yevgeny Petrilin | 7ff93f8 | 2008-10-22 15:38:42 -0700 | [diff] [blame] | 92 | [12] = "DPDP", |
Eli Cohen | 417608c | 2009-11-12 11:19:44 -0800 | [diff] [blame] | 93 | [15] = "Big LSO headers", |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 94 | [16] = "MW support", |
| 95 | [17] = "APM support", |
| 96 | [18] = "Atomic ops support", |
| 97 | [19] = "Raw multicast support", |
| 98 | [20] = "Address vector port checking support", |
| 99 | [21] = "UD multicast support", |
| 100 | [24] = "Demand paging support", |
Eli Cohen | 96dfa68 | 2010-10-20 21:57:02 -0700 | [diff] [blame^] | 101 | [25] = "Router support", |
| 102 | [30] = "IBoE support" |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 103 | }; |
| 104 | int i; |
| 105 | |
| 106 | mlx4_dbg(dev, "DEV_CAP flags:\n"); |
Roland Dreier | 23c15c2 | 2007-05-19 08:51:57 -0700 | [diff] [blame] | 107 | for (i = 0; i < ARRAY_SIZE(fname); ++i) |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 108 | if (fname[i] && (flags & (1 << i))) |
| 109 | mlx4_dbg(dev, " %s\n", fname[i]); |
| 110 | } |
| 111 | |
Vladimir Sokolovsky | 2d92865 | 2008-07-14 23:48:53 -0700 | [diff] [blame] | 112 | int mlx4_MOD_STAT_CFG(struct mlx4_dev *dev, struct mlx4_mod_stat_cfg *cfg) |
| 113 | { |
| 114 | struct mlx4_cmd_mailbox *mailbox; |
| 115 | u32 *inbox; |
| 116 | int err = 0; |
| 117 | |
| 118 | #define MOD_STAT_CFG_IN_SIZE 0x100 |
| 119 | |
| 120 | #define MOD_STAT_CFG_PG_SZ_M_OFFSET 0x002 |
| 121 | #define MOD_STAT_CFG_PG_SZ_OFFSET 0x003 |
| 122 | |
| 123 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 124 | if (IS_ERR(mailbox)) |
| 125 | return PTR_ERR(mailbox); |
| 126 | inbox = mailbox->buf; |
| 127 | |
| 128 | memset(inbox, 0, MOD_STAT_CFG_IN_SIZE); |
| 129 | |
| 130 | MLX4_PUT(inbox, cfg->log_pg_sz, MOD_STAT_CFG_PG_SZ_OFFSET); |
| 131 | MLX4_PUT(inbox, cfg->log_pg_sz_m, MOD_STAT_CFG_PG_SZ_M_OFFSET); |
| 132 | |
| 133 | err = mlx4_cmd(dev, mailbox->dma, 0, 0, MLX4_CMD_MOD_STAT_CFG, |
| 134 | MLX4_CMD_TIME_CLASS_A); |
| 135 | |
| 136 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 137 | return err; |
| 138 | } |
| 139 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 140 | int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) |
| 141 | { |
| 142 | struct mlx4_cmd_mailbox *mailbox; |
| 143 | u32 *outbox; |
| 144 | u8 field; |
| 145 | u16 size; |
| 146 | u16 stat_rate; |
| 147 | int err; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 148 | int i; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 149 | |
| 150 | #define QUERY_DEV_CAP_OUT_SIZE 0x100 |
| 151 | #define QUERY_DEV_CAP_MAX_SRQ_SZ_OFFSET 0x10 |
| 152 | #define QUERY_DEV_CAP_MAX_QP_SZ_OFFSET 0x11 |
| 153 | #define QUERY_DEV_CAP_RSVD_QP_OFFSET 0x12 |
| 154 | #define QUERY_DEV_CAP_MAX_QP_OFFSET 0x13 |
| 155 | #define QUERY_DEV_CAP_RSVD_SRQ_OFFSET 0x14 |
| 156 | #define QUERY_DEV_CAP_MAX_SRQ_OFFSET 0x15 |
| 157 | #define QUERY_DEV_CAP_RSVD_EEC_OFFSET 0x16 |
| 158 | #define QUERY_DEV_CAP_MAX_EEC_OFFSET 0x17 |
| 159 | #define QUERY_DEV_CAP_MAX_CQ_SZ_OFFSET 0x19 |
| 160 | #define QUERY_DEV_CAP_RSVD_CQ_OFFSET 0x1a |
| 161 | #define QUERY_DEV_CAP_MAX_CQ_OFFSET 0x1b |
| 162 | #define QUERY_DEV_CAP_MAX_MPT_OFFSET 0x1d |
| 163 | #define QUERY_DEV_CAP_RSVD_EQ_OFFSET 0x1e |
| 164 | #define QUERY_DEV_CAP_MAX_EQ_OFFSET 0x1f |
| 165 | #define QUERY_DEV_CAP_RSVD_MTT_OFFSET 0x20 |
| 166 | #define QUERY_DEV_CAP_MAX_MRW_SZ_OFFSET 0x21 |
| 167 | #define QUERY_DEV_CAP_RSVD_MRW_OFFSET 0x22 |
| 168 | #define QUERY_DEV_CAP_MAX_MTT_SEG_OFFSET 0x23 |
| 169 | #define QUERY_DEV_CAP_MAX_AV_OFFSET 0x27 |
| 170 | #define QUERY_DEV_CAP_MAX_REQ_QP_OFFSET 0x29 |
| 171 | #define QUERY_DEV_CAP_MAX_RES_QP_OFFSET 0x2b |
Eli Cohen | b832be1 | 2008-04-16 21:09:27 -0700 | [diff] [blame] | 172 | #define QUERY_DEV_CAP_MAX_GSO_OFFSET 0x2d |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 173 | #define QUERY_DEV_CAP_MAX_RDMA_OFFSET 0x2f |
| 174 | #define QUERY_DEV_CAP_RSZ_SRQ_OFFSET 0x33 |
| 175 | #define QUERY_DEV_CAP_ACK_DELAY_OFFSET 0x35 |
| 176 | #define QUERY_DEV_CAP_MTU_WIDTH_OFFSET 0x36 |
| 177 | #define QUERY_DEV_CAP_VL_PORT_OFFSET 0x37 |
Dotan Barak | 149983af | 2007-06-26 15:55:28 +0300 | [diff] [blame] | 178 | #define QUERY_DEV_CAP_MAX_MSG_SZ_OFFSET 0x38 |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 179 | #define QUERY_DEV_CAP_MAX_GID_OFFSET 0x3b |
| 180 | #define QUERY_DEV_CAP_RATE_SUPPORT_OFFSET 0x3c |
| 181 | #define QUERY_DEV_CAP_MAX_PKEY_OFFSET 0x3f |
| 182 | #define QUERY_DEV_CAP_FLAGS_OFFSET 0x44 |
| 183 | #define QUERY_DEV_CAP_RSVD_UAR_OFFSET 0x48 |
| 184 | #define QUERY_DEV_CAP_UAR_SZ_OFFSET 0x49 |
| 185 | #define QUERY_DEV_CAP_PAGE_SZ_OFFSET 0x4b |
| 186 | #define QUERY_DEV_CAP_BF_OFFSET 0x4c |
| 187 | #define QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET 0x4d |
| 188 | #define QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET 0x4e |
| 189 | #define QUERY_DEV_CAP_LOG_MAX_BF_PAGES_OFFSET 0x4f |
| 190 | #define QUERY_DEV_CAP_MAX_SG_SQ_OFFSET 0x51 |
| 191 | #define QUERY_DEV_CAP_MAX_DESC_SZ_SQ_OFFSET 0x52 |
| 192 | #define QUERY_DEV_CAP_MAX_SG_RQ_OFFSET 0x55 |
| 193 | #define QUERY_DEV_CAP_MAX_DESC_SZ_RQ_OFFSET 0x56 |
| 194 | #define QUERY_DEV_CAP_MAX_QP_MCG_OFFSET 0x61 |
| 195 | #define QUERY_DEV_CAP_RSVD_MCG_OFFSET 0x62 |
| 196 | #define QUERY_DEV_CAP_MAX_MCG_OFFSET 0x63 |
| 197 | #define QUERY_DEV_CAP_RSVD_PD_OFFSET 0x64 |
| 198 | #define QUERY_DEV_CAP_MAX_PD_OFFSET 0x65 |
| 199 | #define QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET 0x80 |
| 200 | #define QUERY_DEV_CAP_QPC_ENTRY_SZ_OFFSET 0x82 |
| 201 | #define QUERY_DEV_CAP_AUX_ENTRY_SZ_OFFSET 0x84 |
| 202 | #define QUERY_DEV_CAP_ALTC_ENTRY_SZ_OFFSET 0x86 |
| 203 | #define QUERY_DEV_CAP_EQC_ENTRY_SZ_OFFSET 0x88 |
| 204 | #define QUERY_DEV_CAP_CQC_ENTRY_SZ_OFFSET 0x8a |
| 205 | #define QUERY_DEV_CAP_SRQ_ENTRY_SZ_OFFSET 0x8c |
| 206 | #define QUERY_DEV_CAP_C_MPT_ENTRY_SZ_OFFSET 0x8e |
| 207 | #define QUERY_DEV_CAP_MTT_ENTRY_SZ_OFFSET 0x90 |
| 208 | #define QUERY_DEV_CAP_D_MPT_ENTRY_SZ_OFFSET 0x92 |
Roland Dreier | 95d04f0 | 2008-07-23 08:12:26 -0700 | [diff] [blame] | 209 | #define QUERY_DEV_CAP_BMME_FLAGS_OFFSET 0x94 |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 210 | #define QUERY_DEV_CAP_RSVD_LKEY_OFFSET 0x98 |
| 211 | #define QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET 0xa0 |
| 212 | |
| 213 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 214 | if (IS_ERR(mailbox)) |
| 215 | return PTR_ERR(mailbox); |
| 216 | outbox = mailbox->buf; |
| 217 | |
| 218 | err = mlx4_cmd_box(dev, 0, mailbox->dma, 0, 0, MLX4_CMD_QUERY_DEV_CAP, |
| 219 | MLX4_CMD_TIME_CLASS_A); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 220 | if (err) |
| 221 | goto out; |
| 222 | |
| 223 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET); |
| 224 | dev_cap->reserved_qps = 1 << (field & 0xf); |
| 225 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET); |
| 226 | dev_cap->max_qps = 1 << (field & 0x1f); |
| 227 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_SRQ_OFFSET); |
| 228 | dev_cap->reserved_srqs = 1 << (field >> 4); |
| 229 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SRQ_OFFSET); |
| 230 | dev_cap->max_srqs = 1 << (field & 0x1f); |
| 231 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_CQ_SZ_OFFSET); |
| 232 | dev_cap->max_cq_sz = 1 << field; |
| 233 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_CQ_OFFSET); |
| 234 | dev_cap->reserved_cqs = 1 << (field & 0xf); |
| 235 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_CQ_OFFSET); |
| 236 | dev_cap->max_cqs = 1 << (field & 0x1f); |
| 237 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MPT_OFFSET); |
| 238 | dev_cap->max_mpts = 1 << (field & 0x3f); |
| 239 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_EQ_OFFSET); |
Yevgeny Petrilin | be504b0 | 2009-11-12 15:51:16 -0800 | [diff] [blame] | 240 | dev_cap->reserved_eqs = field & 0xf; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 241 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_EQ_OFFSET); |
Jack Morgenstein | 5920869 | 2007-12-10 05:25:23 +0200 | [diff] [blame] | 242 | dev_cap->max_eqs = 1 << (field & 0xf); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 243 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MTT_OFFSET); |
| 244 | dev_cap->reserved_mtts = 1 << (field >> 4); |
| 245 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MRW_SZ_OFFSET); |
| 246 | dev_cap->max_mrw_sz = 1 << field; |
| 247 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MRW_OFFSET); |
| 248 | dev_cap->reserved_mrws = 1 << (field & 0xf); |
| 249 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MTT_SEG_OFFSET); |
| 250 | dev_cap->max_mtt_seg = 1 << (field & 0x3f); |
| 251 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_REQ_QP_OFFSET); |
| 252 | dev_cap->max_requester_per_qp = 1 << (field & 0x3f); |
| 253 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_RES_QP_OFFSET); |
| 254 | dev_cap->max_responder_per_qp = 1 << (field & 0x3f); |
Eli Cohen | b832be1 | 2008-04-16 21:09:27 -0700 | [diff] [blame] | 255 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_GSO_OFFSET); |
| 256 | field &= 0x1f; |
| 257 | if (!field) |
| 258 | dev_cap->max_gso_sz = 0; |
| 259 | else |
| 260 | dev_cap->max_gso_sz = 1 << field; |
| 261 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 262 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_RDMA_OFFSET); |
| 263 | dev_cap->max_rdma_global = 1 << (field & 0x3f); |
| 264 | MLX4_GET(field, outbox, QUERY_DEV_CAP_ACK_DELAY_OFFSET); |
| 265 | dev_cap->local_ca_ack_delay = field & 0x1f; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 266 | MLX4_GET(field, outbox, QUERY_DEV_CAP_VL_PORT_OFFSET); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 267 | dev_cap->num_ports = field & 0xf; |
Dotan Barak | 149983af | 2007-06-26 15:55:28 +0300 | [diff] [blame] | 268 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MSG_SZ_OFFSET); |
| 269 | dev_cap->max_msg_sz = 1 << (field & 0x1f); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 270 | MLX4_GET(stat_rate, outbox, QUERY_DEV_CAP_RATE_SUPPORT_OFFSET); |
| 271 | dev_cap->stat_rate_support = stat_rate; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 272 | MLX4_GET(dev_cap->flags, outbox, QUERY_DEV_CAP_FLAGS_OFFSET); |
| 273 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_UAR_OFFSET); |
| 274 | dev_cap->reserved_uars = field >> 4; |
| 275 | MLX4_GET(field, outbox, QUERY_DEV_CAP_UAR_SZ_OFFSET); |
| 276 | dev_cap->uar_size = 1 << ((field & 0x3f) + 20); |
| 277 | MLX4_GET(field, outbox, QUERY_DEV_CAP_PAGE_SZ_OFFSET); |
| 278 | dev_cap->min_page_sz = 1 << field; |
| 279 | |
| 280 | MLX4_GET(field, outbox, QUERY_DEV_CAP_BF_OFFSET); |
| 281 | if (field & 0x80) { |
| 282 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET); |
| 283 | dev_cap->bf_reg_size = 1 << (field & 0x1f); |
| 284 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET); |
| 285 | dev_cap->bf_regs_per_page = 1 << (field & 0x3f); |
| 286 | mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n", |
| 287 | dev_cap->bf_reg_size, dev_cap->bf_regs_per_page); |
| 288 | } else { |
| 289 | dev_cap->bf_reg_size = 0; |
| 290 | mlx4_dbg(dev, "BlueFlame not available\n"); |
| 291 | } |
| 292 | |
| 293 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SG_SQ_OFFSET); |
| 294 | dev_cap->max_sq_sg = field; |
| 295 | MLX4_GET(size, outbox, QUERY_DEV_CAP_MAX_DESC_SZ_SQ_OFFSET); |
| 296 | dev_cap->max_sq_desc_sz = size; |
| 297 | |
| 298 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_MCG_OFFSET); |
| 299 | dev_cap->max_qp_per_mcg = 1 << field; |
| 300 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MCG_OFFSET); |
| 301 | dev_cap->reserved_mgms = field & 0xf; |
| 302 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MCG_OFFSET); |
| 303 | dev_cap->max_mcgs = 1 << field; |
| 304 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_PD_OFFSET); |
| 305 | dev_cap->reserved_pds = field >> 4; |
| 306 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_PD_OFFSET); |
| 307 | dev_cap->max_pds = 1 << (field & 0x3f); |
| 308 | |
| 309 | MLX4_GET(size, outbox, QUERY_DEV_CAP_RDMARC_ENTRY_SZ_OFFSET); |
| 310 | dev_cap->rdmarc_entry_sz = size; |
| 311 | MLX4_GET(size, outbox, QUERY_DEV_CAP_QPC_ENTRY_SZ_OFFSET); |
| 312 | dev_cap->qpc_entry_sz = size; |
| 313 | MLX4_GET(size, outbox, QUERY_DEV_CAP_AUX_ENTRY_SZ_OFFSET); |
| 314 | dev_cap->aux_entry_sz = size; |
| 315 | MLX4_GET(size, outbox, QUERY_DEV_CAP_ALTC_ENTRY_SZ_OFFSET); |
| 316 | dev_cap->altc_entry_sz = size; |
| 317 | MLX4_GET(size, outbox, QUERY_DEV_CAP_EQC_ENTRY_SZ_OFFSET); |
| 318 | dev_cap->eqc_entry_sz = size; |
| 319 | MLX4_GET(size, outbox, QUERY_DEV_CAP_CQC_ENTRY_SZ_OFFSET); |
| 320 | dev_cap->cqc_entry_sz = size; |
| 321 | MLX4_GET(size, outbox, QUERY_DEV_CAP_SRQ_ENTRY_SZ_OFFSET); |
| 322 | dev_cap->srq_entry_sz = size; |
| 323 | MLX4_GET(size, outbox, QUERY_DEV_CAP_C_MPT_ENTRY_SZ_OFFSET); |
| 324 | dev_cap->cmpt_entry_sz = size; |
| 325 | MLX4_GET(size, outbox, QUERY_DEV_CAP_MTT_ENTRY_SZ_OFFSET); |
| 326 | dev_cap->mtt_entry_sz = size; |
| 327 | MLX4_GET(size, outbox, QUERY_DEV_CAP_D_MPT_ENTRY_SZ_OFFSET); |
| 328 | dev_cap->dmpt_entry_sz = size; |
| 329 | |
| 330 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SRQ_SZ_OFFSET); |
| 331 | dev_cap->max_srq_sz = 1 << field; |
| 332 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_SZ_OFFSET); |
| 333 | dev_cap->max_qp_sz = 1 << field; |
| 334 | MLX4_GET(field, outbox, QUERY_DEV_CAP_RSZ_SRQ_OFFSET); |
| 335 | dev_cap->resize_srq = field & 1; |
| 336 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_SG_RQ_OFFSET); |
| 337 | dev_cap->max_rq_sg = field; |
| 338 | MLX4_GET(size, outbox, QUERY_DEV_CAP_MAX_DESC_SZ_RQ_OFFSET); |
| 339 | dev_cap->max_rq_desc_sz = size; |
| 340 | |
| 341 | MLX4_GET(dev_cap->bmme_flags, outbox, |
| 342 | QUERY_DEV_CAP_BMME_FLAGS_OFFSET); |
| 343 | MLX4_GET(dev_cap->reserved_lkey, outbox, |
| 344 | QUERY_DEV_CAP_RSVD_LKEY_OFFSET); |
| 345 | MLX4_GET(dev_cap->max_icm_sz, outbox, |
| 346 | QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET); |
| 347 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 348 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
| 349 | for (i = 1; i <= dev_cap->num_ports; ++i) { |
| 350 | MLX4_GET(field, outbox, QUERY_DEV_CAP_VL_PORT_OFFSET); |
| 351 | dev_cap->max_vl[i] = field >> 4; |
| 352 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MTU_WIDTH_OFFSET); |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 353 | dev_cap->ib_mtu[i] = field >> 4; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 354 | dev_cap->max_port_width[i] = field & 0xf; |
| 355 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_GID_OFFSET); |
| 356 | dev_cap->max_gids[i] = 1 << (field & 0xf); |
| 357 | MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_PKEY_OFFSET); |
| 358 | dev_cap->max_pkeys[i] = 1 << (field & 0xf); |
| 359 | } |
| 360 | } else { |
Yevgeny Petrilin | 7ff93f8 | 2008-10-22 15:38:42 -0700 | [diff] [blame] | 361 | #define QUERY_PORT_SUPPORTED_TYPE_OFFSET 0x00 |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 362 | #define QUERY_PORT_MTU_OFFSET 0x01 |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 363 | #define QUERY_PORT_ETH_MTU_OFFSET 0x02 |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 364 | #define QUERY_PORT_WIDTH_OFFSET 0x06 |
| 365 | #define QUERY_PORT_MAX_GID_PKEY_OFFSET 0x07 |
Yevgeny Petrilin | 93fc9e1 | 2008-10-22 10:25:29 -0700 | [diff] [blame] | 366 | #define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 367 | #define QUERY_PORT_MAX_VL_OFFSET 0x0b |
Yevgeny Petrilin | e65b959 | 2008-10-26 17:13:24 +0200 | [diff] [blame] | 368 | #define QUERY_PORT_MAC_OFFSET 0x10 |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 369 | |
| 370 | for (i = 1; i <= dev_cap->num_ports; ++i) { |
| 371 | err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT, |
| 372 | MLX4_CMD_TIME_CLASS_B); |
| 373 | if (err) |
| 374 | goto out; |
| 375 | |
Yevgeny Petrilin | 7ff93f8 | 2008-10-22 15:38:42 -0700 | [diff] [blame] | 376 | MLX4_GET(field, outbox, QUERY_PORT_SUPPORTED_TYPE_OFFSET); |
| 377 | dev_cap->supported_port_types[i] = field & 3; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 378 | MLX4_GET(field, outbox, QUERY_PORT_MTU_OFFSET); |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 379 | dev_cap->ib_mtu[i] = field & 0xf; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 380 | MLX4_GET(field, outbox, QUERY_PORT_WIDTH_OFFSET); |
| 381 | dev_cap->max_port_width[i] = field & 0xf; |
| 382 | MLX4_GET(field, outbox, QUERY_PORT_MAX_GID_PKEY_OFFSET); |
| 383 | dev_cap->max_gids[i] = 1 << (field >> 4); |
| 384 | dev_cap->max_pkeys[i] = 1 << (field & 0xf); |
| 385 | MLX4_GET(field, outbox, QUERY_PORT_MAX_VL_OFFSET); |
| 386 | dev_cap->max_vl[i] = field & 0xf; |
Yevgeny Petrilin | 93fc9e1 | 2008-10-22 10:25:29 -0700 | [diff] [blame] | 387 | MLX4_GET(field, outbox, QUERY_PORT_MAX_MACVLAN_OFFSET); |
| 388 | dev_cap->log_max_macs[i] = field & 0xf; |
| 389 | dev_cap->log_max_vlans[i] = field >> 4; |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 390 | MLX4_GET(dev_cap->eth_mtu[i], outbox, QUERY_PORT_ETH_MTU_OFFSET); |
| 391 | MLX4_GET(dev_cap->def_mac[i], outbox, QUERY_PORT_MAC_OFFSET); |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 392 | } |
| 393 | } |
| 394 | |
Roland Dreier | 95d04f0 | 2008-07-23 08:12:26 -0700 | [diff] [blame] | 395 | mlx4_dbg(dev, "Base MM extensions: flags %08x, rsvd L_Key %08x\n", |
| 396 | dev_cap->bmme_flags, dev_cap->reserved_lkey); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 397 | |
| 398 | /* |
| 399 | * Each UAR has 4 EQ doorbells; so if a UAR is reserved, then |
| 400 | * we can't use any EQs whose doorbell falls on that page, |
| 401 | * even if the EQ itself isn't reserved. |
| 402 | */ |
| 403 | dev_cap->reserved_eqs = max(dev_cap->reserved_uars * 4, |
| 404 | dev_cap->reserved_eqs); |
| 405 | |
| 406 | mlx4_dbg(dev, "Max ICM size %lld MB\n", |
| 407 | (unsigned long long) dev_cap->max_icm_sz >> 20); |
| 408 | mlx4_dbg(dev, "Max QPs: %d, reserved QPs: %d, entry size: %d\n", |
| 409 | dev_cap->max_qps, dev_cap->reserved_qps, dev_cap->qpc_entry_sz); |
| 410 | mlx4_dbg(dev, "Max SRQs: %d, reserved SRQs: %d, entry size: %d\n", |
| 411 | dev_cap->max_srqs, dev_cap->reserved_srqs, dev_cap->srq_entry_sz); |
| 412 | mlx4_dbg(dev, "Max CQs: %d, reserved CQs: %d, entry size: %d\n", |
| 413 | dev_cap->max_cqs, dev_cap->reserved_cqs, dev_cap->cqc_entry_sz); |
| 414 | mlx4_dbg(dev, "Max EQs: %d, reserved EQs: %d, entry size: %d\n", |
| 415 | dev_cap->max_eqs, dev_cap->reserved_eqs, dev_cap->eqc_entry_sz); |
| 416 | mlx4_dbg(dev, "reserved MPTs: %d, reserved MTTs: %d\n", |
| 417 | dev_cap->reserved_mrws, dev_cap->reserved_mtts); |
| 418 | mlx4_dbg(dev, "Max PDs: %d, reserved PDs: %d, reserved UARs: %d\n", |
| 419 | dev_cap->max_pds, dev_cap->reserved_pds, dev_cap->reserved_uars); |
| 420 | mlx4_dbg(dev, "Max QP/MCG: %d, reserved MGMs: %d\n", |
| 421 | dev_cap->max_pds, dev_cap->reserved_mgms); |
| 422 | mlx4_dbg(dev, "Max CQEs: %d, max WQEs: %d, max SRQ WQEs: %d\n", |
| 423 | dev_cap->max_cq_sz, dev_cap->max_qp_sz, dev_cap->max_srq_sz); |
| 424 | mlx4_dbg(dev, "Local CA ACK delay: %d, max MTU: %d, port width cap: %d\n", |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 425 | dev_cap->local_ca_ack_delay, 128 << dev_cap->ib_mtu[1], |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 426 | dev_cap->max_port_width[1]); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 427 | mlx4_dbg(dev, "Max SQ desc size: %d, max SQ S/G: %d\n", |
| 428 | dev_cap->max_sq_desc_sz, dev_cap->max_sq_sg); |
| 429 | mlx4_dbg(dev, "Max RQ desc size: %d, max RQ S/G: %d\n", |
| 430 | dev_cap->max_rq_desc_sz, dev_cap->max_rq_sg); |
Eli Cohen | b832be1 | 2008-04-16 21:09:27 -0700 | [diff] [blame] | 431 | mlx4_dbg(dev, "Max GSO size: %d\n", dev_cap->max_gso_sz); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 432 | |
| 433 | dump_dev_cap_flags(dev, dev_cap->flags); |
| 434 | |
| 435 | out: |
| 436 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 437 | return err; |
| 438 | } |
| 439 | |
| 440 | int mlx4_map_cmd(struct mlx4_dev *dev, u16 op, struct mlx4_icm *icm, u64 virt) |
| 441 | { |
| 442 | struct mlx4_cmd_mailbox *mailbox; |
| 443 | struct mlx4_icm_iter iter; |
| 444 | __be64 *pages; |
| 445 | int lg; |
| 446 | int nent = 0; |
| 447 | int i; |
| 448 | int err = 0; |
| 449 | int ts = 0, tc = 0; |
| 450 | |
| 451 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 452 | if (IS_ERR(mailbox)) |
| 453 | return PTR_ERR(mailbox); |
| 454 | memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE); |
| 455 | pages = mailbox->buf; |
| 456 | |
| 457 | for (mlx4_icm_first(icm, &iter); |
| 458 | !mlx4_icm_last(&iter); |
| 459 | mlx4_icm_next(&iter)) { |
| 460 | /* |
| 461 | * We have to pass pages that are aligned to their |
| 462 | * size, so find the least significant 1 in the |
| 463 | * address or size and use that as our log2 size. |
| 464 | */ |
| 465 | lg = ffs(mlx4_icm_addr(&iter) | mlx4_icm_size(&iter)) - 1; |
| 466 | if (lg < MLX4_ICM_PAGE_SHIFT) { |
| 467 | mlx4_warn(dev, "Got FW area not aligned to %d (%llx/%lx).\n", |
| 468 | MLX4_ICM_PAGE_SIZE, |
| 469 | (unsigned long long) mlx4_icm_addr(&iter), |
| 470 | mlx4_icm_size(&iter)); |
| 471 | err = -EINVAL; |
| 472 | goto out; |
| 473 | } |
| 474 | |
| 475 | for (i = 0; i < mlx4_icm_size(&iter) >> lg; ++i) { |
| 476 | if (virt != -1) { |
| 477 | pages[nent * 2] = cpu_to_be64(virt); |
| 478 | virt += 1 << lg; |
| 479 | } |
| 480 | |
| 481 | pages[nent * 2 + 1] = |
| 482 | cpu_to_be64((mlx4_icm_addr(&iter) + (i << lg)) | |
| 483 | (lg - MLX4_ICM_PAGE_SHIFT)); |
| 484 | ts += 1 << (lg - 10); |
| 485 | ++tc; |
| 486 | |
| 487 | if (++nent == MLX4_MAILBOX_SIZE / 16) { |
| 488 | err = mlx4_cmd(dev, mailbox->dma, nent, 0, op, |
| 489 | MLX4_CMD_TIME_CLASS_B); |
| 490 | if (err) |
| 491 | goto out; |
| 492 | nent = 0; |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | if (nent) |
| 498 | err = mlx4_cmd(dev, mailbox->dma, nent, 0, op, MLX4_CMD_TIME_CLASS_B); |
| 499 | if (err) |
| 500 | goto out; |
| 501 | |
| 502 | switch (op) { |
| 503 | case MLX4_CMD_MAP_FA: |
| 504 | mlx4_dbg(dev, "Mapped %d chunks/%d KB for FW.\n", tc, ts); |
| 505 | break; |
| 506 | case MLX4_CMD_MAP_ICM_AUX: |
| 507 | mlx4_dbg(dev, "Mapped %d chunks/%d KB for ICM aux.\n", tc, ts); |
| 508 | break; |
| 509 | case MLX4_CMD_MAP_ICM: |
| 510 | mlx4_dbg(dev, "Mapped %d chunks/%d KB at %llx for ICM.\n", |
| 511 | tc, ts, (unsigned long long) virt - (ts << 10)); |
| 512 | break; |
| 513 | } |
| 514 | |
| 515 | out: |
| 516 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 517 | return err; |
| 518 | } |
| 519 | |
| 520 | int mlx4_MAP_FA(struct mlx4_dev *dev, struct mlx4_icm *icm) |
| 521 | { |
| 522 | return mlx4_map_cmd(dev, MLX4_CMD_MAP_FA, icm, -1); |
| 523 | } |
| 524 | |
| 525 | int mlx4_UNMAP_FA(struct mlx4_dev *dev) |
| 526 | { |
| 527 | return mlx4_cmd(dev, 0, 0, 0, MLX4_CMD_UNMAP_FA, MLX4_CMD_TIME_CLASS_B); |
| 528 | } |
| 529 | |
| 530 | |
| 531 | int mlx4_RUN_FW(struct mlx4_dev *dev) |
| 532 | { |
| 533 | return mlx4_cmd(dev, 0, 0, 0, MLX4_CMD_RUN_FW, MLX4_CMD_TIME_CLASS_A); |
| 534 | } |
| 535 | |
| 536 | int mlx4_QUERY_FW(struct mlx4_dev *dev) |
| 537 | { |
| 538 | struct mlx4_fw *fw = &mlx4_priv(dev)->fw; |
| 539 | struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd; |
| 540 | struct mlx4_cmd_mailbox *mailbox; |
| 541 | u32 *outbox; |
| 542 | int err = 0; |
| 543 | u64 fw_ver; |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 544 | u16 cmd_if_rev; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 545 | u8 lg; |
| 546 | |
| 547 | #define QUERY_FW_OUT_SIZE 0x100 |
| 548 | #define QUERY_FW_VER_OFFSET 0x00 |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 549 | #define QUERY_FW_CMD_IF_REV_OFFSET 0x0a |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 550 | #define QUERY_FW_MAX_CMD_OFFSET 0x0f |
| 551 | #define QUERY_FW_ERR_START_OFFSET 0x30 |
| 552 | #define QUERY_FW_ERR_SIZE_OFFSET 0x38 |
| 553 | #define QUERY_FW_ERR_BAR_OFFSET 0x3c |
| 554 | |
| 555 | #define QUERY_FW_SIZE_OFFSET 0x00 |
| 556 | #define QUERY_FW_CLR_INT_BASE_OFFSET 0x20 |
| 557 | #define QUERY_FW_CLR_INT_BAR_OFFSET 0x28 |
| 558 | |
| 559 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 560 | if (IS_ERR(mailbox)) |
| 561 | return PTR_ERR(mailbox); |
| 562 | outbox = mailbox->buf; |
| 563 | |
| 564 | err = mlx4_cmd_box(dev, 0, mailbox->dma, 0, 0, MLX4_CMD_QUERY_FW, |
| 565 | MLX4_CMD_TIME_CLASS_A); |
| 566 | if (err) |
| 567 | goto out; |
| 568 | |
| 569 | MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET); |
| 570 | /* |
Roland Dreier | 3e1db33 | 2007-06-03 19:47:10 -0700 | [diff] [blame] | 571 | * FW subminor version is at more significant bits than minor |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 572 | * version, so swap here. |
| 573 | */ |
| 574 | dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) | |
| 575 | ((fw_ver & 0xffff0000ull) >> 16) | |
| 576 | ((fw_ver & 0x0000ffffull) << 16); |
| 577 | |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 578 | MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET); |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 579 | if (cmd_if_rev < MLX4_COMMAND_INTERFACE_MIN_REV || |
| 580 | cmd_if_rev > MLX4_COMMAND_INTERFACE_MAX_REV) { |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 581 | mlx4_err(dev, "Installed FW has unsupported " |
| 582 | "command interface revision %d.\n", |
| 583 | cmd_if_rev); |
| 584 | mlx4_err(dev, "(Installed FW version is %d.%d.%03d)\n", |
| 585 | (int) (dev->caps.fw_ver >> 32), |
| 586 | (int) (dev->caps.fw_ver >> 16) & 0xffff, |
| 587 | (int) dev->caps.fw_ver & 0xffff); |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 588 | mlx4_err(dev, "This driver version supports only revisions %d to %d.\n", |
| 589 | MLX4_COMMAND_INTERFACE_MIN_REV, MLX4_COMMAND_INTERFACE_MAX_REV); |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 590 | err = -ENODEV; |
| 591 | goto out; |
| 592 | } |
| 593 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 594 | if (cmd_if_rev < MLX4_COMMAND_INTERFACE_NEW_PORT_CMDS) |
| 595 | dev->flags |= MLX4_FLAG_OLD_PORT_CMDS; |
| 596 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 597 | MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET); |
| 598 | cmd->max_cmds = 1 << lg; |
| 599 | |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 600 | mlx4_dbg(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n", |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 601 | (int) (dev->caps.fw_ver >> 32), |
| 602 | (int) (dev->caps.fw_ver >> 16) & 0xffff, |
| 603 | (int) dev->caps.fw_ver & 0xffff, |
Roland Dreier | fe40900 | 2007-06-07 23:24:36 -0700 | [diff] [blame] | 604 | cmd_if_rev, cmd->max_cmds); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 605 | |
| 606 | MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET); |
| 607 | MLX4_GET(fw->catas_size, outbox, QUERY_FW_ERR_SIZE_OFFSET); |
| 608 | MLX4_GET(fw->catas_bar, outbox, QUERY_FW_ERR_BAR_OFFSET); |
| 609 | fw->catas_bar = (fw->catas_bar >> 6) * 2; |
| 610 | |
| 611 | mlx4_dbg(dev, "Catastrophic error buffer at 0x%llx, size 0x%x, BAR %d\n", |
| 612 | (unsigned long long) fw->catas_offset, fw->catas_size, fw->catas_bar); |
| 613 | |
| 614 | MLX4_GET(fw->fw_pages, outbox, QUERY_FW_SIZE_OFFSET); |
| 615 | MLX4_GET(fw->clr_int_base, outbox, QUERY_FW_CLR_INT_BASE_OFFSET); |
| 616 | MLX4_GET(fw->clr_int_bar, outbox, QUERY_FW_CLR_INT_BAR_OFFSET); |
| 617 | fw->clr_int_bar = (fw->clr_int_bar >> 6) * 2; |
| 618 | |
| 619 | mlx4_dbg(dev, "FW size %d KB\n", fw->fw_pages >> 2); |
| 620 | |
| 621 | /* |
| 622 | * Round up number of system pages needed in case |
| 623 | * MLX4_ICM_PAGE_SIZE < PAGE_SIZE. |
| 624 | */ |
| 625 | fw->fw_pages = |
| 626 | ALIGN(fw->fw_pages, PAGE_SIZE / MLX4_ICM_PAGE_SIZE) >> |
| 627 | (PAGE_SHIFT - MLX4_ICM_PAGE_SHIFT); |
| 628 | |
| 629 | mlx4_dbg(dev, "Clear int @ %llx, BAR %d\n", |
| 630 | (unsigned long long) fw->clr_int_base, fw->clr_int_bar); |
| 631 | |
| 632 | out: |
| 633 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 634 | return err; |
| 635 | } |
| 636 | |
| 637 | static void get_board_id(void *vsd, char *board_id) |
| 638 | { |
| 639 | int i; |
| 640 | |
| 641 | #define VSD_OFFSET_SIG1 0x00 |
| 642 | #define VSD_OFFSET_SIG2 0xde |
| 643 | #define VSD_OFFSET_MLX_BOARD_ID 0xd0 |
| 644 | #define VSD_OFFSET_TS_BOARD_ID 0x20 |
| 645 | |
| 646 | #define VSD_SIGNATURE_TOPSPIN 0x5ad |
| 647 | |
| 648 | memset(board_id, 0, MLX4_BOARD_ID_LEN); |
| 649 | |
| 650 | if (be16_to_cpup(vsd + VSD_OFFSET_SIG1) == VSD_SIGNATURE_TOPSPIN && |
| 651 | be16_to_cpup(vsd + VSD_OFFSET_SIG2) == VSD_SIGNATURE_TOPSPIN) { |
| 652 | strlcpy(board_id, vsd + VSD_OFFSET_TS_BOARD_ID, MLX4_BOARD_ID_LEN); |
| 653 | } else { |
| 654 | /* |
| 655 | * The board ID is a string but the firmware byte |
| 656 | * swaps each 4-byte word before passing it back to |
| 657 | * us. Therefore we need to swab it before printing. |
| 658 | */ |
| 659 | for (i = 0; i < 4; ++i) |
| 660 | ((u32 *) board_id)[i] = |
| 661 | swab32(*(u32 *) (vsd + VSD_OFFSET_MLX_BOARD_ID + i * 4)); |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | int mlx4_QUERY_ADAPTER(struct mlx4_dev *dev, struct mlx4_adapter *adapter) |
| 666 | { |
| 667 | struct mlx4_cmd_mailbox *mailbox; |
| 668 | u32 *outbox; |
| 669 | int err; |
| 670 | |
| 671 | #define QUERY_ADAPTER_OUT_SIZE 0x100 |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 672 | #define QUERY_ADAPTER_INTA_PIN_OFFSET 0x10 |
| 673 | #define QUERY_ADAPTER_VSD_OFFSET 0x20 |
| 674 | |
| 675 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 676 | if (IS_ERR(mailbox)) |
| 677 | return PTR_ERR(mailbox); |
| 678 | outbox = mailbox->buf; |
| 679 | |
| 680 | err = mlx4_cmd_box(dev, 0, mailbox->dma, 0, 0, MLX4_CMD_QUERY_ADAPTER, |
| 681 | MLX4_CMD_TIME_CLASS_A); |
| 682 | if (err) |
| 683 | goto out; |
| 684 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 685 | MLX4_GET(adapter->inta_pin, outbox, QUERY_ADAPTER_INTA_PIN_OFFSET); |
| 686 | |
| 687 | get_board_id(outbox + QUERY_ADAPTER_VSD_OFFSET / 4, |
| 688 | adapter->board_id); |
| 689 | |
| 690 | out: |
| 691 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 692 | return err; |
| 693 | } |
| 694 | |
| 695 | int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) |
| 696 | { |
| 697 | struct mlx4_cmd_mailbox *mailbox; |
| 698 | __be32 *inbox; |
| 699 | int err; |
| 700 | |
| 701 | #define INIT_HCA_IN_SIZE 0x200 |
| 702 | #define INIT_HCA_VERSION_OFFSET 0x000 |
| 703 | #define INIT_HCA_VERSION 2 |
Eli Cohen | c57e20dcf | 2009-09-24 11:03:03 -0700 | [diff] [blame] | 704 | #define INIT_HCA_CACHELINE_SZ_OFFSET 0x0e |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 705 | #define INIT_HCA_FLAGS_OFFSET 0x014 |
| 706 | #define INIT_HCA_QPC_OFFSET 0x020 |
| 707 | #define INIT_HCA_QPC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x10) |
| 708 | #define INIT_HCA_LOG_QP_OFFSET (INIT_HCA_QPC_OFFSET + 0x17) |
| 709 | #define INIT_HCA_SRQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x28) |
| 710 | #define INIT_HCA_LOG_SRQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x2f) |
| 711 | #define INIT_HCA_CQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x30) |
| 712 | #define INIT_HCA_LOG_CQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x37) |
| 713 | #define INIT_HCA_ALTC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x40) |
| 714 | #define INIT_HCA_AUXC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x50) |
| 715 | #define INIT_HCA_EQC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x60) |
| 716 | #define INIT_HCA_LOG_EQ_OFFSET (INIT_HCA_QPC_OFFSET + 0x67) |
| 717 | #define INIT_HCA_RDMARC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x70) |
| 718 | #define INIT_HCA_LOG_RD_OFFSET (INIT_HCA_QPC_OFFSET + 0x77) |
| 719 | #define INIT_HCA_MCAST_OFFSET 0x0c0 |
| 720 | #define INIT_HCA_MC_BASE_OFFSET (INIT_HCA_MCAST_OFFSET + 0x00) |
| 721 | #define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x12) |
| 722 | #define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x16) |
| 723 | #define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b) |
| 724 | #define INIT_HCA_TPT_OFFSET 0x0f0 |
| 725 | #define INIT_HCA_DMPT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x00) |
| 726 | #define INIT_HCA_LOG_MPT_SZ_OFFSET (INIT_HCA_TPT_OFFSET + 0x0b) |
| 727 | #define INIT_HCA_MTT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x10) |
| 728 | #define INIT_HCA_CMPT_BASE_OFFSET (INIT_HCA_TPT_OFFSET + 0x18) |
| 729 | #define INIT_HCA_UAR_OFFSET 0x120 |
| 730 | #define INIT_HCA_LOG_UAR_SZ_OFFSET (INIT_HCA_UAR_OFFSET + 0x0a) |
| 731 | #define INIT_HCA_UAR_PAGE_SZ_OFFSET (INIT_HCA_UAR_OFFSET + 0x0b) |
| 732 | |
| 733 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 734 | if (IS_ERR(mailbox)) |
| 735 | return PTR_ERR(mailbox); |
| 736 | inbox = mailbox->buf; |
| 737 | |
| 738 | memset(inbox, 0, INIT_HCA_IN_SIZE); |
| 739 | |
| 740 | *((u8 *) mailbox->buf + INIT_HCA_VERSION_OFFSET) = INIT_HCA_VERSION; |
| 741 | |
Eli Cohen | c57e20dcf | 2009-09-24 11:03:03 -0700 | [diff] [blame] | 742 | *((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) = |
| 743 | (ilog2(cache_line_size()) - 4) << 5; |
| 744 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 745 | #if defined(__LITTLE_ENDIAN) |
| 746 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) &= ~cpu_to_be32(1 << 1); |
| 747 | #elif defined(__BIG_ENDIAN) |
| 748 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 1); |
| 749 | #else |
| 750 | #error Host endianness not defined |
| 751 | #endif |
| 752 | /* Check port for UD address vector: */ |
| 753 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1); |
| 754 | |
Eli Cohen | 8ff095e | 2008-04-16 21:01:10 -0700 | [diff] [blame] | 755 | /* Enable IPoIB checksumming if we can: */ |
| 756 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM) |
| 757 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 3); |
| 758 | |
Jack Morgenstein | 51f5f0e | 2008-07-22 14:19:37 -0700 | [diff] [blame] | 759 | /* Enable QoS support if module parameter set */ |
| 760 | if (enable_qos) |
| 761 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 2); |
| 762 | |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 763 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ |
| 764 | |
| 765 | MLX4_PUT(inbox, param->qpc_base, INIT_HCA_QPC_BASE_OFFSET); |
| 766 | MLX4_PUT(inbox, param->log_num_qps, INIT_HCA_LOG_QP_OFFSET); |
| 767 | MLX4_PUT(inbox, param->srqc_base, INIT_HCA_SRQC_BASE_OFFSET); |
| 768 | MLX4_PUT(inbox, param->log_num_srqs, INIT_HCA_LOG_SRQ_OFFSET); |
| 769 | MLX4_PUT(inbox, param->cqc_base, INIT_HCA_CQC_BASE_OFFSET); |
| 770 | MLX4_PUT(inbox, param->log_num_cqs, INIT_HCA_LOG_CQ_OFFSET); |
| 771 | MLX4_PUT(inbox, param->altc_base, INIT_HCA_ALTC_BASE_OFFSET); |
| 772 | MLX4_PUT(inbox, param->auxc_base, INIT_HCA_AUXC_BASE_OFFSET); |
| 773 | MLX4_PUT(inbox, param->eqc_base, INIT_HCA_EQC_BASE_OFFSET); |
| 774 | MLX4_PUT(inbox, param->log_num_eqs, INIT_HCA_LOG_EQ_OFFSET); |
| 775 | MLX4_PUT(inbox, param->rdmarc_base, INIT_HCA_RDMARC_BASE_OFFSET); |
| 776 | MLX4_PUT(inbox, param->log_rd_per_qp, INIT_HCA_LOG_RD_OFFSET); |
| 777 | |
| 778 | /* multicast attributes */ |
| 779 | |
| 780 | MLX4_PUT(inbox, param->mc_base, INIT_HCA_MC_BASE_OFFSET); |
| 781 | MLX4_PUT(inbox, param->log_mc_entry_sz, INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET); |
| 782 | MLX4_PUT(inbox, param->log_mc_hash_sz, INIT_HCA_LOG_MC_HASH_SZ_OFFSET); |
| 783 | MLX4_PUT(inbox, param->log_mc_table_sz, INIT_HCA_LOG_MC_TABLE_SZ_OFFSET); |
| 784 | |
| 785 | /* TPT attributes */ |
| 786 | |
| 787 | MLX4_PUT(inbox, param->dmpt_base, INIT_HCA_DMPT_BASE_OFFSET); |
| 788 | MLX4_PUT(inbox, param->log_mpt_sz, INIT_HCA_LOG_MPT_SZ_OFFSET); |
| 789 | MLX4_PUT(inbox, param->mtt_base, INIT_HCA_MTT_BASE_OFFSET); |
| 790 | MLX4_PUT(inbox, param->cmpt_base, INIT_HCA_CMPT_BASE_OFFSET); |
| 791 | |
| 792 | /* UAR attributes */ |
| 793 | |
| 794 | MLX4_PUT(inbox, (u8) (PAGE_SHIFT - 12), INIT_HCA_UAR_PAGE_SZ_OFFSET); |
| 795 | MLX4_PUT(inbox, param->log_uar_sz, INIT_HCA_LOG_UAR_SZ_OFFSET); |
| 796 | |
Jack Morgenstein | 77109cc | 2007-10-21 12:03:01 +0200 | [diff] [blame] | 797 | err = mlx4_cmd(dev, mailbox->dma, 0, 0, MLX4_CMD_INIT_HCA, 10000); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 798 | |
| 799 | if (err) |
| 800 | mlx4_err(dev, "INIT_HCA returns %d\n", err); |
| 801 | |
| 802 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 803 | return err; |
| 804 | } |
| 805 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 806 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port) |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 807 | { |
| 808 | struct mlx4_cmd_mailbox *mailbox; |
| 809 | u32 *inbox; |
| 810 | int err; |
| 811 | u32 flags; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 812 | u16 field; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 813 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 814 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 815 | #define INIT_PORT_IN_SIZE 256 |
| 816 | #define INIT_PORT_FLAGS_OFFSET 0x00 |
| 817 | #define INIT_PORT_FLAG_SIG (1 << 18) |
| 818 | #define INIT_PORT_FLAG_NG (1 << 17) |
| 819 | #define INIT_PORT_FLAG_G0 (1 << 16) |
| 820 | #define INIT_PORT_VL_SHIFT 4 |
| 821 | #define INIT_PORT_PORT_WIDTH_SHIFT 8 |
| 822 | #define INIT_PORT_MTU_OFFSET 0x04 |
| 823 | #define INIT_PORT_MAX_GID_OFFSET 0x06 |
| 824 | #define INIT_PORT_MAX_PKEY_OFFSET 0x0a |
| 825 | #define INIT_PORT_GUID0_OFFSET 0x10 |
| 826 | #define INIT_PORT_NODE_GUID_OFFSET 0x18 |
| 827 | #define INIT_PORT_SI_GUID_OFFSET 0x20 |
| 828 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 829 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 830 | if (IS_ERR(mailbox)) |
| 831 | return PTR_ERR(mailbox); |
| 832 | inbox = mailbox->buf; |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 833 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 834 | memset(inbox, 0, INIT_PORT_IN_SIZE); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 835 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 836 | flags = 0; |
| 837 | flags |= (dev->caps.vl_cap[port] & 0xf) << INIT_PORT_VL_SHIFT; |
| 838 | flags |= (dev->caps.port_width_cap[port] & 0xf) << INIT_PORT_PORT_WIDTH_SHIFT; |
| 839 | MLX4_PUT(inbox, flags, INIT_PORT_FLAGS_OFFSET); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 840 | |
Yevgeny Petrilin | b79acb4 | 2008-10-22 10:56:48 -0700 | [diff] [blame] | 841 | field = 128 << dev->caps.ib_mtu_cap[port]; |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 842 | MLX4_PUT(inbox, field, INIT_PORT_MTU_OFFSET); |
| 843 | field = dev->caps.gid_table_len[port]; |
| 844 | MLX4_PUT(inbox, field, INIT_PORT_MAX_GID_OFFSET); |
| 845 | field = dev->caps.pkey_table_len[port]; |
| 846 | MLX4_PUT(inbox, field, INIT_PORT_MAX_PKEY_OFFSET); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 847 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 848 | err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_INIT_PORT, |
| 849 | MLX4_CMD_TIME_CLASS_A); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 850 | |
Roland Dreier | 5ae2a7a | 2007-06-18 08:15:02 -0700 | [diff] [blame] | 851 | mlx4_free_cmd_mailbox(dev, mailbox); |
| 852 | } else |
| 853 | err = mlx4_cmd(dev, 0, port, 0, MLX4_CMD_INIT_PORT, |
| 854 | MLX4_CMD_TIME_CLASS_A); |
Roland Dreier | 225c7b1 | 2007-05-08 18:00:38 -0700 | [diff] [blame] | 855 | |
| 856 | return err; |
| 857 | } |
| 858 | EXPORT_SYMBOL_GPL(mlx4_INIT_PORT); |
| 859 | |
| 860 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port) |
| 861 | { |
| 862 | return mlx4_cmd(dev, 0, port, 0, MLX4_CMD_CLOSE_PORT, 1000); |
| 863 | } |
| 864 | EXPORT_SYMBOL_GPL(mlx4_CLOSE_PORT); |
| 865 | |
| 866 | int mlx4_CLOSE_HCA(struct mlx4_dev *dev, int panic) |
| 867 | { |
| 868 | return mlx4_cmd(dev, 0, 0, panic, MLX4_CMD_CLOSE_HCA, 1000); |
| 869 | } |
| 870 | |
| 871 | int mlx4_SET_ICM_SIZE(struct mlx4_dev *dev, u64 icm_size, u64 *aux_pages) |
| 872 | { |
| 873 | int ret = mlx4_cmd_imm(dev, icm_size, aux_pages, 0, 0, |
| 874 | MLX4_CMD_SET_ICM_SIZE, |
| 875 | MLX4_CMD_TIME_CLASS_A); |
| 876 | if (ret) |
| 877 | return ret; |
| 878 | |
| 879 | /* |
| 880 | * Round up number of system pages needed in case |
| 881 | * MLX4_ICM_PAGE_SIZE < PAGE_SIZE. |
| 882 | */ |
| 883 | *aux_pages = ALIGN(*aux_pages, PAGE_SIZE / MLX4_ICM_PAGE_SIZE) >> |
| 884 | (PAGE_SHIFT - MLX4_ICM_PAGE_SHIFT); |
| 885 | |
| 886 | return 0; |
| 887 | } |
| 888 | |
| 889 | int mlx4_NOP(struct mlx4_dev *dev) |
| 890 | { |
| 891 | /* Input modifier of 0x1f means "finish as soon as possible." */ |
| 892 | return mlx4_cmd(dev, 0, 0x1f, 0, MLX4_CMD_NOP, 100); |
| 893 | } |