Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 1 | /* |
Saeed Mahameed | 6cf0a15 | 2015-04-02 17:07:30 +0300 | [diff] [blame] | 2 | * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 3 | * |
| 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| 6 | * General Public License (GPL) Version 2, available from the file |
| 7 | * COPYING in the main directory of this source tree, or the |
| 8 | * OpenIB.org BSD license below: |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or |
| 11 | * without modification, are permitted provided that the following |
| 12 | * conditions are met: |
| 13 | * |
| 14 | * - Redistributions of source code must retain the above |
| 15 | * copyright notice, this list of conditions and the following |
| 16 | * disclaimer. |
| 17 | * |
| 18 | * - Redistributions in binary form must reproduce the above |
| 19 | * copyright notice, this list of conditions and the following |
| 20 | * disclaimer in the documentation and/or other materials |
| 21 | * provided with the distribution. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 | * SOFTWARE. |
| 31 | */ |
| 32 | |
| 33 | #ifndef MLX5_IB_H |
| 34 | #define MLX5_IB_H |
| 35 | |
| 36 | #include <linux/kernel.h> |
| 37 | #include <linux/sched.h> |
| 38 | #include <rdma/ib_verbs.h> |
| 39 | #include <rdma/ib_smi.h> |
| 40 | #include <linux/mlx5/driver.h> |
| 41 | #include <linux/mlx5/cq.h> |
| 42 | #include <linux/mlx5/qp.h> |
| 43 | #include <linux/mlx5/srq.h> |
| 44 | #include <linux/types.h> |
majd@mellanox.com | 146d2f1 | 2016-01-14 19:13:02 +0200 | [diff] [blame^] | 45 | #include <linux/mlx5/transobj.h> |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 46 | |
| 47 | #define mlx5_ib_dbg(dev, format, arg...) \ |
| 48 | pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ |
| 49 | __LINE__, current->pid, ##arg) |
| 50 | |
| 51 | #define mlx5_ib_err(dev, format, arg...) \ |
| 52 | pr_err("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ |
| 53 | __LINE__, current->pid, ##arg) |
| 54 | |
| 55 | #define mlx5_ib_warn(dev, format, arg...) \ |
| 56 | pr_warn("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ |
| 57 | __LINE__, current->pid, ##arg) |
| 58 | |
Matan Barak | b368d7c | 2015-12-15 20:30:12 +0200 | [diff] [blame] | 59 | #define field_avail(type, fld, sz) (offsetof(type, fld) + \ |
| 60 | sizeof(((type *)0)->fld) <= (sz)) |
Haggai Abramovsky | cfb5e08 | 2016-01-14 19:12:57 +0200 | [diff] [blame] | 61 | #define MLX5_IB_DEFAULT_UIDX 0xffffff |
| 62 | #define MLX5_USER_ASSIGNED_UIDX_MASK __mlx5_mask(qpc, user_index) |
Matan Barak | b368d7c | 2015-12-15 20:30:12 +0200 | [diff] [blame] | 63 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 64 | enum { |
| 65 | MLX5_IB_MMAP_CMD_SHIFT = 8, |
| 66 | MLX5_IB_MMAP_CMD_MASK = 0xff, |
| 67 | }; |
| 68 | |
| 69 | enum mlx5_ib_mmap_cmd { |
| 70 | MLX5_IB_MMAP_REGULAR_PAGE = 0, |
Matan Barak | d69e3bc | 2015-12-15 20:30:13 +0200 | [diff] [blame] | 71 | MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1, |
| 72 | /* 5 is chosen in order to be compatible with old versions of libmlx5 */ |
| 73 | MLX5_IB_MMAP_CORE_CLOCK = 5, |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | enum { |
| 77 | MLX5_RES_SCAT_DATA32_CQE = 0x1, |
| 78 | MLX5_RES_SCAT_DATA64_CQE = 0x2, |
| 79 | MLX5_REQ_SCAT_DATA32_CQE = 0x11, |
| 80 | MLX5_REQ_SCAT_DATA64_CQE = 0x22, |
| 81 | }; |
| 82 | |
| 83 | enum mlx5_ib_latency_class { |
| 84 | MLX5_IB_LATENCY_CLASS_LOW, |
| 85 | MLX5_IB_LATENCY_CLASS_MEDIUM, |
| 86 | MLX5_IB_LATENCY_CLASS_HIGH, |
| 87 | MLX5_IB_LATENCY_CLASS_FAST_PATH |
| 88 | }; |
| 89 | |
| 90 | enum mlx5_ib_mad_ifc_flags { |
| 91 | MLX5_MAD_IFC_IGNORE_MKEY = 1, |
| 92 | MLX5_MAD_IFC_IGNORE_BKEY = 2, |
| 93 | MLX5_MAD_IFC_NET_VIEW = 4, |
| 94 | }; |
| 95 | |
Leon Romanovsky | 051f263 | 2015-12-20 12:16:11 +0200 | [diff] [blame] | 96 | enum { |
| 97 | MLX5_CROSS_CHANNEL_UUAR = 0, |
| 98 | }; |
| 99 | |
Haggai Abramovsky | cfb5e08 | 2016-01-14 19:12:57 +0200 | [diff] [blame] | 100 | enum { |
| 101 | MLX5_CQE_VERSION_V0, |
| 102 | MLX5_CQE_VERSION_V1, |
| 103 | }; |
| 104 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 105 | struct mlx5_ib_ucontext { |
| 106 | struct ib_ucontext ibucontext; |
| 107 | struct list_head db_page_list; |
| 108 | |
| 109 | /* protect doorbell record alloc/free |
| 110 | */ |
| 111 | struct mutex db_page_mutex; |
| 112 | struct mlx5_uuar_info uuari; |
Haggai Abramovsky | cfb5e08 | 2016-01-14 19:12:57 +0200 | [diff] [blame] | 113 | u8 cqe_version; |
majd@mellanox.com | 146d2f1 | 2016-01-14 19:13:02 +0200 | [diff] [blame^] | 114 | /* Transport Domain number */ |
| 115 | u32 tdn; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 116 | }; |
| 117 | |
| 118 | static inline struct mlx5_ib_ucontext *to_mucontext(struct ib_ucontext *ibucontext) |
| 119 | { |
| 120 | return container_of(ibucontext, struct mlx5_ib_ucontext, ibucontext); |
| 121 | } |
| 122 | |
| 123 | struct mlx5_ib_pd { |
| 124 | struct ib_pd ibpd; |
| 125 | u32 pdn; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | /* Use macros here so that don't have to duplicate |
| 129 | * enum ib_send_flags and enum ib_qp_type for low-level driver |
| 130 | */ |
| 131 | |
| 132 | #define MLX5_IB_SEND_UMR_UNREG IB_SEND_RESERVED_START |
Haggai Eran | 968e78d | 2014-12-11 17:04:11 +0200 | [diff] [blame] | 133 | #define MLX5_IB_SEND_UMR_FAIL_IF_FREE (IB_SEND_RESERVED_START << 1) |
| 134 | #define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2) |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 135 | #define MLX5_IB_QPT_REG_UMR IB_QPT_RESERVED1 |
| 136 | #define MLX5_IB_WR_UMR IB_WR_RESERVED1 |
| 137 | |
| 138 | struct wr_list { |
| 139 | u16 opcode; |
| 140 | u16 next; |
| 141 | }; |
| 142 | |
| 143 | struct mlx5_ib_wq { |
| 144 | u64 *wrid; |
| 145 | u32 *wr_data; |
| 146 | struct wr_list *w_list; |
| 147 | unsigned *wqe_head; |
| 148 | u16 unsig_count; |
| 149 | |
| 150 | /* serialize post to the work queue |
| 151 | */ |
| 152 | spinlock_t lock; |
| 153 | int wqe_cnt; |
| 154 | int max_post; |
| 155 | int max_gs; |
| 156 | int offset; |
| 157 | int wqe_shift; |
| 158 | unsigned head; |
| 159 | unsigned tail; |
| 160 | u16 cur_post; |
| 161 | u16 last_poll; |
| 162 | void *qend; |
| 163 | }; |
| 164 | |
| 165 | enum { |
| 166 | MLX5_QP_USER, |
| 167 | MLX5_QP_KERNEL, |
| 168 | MLX5_QP_EMPTY |
| 169 | }; |
| 170 | |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 171 | /* |
| 172 | * Connect-IB can trigger up to four concurrent pagefaults |
| 173 | * per-QP. |
| 174 | */ |
| 175 | enum mlx5_ib_pagefault_context { |
| 176 | MLX5_IB_PAGEFAULT_RESPONDER_READ, |
| 177 | MLX5_IB_PAGEFAULT_REQUESTOR_READ, |
| 178 | MLX5_IB_PAGEFAULT_RESPONDER_WRITE, |
| 179 | MLX5_IB_PAGEFAULT_REQUESTOR_WRITE, |
| 180 | MLX5_IB_PAGEFAULT_CONTEXTS |
| 181 | }; |
| 182 | |
| 183 | static inline enum mlx5_ib_pagefault_context |
| 184 | mlx5_ib_get_pagefault_context(struct mlx5_pagefault *pagefault) |
| 185 | { |
| 186 | return pagefault->flags & (MLX5_PFAULT_REQUESTOR | MLX5_PFAULT_WRITE); |
| 187 | } |
| 188 | |
| 189 | struct mlx5_ib_pfault { |
| 190 | struct work_struct work; |
| 191 | struct mlx5_pagefault mpfault; |
| 192 | }; |
| 193 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 194 | struct mlx5_ib_qp { |
| 195 | struct ib_qp ibqp; |
| 196 | struct mlx5_core_qp mqp; |
| 197 | struct mlx5_buf buf; |
| 198 | |
| 199 | struct mlx5_db db; |
| 200 | struct mlx5_ib_wq rq; |
| 201 | |
| 202 | u32 doorbell_qpn; |
| 203 | u8 sq_signal_bits; |
| 204 | u8 fm_cache; |
| 205 | int sq_max_wqes_per_wr; |
| 206 | int sq_spare_wqes; |
| 207 | struct mlx5_ib_wq sq; |
| 208 | |
| 209 | struct ib_umem *umem; |
| 210 | int buf_size; |
| 211 | |
| 212 | /* serialize qp state modifications |
| 213 | */ |
| 214 | struct mutex mutex; |
| 215 | u16 xrcdn; |
| 216 | u32 flags; |
| 217 | u8 port; |
| 218 | u8 alt_port; |
| 219 | u8 atomic_rd_en; |
| 220 | u8 resp_depth; |
| 221 | u8 state; |
| 222 | int mlx_type; |
| 223 | int wq_sig; |
| 224 | int scat_cqe; |
| 225 | int max_inline_data; |
| 226 | struct mlx5_bf *bf; |
| 227 | int has_rq; |
| 228 | |
| 229 | /* only for user space QPs. For kernel |
| 230 | * we have it from the bf object |
| 231 | */ |
| 232 | int uuarn; |
| 233 | |
| 234 | int create_type; |
Sagi Grimberg | e1e66cc | 2014-02-23 14:19:07 +0200 | [diff] [blame] | 235 | |
| 236 | /* Store signature errors */ |
| 237 | bool signature_en; |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 238 | |
| 239 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING |
| 240 | /* |
| 241 | * A flag that is true for QP's that are in a state that doesn't |
| 242 | * allow page faults, and shouldn't schedule any more faults. |
| 243 | */ |
| 244 | int disable_page_faults; |
| 245 | /* |
| 246 | * The disable_page_faults_lock protects a QP's disable_page_faults |
| 247 | * field, allowing for a thread to atomically check whether the QP |
| 248 | * allows page faults, and if so schedule a page fault. |
| 249 | */ |
| 250 | spinlock_t disable_page_faults_lock; |
| 251 | struct mlx5_ib_pfault pagefaults[MLX5_IB_PAGEFAULT_CONTEXTS]; |
| 252 | #endif |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 253 | }; |
| 254 | |
| 255 | struct mlx5_ib_cq_buf { |
| 256 | struct mlx5_buf buf; |
| 257 | struct ib_umem *umem; |
| 258 | int cqe_size; |
Eli Cohen | bde5158 | 2014-01-14 17:45:18 +0200 | [diff] [blame] | 259 | int nent; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 260 | }; |
| 261 | |
| 262 | enum mlx5_ib_qp_flags { |
| 263 | MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK = 1 << 0, |
| 264 | MLX5_IB_QP_SIGNATURE_HANDLING = 1 << 1, |
Leon Romanovsky | 051f263 | 2015-12-20 12:16:11 +0200 | [diff] [blame] | 265 | MLX5_IB_QP_CROSS_CHANNEL = 1 << 2, |
| 266 | MLX5_IB_QP_MANAGED_SEND = 1 << 3, |
| 267 | MLX5_IB_QP_MANAGED_RECV = 1 << 4, |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 268 | }; |
| 269 | |
Haggai Eran | 968e78d | 2014-12-11 17:04:11 +0200 | [diff] [blame] | 270 | struct mlx5_umr_wr { |
Christoph Hellwig | e622f2f | 2015-10-08 09:16:33 +0100 | [diff] [blame] | 271 | struct ib_send_wr wr; |
Haggai Eran | 968e78d | 2014-12-11 17:04:11 +0200 | [diff] [blame] | 272 | union { |
| 273 | u64 virt_addr; |
| 274 | u64 offset; |
| 275 | } target; |
| 276 | struct ib_pd *pd; |
| 277 | unsigned int page_shift; |
| 278 | unsigned int npages; |
| 279 | u32 length; |
| 280 | int access_flags; |
| 281 | u32 mkey; |
| 282 | }; |
| 283 | |
Christoph Hellwig | e622f2f | 2015-10-08 09:16:33 +0100 | [diff] [blame] | 284 | static inline struct mlx5_umr_wr *umr_wr(struct ib_send_wr *wr) |
| 285 | { |
| 286 | return container_of(wr, struct mlx5_umr_wr, wr); |
| 287 | } |
| 288 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 289 | struct mlx5_shared_mr_info { |
| 290 | int mr_id; |
| 291 | struct ib_umem *umem; |
| 292 | }; |
| 293 | |
| 294 | struct mlx5_ib_cq { |
| 295 | struct ib_cq ibcq; |
| 296 | struct mlx5_core_cq mcq; |
| 297 | struct mlx5_ib_cq_buf buf; |
| 298 | struct mlx5_db db; |
| 299 | |
| 300 | /* serialize access to the CQ |
| 301 | */ |
| 302 | spinlock_t lock; |
| 303 | |
| 304 | /* protect resize cq |
| 305 | */ |
| 306 | struct mutex resize_mutex; |
Eli Cohen | bde5158 | 2014-01-14 17:45:18 +0200 | [diff] [blame] | 307 | struct mlx5_ib_cq_buf *resize_buf; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 308 | struct ib_umem *resize_umem; |
| 309 | int cqe_size; |
Leon Romanovsky | 051f263 | 2015-12-20 12:16:11 +0200 | [diff] [blame] | 310 | u32 create_flags; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 311 | }; |
| 312 | |
| 313 | struct mlx5_ib_srq { |
| 314 | struct ib_srq ibsrq; |
| 315 | struct mlx5_core_srq msrq; |
| 316 | struct mlx5_buf buf; |
| 317 | struct mlx5_db db; |
| 318 | u64 *wrid; |
| 319 | /* protect SRQ hanlding |
| 320 | */ |
| 321 | spinlock_t lock; |
| 322 | int head; |
| 323 | int tail; |
| 324 | u16 wqe_ctr; |
| 325 | struct ib_umem *umem; |
| 326 | /* serialize arming a SRQ |
| 327 | */ |
| 328 | struct mutex mutex; |
| 329 | int wq_sig; |
| 330 | }; |
| 331 | |
| 332 | struct mlx5_ib_xrcd { |
| 333 | struct ib_xrcd ibxrcd; |
| 334 | u32 xrcdn; |
| 335 | }; |
| 336 | |
Haggai Eran | cc149f75 | 2014-12-11 17:04:21 +0200 | [diff] [blame] | 337 | enum mlx5_ib_mtt_access_flags { |
| 338 | MLX5_IB_MTT_READ = (1 << 0), |
| 339 | MLX5_IB_MTT_WRITE = (1 << 1), |
| 340 | }; |
| 341 | |
| 342 | #define MLX5_IB_MTT_PRESENT (MLX5_IB_MTT_READ | MLX5_IB_MTT_WRITE) |
| 343 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 344 | struct mlx5_ib_mr { |
| 345 | struct ib_mr ibmr; |
Sagi Grimberg | 8a187ee | 2015-10-13 19:11:26 +0300 | [diff] [blame] | 346 | void *descs; |
| 347 | dma_addr_t desc_map; |
| 348 | int ndescs; |
| 349 | int max_descs; |
| 350 | int desc_size; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 351 | struct mlx5_core_mr mmr; |
| 352 | struct ib_umem *umem; |
| 353 | struct mlx5_shared_mr_info *smr_info; |
| 354 | struct list_head list; |
| 355 | int order; |
| 356 | int umred; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 357 | int npages; |
Eli Cohen | 746b558 | 2013-10-23 09:53:14 +0300 | [diff] [blame] | 358 | struct mlx5_ib_dev *dev; |
| 359 | struct mlx5_create_mkey_mbox_out out; |
Sagi Grimberg | 3121e3c | 2014-02-23 14:19:06 +0200 | [diff] [blame] | 360 | struct mlx5_core_sig_ctx *sig; |
Haggai Eran | b4cfe44 | 2014-12-11 17:04:26 +0200 | [diff] [blame] | 361 | int live; |
Sagi Grimberg | 8a187ee | 2015-10-13 19:11:26 +0300 | [diff] [blame] | 362 | void *descs_alloc; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 363 | }; |
| 364 | |
Shachar Raindel | a74d241 | 2014-05-22 14:50:12 +0300 | [diff] [blame] | 365 | struct mlx5_ib_umr_context { |
| 366 | enum ib_wc_status status; |
| 367 | struct completion done; |
| 368 | }; |
| 369 | |
| 370 | static inline void mlx5_ib_init_umr_context(struct mlx5_ib_umr_context *context) |
| 371 | { |
| 372 | context->status = -1; |
| 373 | init_completion(&context->done); |
| 374 | } |
| 375 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 376 | struct umr_common { |
| 377 | struct ib_pd *pd; |
| 378 | struct ib_cq *cq; |
| 379 | struct ib_qp *qp; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 380 | /* control access to UMR QP |
| 381 | */ |
| 382 | struct semaphore sem; |
| 383 | }; |
| 384 | |
| 385 | enum { |
| 386 | MLX5_FMR_INVALID, |
| 387 | MLX5_FMR_VALID, |
| 388 | MLX5_FMR_BUSY, |
| 389 | }; |
| 390 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 391 | struct mlx5_cache_ent { |
| 392 | struct list_head head; |
| 393 | /* sync access to the cahce entry |
| 394 | */ |
| 395 | spinlock_t lock; |
| 396 | |
| 397 | |
| 398 | struct dentry *dir; |
| 399 | char name[4]; |
| 400 | u32 order; |
| 401 | u32 size; |
| 402 | u32 cur; |
| 403 | u32 miss; |
| 404 | u32 limit; |
| 405 | |
| 406 | struct dentry *fsize; |
| 407 | struct dentry *fcur; |
| 408 | struct dentry *fmiss; |
| 409 | struct dentry *flimit; |
| 410 | |
| 411 | struct mlx5_ib_dev *dev; |
| 412 | struct work_struct work; |
| 413 | struct delayed_work dwork; |
Eli Cohen | 746b558 | 2013-10-23 09:53:14 +0300 | [diff] [blame] | 414 | int pending; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 415 | }; |
| 416 | |
| 417 | struct mlx5_mr_cache { |
| 418 | struct workqueue_struct *wq; |
| 419 | struct mlx5_cache_ent ent[MAX_MR_CACHE_ENTRIES]; |
| 420 | int stopped; |
| 421 | struct dentry *root; |
| 422 | unsigned long last_add; |
| 423 | }; |
| 424 | |
| 425 | struct mlx5_ib_resources { |
| 426 | struct ib_cq *c0; |
| 427 | struct ib_xrcd *x0; |
| 428 | struct ib_xrcd *x1; |
| 429 | struct ib_pd *p0; |
| 430 | struct ib_srq *s0; |
Haggai Abramonvsky | 4aa17b2 | 2015-06-04 19:30:48 +0300 | [diff] [blame] | 431 | struct ib_srq *s1; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 432 | }; |
| 433 | |
Achiad Shochat | fc24fc5 | 2015-12-23 18:47:17 +0200 | [diff] [blame] | 434 | struct mlx5_roce { |
| 435 | /* Protect mlx5_ib_get_netdev from invoking dev_hold() with a NULL |
| 436 | * netdev pointer |
| 437 | */ |
| 438 | rwlock_t netdev_lock; |
| 439 | struct net_device *netdev; |
| 440 | struct notifier_block nb; |
| 441 | }; |
| 442 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 443 | struct mlx5_ib_dev { |
| 444 | struct ib_device ib_dev; |
Jack Morgenstein | 9603b61 | 2014-07-28 23:30:22 +0300 | [diff] [blame] | 445 | struct mlx5_core_dev *mdev; |
Achiad Shochat | fc24fc5 | 2015-12-23 18:47:17 +0200 | [diff] [blame] | 446 | struct mlx5_roce roce; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 447 | MLX5_DECLARE_DOORBELL_LOCK(uar_lock); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 448 | int num_ports; |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 449 | /* serialize update of capability mask |
| 450 | */ |
| 451 | struct mutex cap_mask_mutex; |
| 452 | bool ib_active; |
| 453 | struct umr_common umrc; |
| 454 | /* sync used page count stats |
| 455 | */ |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 456 | struct mlx5_ib_resources devr; |
| 457 | struct mlx5_mr_cache cache; |
Eli Cohen | 746b558 | 2013-10-23 09:53:14 +0300 | [diff] [blame] | 458 | struct timer_list delay_timer; |
| 459 | int fill_delay; |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 460 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING |
| 461 | struct ib_odp_caps odp_caps; |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 462 | /* |
| 463 | * Sleepable RCU that prevents destruction of MRs while they are still |
| 464 | * being used by a page fault handler. |
| 465 | */ |
| 466 | struct srcu_struct mr_srcu; |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 467 | #endif |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 468 | }; |
| 469 | |
| 470 | static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq) |
| 471 | { |
| 472 | return container_of(mcq, struct mlx5_ib_cq, mcq); |
| 473 | } |
| 474 | |
| 475 | static inline struct mlx5_ib_xrcd *to_mxrcd(struct ib_xrcd *ibxrcd) |
| 476 | { |
| 477 | return container_of(ibxrcd, struct mlx5_ib_xrcd, ibxrcd); |
| 478 | } |
| 479 | |
| 480 | static inline struct mlx5_ib_dev *to_mdev(struct ib_device *ibdev) |
| 481 | { |
| 482 | return container_of(ibdev, struct mlx5_ib_dev, ib_dev); |
| 483 | } |
| 484 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 485 | static inline struct mlx5_ib_cq *to_mcq(struct ib_cq *ibcq) |
| 486 | { |
| 487 | return container_of(ibcq, struct mlx5_ib_cq, ibcq); |
| 488 | } |
| 489 | |
| 490 | static inline struct mlx5_ib_qp *to_mibqp(struct mlx5_core_qp *mqp) |
| 491 | { |
| 492 | return container_of(mqp, struct mlx5_ib_qp, mqp); |
| 493 | } |
| 494 | |
Sagi Grimberg | d5436ba | 2014-02-23 14:19:12 +0200 | [diff] [blame] | 495 | static inline struct mlx5_ib_mr *to_mibmr(struct mlx5_core_mr *mmr) |
| 496 | { |
| 497 | return container_of(mmr, struct mlx5_ib_mr, mmr); |
| 498 | } |
| 499 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 500 | static inline struct mlx5_ib_pd *to_mpd(struct ib_pd *ibpd) |
| 501 | { |
| 502 | return container_of(ibpd, struct mlx5_ib_pd, ibpd); |
| 503 | } |
| 504 | |
| 505 | static inline struct mlx5_ib_srq *to_msrq(struct ib_srq *ibsrq) |
| 506 | { |
| 507 | return container_of(ibsrq, struct mlx5_ib_srq, ibsrq); |
| 508 | } |
| 509 | |
| 510 | static inline struct mlx5_ib_qp *to_mqp(struct ib_qp *ibqp) |
| 511 | { |
| 512 | return container_of(ibqp, struct mlx5_ib_qp, ibqp); |
| 513 | } |
| 514 | |
| 515 | static inline struct mlx5_ib_srq *to_mibsrq(struct mlx5_core_srq *msrq) |
| 516 | { |
| 517 | return container_of(msrq, struct mlx5_ib_srq, msrq); |
| 518 | } |
| 519 | |
| 520 | static inline struct mlx5_ib_mr *to_mmr(struct ib_mr *ibmr) |
| 521 | { |
| 522 | return container_of(ibmr, struct mlx5_ib_mr, ibmr); |
| 523 | } |
| 524 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 525 | struct mlx5_ib_ah { |
| 526 | struct ib_ah ibah; |
| 527 | struct mlx5_av av; |
| 528 | }; |
| 529 | |
| 530 | static inline struct mlx5_ib_ah *to_mah(struct ib_ah *ibah) |
| 531 | { |
| 532 | return container_of(ibah, struct mlx5_ib_ah, ibah); |
| 533 | } |
| 534 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 535 | int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, unsigned long virt, |
| 536 | struct mlx5_db *db); |
| 537 | void mlx5_ib_db_unmap_user(struct mlx5_ib_ucontext *context, struct mlx5_db *db); |
| 538 | void __mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq); |
| 539 | void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq); |
| 540 | void mlx5_ib_free_srq_wqe(struct mlx5_ib_srq *srq, int wqe_index); |
| 541 | int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey, |
Ira Weiny | a97e2d8 | 2015-05-31 17:15:30 -0400 | [diff] [blame] | 542 | u8 port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
| 543 | const void *in_mad, void *response_mad); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 544 | struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); |
| 545 | int mlx5_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr); |
| 546 | int mlx5_ib_destroy_ah(struct ib_ah *ah); |
| 547 | struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, |
| 548 | struct ib_srq_init_attr *init_attr, |
| 549 | struct ib_udata *udata); |
| 550 | int mlx5_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, |
| 551 | enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); |
| 552 | int mlx5_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr); |
| 553 | int mlx5_ib_destroy_srq(struct ib_srq *srq); |
| 554 | int mlx5_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, |
| 555 | struct ib_recv_wr **bad_wr); |
| 556 | struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, |
| 557 | struct ib_qp_init_attr *init_attr, |
| 558 | struct ib_udata *udata); |
| 559 | int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
| 560 | int attr_mask, struct ib_udata *udata); |
| 561 | int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, |
| 562 | struct ib_qp_init_attr *qp_init_attr); |
| 563 | int mlx5_ib_destroy_qp(struct ib_qp *qp); |
| 564 | int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, |
| 565 | struct ib_send_wr **bad_wr); |
| 566 | int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, |
| 567 | struct ib_recv_wr **bad_wr); |
| 568 | void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); |
Haggai Eran | c1395a2 | 2014-12-11 17:04:14 +0200 | [diff] [blame] | 569 | int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index, |
| 570 | void *buffer, u32 length); |
Matan Barak | bcf4c1e | 2015-06-11 16:35:20 +0300 | [diff] [blame] | 571 | struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, |
| 572 | const struct ib_cq_init_attr *attr, |
| 573 | struct ib_ucontext *context, |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 574 | struct ib_udata *udata); |
| 575 | int mlx5_ib_destroy_cq(struct ib_cq *cq); |
| 576 | int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); |
| 577 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); |
| 578 | int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period); |
| 579 | int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata); |
| 580 | struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int acc); |
| 581 | struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
| 582 | u64 virt_addr, int access_flags, |
| 583 | struct ib_udata *udata); |
Haggai Eran | 832a6b0 | 2014-12-11 17:04:22 +0200 | [diff] [blame] | 584 | int mlx5_ib_update_mtt(struct mlx5_ib_mr *mr, u64 start_page_index, |
| 585 | int npages, int zap); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 586 | int mlx5_ib_dereg_mr(struct ib_mr *ibmr); |
Sagi Grimberg | 9bee178 | 2015-07-30 10:32:35 +0300 | [diff] [blame] | 587 | struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, |
| 588 | enum ib_mr_type mr_type, |
| 589 | u32 max_num_sg); |
Sagi Grimberg | 8a187ee | 2015-10-13 19:11:26 +0300 | [diff] [blame] | 590 | int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, |
| 591 | struct scatterlist *sg, |
| 592 | int sg_nents); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 593 | int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, |
Ira Weiny | a97e2d8 | 2015-05-31 17:15:30 -0400 | [diff] [blame] | 594 | const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
Ira Weiny | 4cd7c94 | 2015-06-06 14:38:31 -0400 | [diff] [blame] | 595 | const struct ib_mad_hdr *in, size_t in_mad_size, |
| 596 | struct ib_mad_hdr *out, size_t *out_mad_size, |
| 597 | u16 *out_mad_pkey_index); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 598 | struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev, |
| 599 | struct ib_ucontext *context, |
| 600 | struct ib_udata *udata); |
| 601 | int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 602 | int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset); |
| 603 | int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port); |
Majd Dibbiny | 1b5daf1 | 2015-06-04 19:30:46 +0300 | [diff] [blame] | 604 | int mlx5_query_mad_ifc_smp_attr_node_info(struct ib_device *ibdev, |
| 605 | struct ib_smp *out_mad); |
| 606 | int mlx5_query_mad_ifc_system_image_guid(struct ib_device *ibdev, |
| 607 | __be64 *sys_image_guid); |
| 608 | int mlx5_query_mad_ifc_max_pkeys(struct ib_device *ibdev, |
| 609 | u16 *max_pkeys); |
| 610 | int mlx5_query_mad_ifc_vendor_id(struct ib_device *ibdev, |
| 611 | u32 *vendor_id); |
| 612 | int mlx5_query_mad_ifc_node_desc(struct mlx5_ib_dev *dev, char *node_desc); |
| 613 | int mlx5_query_mad_ifc_node_guid(struct mlx5_ib_dev *dev, __be64 *node_guid); |
| 614 | int mlx5_query_mad_ifc_pkey(struct ib_device *ibdev, u8 port, u16 index, |
| 615 | u16 *pkey); |
| 616 | int mlx5_query_mad_ifc_gids(struct ib_device *ibdev, u8 port, int index, |
| 617 | union ib_gid *gid); |
| 618 | int mlx5_query_mad_ifc_port(struct ib_device *ibdev, u8 port, |
| 619 | struct ib_port_attr *props); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 620 | int mlx5_ib_query_port(struct ib_device *ibdev, u8 port, |
| 621 | struct ib_port_attr *props); |
| 622 | int mlx5_ib_init_fmr(struct mlx5_ib_dev *dev); |
| 623 | void mlx5_ib_cleanup_fmr(struct mlx5_ib_dev *dev); |
| 624 | void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, |
| 625 | int *ncont, int *order); |
Haggai Eran | 832a6b0 | 2014-12-11 17:04:22 +0200 | [diff] [blame] | 626 | void __mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, |
| 627 | int page_shift, size_t offset, size_t num_pages, |
| 628 | __be64 *pas, int access_flags); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 629 | void mlx5_ib_populate_pas(struct mlx5_ib_dev *dev, struct ib_umem *umem, |
Haggai Eran | cc149f75 | 2014-12-11 17:04:21 +0200 | [diff] [blame] | 630 | int page_shift, __be64 *pas, int access_flags); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 631 | void mlx5_ib_copy_pas(u64 *old, u64 *new, int step, int num); |
| 632 | int mlx5_ib_get_cqe_size(struct mlx5_ib_dev *dev, struct ib_cq *ibcq); |
| 633 | int mlx5_mr_cache_init(struct mlx5_ib_dev *dev); |
| 634 | int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev); |
| 635 | int mlx5_mr_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift); |
| 636 | void mlx5_umr_cq_handler(struct ib_cq *cq, void *cq_context); |
Sagi Grimberg | d5436ba | 2014-02-23 14:19:12 +0200 | [diff] [blame] | 637 | int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask, |
| 638 | struct ib_mr_status *mr_status); |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 639 | |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 640 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 641 | extern struct workqueue_struct *mlx5_ib_page_fault_wq; |
| 642 | |
Saeed Mahameed | 938fe83 | 2015-05-28 22:28:41 +0300 | [diff] [blame] | 643 | void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev); |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 644 | void mlx5_ib_mr_pfault_handler(struct mlx5_ib_qp *qp, |
| 645 | struct mlx5_ib_pfault *pfault); |
| 646 | void mlx5_ib_odp_create_qp(struct mlx5_ib_qp *qp); |
| 647 | int mlx5_ib_odp_init_one(struct mlx5_ib_dev *ibdev); |
| 648 | void mlx5_ib_odp_remove_one(struct mlx5_ib_dev *ibdev); |
| 649 | int __init mlx5_ib_odp_init(void); |
| 650 | void mlx5_ib_odp_cleanup(void); |
| 651 | void mlx5_ib_qp_disable_pagefaults(struct mlx5_ib_qp *qp); |
| 652 | void mlx5_ib_qp_enable_pagefaults(struct mlx5_ib_qp *qp); |
Haggai Eran | b4cfe44 | 2014-12-11 17:04:26 +0200 | [diff] [blame] | 653 | void mlx5_ib_invalidate_range(struct ib_umem *umem, unsigned long start, |
| 654 | unsigned long end); |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 655 | |
| 656 | #else /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */ |
Saeed Mahameed | 938fe83 | 2015-05-28 22:28:41 +0300 | [diff] [blame] | 657 | static inline void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev) |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 658 | { |
Saeed Mahameed | 938fe83 | 2015-05-28 22:28:41 +0300 | [diff] [blame] | 659 | return; |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 660 | } |
Haggai Eran | 6aec21f | 2014-12-11 17:04:23 +0200 | [diff] [blame] | 661 | |
| 662 | static inline void mlx5_ib_odp_create_qp(struct mlx5_ib_qp *qp) {} |
| 663 | static inline int mlx5_ib_odp_init_one(struct mlx5_ib_dev *ibdev) { return 0; } |
| 664 | static inline void mlx5_ib_odp_remove_one(struct mlx5_ib_dev *ibdev) {} |
| 665 | static inline int mlx5_ib_odp_init(void) { return 0; } |
| 666 | static inline void mlx5_ib_odp_cleanup(void) {} |
| 667 | static inline void mlx5_ib_qp_disable_pagefaults(struct mlx5_ib_qp *qp) {} |
| 668 | static inline void mlx5_ib_qp_enable_pagefaults(struct mlx5_ib_qp *qp) {} |
| 669 | |
Haggai Eran | 8cdd312 | 2014-12-11 17:04:20 +0200 | [diff] [blame] | 670 | #endif /* CONFIG_INFINIBAND_ON_DEMAND_PAGING */ |
| 671 | |
Achiad Shochat | 2811ba5 | 2015-12-23 18:47:24 +0200 | [diff] [blame] | 672 | __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, |
| 673 | int index); |
| 674 | |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 675 | static inline void init_query_mad(struct ib_smp *mad) |
| 676 | { |
| 677 | mad->base_version = 1; |
| 678 | mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; |
| 679 | mad->class_version = 1; |
| 680 | mad->method = IB_MGMT_METHOD_GET; |
| 681 | } |
| 682 | |
| 683 | static inline u8 convert_access(int acc) |
| 684 | { |
| 685 | return (acc & IB_ACCESS_REMOTE_ATOMIC ? MLX5_PERM_ATOMIC : 0) | |
| 686 | (acc & IB_ACCESS_REMOTE_WRITE ? MLX5_PERM_REMOTE_WRITE : 0) | |
| 687 | (acc & IB_ACCESS_REMOTE_READ ? MLX5_PERM_REMOTE_READ : 0) | |
| 688 | (acc & IB_ACCESS_LOCAL_WRITE ? MLX5_PERM_LOCAL_WRITE : 0) | |
| 689 | MLX5_PERM_LOCAL_READ; |
| 690 | } |
| 691 | |
Sagi Grimberg | b636401 | 2015-09-02 22:23:04 +0300 | [diff] [blame] | 692 | static inline int is_qp1(enum ib_qp_type qp_type) |
| 693 | { |
| 694 | return qp_type == IB_QPT_GSI; |
| 695 | } |
| 696 | |
Haggai Eran | cc149f75 | 2014-12-11 17:04:21 +0200 | [diff] [blame] | 697 | #define MLX5_MAX_UMR_SHIFT 16 |
| 698 | #define MLX5_MAX_UMR_PAGES (1 << MLX5_MAX_UMR_SHIFT) |
| 699 | |
Leon Romanovsky | 051f263 | 2015-12-20 12:16:11 +0200 | [diff] [blame] | 700 | static inline u32 check_cq_create_flags(u32 flags) |
| 701 | { |
| 702 | /* |
| 703 | * It returns non-zero value for unsupported CQ |
| 704 | * create flags, otherwise it returns zero. |
| 705 | */ |
| 706 | return (flags & ~IB_CQ_FLAGS_IGNORE_OVERRUN); |
| 707 | } |
Haggai Abramovsky | cfb5e08 | 2016-01-14 19:12:57 +0200 | [diff] [blame] | 708 | |
| 709 | static inline int verify_assign_uidx(u8 cqe_version, u32 cmd_uidx, |
| 710 | u32 *user_index) |
| 711 | { |
| 712 | if (cqe_version) { |
| 713 | if ((cmd_uidx == MLX5_IB_DEFAULT_UIDX) || |
| 714 | (cmd_uidx & ~MLX5_USER_ASSIGNED_UIDX_MASK)) |
| 715 | return -EINVAL; |
| 716 | *user_index = cmd_uidx; |
| 717 | } else { |
| 718 | *user_index = MLX5_IB_DEFAULT_UIDX; |
| 719 | } |
| 720 | |
| 721 | return 0; |
| 722 | } |
Eli Cohen | e126ba9 | 2013-07-07 17:25:49 +0300 | [diff] [blame] | 723 | #endif /* MLX5_IB_H */ |