rsm_in.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1999-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RSM_IN_H
#define _RSM_IN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define DRIVER_NAME "rsm"
#define RSM_DRIVER_MINOR 0
#define RSM_CNUM 8
/*
* The base for Sun RSMAPI Kernel Agent service idenitifiers is RSM_INTR_T_KA
* as defined below. This is as per the RSMPI specification. Thus,
* in the kernel agent, we need to use this value as the service identifier
* while registering the service handlers.
*/
#define RSM_INTR_T_KA 0x88
#define RSM_SERVICE RSM_INTR_T_KA
#define RSM_PRI 2
#define RSM_QUEUE_SZ 256
#define RSM_LOCK 0
#define RSM_NOLOCK 1
/*
* The following defines UINT_MAX rounded down to a page aligned value.
*/
/*
* Define TRASHSIZE as the maximum possible size which is page aligned
* This value cannot be 0xffffffffffffe000 since this is taken as a
* negative value in the devmap_umem_remap call, thus causing the call
* to fail.
*/
#define TRASHSIZE 0x7fffffffffffe000
#define RSM_ACCESS_READ 0444
#define RSM_ACCESS_WRITE 0222
#define RSM_ACCESS_TRUSTED 0666
/* flag values for rsmseg_unload */
#define DISCONNECT 1
#define NO_DISCONNECT 0
struct rsm_driver_data {
int drv_state; /* RSM_DRV_YYYY states */
int drv_memdel_cnt; /* number of memdel callbacks */
};
/* rsm driver state */
#define RSM_DRV_NEW 0
#define RSM_DRV_OK 1
#define RSM_DRV_PREDEL_STARTED 2
#define RSM_DRV_PREDEL_COMPLETED 3
#define RSM_DRV_POSTDEL_IN_PROGRESS 4
#define RSM_DRV_DR_IN_PROGRESS 5
#define RSM_DRV_REG_PROCESSING 6
#define RSM_DRV_UNREG_PROCESSING 7
/* internal flags */
#define RSM_DR_QUIESCE 0
#define RSM_DR_UNQUIESCE 1
typedef enum {
RSM_STATE_NEW = 0,
typedef enum {
/*
* All resources have the only common info. whether it is a segment or
* a notification queue.
*/
typedef struct rsm_resource {
struct rsm_resource *rsmrc_next;
#define RSMRC_BLKSZ 16
#define RSM_HASHSZ 128
#define RSM_USER_MEMORY 0x1
#define RSM_KERNEL_MEMORY 0x2
#define RSM_EXPORT_WAIT 0x4
#define RSM_SEGMENT_POLL 0x8
#define RSM_FORCE_DISCONNECT 0x10
#define RSM_IMPORT_DUMMY 0x20
/*
* The following macro is used within the kernel agent to indicate that
* segment's s_flags field.
*/
#define RSMKA_ALLOW_UNBIND_REBIND 0x40
#define RSM_REPUBLISH_WAIT 0x80
#define RSM_DR_INPROGRESS 0x100
#define RSM_FORCE_DESTROY_WAIT 0x200
#define RSMKA_SET_RESOURCE_DONTWAIT 0x400
typedef struct rsm_region {
typedef struct rsm_cookie {
typedef struct rsm_mapinfo {
struct rsm_mapinfo *next;
/*
* Shared Importer data structure
*
*/
typedef struct rsm_import_share {
#define RSMSI_STATE_NEW 0x0001
#define RSMSI_STATE_CONNECTING 0x0002
#define RSMSI_STATE_ABORT_CONNECT 0x0004
#define RSMSI_STATE_CONNECTED 0x0008
#define RSMSI_STATE_CONN_QUIESCE 0x0010
#define RSMSI_STATE_MAPPED 0x0020
#define RSMSI_STATE_MAP_QUIESCE 0x0040
#define RSMSI_STATE_DISCONNECTED 0x0080
/* has been sent */
void *rsmsi_cookie; /* cookie of the first seg connect */
typedef struct rsm_seginfo {
int s_flags;
int s_pollflag; /* indicates poll status */
int s_acl_len; /* length of access list */
union {
} s_handle; /* NIC handle for segment */
/*
* This field is used to indicate the cookie returned by the
* ddi_umem_lock when binding pages for an export segment.
* Also, for importers on the same node as the export segment,
* this field indicates the cookie used during import mapping.
*/
/*
* This field in an import segments indicates the number of
* a handle in the iovec.
*/
} rsmseg_t;
/*
* Resource elements structure
*/
typedef struct {
int rsmrcblk_avail;
struct rsmresource_table {
int rsmrc_len;
int rsmrc_sz;
};
/*
* Struct for advertised resource list
*/
/*
* Hashtable structs
* bucket points to an array of pointers, each entry in the bucket array
* points to a linked list of resource items.
* bucket index = bucket_address%RSM_HASHSZ
*/
typedef struct rsmhash_table {
/*
* Remote messaging related structure
*/
/*
* Flags for ipc slot
*/
#define RSMIPC_SET(x, v) ((x)->rsmipc_flags |= (v))
#define RSMIPC_GET(x, v) ((x)->rsmipc_flags & (v))
#define RSMIPC_CLEAR(x, v) ((x)->rsmipc_flags &= ~(v))
typedef struct rsmipc_slot {
int rsmipc_flags;
void *rsmipc_data; /* ptr to data to copy */
/*
* Messaging struc
*/
typedef struct {
int count;
int wanted;
int sequence;
/*
* These tokens are used for building the list of remote node importers
* of a segment exported from the local node
*/
typedef struct importing_token {
struct importing_token *next;
void *import_segment_cookie;
typedef struct {
/*
* Used by the rsm_send_republish() fn
*/
typedef struct republish_token {
struct republish_token *next;
/*
* data strucuture for list manipulation
*/
typedef struct list_element {
struct list_element *next;
#define RSM_SUSPEND_ACKPENDING 0x01
#define RSM_SUSPEND_NODEDEAD 0x02
typedef struct list_head {
struct list_element *list_head;
} list_head_t;
#ifdef __cplusplus
}
#endif
#endif /* _RSM_IN_H */