xref: /onnv-gate/usr/src/uts/common/sys/rds.h (revision 12580:4daad5d7c55d)
112198SEiji.Ota@Sun.COM /*
212198SEiji.Ota@Sun.COM  * CDDL HEADER START
312198SEiji.Ota@Sun.COM  *
412198SEiji.Ota@Sun.COM  * The contents of this file are subject to the terms of the
512198SEiji.Ota@Sun.COM  * Common Development and Distribution License (the "License").
612198SEiji.Ota@Sun.COM  * You may not use this file except in compliance with the License.
712198SEiji.Ota@Sun.COM  *
812198SEiji.Ota@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
912198SEiji.Ota@Sun.COM  * or http://www.opensolaris.org/os/licensing.
1012198SEiji.Ota@Sun.COM  * See the License for the specific language governing permissions
1112198SEiji.Ota@Sun.COM  * and limitations under the License.
1212198SEiji.Ota@Sun.COM  *
1312198SEiji.Ota@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
1412198SEiji.Ota@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1512198SEiji.Ota@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
1612198SEiji.Ota@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
1712198SEiji.Ota@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
1812198SEiji.Ota@Sun.COM  *
1912198SEiji.Ota@Sun.COM  * CDDL HEADER END
2012198SEiji.Ota@Sun.COM  */
2112198SEiji.Ota@Sun.COM /*
2212198SEiji.Ota@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2312198SEiji.Ota@Sun.COM  */
2412198SEiji.Ota@Sun.COM 
2512198SEiji.Ota@Sun.COM /*
2612198SEiji.Ota@Sun.COM  * Copyright (c) 2008 Oracle.  All rights reserved.
2712198SEiji.Ota@Sun.COM  *
2812198SEiji.Ota@Sun.COM  * This software is available to you under a choice of one of two
2912198SEiji.Ota@Sun.COM  * licenses.  You may choose to be licensed under the terms of the GNU
3012198SEiji.Ota@Sun.COM  * General Public License (GPL) Version 2, available from the file
3112198SEiji.Ota@Sun.COM  * COPYING in the main directory of this source tree, or the
3212198SEiji.Ota@Sun.COM  * OpenIB.org BSD license below:
3312198SEiji.Ota@Sun.COM  *
3412198SEiji.Ota@Sun.COM  *     Redistribution and use in source and binary forms, with or
3512198SEiji.Ota@Sun.COM  *     without modification, are permitted provided that the following
3612198SEiji.Ota@Sun.COM  *     conditions are met:
3712198SEiji.Ota@Sun.COM  *
3812198SEiji.Ota@Sun.COM  *      - Redistributions of source code must retain the above
3912198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
4012198SEiji.Ota@Sun.COM  *        disclaimer.
4112198SEiji.Ota@Sun.COM  *
4212198SEiji.Ota@Sun.COM  *      - Redistributions in binary form must reproduce the above
4312198SEiji.Ota@Sun.COM  *        copyright notice, this list of conditions and the following
4412198SEiji.Ota@Sun.COM  *        disclaimer in the documentation and/or other materials
4512198SEiji.Ota@Sun.COM  *        provided with the distribution.
4612198SEiji.Ota@Sun.COM  *
4712198SEiji.Ota@Sun.COM  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4812198SEiji.Ota@Sun.COM  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4912198SEiji.Ota@Sun.COM  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
5012198SEiji.Ota@Sun.COM  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
5112198SEiji.Ota@Sun.COM  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
5212198SEiji.Ota@Sun.COM  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5312198SEiji.Ota@Sun.COM  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5412198SEiji.Ota@Sun.COM  * SOFTWARE.
5512198SEiji.Ota@Sun.COM  *
5612198SEiji.Ota@Sun.COM  */
5712198SEiji.Ota@Sun.COM 
5812198SEiji.Ota@Sun.COM /*
5912198SEiji.Ota@Sun.COM  * Include this file if the application uses rdsv3 sockets.
6012198SEiji.Ota@Sun.COM  */
6112198SEiji.Ota@Sun.COM 
6212198SEiji.Ota@Sun.COM /*
6312198SEiji.Ota@Sun.COM  * This file contains definitions from the ofed rds.h and rds_rdma.h
6412198SEiji.Ota@Sun.COM  * header file.
6512198SEiji.Ota@Sun.COM  */
6612198SEiji.Ota@Sun.COM #ifndef _RDSV3_RDS_H
6712198SEiji.Ota@Sun.COM #define	_RDSV3_RDS_H
6812198SEiji.Ota@Sun.COM 
6912198SEiji.Ota@Sun.COM #include <sys/types.h>
7012198SEiji.Ota@Sun.COM 
7112198SEiji.Ota@Sun.COM #ifdef __cplusplus
7212198SEiji.Ota@Sun.COM extern "C" {
7312198SEiji.Ota@Sun.COM #endif
7412198SEiji.Ota@Sun.COM 
7512198SEiji.Ota@Sun.COM #define	RDS_IB_ABI_VERSION		0x301
7612198SEiji.Ota@Sun.COM 
7712198SEiji.Ota@Sun.COM #define	AF_RDS				AF_INET_OFFLOAD
7812198SEiji.Ota@Sun.COM #define	PF_RDS				AF_INET_OFFLOAD
7912198SEiji.Ota@Sun.COM 
8012198SEiji.Ota@Sun.COM #define	SOL_RDS				272
8112198SEiji.Ota@Sun.COM 
8212198SEiji.Ota@Sun.COM /*
8312198SEiji.Ota@Sun.COM  * setsockopt/getsockopt for SOL_RDS
8412198SEiji.Ota@Sun.COM  */
8512198SEiji.Ota@Sun.COM #define	RDSV3_CANCEL_SENT_TO		1
8612198SEiji.Ota@Sun.COM #define	RDSV3_GET_MR			2
8712198SEiji.Ota@Sun.COM #define	RDSV3_FREE_MR			3
8812198SEiji.Ota@Sun.COM /* deprecated: RDS_BARRIER 4 */
8912198SEiji.Ota@Sun.COM #define	RDSV3_RECVERR			5
9012198SEiji.Ota@Sun.COM #define	RDSV3_CONG_MONITOR		6
9112414SEiji.Ota@Sun.COM #define	RDSV3_GET_MR_FOR_DEST		7
9212198SEiji.Ota@Sun.COM 
9312198SEiji.Ota@Sun.COM /*
9412198SEiji.Ota@Sun.COM  * Control message types for SOL_RDS.
9512198SEiji.Ota@Sun.COM  *
9612198SEiji.Ota@Sun.COM  * RDS_CMSG_RDMA_ARGS (sendmsg)
9712198SEiji.Ota@Sun.COM  *	Request a RDMA transfer to/from the specified
9812198SEiji.Ota@Sun.COM  *	memory ranges.
9912198SEiji.Ota@Sun.COM  *	The cmsg_data is a struct rdsv3_rdma_args.
10012198SEiji.Ota@Sun.COM  * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg)
10112198SEiji.Ota@Sun.COM  *	Kernel informs application about intended
10212198SEiji.Ota@Sun.COM  *	source/destination of a RDMA transfer
10312198SEiji.Ota@Sun.COM  * RDS_CMSG_RDMA_MAP (sendmsg)
10412198SEiji.Ota@Sun.COM  *	Application asks kernel to map the given
10512198SEiji.Ota@Sun.COM  *	memory range into a IB MR, and send the
10612198SEiji.Ota@Sun.COM  *	R_Key along in an RDS extension header.
10712198SEiji.Ota@Sun.COM  *	The cmsg_data is a struct rdsv3_get_mr_args,
10812198SEiji.Ota@Sun.COM  *	the same as for the GET_MR setsockopt.
10912198SEiji.Ota@Sun.COM  * RDS_CMSG_RDMA_STATUS (recvmsg)
11012198SEiji.Ota@Sun.COM  *	Returns the status of a completed RDMA operation.
11112198SEiji.Ota@Sun.COM  */
11212198SEiji.Ota@Sun.COM #define	RDSV3_CMSG_RDMA_ARGS		1
11312198SEiji.Ota@Sun.COM #define	RDSV3_CMSG_RDMA_DEST		2
11412198SEiji.Ota@Sun.COM #define	RDSV3_CMSG_RDMA_MAP		3
11512198SEiji.Ota@Sun.COM #define	RDSV3_CMSG_RDMA_STATUS		4
11612198SEiji.Ota@Sun.COM #define	RDSV3_CMSG_CONG_UPDATE		5
11712198SEiji.Ota@Sun.COM 
11812198SEiji.Ota@Sun.COM /* rds-info related */
11912198SEiji.Ota@Sun.COM 
12012198SEiji.Ota@Sun.COM #define	RDSV3_INFO_FIRST		10000
12112198SEiji.Ota@Sun.COM #define	RDSV3_INFO_COUNTERS		10000
12212198SEiji.Ota@Sun.COM #define	RDSV3_INFO_CONNECTIONS		10001
12312198SEiji.Ota@Sun.COM /* 10002 aka RDS_INFO_FLOWS is deprecated */
12412198SEiji.Ota@Sun.COM #define	RDSV3_INFO_SEND_MESSAGES	10003
12512198SEiji.Ota@Sun.COM #define	RDSV3_INFO_RETRANS_MESSAGES	10004
12612198SEiji.Ota@Sun.COM #define	RDSV3_INFO_RECV_MESSAGES	10005
12712198SEiji.Ota@Sun.COM #define	RDSV3_INFO_SOCKETS		10006
12812198SEiji.Ota@Sun.COM #define	RDSV3_INFO_TCP_SOCKETS		10007
12912198SEiji.Ota@Sun.COM #define	RDSV3_INFO_IB_CONNECTIONS	10008
13012198SEiji.Ota@Sun.COM #define	RDSV3_INFO_CONNECTION_STATS	10009
13112198SEiji.Ota@Sun.COM #define	RDSV3_INFO_IWARP_CONNECTIONS	10010
13212198SEiji.Ota@Sun.COM #define	RDSV3_INFO_LAST			10010
13312198SEiji.Ota@Sun.COM 
134*12580SGiri.Adari@Sun.COM struct rds_info_arg {
135*12580SGiri.Adari@Sun.COM 	uint64_t	lenp;
136*12580SGiri.Adari@Sun.COM 	uint64_t	datap;
137*12580SGiri.Adari@Sun.COM };
138*12580SGiri.Adari@Sun.COM 
13912198SEiji.Ota@Sun.COM #ifndef __lock_lint
14012198SEiji.Ota@Sun.COM #pragma pack(1)
14112198SEiji.Ota@Sun.COM struct rdsv3_info_counter {
14212198SEiji.Ota@Sun.COM 	uint8_t	name[32];
14312198SEiji.Ota@Sun.COM 	uint64_t	value;
14412198SEiji.Ota@Sun.COM } __attribute__((packed));
14512198SEiji.Ota@Sun.COM #pragma pack()
14612198SEiji.Ota@Sun.COM #else
14712198SEiji.Ota@Sun.COM struct rdsv3_info_counter {
14812198SEiji.Ota@Sun.COM 	uint8_t	name[32];
14912198SEiji.Ota@Sun.COM 	uint64_t	value;
15012198SEiji.Ota@Sun.COM };
15112198SEiji.Ota@Sun.COM #endif
15212198SEiji.Ota@Sun.COM 
15312198SEiji.Ota@Sun.COM #define	RDSV3_INFO_CONNECTION_FLAG_SENDING	0x01
15412198SEiji.Ota@Sun.COM #define	RDSV3_INFO_CONNECTION_FLAG_CONNECTING	0x02
15512198SEiji.Ota@Sun.COM #define	RDSV3_INFO_CONNECTION_FLAG_CONNECTED	0x04
15612198SEiji.Ota@Sun.COM 
15712414SEiji.Ota@Sun.COM #define	TRANSNAMSIZ	16
15812414SEiji.Ota@Sun.COM 
15912198SEiji.Ota@Sun.COM #ifndef __lock_lint
16012198SEiji.Ota@Sun.COM #pragma pack(1)
16112198SEiji.Ota@Sun.COM struct rdsv3_info_connection {
16212198SEiji.Ota@Sun.COM 	uint64_t	next_tx_seq;
16312198SEiji.Ota@Sun.COM 	uint64_t	next_rx_seq;
16412198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
16512198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
16612198SEiji.Ota@Sun.COM 	uint8_t		transport[15];		/* null term ascii */
16712198SEiji.Ota@Sun.COM 	uint8_t		flags;
16812198SEiji.Ota@Sun.COM } __attribute__((packed));
16912198SEiji.Ota@Sun.COM #pragma pack()
17012198SEiji.Ota@Sun.COM #else
17112198SEiji.Ota@Sun.COM struct rdsv3_info_connection {
17212198SEiji.Ota@Sun.COM 	uint64_t	next_tx_seq;
17312198SEiji.Ota@Sun.COM 	uint64_t	next_rx_seq;
17412198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
17512198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
17612198SEiji.Ota@Sun.COM 	uint8_t		transport[15];		/* null term ascii */
17712198SEiji.Ota@Sun.COM 	uint8_t		flags;
17812198SEiji.Ota@Sun.COM };
17912198SEiji.Ota@Sun.COM #endif
18012198SEiji.Ota@Sun.COM 
18112198SEiji.Ota@Sun.COM #ifndef __lock_lint
18212198SEiji.Ota@Sun.COM #pragma pack(1)
18312198SEiji.Ota@Sun.COM struct rdsv3_info_flow {
18412198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
18512198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
18612198SEiji.Ota@Sun.COM 	uint32_t	bytes;
18712198SEiji.Ota@Sun.COM 	uint16_t	lport;			/* network order */
18812198SEiji.Ota@Sun.COM 	uint16_t	fport;			/* network order */
18912198SEiji.Ota@Sun.COM } __attribute__((packed));
19012198SEiji.Ota@Sun.COM #pragma pack()
19112198SEiji.Ota@Sun.COM #else
19212198SEiji.Ota@Sun.COM struct rdsv3_info_flow {
19312198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
19412198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
19512198SEiji.Ota@Sun.COM 	uint32_t	bytes;
19612198SEiji.Ota@Sun.COM 	uint16_t	lport;			/* network order */
19712198SEiji.Ota@Sun.COM 	uint16_t	fport;			/* network order */
19812198SEiji.Ota@Sun.COM };
19912198SEiji.Ota@Sun.COM #endif
20012198SEiji.Ota@Sun.COM 
20112198SEiji.Ota@Sun.COM #define	RDSV3_INFO_MESSAGE_FLAG_ACK		0x01
20212414SEiji.Ota@Sun.COM #define	RDSV3_INFO_MESSAGE_FLAG_FAST_ACK	0x02
20312198SEiji.Ota@Sun.COM 
20412198SEiji.Ota@Sun.COM #ifndef __lock_lint
20512198SEiji.Ota@Sun.COM #pragma pack(1)
20612198SEiji.Ota@Sun.COM struct rdsv3_info_message {
20712198SEiji.Ota@Sun.COM 	uint64_t	seq;
20812198SEiji.Ota@Sun.COM 	uint32_t	len;
20912198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
21012198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
21112198SEiji.Ota@Sun.COM 	uint16_t	lport;			/* network order */
21212198SEiji.Ota@Sun.COM 	uint16_t	fport;			/* network order */
21312198SEiji.Ota@Sun.COM 	uint8_t		flags;
21412198SEiji.Ota@Sun.COM } __attribute__((packed));
21512198SEiji.Ota@Sun.COM #pragma pack()
21612198SEiji.Ota@Sun.COM #else
21712198SEiji.Ota@Sun.COM struct rdsv3_info_message {
21812198SEiji.Ota@Sun.COM 	uint64_t	seq;
21912198SEiji.Ota@Sun.COM 	uint32_t	len;
22012198SEiji.Ota@Sun.COM 	uint32_t	laddr;			/* network order */
22112198SEiji.Ota@Sun.COM 	uint32_t	faddr;			/* network order */
22212198SEiji.Ota@Sun.COM 	uint16_t	lport;			/* network order */
22312198SEiji.Ota@Sun.COM 	uint16_t	fport;			/* network order */
22412198SEiji.Ota@Sun.COM 	uint8_t		flags;
22512198SEiji.Ota@Sun.COM };
22612198SEiji.Ota@Sun.COM #endif
22712198SEiji.Ota@Sun.COM 
22812198SEiji.Ota@Sun.COM #ifndef __lock_lint
22912198SEiji.Ota@Sun.COM #pragma pack(1)
23012198SEiji.Ota@Sun.COM struct rdsv3_info_socket {
23112198SEiji.Ota@Sun.COM 	uint32_t	sndbuf;
23212198SEiji.Ota@Sun.COM 	uint32_t	bound_addr;		/* network order */
23312198SEiji.Ota@Sun.COM 	uint32_t	connected_addr;		/* network order */
23412198SEiji.Ota@Sun.COM 	uint16_t	bound_port;		/* network order */
23512198SEiji.Ota@Sun.COM 	uint16_t	connected_port;		/* network order */
23612198SEiji.Ota@Sun.COM 	uint32_t	rcvbuf;
23712198SEiji.Ota@Sun.COM 	uint64_t	inum;
23812198SEiji.Ota@Sun.COM } __attribute__((packed));
23912198SEiji.Ota@Sun.COM #pragma pack()
24012198SEiji.Ota@Sun.COM #else
24112198SEiji.Ota@Sun.COM struct rdsv3_info_socket {
24212198SEiji.Ota@Sun.COM 	uint32_t	sndbuf;
24312198SEiji.Ota@Sun.COM 	uint32_t	bound_addr;		/* network order */
24412198SEiji.Ota@Sun.COM 	uint32_t	connected_addr;		/* network order */
24512198SEiji.Ota@Sun.COM 	uint16_t	bound_port;		/* network order */
24612198SEiji.Ota@Sun.COM 	uint16_t	connected_port;		/* network order */
24712198SEiji.Ota@Sun.COM 	uint32_t	rcvbuf;
24812198SEiji.Ota@Sun.COM 	uint64_t	inum;
24912198SEiji.Ota@Sun.COM };
25012198SEiji.Ota@Sun.COM #endif
25112198SEiji.Ota@Sun.COM 
25212198SEiji.Ota@Sun.COM #ifndef __lock_lint
25312198SEiji.Ota@Sun.COM #pragma pack(1)
25412198SEiji.Ota@Sun.COM struct rdsv3_info_socket_v1 {
25512198SEiji.Ota@Sun.COM 	uint32_t	sndbuf;
25612198SEiji.Ota@Sun.COM 	uint32_t	bound_addr;		/* network order */
25712198SEiji.Ota@Sun.COM 	uint32_t	connected_addr;		/* network order */
25812198SEiji.Ota@Sun.COM 	uint16_t	bound_port;		/* network order */
25912198SEiji.Ota@Sun.COM 	uint16_t	connected_port;		/* network order */
26012198SEiji.Ota@Sun.COM 	uint32_t	rcvbuf;
26112198SEiji.Ota@Sun.COM } __attribute__((packed));
26212198SEiji.Ota@Sun.COM #pragma pack()
26312198SEiji.Ota@Sun.COM #else
26412198SEiji.Ota@Sun.COM struct rdsv3_info_socket_v1 {
26512198SEiji.Ota@Sun.COM 	uint32_t	sndbuf;
26612198SEiji.Ota@Sun.COM 	uint32_t	bound_addr;		/* network order */
26712198SEiji.Ota@Sun.COM 	uint32_t	connected_addr;		/* network order */
26812198SEiji.Ota@Sun.COM 	uint16_t	bound_port;		/* network order */
26912198SEiji.Ota@Sun.COM 	uint16_t	connected_port;		/* network order */
27012198SEiji.Ota@Sun.COM 	uint32_t	rcvbuf;
27112198SEiji.Ota@Sun.COM };
27212198SEiji.Ota@Sun.COM #endif
27312198SEiji.Ota@Sun.COM 
27412198SEiji.Ota@Sun.COM #define	RDS_IB_GID_LEN	16
27512198SEiji.Ota@Sun.COM struct rdsv3_info_rdma_connection {
27612198SEiji.Ota@Sun.COM 	uint32_t	src_addr;		/* network order */
27712198SEiji.Ota@Sun.COM 	uint32_t	dst_addr;		/* network order */
27812198SEiji.Ota@Sun.COM 	uint8_t		src_gid[RDS_IB_GID_LEN];
27912198SEiji.Ota@Sun.COM 	uint8_t		dst_gid[RDS_IB_GID_LEN];
28012198SEiji.Ota@Sun.COM 
28112198SEiji.Ota@Sun.COM 	uint32_t	max_send_wr;
28212198SEiji.Ota@Sun.COM 	uint32_t	max_recv_wr;
28312198SEiji.Ota@Sun.COM 	uint32_t	max_send_sge;
28412198SEiji.Ota@Sun.COM 	uint32_t	rdma_mr_max;
28512198SEiji.Ota@Sun.COM 	uint32_t	rdma_mr_size;
28612198SEiji.Ota@Sun.COM };
28712198SEiji.Ota@Sun.COM 
28812198SEiji.Ota@Sun.COM #define	rdsv3_info_ib_connection rdsv3_info_rdma_connection
28912198SEiji.Ota@Sun.COM #define	rdma_fmr_max rdma_mr_max
29012198SEiji.Ota@Sun.COM #define	rdma_fmr_size rdma_mr_size
29112198SEiji.Ota@Sun.COM 
29212414SEiji.Ota@Sun.COM /*
29312414SEiji.Ota@Sun.COM  * Congestion monitoring.
29412414SEiji.Ota@Sun.COM  * Congestion control in RDS happens at the host connection
29512414SEiji.Ota@Sun.COM  * level by exchanging a bitmap marking congested ports.
29612414SEiji.Ota@Sun.COM  * By default, a process sleeping in poll() is always woken
29712414SEiji.Ota@Sun.COM  * up when the congestion map is updated.
29812414SEiji.Ota@Sun.COM  * With explicit monitoring, an application can have more
29912414SEiji.Ota@Sun.COM  * fine-grained control.
30012414SEiji.Ota@Sun.COM  * The application installs a 64bit mask value in the socket,
30112414SEiji.Ota@Sun.COM  * where each bit corresponds to a group of ports.
30212414SEiji.Ota@Sun.COM  * When a congestion update arrives, RDS checks the set of
30312414SEiji.Ota@Sun.COM  * ports that are now uncongested against the list bit mask
30412414SEiji.Ota@Sun.COM  * installed in the socket, and if they overlap, we queue a
30512414SEiji.Ota@Sun.COM  * cong_notification on the socket.
30612414SEiji.Ota@Sun.COM  *
30712414SEiji.Ota@Sun.COM  * To install the congestion monitor bitmask, use RDS_CONG_MONITOR
30812414SEiji.Ota@Sun.COM  * with the 64bit mask.
30912414SEiji.Ota@Sun.COM  * Congestion updates are received via RDS_CMSG_CONG_UPDATE
31012414SEiji.Ota@Sun.COM  * control messages.
31112414SEiji.Ota@Sun.COM  *
31212414SEiji.Ota@Sun.COM  * The correspondence between bits and ports is
31312414SEiji.Ota@Sun.COM  *	1 << (portnum % 64)
31412414SEiji.Ota@Sun.COM  */
31512414SEiji.Ota@Sun.COM #define	RDSV3_CONG_MONITOR_SIZE	64
31612414SEiji.Ota@Sun.COM #define	RDSV3_CONG_MONITOR_BIT(port)	\
31712414SEiji.Ota@Sun.COM 	(((unsigned int) port) % RDSV3_CONG_MONITOR_SIZE)
31812414SEiji.Ota@Sun.COM #define	RDSV3_CONG_MONITOR_MASK(port) (1ULL << RDSV3_CONG_MONITOR_BIT(port))
31912414SEiji.Ota@Sun.COM 
32012414SEiji.Ota@Sun.COM /*
32112414SEiji.Ota@Sun.COM  * RDMA related types
32212414SEiji.Ota@Sun.COM  */
32312414SEiji.Ota@Sun.COM 
32412414SEiji.Ota@Sun.COM /*
32512414SEiji.Ota@Sun.COM  * This encapsulates a remote memory location.
32612414SEiji.Ota@Sun.COM  * In the current implementation, it contains the R_Key
32712414SEiji.Ota@Sun.COM  * of the remote memory region, and the offset into it
32812414SEiji.Ota@Sun.COM  * (so that the application does not have to worry about
32912414SEiji.Ota@Sun.COM  * alignment).
33012414SEiji.Ota@Sun.COM  */
33112414SEiji.Ota@Sun.COM typedef uint64_t	rdsv3_rdma_cookie_t;
33212414SEiji.Ota@Sun.COM 
33312414SEiji.Ota@Sun.COM struct rdsv3_iovec {
33412414SEiji.Ota@Sun.COM 	uint64_t	addr;
33512414SEiji.Ota@Sun.COM 	uint64_t	bytes;
33612414SEiji.Ota@Sun.COM };
33712414SEiji.Ota@Sun.COM 
33812414SEiji.Ota@Sun.COM struct rdsv3_get_mr_args {
33912414SEiji.Ota@Sun.COM 	struct rdsv3_iovec vec;
34012414SEiji.Ota@Sun.COM 	uint64_t	cookie_addr;
34112414SEiji.Ota@Sun.COM 	uint64_t	flags;
34212414SEiji.Ota@Sun.COM };
34312414SEiji.Ota@Sun.COM 
34412414SEiji.Ota@Sun.COM #if 1 /* 1 at 1.5.1 */
34512414SEiji.Ota@Sun.COM #include <sys/socket_impl.h>
34612414SEiji.Ota@Sun.COM struct rdsv3_get_mr_for_dest_args {
34712414SEiji.Ota@Sun.COM 	struct sockaddr_storage	dest_addr;
34812414SEiji.Ota@Sun.COM 	struct rdsv3_iovec 	vec;
34912414SEiji.Ota@Sun.COM 	uint64_t		cookie_addr;
35012414SEiji.Ota@Sun.COM 	uint64_t		flags;
35112414SEiji.Ota@Sun.COM };
35212414SEiji.Ota@Sun.COM #endif
35312414SEiji.Ota@Sun.COM 
35412414SEiji.Ota@Sun.COM struct rdsv3_free_mr_args {
35512414SEiji.Ota@Sun.COM 	rdsv3_rdma_cookie_t cookie;
35612414SEiji.Ota@Sun.COM 	uint64_t	flags;
35712414SEiji.Ota@Sun.COM };
35812414SEiji.Ota@Sun.COM 
35912414SEiji.Ota@Sun.COM struct rdsv3_rdma_args {
36012414SEiji.Ota@Sun.COM 	rdsv3_rdma_cookie_t cookie;
36112414SEiji.Ota@Sun.COM 	struct rdsv3_iovec remote_vec;
36212414SEiji.Ota@Sun.COM 	uint64_t	local_vec_addr;
36312414SEiji.Ota@Sun.COM 	uint64_t	nr_local;
36412414SEiji.Ota@Sun.COM 	uint64_t	flags;
36512414SEiji.Ota@Sun.COM 	uint64_t	user_token;
36612414SEiji.Ota@Sun.COM };
36712414SEiji.Ota@Sun.COM 
36812414SEiji.Ota@Sun.COM struct rdsv3_rdma_notify {
36912414SEiji.Ota@Sun.COM 	uint64_t	user_token;
37012414SEiji.Ota@Sun.COM 	int32_t		status;
37112414SEiji.Ota@Sun.COM };
37212414SEiji.Ota@Sun.COM 
37312414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_SUCCESS	0
37412414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_REMOTE_ERROR	1
37512414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_CANCELED	2
37612414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_DROPPED	3
37712414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_OTHER_ERROR	4
37812414SEiji.Ota@Sun.COM 
37912414SEiji.Ota@Sun.COM /*
38012414SEiji.Ota@Sun.COM  * Common set of flags for all RDMA related structs
38112414SEiji.Ota@Sun.COM  */
38212414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_READWRITE	0x0001
38312414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_FENCE	0x0002	/* use FENCE for immediate send */
38412414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_INVALIDATE	0x0004	/* invalidate R_Key after freeing MR */
38512414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_USE_ONCE	0x0008	/* free MR after use */
38612414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_DONTWAIT	0x0010	/* Don't wait in SET_BARRIER */
38712414SEiji.Ota@Sun.COM #define	RDSV3_RDMA_NOTIFY_ME	0x0020	/* Notify when operation completes */
38812414SEiji.Ota@Sun.COM 
38912198SEiji.Ota@Sun.COM #ifdef	__cplusplus
39012198SEiji.Ota@Sun.COM }
39112198SEiji.Ota@Sun.COM #endif
39212198SEiji.Ota@Sun.COM 
39312198SEiji.Ota@Sun.COM #endif /* _RDSV3_RDS_H */
394