rdsib_ep.h revision 00a3eaf3896a33935e11fd5c5fb5c1714225c067
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2005 SilverStorm Technologies, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/*
* Sun elects to include this software in Sun product
* under the OpenIB BSD license.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _RDSIB_EP_H
#define _RDSIB_EP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Control channel or Data channel
*/
typedef enum rds_ep_type_s {
RDS_EP_TYPE_CTRL = 1,
RDS_EP_TYPE_DATA = 2
/*
* Channel States
*
* RDS_EP_STATE_UNCONNECTED - Initial state when rds_ep_t is created
* RDS_EP_STATE_ACTIVE_PENDING - Active side connection in progress
* RDS_EP_STATE_PASSIVE_PENDING - Passice side connection in progress
* RDS_EP_STATE_CONNECTED - Channel is connected
* RDS_EP_STATE_DESTROY_TIMEWAIT - Channel is closed
*/
typedef enum rds_ep_state_s {
RDS_EP_STATE_CLOSING = 4,
RDS_EP_STATE_CLOSED = 5,
/*
* Session State Machine Diagram
*
* -----------------
* | (6) |
* | |
* v |
* --> (Created)-------->(Failed)
* | | (5) ^
* | |(1) |
* | | |(9)
* | v |
* | (Init)<--------------|
* | | | (8) |
* | | | |
* | (2)| -------------- |
* (11)| | (7) | |
* | v v |
* | (Connected)------>(Error)
* | | (10)
* | |(3)
* | |
* | v
* | (Closed)
* | |
* | |(4)
* | |
* | v
* --- (Fini) ------->(Destroy)
* (12)
*
* (1) rds_session_init()
* (2) rds_session_open()
* (3) rds_session_close()
* (4) rds_session_fini()
* (4) rds_passive_session_fini()
* (5) Failure in rds_session_init()
* (6) rds_sendmsg(3SOCKET)/Incoming CM REQ
* (7) Failure in rds_session_open()
* (8) rds_session_close(), rds_get_ibaddr() and rds_session_reinit()
* (9) rds_session_close() and rds_session_fini()
* (9) rds_cleanup_passive_session() and rds_passive_session_fini()
* (11) rds_sendmsg(3SOCKET)/Incoming REQ
*
*
* Created - Session is allocated and inserted into the sessionlist but
* not all members are initialized.
* Init - All members are initialized, send buffer pool is allocated.
* Connected - Data and ctrl RC channels are opened.
* Closed - Data and ctrl RC channels are closed.
* Fini - Send buffer pool and buffers in the receive pool are freed.
* Destroy - Session is removed from the session list and is ready to be
* freed.
* Failed - Session initialization has failed (send buffer pool allocation).
* Error - (1) Failed to open the RC channels.
* (2) An error occurred on the RC channels while sending.
* (3) Received a new CM REQ message on the existing connection.
*/
typedef enum rds_session_state_s {
/* Active or Passive */
#define RDS_SESSION_ACTIVE 1
#define RDS_SESSION_PASSIVE 2
/*
* RDS QP Information
*
* lock - Synchronize access
* depth - Max number of WRs that can be posted.
* level - Number of outstanding WRs in the QP
* lwm - Water mark at which to post more receive WRs.
* taskqpending - Indicates if a taskq thread is dispatched to post receive
* WRs in the RQ
*/
typedef struct rds_qp_s {
} rds_qp_t;
/*
* RDS EndPoint(One end of RC connection)
*
* sp - Parent Session
* type - Control or Data Channel
* remip - Same as session_remip
* myip - Same as session_myip
* snd_lkey - LKey for the send buffer pool
* hca_guid - HCA guid
* snd_mrhdl - Memory handle for the send buffer pool
* lock - Protects the members
* state - See rds_ep_state_t
* chanhdl - RC channel handle
* sendcq - Send CQ handle
* recvcq - Recv CQ handle
* sndpool - Send buffer Pool
* rcvpool - Recv buffer Pool
* segfbp - First packet of a segmented message.
* seglbp - Last packet of a segmented message.
* lbufid - Last successful buffer that was received by the remote.
* rbufid - Last buffer (remote buffer) that was received successfully
* from the remote node.
* ds - SGL used for send acknowledgement.
* ackwr - WR to send acknowledgement.
* ackhdl - Memory handle for 'ack_addr'.
* ack_rkey - RKey for 'ack_addr'.
* ack_addr - Memory region to receive RDMA acknowledgement from remote.
*/
typedef struct rds_ep_s {
struct rds_session_s *ep_sp;
} rds_ep_t;
/*
* One end of an RDS session
*
* nextp - Pointer to the next session in the session list.
* This is protected by rds_state_t:rds_sessionlock.
* remip - IP address of the node having the remote end of the session.
* myip - IP address of this end of the session.
* lgid - IB local (source) gid, hosting "myip".
* rgid - IB remote (destination) gid, hosting "remip".
* type - Identifies which end of session (active or passive).
* state - State of session (rds_session_state_t).
* dataep - Data endpoint
* ctrlep - Control endpoint
* failover- Flag to indicate that an error occured and the session is
* re-connecting.
* portmap_lock - To serialize access to portmap.
* portmap - Bitmap of sockets.
* The maximum number of sockets seem to be 65536, the portmap has
* 1 bit for each remote socket. A set bit indicates that the
* corresponding remote socket is stalled and vice versa.
*/
typedef struct rds_session_s {
struct rds_session_s *session_nextp;
struct rds_ep_s session_dataep;
struct rds_ep_s session_ctrlep;
/* defined in rds_ep.c */
void rds_close_sessions(void *arg);
void rds_cleanup_passive_session(void *arg);
/* defined in rds_ib.c */
void rds_post_recv_buf(void *arg);
/* defined in rds_cm.c */
/* defined in rds_sc.c */
#ifdef __cplusplus
}
#endif
#endif /* _RDSIB_EP_H */