| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. |
|---|
| 3 | 4 | * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This software is available to you under a choice of one of two |
|---|
| 6 | | - * licenses. You may choose to be licensed under the terms of the GNU |
|---|
| 7 | | - * General Public License (GPL) Version 2, available from the file |
|---|
| 8 | | - * COPYING in the main directory of this source tree, or the |
|---|
| 9 | | - * OpenIB.org BSD license below: |
|---|
| 10 | | - * |
|---|
| 11 | | - * Redistribution and use in source and binary forms, with or |
|---|
| 12 | | - * without modification, are permitted provided that the following |
|---|
| 13 | | - * conditions are met: |
|---|
| 14 | | - * |
|---|
| 15 | | - * - Redistributions of source code must retain the above |
|---|
| 16 | | - * copyright notice, this list of conditions and the following |
|---|
| 17 | | - * disclaimer. |
|---|
| 18 | | - * |
|---|
| 19 | | - * - Redistributions in binary form must reproduce the above |
|---|
| 20 | | - * copyright notice, this list of conditions and the following |
|---|
| 21 | | - * disclaimer in the documentation and/or other materials |
|---|
| 22 | | - * provided with the distribution. |
|---|
| 23 | | - * |
|---|
| 24 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|---|
| 25 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|---|
| 26 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|---|
| 27 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
|---|
| 28 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|---|
| 29 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|---|
| 30 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|---|
| 31 | | - * SOFTWARE. |
|---|
| 32 | 5 | */ |
|---|
| 33 | 6 | |
|---|
| 34 | 7 | #ifndef RXE_VERBS_H |
|---|
| .. | .. |
|---|
| 61 | 34 | } |
|---|
| 62 | 35 | |
|---|
| 63 | 36 | struct rxe_ucontext { |
|---|
| 37 | + struct ib_ucontext ibuc; |
|---|
| 64 | 38 | struct rxe_pool_entry pelem; |
|---|
| 65 | | - struct ib_ucontext ibuc; |
|---|
| 66 | 39 | }; |
|---|
| 67 | 40 | |
|---|
| 68 | 41 | struct rxe_pd { |
|---|
| 42 | + struct ib_pd ibpd; |
|---|
| 69 | 43 | struct rxe_pool_entry pelem; |
|---|
| 70 | | - struct ib_pd ibpd; |
|---|
| 71 | 44 | }; |
|---|
| 72 | 45 | |
|---|
| 73 | 46 | struct rxe_ah { |
|---|
| 74 | | - struct rxe_pool_entry pelem; |
|---|
| 75 | 47 | struct ib_ah ibah; |
|---|
| 48 | + struct rxe_pool_entry pelem; |
|---|
| 76 | 49 | struct rxe_pd *pd; |
|---|
| 77 | 50 | struct rxe_av av; |
|---|
| 78 | 51 | }; |
|---|
| .. | .. |
|---|
| 85 | 58 | }; |
|---|
| 86 | 59 | |
|---|
| 87 | 60 | struct rxe_cq { |
|---|
| 88 | | - struct rxe_pool_entry pelem; |
|---|
| 89 | 61 | struct ib_cq ibcq; |
|---|
| 62 | + struct rxe_pool_entry pelem; |
|---|
| 90 | 63 | struct rxe_queue *queue; |
|---|
| 91 | 64 | spinlock_t cq_lock; |
|---|
| 92 | 65 | u8 notify; |
|---|
| .. | .. |
|---|
| 120 | 93 | }; |
|---|
| 121 | 94 | |
|---|
| 122 | 95 | struct rxe_srq { |
|---|
| 123 | | - struct rxe_pool_entry pelem; |
|---|
| 124 | 96 | struct ib_srq ibsrq; |
|---|
| 97 | + struct rxe_pool_entry pelem; |
|---|
| 125 | 98 | struct rxe_pd *pd; |
|---|
| 126 | 99 | struct rxe_rq rq; |
|---|
| 127 | 100 | u32 srq_num; |
|---|
| .. | .. |
|---|
| 252 | 225 | |
|---|
| 253 | 226 | struct socket *sk; |
|---|
| 254 | 227 | u32 dst_cookie; |
|---|
| 228 | + u16 src_port; |
|---|
| 255 | 229 | |
|---|
| 256 | 230 | struct rxe_av pri_av; |
|---|
| 257 | 231 | struct rxe_av alt_av; |
|---|
| .. | .. |
|---|
| 321 | 295 | struct ib_mw ibmw; |
|---|
| 322 | 296 | }; |
|---|
| 323 | 297 | |
|---|
| 324 | | - struct rxe_pd *pd; |
|---|
| 325 | 298 | struct ib_umem *umem; |
|---|
| 326 | | - |
|---|
| 327 | | - u32 lkey; |
|---|
| 328 | | - u32 rkey; |
|---|
| 329 | 299 | |
|---|
| 330 | 300 | enum rxe_mem_state state; |
|---|
| 331 | 301 | enum rxe_mem_type type; |
|---|
| .. | .. |
|---|
| 370 | 340 | |
|---|
| 371 | 341 | struct rxe_port { |
|---|
| 372 | 342 | struct ib_port_attr attr; |
|---|
| 373 | | - u16 *pkey_tbl; |
|---|
| 374 | 343 | __be64 port_guid; |
|---|
| 375 | 344 | __be64 subnet_prefix; |
|---|
| 376 | 345 | spinlock_t port_lock; /* guard port */ |
|---|
| .. | .. |
|---|
| 385 | 354 | struct ib_device_attr attr; |
|---|
| 386 | 355 | int max_ucontext; |
|---|
| 387 | 356 | int max_inline_data; |
|---|
| 388 | | - struct kref ref_cnt; |
|---|
| 389 | 357 | struct mutex usdev_lock; |
|---|
| 390 | 358 | |
|---|
| 391 | 359 | struct net_device *ndev; |
|---|
| .. | .. |
|---|
| 412 | 380 | atomic64_t stats_counters[RXE_NUM_OF_COUNTERS]; |
|---|
| 413 | 381 | |
|---|
| 414 | 382 | struct rxe_port port; |
|---|
| 415 | | - struct list_head list; |
|---|
| 416 | 383 | struct crypto_shash *tfm; |
|---|
| 417 | 384 | }; |
|---|
| 418 | 385 | |
|---|
| .. | .. |
|---|
| 466 | 433 | return mw ? container_of(mw, struct rxe_mem, ibmw) : NULL; |
|---|
| 467 | 434 | } |
|---|
| 468 | 435 | |
|---|
| 469 | | -int rxe_register_device(struct rxe_dev *rxe); |
|---|
| 470 | | -int rxe_unregister_device(struct rxe_dev *rxe); |
|---|
| 436 | +static inline struct rxe_pd *mr_pd(struct rxe_mem *mr) |
|---|
| 437 | +{ |
|---|
| 438 | + return to_rpd(mr->ibmr.pd); |
|---|
| 439 | +} |
|---|
| 440 | + |
|---|
| 441 | +static inline u32 mr_lkey(struct rxe_mem *mr) |
|---|
| 442 | +{ |
|---|
| 443 | + return mr->ibmr.lkey; |
|---|
| 444 | +} |
|---|
| 445 | + |
|---|
| 446 | +static inline u32 mr_rkey(struct rxe_mem *mr) |
|---|
| 447 | +{ |
|---|
| 448 | + return mr->ibmr.rkey; |
|---|
| 449 | +} |
|---|
| 450 | + |
|---|
| 451 | +int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name); |
|---|
| 471 | 452 | |
|---|
| 472 | 453 | void rxe_mc_cleanup(struct rxe_pool_entry *arg); |
|---|
| 473 | 454 | |
|---|