sol_cma.h revision 5c5f137104b2d56181283389fa902220f2023809
/*
* 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
*/
/*
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/sysmacros.h>
#define IS_VALID_SOCKADDR(sockaddrp) \
/*
* Global structure which contains information about all
* CMIDs, which have called rdma_listen().
*/
typedef struct sol_cma_glbl_listen_s {
void *cma_listen_clnt_hdl;
void *cma_listen_svc_hdl;
/* State of the RDMA-CM ID */
typedef enum {
typedef struct listen_info_s {
/* For Root CMIDs, pointer to global listen info */
/*
* For EP CMIDs, pointer to ib_device and root CMID
* for HCA DR
*/
struct ib_device *listen_ep_device;
/*
* Count & list of EPs for this listen_info.
* This is 0, if listen_is_root is 0.
*/
/* Transport Specific */
union {
/* For Root CMID */
/* For Endpoint CMID */
} un_listen;
typedef enum {
SOL_CMA_XPORT_NONE = 0,
/*
* This is used to track the state of a client side CMID.
* CONNECT_NONE Server side CMID, or CMID for which
* rdma_connect() has not been called.
*
* CLIENT_NONE Client side CMID for which connection
* has been torn down.
*
* For UDP it also represents connection
* established (no more IBTF CM events
* expected).
*
* INITIATED rdma_connect() has been called not yet
* established.
*
* ESTABLISHED Client CMID has connection established.
*/
typedef enum {
SOL_CMA_CONNECT_NONE = 0,
/*
* This is used to track the state of CMIDs created for Connection
* Requests and listening CMID.
*
* NONE Client CMID, listen CMID with no REQs yet.
*
* SERVER_DONE REQ CMID connection done, no more events.
*
* For listening CMID all REQ CMIDs have events
* completed.
*
* CREATED listening CMID with > 1 REQ CMID with events
* pending.
*
* QUEUED REQ CMID in REQ AVL tree of listening CMID
*
* ACCEPTED REQ CMID accepted and in ACPT AVL tree of the
* listening CMID.
*/
typedef enum {
REQ_CMID_NONE = 0,
#define SOL_IS_SERVER_CMID(chanp) \
#define SOL_IS_CLIENT_CMID(chanp) \
#define REQ_CMID_IN_REQ_AVL_TREE(chanp) \
#define SOL_CMID_CLOSE_REQUIRED(chanp) \
#define SOL_CMAID_CONNECTED(chanp) \
(SOL_CMID_CLOSE_REQUIRED(chanp) || \
/*
* CMID_DESTROYED - Flag to indicate rdma_destroy_id has been
* called for this CMID
*
* EVENT_PROGRESS - RDMACM Event for this CMID been passed to
* the sol_ofs client.
*
* API_PROGRESS - rdma_resolve_addr() / rdma_resolve_route() /
* rdma_listen() is in progress.
*/
#define SOL_CMA_CALLER_CMID_DESTROYED 0x01
#define SOL_CMA_CALLER_EVENT_PROGRESS 0x02
#define SOL_CMA_CALLER_API_PROGRESS 0x04
typedef struct {
struct rdma_cm_id chan_rdma_cm;
/*
* Below are all CMA Channel specific fields required in Solaris,
* apart from rdma_cm_id.
*/
/* AVL Tree for REQs and EST CMIDs */
/*
* chan_req_cnt -
* REQ CMIDs created not yet notified to client
* chan_total_req_cnt -
* REQ CMIDs created not destroy_id(0 not called.
*/
/* State for Server side and client side CMIDs */
/*
* Transport type for the rdma_id, IB or IWARP. This is set to
* NONE, when the transport type is not yet determined.
*/
/*
* Passed from sol_ofs consumer, using the rdma_map_id2clnthdl
* and rdma_map_id2qphdl
*/
void *chan_ib_client_hdl;
void *chan_iw_client_hdl;
void *chan_qp_hdl;
/* Data for root / endpoint CM ID. */
/* Ptr to the root CMID for Endpoint & Req CMID */
struct rdma_cm_id *listen_root;
struct rdma_conn_param chan_param;
/* Session ID for completion */
void *chan_session_id;
union {
} un_xport; /* Transport specific fields */
void ibcma_append_listen_list(struct rdma_cm_id *);
#ifdef IWARP_SUPPORT
void iwcma_append_listen_list(struct rdma_cm_id *);
#endif
int, struct rdma_conn_param *, struct rdma_ud_param *);
static inline int
{
struct sockaddr_in *in_addr;
struct sockaddr_in6 *in6_addr;
}
return (0);
}
static inline struct rdma_cm_id *
{
struct rdma_cm_id *newid;
return (newid);
}
sizeof (struct rdma_addr));
int num_paths;
sizeof (struct ib_sa_path_rec), KM_SLEEP);
num_paths * sizeof (struct ib_sa_path_rec));
}
if (CHAN_LISTEN_ROOT(src_chanp))
else
return (newid);
}
static inline struct rdma_cm_id *
{
struct rdma_cm_id *req_idp;
return (req_idp);
}
static inline struct rdma_cm_id *
{
struct rdma_cm_id *acpt_idp;
return (acpt_idp);
}
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_CLIENTS_OF_SOL_OFS_SOL_CMA_H */