forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/include/rdma/iw_portmap.h
....@@ -1,37 +1,14 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
23 * Copyright (c) 2014 Intel Corporation. All rights reserved.
34 * Copyright (c) 2014 Chelsio, 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 */
6
+
337 #ifndef _IW_PORTMAP_H
348 #define _IW_PORTMAP_H
9
+
10
+#include <linux/socket.h>
11
+#include <linux/netlink.h>
3512
3613 #define IWPM_ULIBNAME_SIZE 32
3714 #define IWPM_DEVNAME_SIZE 32
....@@ -58,167 +35,31 @@
5835 struct sockaddr_storage mapped_loc_addr;
5936 struct sockaddr_storage rem_addr;
6037 struct sockaddr_storage mapped_rem_addr;
38
+ u32 flags;
6139 };
6240
63
-/**
64
- * iwpm_init - Allocate resources for the iwarp port mapper
65
- *
66
- * Should be called when network interface goes up.
67
- */
6841 int iwpm_init(u8);
69
-
70
-/**
71
- * iwpm_exit - Deallocate resources for the iwarp port mapper
72
- *
73
- * Should be called when network interface goes down.
74
- */
7542 int iwpm_exit(u8);
76
-
77
-/**
78
- * iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
79
- *
80
- * Returns true if the pid is greater than zero, otherwise returns false
81
- */
8243 int iwpm_valid_pid(void);
83
-
84
-/**
85
- * iwpm_register_pid - Send a netlink query to userspace
86
- * to get the iwarp port mapper pid
87
- * @pm_msg: Contains driver info to send to the userspace port mapper
88
- * @nl_client: The index of the netlink client
89
- */
9044 int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
91
-
92
-/**
93
- * iwpm_add_mapping - Send a netlink add mapping request to
94
- * the userspace port mapper
95
- * @pm_msg: Contains the local ip/tcp address info to send
96
- * @nl_client: The index of the netlink client
97
- *
98
- * If the request is successful, the pm_msg stores
99
- * the port mapper response (mapped address info)
100
- */
10145 int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
102
-
103
-/**
104
- * iwpm_add_and_query_mapping - Send a netlink add and query mapping request
105
- * to the userspace port mapper
106
- * @pm_msg: Contains the local and remote ip/tcp address info to send
107
- * @nl_client: The index of the netlink client
108
- *
109
- * If the request is successful, the pm_msg stores the
110
- * port mapper response (mapped local and remote address info)
111
- */
11246 int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
113
-
114
-/**
115
- * iwpm_remove_mapping - Send a netlink remove mapping request
116
- * to the userspace port mapper
117
- *
118
- * @local_addr: Local ip/tcp address to remove
119
- * @nl_client: The index of the netlink client
120
- */
12147 int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
122
-
123
-/**
124
- * iwpm_register_pid_cb - Process the port mapper response to
125
- * iwpm_register_pid query
126
- * @skb:
127
- * @cb: Contains the received message (payload and netlink header)
128
- *
129
- * If successful, the function receives the userspace port mapper pid
130
- * which is used in future communication with the port mapper
131
- */
13248 int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
133
-
134
-/**
135
- * iwpm_add_mapping_cb - Process the port mapper response to
136
- * iwpm_add_mapping request
137
- * @skb:
138
- * @cb: Contains the received message (payload and netlink header)
139
- */
14049 int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
141
-
142
-/**
143
- * iwpm_add_and_query_mapping_cb - Process the port mapper response to
144
- * iwpm_add_and_query_mapping request
145
- * @skb:
146
- * @cb: Contains the received message (payload and netlink header)
147
- */
14850 int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
149
-
150
-/**
151
- * iwpm_remote_info_cb - Process remote connecting peer address info, which
152
- * the port mapper has received from the connecting peer
153
- *
154
- * @cb: Contains the received message (payload and netlink header)
155
- *
156
- * Stores the IPv4/IPv6 address info in a hash table
157
- */
15851 int iwpm_remote_info_cb(struct sk_buff *, struct netlink_callback *);
159
-
160
-/**
161
- * iwpm_mapping_error_cb - Process port mapper notification for error
162
- *
163
- * @skb:
164
- * @cb: Contains the received message (payload and netlink header)
165
- */
16652 int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
167
-
168
-/**
169
- * iwpm_mapping_info_cb - Process a notification that the userspace
170
- * port mapper daemon is started
171
- * @skb:
172
- * @cb: Contains the received message (payload and netlink header)
173
- *
174
- * Using the received port mapper pid, send all the local mapping
175
- * info records to the userspace port mapper
176
- */
17753 int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
178
-
179
-/**
180
- * iwpm_ack_mapping_info_cb - Process the port mapper ack for
181
- * the provided local mapping info records
182
- * @skb:
183
- * @cb: Contains the received message (payload and netlink header)
184
- */
18554 int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
186
-
187
-/**
188
- * iwpm_get_remote_info - Get the remote connecting peer address info
189
- *
190
- * @mapped_loc_addr: Mapped local address of the listening peer
191
- * @mapped_rem_addr: Mapped remote address of the connecting peer
192
- * @remote_addr: To store the remote address of the connecting peer
193
- * @nl_client: The index of the netlink client
194
- *
195
- * The remote address info is retrieved and provided to the client in
196
- * the remote_addr. After that it is removed from the hash table
197
- */
19855 int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
19956 struct sockaddr_storage *mapped_rem_addr,
20057 struct sockaddr_storage *remote_addr, u8 nl_client);
201
-
202
-/**
203
- * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
204
- * info in a hash table
205
- * @local_addr: Local ip/tcp address
206
- * @mapped_addr: Mapped local ip/tcp address
207
- * @nl_client: The index of the netlink client
208
- */
20958 int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
210
- struct sockaddr_storage *mapped_addr, u8 nl_client);
211
-
212
-/**
213
- * iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
214
- * info from the hash table
215
- * @local_addr: Local ip/tcp address
216
- * @mapped_addr: Mapped local ip/tcp address
217
- *
218
- * Returns err code if mapping info is not found in the hash table,
219
- * otherwise returns 0
220
- */
59
+ struct sockaddr_storage *mapped_addr, u8 nl_client,
60
+ u32 map_flags);
22161 int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
22262 struct sockaddr_storage *mapped_addr);
22363
64
+int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb);
22465 #endif /* _IW_PORTMAP_H */