xref: /freebsd/sys/ofed/include/rdma/rdma_sdp.h (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
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  * $FreeBSD$
286b2f0171SConrad Meyer  */
296b2f0171SConrad Meyer 
306b2f0171SConrad Meyer #ifndef _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
316b2f0171SConrad Meyer #define _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_
326b2f0171SConrad Meyer 
336b2f0171SConrad Meyer #include <sys/cdefs.h>
346b2f0171SConrad Meyer #include <netinet/in.h>
356b2f0171SConrad Meyer 
366b2f0171SConrad Meyer #include <rdma/ib_cm.h>
376b2f0171SConrad Meyer 
386b2f0171SConrad Meyer union cma_ip_addr {
396b2f0171SConrad Meyer 	struct in6_addr ip6;
406b2f0171SConrad Meyer 	struct {
416b2f0171SConrad Meyer 		__be32 pad[3];
426b2f0171SConrad Meyer 		__be32 addr;
436b2f0171SConrad Meyer 	} ip4;
446b2f0171SConrad Meyer };
456b2f0171SConrad Meyer 
466b2f0171SConrad Meyer struct sdp_bsdh {
476b2f0171SConrad Meyer 	u8 mid;
486b2f0171SConrad Meyer 	u8 flags;
496b2f0171SConrad Meyer 	__u16 bufs;
506b2f0171SConrad Meyer 	__u32 len;
516b2f0171SConrad Meyer 	__u32 mseq;
526b2f0171SConrad Meyer 	__u32 mseq_ack;
536b2f0171SConrad Meyer } __packed;
546b2f0171SConrad Meyer 
556b2f0171SConrad Meyer struct sdp_hh {
566b2f0171SConrad Meyer 	struct sdp_bsdh bsdh;
576b2f0171SConrad Meyer 	u8 majv_minv;
586b2f0171SConrad Meyer 	u8 ipv_cap;
596b2f0171SConrad Meyer 	u8 rsvd1;
606b2f0171SConrad Meyer 	u8 max_adverts;
616b2f0171SConrad Meyer 	__u32 desremrcvsz;
626b2f0171SConrad Meyer 	__u32 localrcvsz;
636b2f0171SConrad Meyer 	__u16 port;
646b2f0171SConrad Meyer 	__u16 rsvd2;
656b2f0171SConrad Meyer 	union cma_ip_addr src_addr;
666b2f0171SConrad Meyer 	union cma_ip_addr dst_addr;
676b2f0171SConrad Meyer 	u8 rsvd3[IB_CM_REQ_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 48];
686b2f0171SConrad Meyer } __packed;
696b2f0171SConrad Meyer 
706b2f0171SConrad Meyer struct sdp_hah {
716b2f0171SConrad Meyer 	struct sdp_bsdh bsdh;
726b2f0171SConrad Meyer 	u8 majv_minv;
736b2f0171SConrad Meyer 	u8 ipv_cap;
746b2f0171SConrad Meyer 	u8 rsvd1;
756b2f0171SConrad Meyer 	u8 ext_max_adverts;
766b2f0171SConrad Meyer 	__u32 actrcvsz;
776b2f0171SConrad Meyer 	u8 rsvd2[IB_CM_REP_PRIVATE_DATA_SIZE - sizeof(struct sdp_bsdh) - 8];
786b2f0171SConrad Meyer } __packed;
796b2f0171SConrad Meyer 
806b2f0171SConrad Meyer #endif /* _SYS_OFED_INCLUDE_RDMA_RDMA_SDP_H_ */
81