hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/infiniband/sw/rxe/rxe_verbs.h
....@@ -1,34 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
23 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
34 * 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.
325 */
336
347 #ifndef RXE_VERBS_H
....@@ -61,18 +34,18 @@
6134 }
6235
6336 struct rxe_ucontext {
37
+ struct ib_ucontext ibuc;
6438 struct rxe_pool_entry pelem;
65
- struct ib_ucontext ibuc;
6639 };
6740
6841 struct rxe_pd {
42
+ struct ib_pd ibpd;
6943 struct rxe_pool_entry pelem;
70
- struct ib_pd ibpd;
7144 };
7245
7346 struct rxe_ah {
74
- struct rxe_pool_entry pelem;
7547 struct ib_ah ibah;
48
+ struct rxe_pool_entry pelem;
7649 struct rxe_pd *pd;
7750 struct rxe_av av;
7851 };
....@@ -85,8 +58,8 @@
8558 };
8659
8760 struct rxe_cq {
88
- struct rxe_pool_entry pelem;
8961 struct ib_cq ibcq;
62
+ struct rxe_pool_entry pelem;
9063 struct rxe_queue *queue;
9164 spinlock_t cq_lock;
9265 u8 notify;
....@@ -120,8 +93,8 @@
12093 };
12194
12295 struct rxe_srq {
123
- struct rxe_pool_entry pelem;
12496 struct ib_srq ibsrq;
97
+ struct rxe_pool_entry pelem;
12598 struct rxe_pd *pd;
12699 struct rxe_rq rq;
127100 u32 srq_num;
....@@ -252,6 +225,7 @@
252225
253226 struct socket *sk;
254227 u32 dst_cookie;
228
+ u16 src_port;
255229
256230 struct rxe_av pri_av;
257231 struct rxe_av alt_av;
....@@ -321,11 +295,7 @@
321295 struct ib_mw ibmw;
322296 };
323297
324
- struct rxe_pd *pd;
325298 struct ib_umem *umem;
326
-
327
- u32 lkey;
328
- u32 rkey;
329299
330300 enum rxe_mem_state state;
331301 enum rxe_mem_type type;
....@@ -370,7 +340,6 @@
370340
371341 struct rxe_port {
372342 struct ib_port_attr attr;
373
- u16 *pkey_tbl;
374343 __be64 port_guid;
375344 __be64 subnet_prefix;
376345 spinlock_t port_lock; /* guard port */
....@@ -385,7 +354,6 @@
385354 struct ib_device_attr attr;
386355 int max_ucontext;
387356 int max_inline_data;
388
- struct kref ref_cnt;
389357 struct mutex usdev_lock;
390358
391359 struct net_device *ndev;
....@@ -412,7 +380,6 @@
412380 atomic64_t stats_counters[RXE_NUM_OF_COUNTERS];
413381
414382 struct rxe_port port;
415
- struct list_head list;
416383 struct crypto_shash *tfm;
417384 };
418385
....@@ -466,8 +433,22 @@
466433 return mw ? container_of(mw, struct rxe_mem, ibmw) : NULL;
467434 }
468435
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);
471452
472453 void rxe_mc_cleanup(struct rxe_pool_entry *arg);
473454