Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
a046d57d UB |
2 | /* |
3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | |
4 | * | |
5 | * CLC (connection layer control) handshake over initial TCP socket to | |
6 | * prepare for RDMA traffic | |
7 | * | |
8 | * Copyright IBM Corp. 2016 | |
9 | * | |
10 | * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com> | |
11 | */ | |
12 | ||
13 | #ifndef _SMC_CLC_H | |
14 | #define _SMC_CLC_H | |
15 | ||
16 | #include <rdma/ib_verbs.h> | |
fa086662 | 17 | #include <linux/smc.h> |
a046d57d UB |
18 | |
19 | #include "smc.h" | |
fa086662 | 20 | #include "smc_netlink.h" |
a046d57d UB |
21 | |
22 | #define SMC_CLC_PROPOSAL 0x01 | |
23 | #define SMC_CLC_ACCEPT 0x02 | |
24 | #define SMC_CLC_CONFIRM 0x03 | |
25 | #define SMC_CLC_DECLINE 0x04 | |
26 | ||
c758dfdd HW |
27 | #define SMC_TYPE_R 0 /* SMC-R only */ |
28 | #define SMC_TYPE_D 1 /* SMC-D only */ | |
fb4f7926 | 29 | #define SMC_TYPE_N 2 /* neither SMC-R nor SMC-D */ |
c758dfdd | 30 | #define SMC_TYPE_B 3 /* SMC-R and SMC-D */ |
a046d57d | 31 | #define CLC_WAIT_TIME (6 * HZ) /* max. wait time on clcsock */ |
2b59f58e | 32 | #define CLC_WAIT_TIME_SHORT HZ /* short wait time on clcsock */ |
a046d57d | 33 | #define SMC_CLC_DECL_MEM 0x01010000 /* insufficient memory resources */ |
603cc149 KG |
34 | #define SMC_CLC_DECL_TIMEOUT_CL 0x02010000 /* timeout w4 QP confirm link */ |
35 | #define SMC_CLC_DECL_TIMEOUT_AL 0x02020000 /* timeout w4 QP add link */ | |
a046d57d | 36 | #define SMC_CLC_DECL_CNFERR 0x03000000 /* configuration error */ |
603cc149 KG |
37 | #define SMC_CLC_DECL_PEERNOSMC 0x03010000 /* peer did not indicate SMC */ |
38 | #define SMC_CLC_DECL_IPSEC 0x03020000 /* IPsec usage */ | |
9aa68d29 KG |
39 | #define SMC_CLC_DECL_NOSMCDEV 0x03030000 /* no SMC device found (R or D) */ |
40 | #define SMC_CLC_DECL_NOSMCDDEV 0x03030001 /* no SMC-D device found */ | |
41 | #define SMC_CLC_DECL_NOSMCRDEV 0x03030002 /* no SMC-R device found */ | |
3752404a KG |
42 | #define SMC_CLC_DECL_NOISM2SUPP 0x03030003 /* hardware has no ISMv2 support */ |
43 | #define SMC_CLC_DECL_NOV2EXT 0x03030004 /* peer sent no clc v2 extension */ | |
44 | #define SMC_CLC_DECL_NOV2DEXT 0x03030005 /* peer sent no clc SMC-Dv2 ext. */ | |
45 | #define SMC_CLC_DECL_NOSEID 0x03030006 /* peer sent no SEID */ | |
46 | #define SMC_CLC_DECL_NOSMCD2DEV 0x03030007 /* no SMC-Dv2 device found */ | |
e49300a6 | 47 | #define SMC_CLC_DECL_NOUEID 0x03030008 /* peer sent no UEID */ |
6ac1e656 | 48 | #define SMC_CLC_DECL_RELEASEERR 0x03030009 /* release version negotiate failed */ |
7f0620b9 | 49 | #define SMC_CLC_DECL_MAXCONNERR 0x0303000a /* max connections negotiate failed */ |
69b888e3 | 50 | #define SMC_CLC_DECL_MAXLINKERR 0x0303000b /* max links negotiate failed */ |
603cc149 KG |
51 | #define SMC_CLC_DECL_MODEUNSUPP 0x03040000 /* smc modes do not match (R or D)*/ |
52 | #define SMC_CLC_DECL_RMBE_EC 0x03050000 /* peer has eyecatcher in RMBE */ | |
53 | #define SMC_CLC_DECL_OPTUNSUPP 0x03060000 /* fastopen sockopt not supported */ | |
59886697 | 54 | #define SMC_CLC_DECL_DIFFPREFIX 0x03070000 /* IP prefix / subnet mismatch */ |
fba7e8ef | 55 | #define SMC_CLC_DECL_GETVLANERR 0x03080000 /* err to get vlan id of ip device*/ |
7a62725a | 56 | #define SMC_CLC_DECL_ISMVLANERR 0x03090000 /* err to reg vlan id on ism dev */ |
b9247544 | 57 | #define SMC_CLC_DECL_NOACTLINK 0x030a0000 /* no active smc-r link in lgr */ |
0fb0b02b | 58 | #define SMC_CLC_DECL_NOSRVLINK 0x030b0000 /* SMC-R link from srv not found */ |
fb4f7926 | 59 | #define SMC_CLC_DECL_VERSMISMAT 0x030c0000 /* SMC version mismatch */ |
72b7f6c4 | 60 | #define SMC_CLC_DECL_MAX_DMB 0x030d0000 /* SMC-D DMB limit exceeded */ |
e5c4744c KG |
61 | #define SMC_CLC_DECL_NOROUTE 0x030e0000 /* SMC-Rv2 conn. no route to peer */ |
62 | #define SMC_CLC_DECL_NOINDIRECT 0x030f0000 /* SMC-Rv2 conn. indirect mismatch*/ | |
a046d57d | 63 | #define SMC_CLC_DECL_SYNCERR 0x04000000 /* synchronization error */ |
603cc149 | 64 | #define SMC_CLC_DECL_PEERDECL 0x05000000 /* peer declined during handshake */ |
4ada81fd KG |
65 | #define SMC_CLC_DECL_INTERR 0x09990000 /* internal error */ |
66 | #define SMC_CLC_DECL_ERR_RTOK 0x09990001 /* rtoken handling failed */ | |
67 | #define SMC_CLC_DECL_ERR_RDYLNK 0x09990002 /* ib ready link failed */ | |
b8d19945 | 68 | #define SMC_CLC_DECL_ERR_REGBUF 0x09990003 /* reg rdma bufs failed */ |
a046d57d | 69 | |
f1eb02f9 UB |
70 | #define SMC_FIRST_CONTACT_MASK 0b10 /* first contact bit within typev2 */ |
71 | ||
a046d57d UB |
72 | struct smc_clc_msg_hdr { /* header1 of clc messages */ |
73 | u8 eyecatcher[4]; /* eye catcher */ | |
74 | u8 type; /* proposal / accept / confirm / decline */ | |
75 | __be16 length; | |
76 | #if defined(__BIG_ENDIAN_BITFIELD) | |
77 | u8 version : 4, | |
f1eb02f9 UB |
78 | typev2 : 2, |
79 | typev1 : 2; | |
a046d57d | 80 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
f1eb02f9 UB |
81 | u8 typev1 : 2, |
82 | typev2 : 2, | |
a046d57d UB |
83 | version : 4; |
84 | #endif | |
85 | } __packed; /* format defined in RFC7609 */ | |
86 | ||
87 | struct smc_clc_msg_trail { /* trailer of clc messages */ | |
88 | u8 eyecatcher[4]; | |
89 | }; | |
90 | ||
91 | struct smc_clc_msg_local { /* header2 of clc messages */ | |
92 | u8 id_for_peer[SMC_SYSTEMID_LEN]; /* unique system id */ | |
93 | u8 gid[16]; /* gid of ib_device port */ | |
94 | u8 mac[6]; /* mac of ib_device port */ | |
95 | }; | |
96 | ||
1a26d020 KG |
97 | /* Struct would be 4 byte aligned, but it is used in an array that is sent |
98 | * to peers and must conform to RFC7609, hence we need to use packed here. | |
99 | */ | |
e7b7a64a | 100 | struct smc_clc_ipv6_prefix { |
1a26d020 | 101 | struct in6_addr prefix; |
e7b7a64a | 102 | u8 prefix_len; |
1a26d020 | 103 | } __packed; /* format defined in RFC7609 */ |
e7b7a64a | 104 | |
8c3dca34 UB |
105 | #if defined(__BIG_ENDIAN_BITFIELD) |
106 | struct smc_clc_v2_flag { | |
107 | u8 release : 4, | |
108 | rsvd : 3, | |
109 | seid : 1; | |
110 | }; | |
111 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | |
112 | struct smc_clc_v2_flag { | |
113 | u8 seid : 1, | |
114 | rsvd : 3, | |
115 | release : 4; | |
116 | }; | |
117 | #endif | |
118 | ||
119 | struct smc_clnt_opts_area_hdr { | |
120 | u8 eid_cnt; /* number of user defined EIDs */ | |
121 | u8 ism_gid_cnt; /* number of ISMv2 GIDs */ | |
122 | u8 reserved1; | |
123 | struct smc_clc_v2_flag flag; | |
124 | u8 reserved2[2]; | |
125 | __be16 smcd_v2_ext_offset; /* SMC-Dv2 Extension Offset */ | |
126 | }; | |
127 | ||
128 | struct smc_clc_smcd_gid_chid { | |
129 | __be64 gid; /* ISM GID */ | |
130 | __be16 chid; /* ISMv2 CHID */ | |
131 | } __packed; /* format defined in | |
132 | * IBM Shared Memory Communications Version 2 | |
133 | * (https://www.ibm.com/support/pages/node/6326337) | |
134 | */ | |
135 | ||
136 | struct smc_clc_v2_extension { | |
137 | struct smc_clnt_opts_area_hdr hdr; | |
138 | u8 roce[16]; /* RoCEv2 GID */ | |
7f0620b9 | 139 | u8 max_conns; |
69b888e3 GW |
140 | u8 max_links; |
141 | u8 reserved[14]; | |
7206d58a | 142 | u8 user_eids[][SMC_MAX_EID_LEN]; |
8c3dca34 UB |
143 | }; |
144 | ||
e7b7a64a | 145 | struct smc_clc_msg_proposal_prefix { /* prefix part of clc proposal message*/ |
a046d57d UB |
146 | __be32 outgoing_subnet; /* subnet mask */ |
147 | u8 prefix_len; /* number of significant bits in mask */ | |
148 | u8 reserved[2]; | |
149 | u8 ipv6_prefixes_cnt; /* number of IPv6 prefixes in prefix array */ | |
a046d57d UB |
150 | } __aligned(4); |
151 | ||
c758dfdd | 152 | struct smc_clc_msg_smcd { /* SMC-D GID information */ |
8c3dca34 UB |
153 | struct smc_clc_smcd_gid_chid ism; /* ISM native GID+CHID of requestor */ |
154 | __be16 v2_ext_offset; /* SMC Version 2 Extension Offset */ | |
7290178a GW |
155 | u8 vendor_oui[3]; /* vendor organizationally unique identifier */ |
156 | u8 vendor_exp_options[5]; | |
157 | u8 reserved[20]; | |
8c3dca34 UB |
158 | }; |
159 | ||
160 | struct smc_clc_smcd_v2_extension { | |
161 | u8 system_eid[SMC_MAX_EID_LEN]; | |
162 | u8 reserved[16]; | |
7206d58a | 163 | struct smc_clc_smcd_gid_chid gidchid[]; |
c758dfdd HW |
164 | }; |
165 | ||
e7b7a64a UB |
166 | struct smc_clc_msg_proposal { /* clc proposal message sent by Linux */ |
167 | struct smc_clc_msg_hdr hdr; | |
168 | struct smc_clc_msg_local lcl; | |
169 | __be16 iparea_offset; /* offset to IP address information area */ | |
170 | } __aligned(4); | |
171 | ||
8c3dca34 | 172 | #define SMC_CLC_MAX_V6_PREFIX 8 |
fa086662 | 173 | #define SMC_CLC_MAX_UEID 8 |
8c3dca34 | 174 | |
6bb14e48 UB |
175 | struct smc_clc_msg_proposal_area { |
176 | struct smc_clc_msg_proposal pclc_base; | |
177 | struct smc_clc_msg_smcd pclc_smcd; | |
178 | struct smc_clc_msg_proposal_prefix pclc_prfx; | |
179 | struct smc_clc_ipv6_prefix pclc_prfx_ipv6[SMC_CLC_MAX_V6_PREFIX]; | |
8c3dca34 | 180 | struct smc_clc_v2_extension pclc_v2_ext; |
fa086662 | 181 | u8 user_eids[SMC_CLC_MAX_UEID][SMC_MAX_EID_LEN]; |
8c3dca34 UB |
182 | struct smc_clc_smcd_v2_extension pclc_smcd_v2_ext; |
183 | struct smc_clc_smcd_gid_chid pclc_gidchids[SMC_MAX_ISM_DEVS]; | |
6bb14e48 UB |
184 | struct smc_clc_msg_trail pclc_trl; |
185 | }; | |
e7b7a64a | 186 | |
3d9725a6 UB |
187 | struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */ |
188 | struct smc_clc_msg_local lcl; | |
189 | u8 qpn[3]; /* QP number */ | |
190 | __be32 rmb_rkey; /* RMB rkey */ | |
191 | u8 rmbe_idx; /* Index of RMBE in RMB */ | |
192 | __be32 rmbe_alert_token; /* unique connection id */ | |
193 | #if defined(__BIG_ENDIAN_BITFIELD) | |
194 | u8 rmbe_size : 4, /* buf size (compressed) */ | |
195 | qp_mtu : 4; /* QP mtu */ | |
a046d57d | 196 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
3d9725a6 UB |
197 | u8 qp_mtu : 4, |
198 | rmbe_size : 4; | |
a046d57d | 199 | #endif |
3d9725a6 UB |
200 | u8 reserved; |
201 | __be64 rmb_dma_addr; /* RMB virtual address */ | |
202 | u8 reserved2; | |
203 | u8 psn[3]; /* packet sequence number */ | |
3d9725a6 UB |
204 | } __packed; |
205 | ||
a7c9c5f4 | 206 | struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */ |
c5a10397 WG |
207 | __be64 gid; /* Sender GID */ |
208 | __be64 token; /* DMB token */ | |
3d9725a6 | 209 | u8 dmbe_idx; /* DMBE index */ |
c758dfdd | 210 | #if defined(__BIG_ENDIAN_BITFIELD) |
3d9725a6 UB |
211 | u8 dmbe_size : 4, /* buf size (compressed) */ |
212 | reserved3 : 4; | |
c758dfdd | 213 | #elif defined(__LITTLE_ENDIAN_BITFIELD) |
3d9725a6 UB |
214 | u8 reserved3 : 4, |
215 | dmbe_size : 4; | |
c758dfdd | 216 | #endif |
3d9725a6 | 217 | u16 reserved4; |
e15c6c46 | 218 | __be32 linkid; /* Link identifier */ |
3d9725a6 UB |
219 | } __packed; |
220 | ||
b81a5eb7 UB |
221 | #define SMC_CLC_OS_ZOS 1 |
222 | #define SMC_CLC_OS_LINUX 2 | |
223 | #define SMC_CLC_OS_AIX 3 | |
224 | ||
225 | struct smc_clc_first_contact_ext { | |
b81a5eb7 | 226 | #if defined(__BIG_ENDIAN_BITFIELD) |
e5c4744c KG |
227 | u8 v2_direct : 1, |
228 | reserved : 7; | |
b81a5eb7 UB |
229 | u8 os_type : 4, |
230 | release : 4; | |
231 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | |
e5c4744c KG |
232 | u8 reserved : 7, |
233 | v2_direct : 1; | |
b81a5eb7 UB |
234 | u8 release : 4, |
235 | os_type : 4; | |
236 | #endif | |
237 | u8 reserved2[2]; | |
238 | u8 hostname[SMC_MAX_HOSTNAME_LEN]; | |
239 | }; | |
240 | ||
7290178a GW |
241 | struct smc_clc_first_contact_ext_v2x { |
242 | struct smc_clc_first_contact_ext fce_v2_base; | |
7f0620b9 | 243 | u8 max_conns; /* for SMC-R only */ |
69b888e3 GW |
244 | u8 max_links; /* for SMC-R only */ |
245 | u8 reserved3[2]; | |
7290178a GW |
246 | __be32 vendor_exp_options; |
247 | u8 reserved4[8]; | |
248 | } __packed; /* format defined in | |
249 | * IBM Shared Memory Communications Version 2 (Third Edition) | |
250 | * (https://www.ibm.com/support/pages/node/7009315) | |
251 | */ | |
252 | ||
e5c4744c | 253 | struct smc_clc_fce_gid_ext { |
e5c4744c KG |
254 | u8 gid_cnt; |
255 | u8 reserved2[3]; | |
256 | u8 gid[][SMC_GID_SIZE]; | |
257 | }; | |
258 | ||
3d9725a6 | 259 | struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */ |
a7c9c5f4 UB |
260 | struct smc_clc_msg_hdr hdr; |
261 | union { | |
e5c4744c KG |
262 | struct { /* SMC-R */ |
263 | struct smcr_clc_msg_accept_confirm r0; | |
9505450d WG |
264 | struct { /* v2 only */ |
265 | u8 eid[SMC_MAX_EID_LEN]; | |
266 | u8 reserved6[8]; | |
267 | } __packed r1; | |
268 | }; | |
a7c9c5f4 UB |
269 | struct { /* SMC-D */ |
270 | struct smcd_clc_msg_accept_confirm_common d0; | |
9505450d WG |
271 | struct { /* v2 only, but 12 bytes reserved in v1 */ |
272 | __be16 chid; | |
273 | u8 eid[SMC_MAX_EID_LEN]; | |
274 | u8 reserved5[8]; | |
275 | } __packed d1; | |
276 | }; | |
a7c9c5f4 UB |
277 | }; |
278 | }; | |
279 | ||
a046d57d UB |
280 | struct smc_clc_msg_decline { /* clc decline message */ |
281 | struct smc_clc_msg_hdr hdr; | |
282 | u8 id_for_peer[SMC_SYSTEMID_LEN]; /* sender peer_id */ | |
283 | __be32 peer_diagnosis; /* diagnosis information */ | |
e8d726c8 UB |
284 | #if defined(__BIG_ENDIAN_BITFIELD) |
285 | u8 os_type : 4, | |
286 | reserved : 4; | |
287 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | |
288 | u8 reserved : 4, | |
289 | os_type : 4; | |
290 | #endif | |
291 | u8 reserved2[3]; | |
292 | struct smc_clc_msg_trail trl; /* eye catcher "SMCD" or "SMCR" EBCDIC */ | |
a046d57d UB |
293 | } __aligned(4); |
294 | ||
8ade200c KG |
295 | #define SMC_DECL_DIAG_COUNT_V2 4 /* no. of additional peer diagnosis codes */ |
296 | ||
297 | struct smc_clc_msg_decline_v2 { /* clc decline message */ | |
298 | struct smc_clc_msg_hdr hdr; | |
299 | u8 id_for_peer[SMC_SYSTEMID_LEN]; /* sender peer_id */ | |
300 | __be32 peer_diagnosis; /* diagnosis information */ | |
301 | #if defined(__BIG_ENDIAN_BITFIELD) | |
302 | u8 os_type : 4, | |
303 | reserved : 4; | |
304 | #elif defined(__LITTLE_ENDIAN_BITFIELD) | |
305 | u8 reserved : 4, | |
306 | os_type : 4; | |
307 | #endif | |
308 | u8 reserved2[3]; | |
309 | __be32 peer_diagnosis_v2[SMC_DECL_DIAG_COUNT_V2]; | |
310 | struct smc_clc_msg_trail trl; /* eye catcher "SMCD" or "SMCR" EBCDIC */ | |
311 | } __aligned(4); | |
312 | ||
e7b7a64a UB |
313 | /* determine start of the prefix area within the proposal message */ |
314 | static inline struct smc_clc_msg_proposal_prefix * | |
315 | smc_clc_proposal_get_prefix(struct smc_clc_msg_proposal *pclc) | |
316 | { | |
317 | return (struct smc_clc_msg_proposal_prefix *) | |
318 | ((u8 *)pclc + sizeof(*pclc) + ntohs(pclc->iparea_offset)); | |
319 | } | |
320 | ||
7affc809 UB |
321 | static inline bool smcr_indicated(int smc_type) |
322 | { | |
323 | return smc_type == SMC_TYPE_R || smc_type == SMC_TYPE_B; | |
324 | } | |
325 | ||
326 | static inline bool smcd_indicated(int smc_type) | |
327 | { | |
328 | return smc_type == SMC_TYPE_D || smc_type == SMC_TYPE_B; | |
329 | } | |
330 | ||
42042dbb KG |
331 | static inline u8 smc_indicated_type(int is_smcd, int is_smcr) |
332 | { | |
333 | if (is_smcd && is_smcr) | |
334 | return SMC_TYPE_B; | |
335 | if (is_smcd) | |
336 | return SMC_TYPE_D; | |
337 | if (is_smcr) | |
338 | return SMC_TYPE_R; | |
339 | return SMC_TYPE_N; | |
340 | } | |
341 | ||
c758dfdd HW |
342 | /* get SMC-D info from proposal message */ |
343 | static inline struct smc_clc_msg_smcd * | |
344 | smc_get_clc_msg_smcd(struct smc_clc_msg_proposal *prop) | |
345 | { | |
8c3dca34 | 346 | if (smcd_indicated(prop->hdr.typev1) && |
7affc809 | 347 | ntohs(prop->iparea_offset) != sizeof(struct smc_clc_msg_smcd)) |
c758dfdd HW |
348 | return NULL; |
349 | ||
350 | return (struct smc_clc_msg_smcd *)(prop + 1); | |
351 | } | |
352 | ||
8c3dca34 UB |
353 | static inline struct smc_clc_v2_extension * |
354 | smc_get_clc_v2_ext(struct smc_clc_msg_proposal *prop) | |
355 | { | |
356 | struct smc_clc_msg_smcd *prop_smcd = smc_get_clc_msg_smcd(prop); | |
357 | ||
358 | if (!prop_smcd || !ntohs(prop_smcd->v2_ext_offset)) | |
359 | return NULL; | |
360 | ||
361 | return (struct smc_clc_v2_extension *) | |
362 | ((u8 *)prop_smcd + | |
363 | offsetof(struct smc_clc_msg_smcd, v2_ext_offset) + | |
364 | sizeof(prop_smcd->v2_ext_offset) + | |
365 | ntohs(prop_smcd->v2_ext_offset)); | |
366 | } | |
367 | ||
5c21c4cc UB |
368 | static inline struct smc_clc_smcd_v2_extension * |
369 | smc_get_clc_smcd_v2_ext(struct smc_clc_v2_extension *prop_v2ext) | |
370 | { | |
371 | if (!prop_v2ext) | |
372 | return NULL; | |
373 | if (!ntohs(prop_v2ext->hdr.smcd_v2_ext_offset)) | |
374 | return NULL; | |
375 | ||
376 | return (struct smc_clc_smcd_v2_extension *) | |
377 | ((u8 *)prop_v2ext + | |
378 | offsetof(struct smc_clc_v2_extension, hdr) + | |
379 | offsetof(struct smc_clnt_opts_area_hdr, smcd_v2_ext_offset) + | |
380 | sizeof(prop_v2ext->hdr.smcd_v2_ext_offset) + | |
381 | ntohs(prop_v2ext->hdr.smcd_v2_ext_offset)); | |
382 | } | |
383 | ||
1e700948 | 384 | static inline struct smc_clc_first_contact_ext * |
9505450d | 385 | smc_get_clc_first_contact_ext(struct smc_clc_msg_accept_confirm *clc, |
1e700948 GW |
386 | bool is_smcd) |
387 | { | |
388 | int clc_v2_len; | |
389 | ||
9505450d WG |
390 | if (clc->hdr.version == SMC_V1 || |
391 | !(clc->hdr.typev2 & SMC_FIRST_CONTACT_MASK)) | |
1e700948 GW |
392 | return NULL; |
393 | ||
394 | if (is_smcd) | |
395 | clc_v2_len = | |
9505450d | 396 | offsetofend(struct smc_clc_msg_accept_confirm, d1); |
1e700948 GW |
397 | else |
398 | clc_v2_len = | |
9505450d | 399 | offsetofend(struct smc_clc_msg_accept_confirm, r1); |
1e700948 | 400 | |
9505450d | 401 | return (struct smc_clc_first_contact_ext *)(((u8 *)clc) + clc_v2_len); |
1e700948 GW |
402 | } |
403 | ||
c758dfdd | 404 | struct smcd_dev; |
bc36d2fc | 405 | struct smc_init_info; |
c758dfdd | 406 | |
c246d942 KG |
407 | int smc_clc_prfx_match(struct socket *clcsock, |
408 | struct smc_clc_msg_proposal_prefix *prop); | |
a046d57d | 409 | int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, |
2b59f58e | 410 | u8 expected_type, unsigned long timeout); |
e8d726c8 | 411 | int smc_clc_send_decline(struct smc_sock *smc, u32 peer_diag_info, u8 version); |
d70bf4f7 | 412 | int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini); |
a7c9c5f4 | 413 | int smc_clc_send_confirm(struct smc_sock *smc, bool clnt_first_contact, |
e5c4744c | 414 | u8 version, u8 *eid, struct smc_init_info *ini); |
a7c9c5f4 | 415 | int smc_clc_send_accept(struct smc_sock *smc, bool srv_first_contact, |
1e700948 | 416 | u8 version, u8 *negotiated_eid, struct smc_init_info *ini); |
f8e80fc4 GW |
417 | int smc_clc_srv_v2x_features_validate(struct smc_sock *smc, |
418 | struct smc_clc_msg_proposal *pclc, | |
6ac1e656 GW |
419 | struct smc_init_info *ini); |
420 | int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce, | |
421 | struct smc_init_info *ini); | |
422 | int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc, | |
423 | struct smc_init_info *ini); | |
b81a5eb7 | 424 | void smc_clc_init(void) __init; |
fa086662 | 425 | void smc_clc_exit(void); |
099b990b | 426 | void smc_clc_get_hostname(u8 **host); |
fa086662 KG |
427 | bool smc_clc_match_eid(u8 *negotiated_eid, |
428 | struct smc_clc_v2_extension *smc_v2_ext, | |
429 | u8 *peer_eid, u8 *local_eid); | |
42042dbb | 430 | int smc_clc_ueid_count(void); |
fa086662 KG |
431 | int smc_nl_dump_ueid(struct sk_buff *skb, struct netlink_callback *cb); |
432 | int smc_nl_add_ueid(struct sk_buff *skb, struct genl_info *info); | |
433 | int smc_nl_remove_ueid(struct sk_buff *skb, struct genl_info *info); | |
434 | int smc_nl_flush_ueid(struct sk_buff *skb, struct genl_info *info); | |
3c572145 KG |
435 | int smc_nl_dump_seid(struct sk_buff *skb, struct netlink_callback *cb); |
436 | int smc_nl_enable_seid(struct sk_buff *skb, struct genl_info *info); | |
437 | int smc_nl_disable_seid(struct sk_buff *skb, struct genl_info *info); | |
a046d57d UB |
438 | |
439 | #endif |