xref: /linux/include/uapi/rdma/rdma_user_rxe.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 /*
2  * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
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 RDMA_USER_RXE_H
34 #define RDMA_USER_RXE_H
35 
36 #include <linux/types.h>
37 
38 union rxe_gid {
39 	__u8	raw[16];
40 	struct {
41 		__be64	subnet_prefix;
42 		__be64	interface_id;
43 	} global;
44 };
45 
46 struct rxe_global_route {
47 	union rxe_gid	dgid;
48 	__u32		flow_label;
49 	__u8		sgid_index;
50 	__u8		hop_limit;
51 	__u8		traffic_class;
52 };
53 
54 struct rxe_av {
55 	__u8			port_num;
56 	__u8			network_type;
57 	struct rxe_global_route	grh;
58 	union {
59 		struct sockaddr		_sockaddr;
60 		struct sockaddr_in	_sockaddr_in;
61 		struct sockaddr_in6	_sockaddr_in6;
62 	} sgid_addr, dgid_addr;
63 };
64 
65 struct rxe_send_wr {
66 	__u64			wr_id;
67 	__u32			num_sge;
68 	__u32			opcode;
69 	__u32			send_flags;
70 	union {
71 		__be32		imm_data;
72 		__u32		invalidate_rkey;
73 	} ex;
74 	union {
75 		struct {
76 			__u64	remote_addr;
77 			__u32	rkey;
78 		} rdma;
79 		struct {
80 			__u64	remote_addr;
81 			__u64	compare_add;
82 			__u64	swap;
83 			__u32	rkey;
84 		} atomic;
85 		struct {
86 			__u32	remote_qpn;
87 			__u32	remote_qkey;
88 			__u16	pkey_index;
89 		} ud;
90 		struct {
91 			struct ib_mr *mr;
92 			__u32        key;
93 			int          access;
94 		} reg;
95 	} wr;
96 };
97 
98 struct rxe_sge {
99 	__u64	addr;
100 	__u32	length;
101 	__u32	lkey;
102 };
103 
104 struct mminfo {
105 	__u64			offset;
106 	__u32			size;
107 	__u32			pad;
108 };
109 
110 struct rxe_dma_info {
111 	__u32			length;
112 	__u32			resid;
113 	__u32			cur_sge;
114 	__u32			num_sge;
115 	__u32			sge_offset;
116 	union {
117 		__u8		inline_data[0];
118 		struct rxe_sge	sge[0];
119 	};
120 };
121 
122 struct rxe_send_wqe {
123 	struct rxe_send_wr	wr;
124 	struct rxe_av		av;
125 	__u32			status;
126 	__u32			state;
127 	__u64			iova;
128 	__u32			mask;
129 	__u32			first_psn;
130 	__u32			last_psn;
131 	__u32			ack_length;
132 	__u32			ssn;
133 	__u32			has_rd_atomic;
134 	struct rxe_dma_info	dma;
135 };
136 
137 struct rxe_recv_wqe {
138 	__u64			wr_id;
139 	__u32			num_sge;
140 	__u32			padding;
141 	struct rxe_dma_info	dma;
142 };
143 
144 #endif /* RDMA_USER_RXE_H */
145