xref: /freebsd/sys/ofed/include/rdma/rdma_sdp.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2019 Isilon Systems, LLC.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #ifndef _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
29 #define _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
30 
31 #include <sys/cdefs.h>
32 #include <netinet/in.h>
33 
34 #include <rdma/ib_cm.h>
35 
36 union cma_ip_addr {
37 	struct in6_addr ip6;
38 	struct {
39 		__be32 pad[3];
40 		__be32 addr;
41 	} ip4;
42 };
43 
44 struct sdp_bsdh {
45 	u8 mid;
46 	u8 flags;
47 	__u16 bufs;
48 	__u32 len;
49 	__u32 mseq;
50 	__u32 mseq_ack;
51 } __packed;
52 
53 struct sdp_hh {
54 	struct sdp_bsdh bsdh;
55 	u8 majv_minv;
56 	u8 ipv_cap;
57 	u8 rsvd1;
58 	u8 max_adverts;
59 	__u32 desremrcvsz;
60 	__u32 localrcvsz;
61 	__u16 port;
62 	__u16 rsvd2;
63 	union cma_ip_addr src_addr;
64 	union cma_ip_addr dst_addr;
65 	u8 rsvd3[IB_CM_REQ_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 48];
66 } __packed;
67 
68 struct sdp_hah {
69 	struct sdp_bsdh bsdh;
70 	u8 majv_minv;
71 	u8 ipv_cap;
72 	u8 rsvd1;
73 	u8 ext_max_adverts;
74 	__u32 actrcvsz;
75 	u8 rsvd2[IB_CM_REP_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 8];
76 } __packed;
77 
78 #endif /* _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ */
79