1b86efd96Sagiri /* 2b86efd96Sagiri * CDDL HEADER START 3b86efd96Sagiri * 4b86efd96Sagiri * The contents of this file are subject to the terms of the 5b86efd96Sagiri * Common Development and Distribution License (the "License"). 6b86efd96Sagiri * You may not use this file except in compliance with the License. 7b86efd96Sagiri * 8b86efd96Sagiri * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9b86efd96Sagiri * or http://www.opensolaris.org/os/licensing. 10b86efd96Sagiri * See the License for the specific language governing permissions 11b86efd96Sagiri * and limitations under the License. 12b86efd96Sagiri * 13b86efd96Sagiri * When distributing Covered Code, include this CDDL HEADER in each 14b86efd96Sagiri * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15b86efd96Sagiri * If applicable, add the following below this CDDL HEADER, with the 16b86efd96Sagiri * fields enclosed by brackets "[]" replaced with your own identifying 17b86efd96Sagiri * information: Portions Copyright [yyyy] [name of copyright owner] 18b86efd96Sagiri * 19b86efd96Sagiri * CDDL HEADER END 20b86efd96Sagiri */ 21b86efd96Sagiri /* 22*00a3eaf3SRamaswamy Tummala * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23b86efd96Sagiri * Use is subject to license terms. 24b86efd96Sagiri */ 25b86efd96Sagiri /* 26b86efd96Sagiri * Copyright (c) 2005 SilverStorm Technologies, Inc. All rights reserved. 27b86efd96Sagiri * 28b86efd96Sagiri * This software is available to you under a choice of one of two 29b86efd96Sagiri * licenses. You may choose to be licensed under the terms of the GNU 30b86efd96Sagiri * General Public License (GPL) Version 2, available from the file 31b86efd96Sagiri * COPYING in the main directory of this source tree, or the 32b86efd96Sagiri * OpenIB.org BSD license below: 33b86efd96Sagiri * 34b86efd96Sagiri * Redistribution and use in source and binary forms, with or 35b86efd96Sagiri * without modification, are permitted provided that the following 36b86efd96Sagiri * conditions are met: 37b86efd96Sagiri * 38b86efd96Sagiri * - Redistributions of source code must retain the above 39b86efd96Sagiri * copyright notice, this list of conditions and the following 40b86efd96Sagiri * disclaimer. 41b86efd96Sagiri * 42b86efd96Sagiri * - Redistributions in binary form must reproduce the above 43b86efd96Sagiri * copyright notice, this list of conditions and the following 44b86efd96Sagiri * disclaimer in the documentation and/or other materials 45b86efd96Sagiri * provided with the distribution. 46b86efd96Sagiri * 47b86efd96Sagiri * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 48b86efd96Sagiri * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 49b86efd96Sagiri * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 50b86efd96Sagiri * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 51b86efd96Sagiri * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 52b86efd96Sagiri * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 53b86efd96Sagiri * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 54b86efd96Sagiri * SOFTWARE. 55b86efd96Sagiri * 56b86efd96Sagiri */ 57b86efd96Sagiri /* 58b86efd96Sagiri * Sun elects to include this software in Sun product 59b86efd96Sagiri * under the OpenIB BSD license. 60b86efd96Sagiri * 61b86efd96Sagiri * 62b86efd96Sagiri * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 63b86efd96Sagiri * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 64b86efd96Sagiri * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 65b86efd96Sagiri * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 66b86efd96Sagiri * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 67b86efd96Sagiri * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 68b86efd96Sagiri * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 69b86efd96Sagiri * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 70b86efd96Sagiri * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 71b86efd96Sagiri * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 72b86efd96Sagiri * POSSIBILITY OF SUCH DAMAGE. 73b86efd96Sagiri */ 74b86efd96Sagiri 75b86efd96Sagiri #ifndef _RDSIB_PROTOCOL_H 76b86efd96Sagiri #define _RDSIB_PROTOCOL_H 77b86efd96Sagiri 78b86efd96Sagiri #ifdef __cplusplus 79b86efd96Sagiri extern "C" { 80b86efd96Sagiri #endif 81b86efd96Sagiri 82b86efd96Sagiri #include <netinet/in.h> 83b86efd96Sagiri 84948cd88eSagiri #define RDS_VERSION 4 85b86efd96Sagiri 86b86efd96Sagiri /* 87b86efd96Sagiri * RDS Well known service id 88b86efd96Sagiri * Format: 0x1h00144Fhhhhhhhh 89b86efd96Sagiri * "00144F" is the Sun OUI 90b86efd96Sagiri * 'h' can be any hex-decimal digit. 91b86efd96Sagiri */ 92b86efd96Sagiri #define RDS_SERVICE_ID 0x1000144F00000001ULL 93b86efd96Sagiri 945763ba1eSagiri /* Max number of nodes supported with the default configuration */ 955763ba1eSagiri #define RDS_MAX_NODES 8 965763ba1eSagiri 97b86efd96Sagiri /* packet size */ 98b86efd96Sagiri #define RDS_USER_DATA_BUFFER_SIZE 4096 /* 4K */ 99b86efd96Sagiri 100b86efd96Sagiri /* per session */ 101b86efd96Sagiri #define RDS_MAX_DATA_RECV_BUFFERS 3000 102b86efd96Sagiri #define RDS_MAX_DATA_SEND_BUFFERS 2000 103b86efd96Sagiri #define RDS_MAX_CTRL_RECV_BUFFERS 100 104b86efd96Sagiri #define RDS_MAX_CTRL_SEND_BUFFERS 50 105b86efd96Sagiri 106b86efd96Sagiri /* RQ low water mark in percentage. More RWR have to be posted */ 107b86efd96Sagiri #define RDS_DATA_RECV_BUFFER_LWM 90 108b86efd96Sagiri #define RDS_CTRL_RECV_BUFFER_LWM 50 109b86efd96Sagiri 110b86efd96Sagiri /* 111b86efd96Sagiri * High water mark in percentage of pkts pending on sockets. 112b86efd96Sagiri * Incoming traffic should be controlled or stopped for all sockets 113b86efd96Sagiri * or some sockets that are above their quota 114b86efd96Sagiri */ 115b86efd96Sagiri #define RDS_PENDING_RX_PKTS_HWM 75 116b86efd96Sagiri 117b86efd96Sagiri /* 118b86efd96Sagiri * Only interoperate with homogeneous Solaris (x32, x64, sparcv9). 119b86efd96Sagiri */ 120b86efd96Sagiri #if defined(__sparcv9) 121b86efd96Sagiri #define RDS_THIS_ARCH 1 122b86efd96Sagiri #elif defined(__amd64) 123b86efd96Sagiri #define RDS_THIS_ARCH 2 124b86efd96Sagiri #elif defined(__i386) 125b86efd96Sagiri #define RDS_THIS_ARCH 3 126b86efd96Sagiri #else 127b86efd96Sagiri #error "ISA not supported" 128b86efd96Sagiri #endif 129b86efd96Sagiri 130b86efd96Sagiri /* 131b86efd96Sagiri * CM Private Data 132b86efd96Sagiri * 133b86efd96Sagiri * This data is sent with the CM REQ message by the initiater of the 134b86efd96Sagiri * RC channel. 135b86efd96Sagiri * 136948cd88eSagiri * cm_ip_pvt - ibt_ip_cm_info_t 137b86efd96Sagiri * version - RDS version 138b86efd96Sagiri * arch - only interoperate with homogeneous Solaris (x32, x64, sparcv9). 139b86efd96Sagiri * eptype - RDS_EP_TYPE_CTRL or RDS_EP_TYPE_DATA 140948cd88eSagiri * failover - flag to indicate failover. 141948cd88eSagiri * last_bufid - used during failover, indicates the last buffer the remote 142948cd88eSagiri * received. 143b86efd96Sagiri * user_buffer_size - Packet size on the sending node. This is also the size 144b86efd96Sagiri * of the SGL buffer used in the send and receive WRs. This should be 145b86efd96Sagiri * same size on the both active and passive nodes. 146948cd88eSagiri * ack_rkey - RKEY for the RDMA acknowledgement buffer. 147948cd88eSagiri * ack_addr - Registered MR address to receive RDMA acknowledgement. 148b86efd96Sagiri */ 149b86efd96Sagiri typedef struct rds_cm_private_data_s { 150015f8fffShiremath uint8_t cmp_ip_pvt[IBT_IP_HDR_PRIV_DATA_SZ]; 151b86efd96Sagiri uint8_t cmp_version; 152b86efd96Sagiri uint8_t cmp_arch; 153b86efd96Sagiri uint8_t cmp_eptype; 154b86efd96Sagiri uint8_t cmp_failover; 155b86efd96Sagiri uintptr_t cmp_last_bufid; 156b86efd96Sagiri uint32_t cmp_user_buffer_size; 157b86efd96Sagiri ibt_rkey_t cmp_ack_rkey; 158b86efd96Sagiri uintptr_t cmp_ack_addr; 159b86efd96Sagiri } rds_cm_private_data_t; 160b86efd96Sagiri 161b86efd96Sagiri /* 162b86efd96Sagiri * Data Header 163b86efd96Sagiri * This header is transmitted with every WR. 164b86efd96Sagiri * 165b86efd96Sagiri * bufid - Ponter to the send buffer that is used to send this packet. 166b86efd96Sagiri * datalen - Number of bytes of data (not including the header) 167b86efd96Sagiri * npkts - number of remaining pkts(including this one) for the message. 168b86efd96Sagiri * It is set to 1 for single packet messages. 169b86efd96Sagiri * psn - Packet sequence number(starts at 0). Zero for single packet messages. 170b86efd96Sagiri * sendport - Port number of the sending socket 171b86efd96Sagiri * recvport - Port number of the receiving socket 172b86efd96Sagiri */ 173b86efd96Sagiri typedef struct rds_data_hdr_s { 174b86efd96Sagiri uintptr_t dh_bufid; 175b86efd96Sagiri uint32_t dh_datalen; 176b86efd96Sagiri uint32_t dh_npkts; 177b86efd96Sagiri uint32_t dh_psn; 178b86efd96Sagiri in_port_t dh_sendport; 179b86efd96Sagiri in_port_t dh_recvport; 180b86efd96Sagiri } rds_data_hdr_t; 181b86efd96Sagiri 182b86efd96Sagiri #define RDS_DATA_HDR_SZ sizeof (rds_data_hdr_t) 183b86efd96Sagiri 184b86efd96Sagiri /* 185b86efd96Sagiri * List of control commands sent on a session: 186b86efd96Sagiri * 187b86efd96Sagiri * STALL: This command is sent to inform remote RDS that a port is stalled. 188b86efd96Sagiri * Always sent on all existing sessions. 189b86efd96Sagiri * UNSTALL: This command is sent to inform remote RDS that a port is unstalled. 190b86efd96Sagiri * Always sent on all existing sessions. 191b86efd96Sagiri * STALL_PORTS: Inform remote RDS that all local ports are stalled. 192b86efd96Sagiri * UNSTALL_PORTS: Inform remote RDS that all local ports are unstalled. 193b86efd96Sagiri * HEARTBEAT: Sent to check if the connection is still alive 194b86efd96Sagiri */ 195b86efd96Sagiri #define RDS_CTRL_CODE_STALL 1 196b86efd96Sagiri #define RDS_CTRL_CODE_UNSTALL 2 197b86efd96Sagiri #define RDS_CTRL_CODE_STALL_PORTS 3 198b86efd96Sagiri #define RDS_CTRL_CODE_UNSTALL_PORTS 4 199b86efd96Sagiri #define RDS_CTRL_CODE_HEARTBEAT 5 200*00a3eaf3SRamaswamy Tummala #define RDS_CTRL_CODE_CLOSE_SESSION 6 201b86efd96Sagiri 202b86efd96Sagiri /* 203b86efd96Sagiri * RDS ctrl packet 204b86efd96Sagiri * 205b86efd96Sagiri * port - Socket to be stalled/unstalled 206b86efd96Sagiri * code - STALL/UNSTALL (other codes are currently not used) 207b86efd96Sagiri */ 208b86efd96Sagiri 209b86efd96Sagiri typedef struct rds_ctrl_pkt_s { 210b86efd96Sagiri uint16_t rcp_port; 211b86efd96Sagiri uint8_t rcp_code; 212b86efd96Sagiri } rds_ctrl_pkt_t; 213b86efd96Sagiri 214b86efd96Sagiri #define RDS_CTRLPKT_SIZE sizeof (rds_ctrl_pkt_t) 215b86efd96Sagiri 216b86efd96Sagiri #ifdef __cplusplus 217b86efd96Sagiri } 218b86efd96Sagiri #endif 219b86efd96Sagiri 220b86efd96Sagiri #endif /* _RDSIB_PROTOCOL_H */ 221