daplt.h revision 9e39c5ba00a55fa05777cc94b148296af305e135
/*
* 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.
*/
#ifndef _DAPL_H_
#define _DAPL_H_
#ifdef __cplusplus
extern "C" {
#endif
#define DAPLKA_VERSION (1)
#define DAPLKA_TQ_NTHREADS 16
#define DAPLKA_STATE_DETACHED 0x0000
#define DAPLKA_STATE_ATTACHED 0x0001
/*
* HCA structure
*/
typedef struct daplka_hca {
int hca_ref_cnt;
struct daplka_hca *hca_next;
} daplka_hca_t;
/*
* Per-Device instance state information.
*/
typedef struct daplka {
} daplka_t;
/*
* generic hash table
*/
typedef struct daplka_hash_entry {
void *he_objp;
struct daplka_hash_entry *he_next;
typedef struct daplka_hash_bucket {
typedef struct daplka_hash_table {
void (*ht_free_func)(void *);
void (*ht_lookup_func)(void *);
/*
* resource structure header
*/
typedef struct daplka_resource {
int (*rs_free)(struct daplka_resource *);
#define DAPLKA_EP_HTBL_SZ 128
#define DAPLKA_MR_HTBL_SZ 64
#define DAPLKA_MW_HTBL_SZ 64
#define DAPLKA_PD_HTBL_SZ 32
#define DAPLKA_SP_HTBL_SZ 32
#define DAPLKA_EVD_HTBL_SZ 32
#define DAPLKA_G_SP_HTBL_SZ 512
#define DAPLKA_TIMER_HTBL_SZ 512
#define DAPLKA_CNO_HTBL_SZ 16
#define DAPLKA_SRQ_HTBL_SZ 32
typedef struct daplka_async_evd_hkey_s {
struct daplka_async_evd_hkey_s *aeh_next;
/*
* Various states IA can be in, this is primarily for handling race
* between MW allocation and MR cleanup callback.
*/
typedef enum daplka_ia_state_e {
DAPLKA_IA_INIT = 0,
typedef struct daplka_ia_resource {
typedef struct daplka_pd_resource {
/*
* Passive side EP cookies - this is generated at the connection request
* time and unique for every CR. It gets associated with the EP that
* is passed to the CR accept.
*
* daplka_psep_cookie contains the following information
* - 48 bit timestamp (unit = 1/10us)
* - 16 bit index in the psp backlog array corr to this CR event
* this makes it unique for every CR.
*/
typedef uint64_t daplka_psep_cookie_t;
#define DAPLKA_CREATE_PSEP_COOKIE(index) \
#define DAPLKA_GET_PSEP_INDEX(cookie) \
0xffff))
/*
* daplka_evd_cme_t defines connection manager events that can be
* chained to the daplka_evd_cme_list_t.
*/
typedef struct daplka_evd_cme_s {
/* ec_cm_cookie is the SP(passive)/EP(active) cookie */
/* ec_cm_ev_session_id is the cookie for DEFER processing */
void *ec_cm_ev_session_id;
/* true - passive side event, false - active side event */
void *ec_cm_ev_priv_data;
typedef enum daplka_evd_event_type_e {
DAPLKA_EVD_NO_EVENTS = 0x00,
DAPLKA_EVD_CM_EVENTS = 0x02,
DAPLKA_EVD_ASYNC_EVENTS = 0x04
/*
* daplka_evd_event_t defines elements in the event list - this is
* used for both async as well as connection manager events
*/
typedef struct daplka_evd_event_s {
struct daplka_evd_event_s *ee_next;
union {
} ee_event;
typedef struct daplka_evd_event_list_s {
typedef struct daplka_evd_resource {
struct daplka_cno_resource *evd_cno_res;
typedef struct daplka_srq_resource {
#define DAPLKA_EP_STATE_CLOSED 0x0001
#define DAPLKA_EP_STATE_CONNECTING 0x0002
#define DAPLKA_EP_STATE_ACCEPTING 0x0003
#define DAPLKA_EP_STATE_CONNECTED 0x0004
#define DAPLKA_EP_STATE_DISCONNECTING 0x0005
#define DAPLKA_EP_STATE_ABORTING 0x0006
#define DAPLKA_EP_STATE_DISCONNECTED 0x0007
#define DAPLKA_EP_STATE_TRANSITIONING 0x0008
#define DAPLKA_EP_STATE_FREED 0x0009
typedef struct daplka_ep_resource {
typedef struct daplka_timer_info {
typedef struct daplka_mr_resource {
struct daplka_mr_resource *mr_next;
struct daplka_shared_mr *mr_shared_mr;
typedef struct daplka_mw_resource {
/*
* This describes the elements in a connection pending list that each SP
* maintains. Fields are protected using the sp_lock.
*/
typedef enum {
DAPLKA_SPCP_INIT = 0,
typedef struct daplka_sp_conn_pend_s {
void *spcp_sid; /* session id for cm_proceed */
#define DAPLKA_DEFAULT_SP_BACKLOG 256
typedef struct daplka_sp_resource {
int sp_backlog_size; /* # elements backlog */
typedef struct daplka_cno_resource {
#define DAPLKA_SMR_FREED 0x0000
#define DAPLKA_SMR_TRANSITIONING 0x0001
#define DAPLKA_SMR_READY 0x0002
typedef struct daplka_shared_mr {
/*
* resource table data structures
*/
#define DAPLKA_RC_BLKSZ 16
#define DAPLKA_RC_RESERVED 0xff
typedef struct daplka_resource_blk {
int daplka_rcblk_avail;
struct daplka_resource_table {
int daplka_rc_len;
int daplka_rc_sz;
int daplka_rc_cnt;
};
#ifdef __cplusplus
}
#endif
#endif /* _DAPL_H_ */