xref: /freebsd/sys/ofed/include/rdma/rdma_sdp.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
16b2f0171SConrad Meyer /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
36b2f0171SConrad Meyer  *
46b2f0171SConrad Meyer  * Copyright (c) 2019 Isilon Systems, LLC.
56b2f0171SConrad Meyer  *
66b2f0171SConrad Meyer  * Redistribution and use in source and binary forms, with or without
76b2f0171SConrad Meyer  * modification, are permitted provided that the following conditions
86b2f0171SConrad Meyer  * are met:
96b2f0171SConrad Meyer  * 1. Redistributions of source code must retain the above copyright
106b2f0171SConrad Meyer  *    notice, this list of conditions and the following disclaimer.
116b2f0171SConrad Meyer  * 2. Redistributions in binary form must reproduce the above copyright
126b2f0171SConrad Meyer  *    notice, this list of conditions and the following disclaimer in the
136b2f0171SConrad Meyer  *    documentation and/or other materials provided with the distribution.
146b2f0171SConrad Meyer  *
156b2f0171SConrad Meyer  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
166b2f0171SConrad Meyer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
176b2f0171SConrad Meyer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
186b2f0171SConrad Meyer  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
196b2f0171SConrad Meyer  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
206b2f0171SConrad Meyer  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
216b2f0171SConrad Meyer  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
226b2f0171SConrad Meyer  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
236b2f0171SConrad Meyer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
246b2f0171SConrad Meyer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
256b2f0171SConrad Meyer  * SUCH DAMAGE.
266b2f0171SConrad Meyer  */
276b2f0171SConrad Meyer 
286b2f0171SConrad Meyer #ifndef _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
296b2f0171SConrad Meyer #define _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
306b2f0171SConrad Meyer 
316b2f0171SConrad Meyer #include <sys/cdefs.h>
326b2f0171SConrad Meyer #include <netinet/in.h>
336b2f0171SConrad Meyer 
346b2f0171SConrad Meyer #include <rdma/ib_cm.h>
356b2f0171SConrad Meyer 
366b2f0171SConrad Meyer union cma_ip_addr {
376b2f0171SConrad Meyer 	struct in6_addr ip6;
386b2f0171SConrad Meyer 	struct {
396b2f0171SConrad Meyer 		__be32 pad[3];
406b2f0171SConrad Meyer 		__be32 addr;
416b2f0171SConrad Meyer 	} ip4;
426b2f0171SConrad Meyer };
436b2f0171SConrad Meyer 
446b2f0171SConrad Meyer struct sdp_bsdh {
456b2f0171SConrad Meyer 	u8 mid;
466b2f0171SConrad Meyer 	u8 flags;
476b2f0171SConrad Meyer 	__u16 bufs;
486b2f0171SConrad Meyer 	__u32 len;
496b2f0171SConrad Meyer 	__u32 mseq;
506b2f0171SConrad Meyer 	__u32 mseq_ack;
516b2f0171SConrad Meyer } __packed;
526b2f0171SConrad Meyer 
536b2f0171SConrad Meyer struct sdp_hh {
546b2f0171SConrad Meyer 	struct sdp_bsdh bsdh;
556b2f0171SConrad Meyer 	u8 majv_minv;
566b2f0171SConrad Meyer 	u8 ipv_cap;
576b2f0171SConrad Meyer 	u8 rsvd1;
586b2f0171SConrad Meyer 	u8 max_adverts;
596b2f0171SConrad Meyer 	__u32 desremrcvsz;
606b2f0171SConrad Meyer 	__u32 localrcvsz;
616b2f0171SConrad Meyer 	__u16 port;
626b2f0171SConrad Meyer 	__u16 rsvd2;
636b2f0171SConrad Meyer 	union cma_ip_addr src_addr;
646b2f0171SConrad Meyer 	union cma_ip_addr dst_addr;
656b2f0171SConrad Meyer 	u8 rsvd3[IB_CM_REQ_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 48];
666b2f0171SConrad Meyer } __packed;
676b2f0171SConrad Meyer 
686b2f0171SConrad Meyer struct sdp_hah {
696b2f0171SConrad Meyer 	struct sdp_bsdh bsdh;
706b2f0171SConrad Meyer 	u8 majv_minv;
716b2f0171SConrad Meyer 	u8 ipv_cap;
726b2f0171SConrad Meyer 	u8 rsvd1;
736b2f0171SConrad Meyer 	u8 ext_max_adverts;
746b2f0171SConrad Meyer 	__u32 actrcvsz;
756b2f0171SConrad Meyer 	u8 rsvd2[IB_CM_REP_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 8];
766b2f0171SConrad Meyer } __packed;
776b2f0171SConrad Meyer 
786b2f0171SConrad Meyer #endif /* _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ */
79