wrsm_common.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 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _WRSM_COMMON_H
#define _WRSM_COMMON_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dditypes.h>
#ifdef _KERNEL
#include <sys/ddidevmap.h>
#endif
#include <sys/wci_offsets.h>
#include <sys/wrsm_types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef wrsm_ncslice_bitmask_t ncslice_bitmask_t;
typedef wrsm_cnode_bitmask_t cnode_bitmask_t;
typedef wrsm_wnode_bitmask_t wnode_bitmask_t;
typedef wrsm_fmnodeid_t fmnodeid_t;
typedef wrsm_cnodeid_t cnodeid_t;
typedef wrsm_wnodeid_t wnodeid_t;
typedef wrsm_gnid_t gnid_t;
typedef wrsm_ncslice_t ncslice_t;
typedef wrsm_linkid_t linkid_t;
typedef wrsm_safari_port_t safari_port_t;
/*
* Cacheline-size related constants
*/
#define WRSM_CACHELINE_SIZE 64
#define WRSM_CACHELINE_SHIFT 6
/*
* This is a more meaningful name for the errno return value of 0. It
*/
#define WRSM_SUCCESS 0
/*
* Hash for fmnodeid to node pointer mapping.
* Most likely the fmnodeid will be a low integer.
*/
#define WRSM_CNODE_HASH_FUNC(r) \
(((uint_t)r) & WRSM_CNODE_HASH_MASK)
/*
* 8 is the lower bound allowed before we are required to start freezing
* Request Agent (RAG) instances per PRM
*/
#define WRSM_RAG_FREEZE_NODE_LIMIT 8
/*
* additional bit mask manipulation macros
*/
/* Copy bits from set1 to set2 */
WRSMMASKSIZE(set1)))
#define WRSMSET_ISNULL(set) \
int _i; \
}
int _i; \
}
int _i; \
}
/*
* in the node->link_stripes field, this is the number of bits to
* shift to get to the bit referring to the next link in the same wci
*/
#define BBIT_LINK_STRIDE 4
/* opaque type for LC's handle */
typedef struct wrsm_soft_state *lcwci_handle_t;
/* opaque type for NC's handle */
typedef struct wrsm_ncwci *ncwci_handle_t;
/*
* typedefs for opaque structure definitions (for structures private to
* particular wrsm modules, declared in module specific header files)
*/
typedef struct wrsm_node_routeinfo wrsm_node_routeinfo_t;
typedef struct wrsm_node_memseg wrsm_node_memseg_t;
typedef struct wrsm_transport wrsm_transport_t;
typedef struct wrsm_session wrsm_session_t;
typedef struct wrsm_cmmu_alloc wrsm_cmmu_alloc_t;
typedef struct wrsm_interrupt wrsm_interrupt_t;
typedef struct wrsm_memseg wrsm_memseg_t;
typedef struct __rsm_controller_handle wrsm_network_t;
typedef struct wrsm_node wrsm_node_t;
typedef struct wrsm_cmmu_tuple wrsm_cmmu_tuple_t;
/*
* configuration states
*/
typedef enum {
wrsm_disabled, /* new config, no ncslice rerouting allowed */
wrsm_pending, /* can reroute using old/new config intersection */
wrsm_installed, /* ncslice routes are not using old config */
wrsm_installed_up, /* all links in new config are up */
wrsm_enabled /* ncslice routes are using new config */
#define WRSM_INSTALLED(n) \
((n)->availability == wrsm_enabled || \
(n)->availability == wrsm_installed || \
(n)->availability == wrsm_installed_up)
/*
* state of communication to node
*/
typedef enum {
wrsm_node_needroute, /* no ncslice routes to node */
wrsm_node_haveroute /* ncslice route set up */
/*
* information about a remote node participating in an RSM network
*/
struct wrsm_node {
/*
* wrsm module private info about node
*/
/*
* The following structures are for tracking RSMPI data structures.
*/
/*
* links
*/
};
/*
* The RSM controller's view of the RSM network it is participating in.
*/
#ifdef _KERNEL
struct __rsm_controller_handle {
/* ncslices local node exports */
/* per ncslice count of ncslice users */
/*
* route_umem is the kernel allocated address space that
* can also be mapped to user space. both route_countp
* and reroutingp will point to an address range within
* route_umem. the wrsm plug-in uses this address range
* when it mmaps route_counter and rerouting to user space
* the plug-in requires these fields when it must preform
* explicit barriers, as the plugin must check to see if the
* routing has changed.
*/
void *route_umem; /* returned by ddi_umem_alloc */
/* keeps track of controller opened by plugin library */
/*
* wrsm module private info about network
*/
int wrsm_num_nodes; /* number of nodes in this network */
/*
* NC info
*/
/*
* links
*/
/*
* RSMPI information
*/
/*
* Kstat for the controller
*/
};
#endif /* KERNEL */
#define PROTOCOLS_SUPPORTED 1
/*
* The protocol_versions_supported is a bit mask representing all the
* protocol versions that this driver supports.
*/
extern uint32_t protocol_versions_supported;
extern int protocol_version; /* version native to this driver */
int
/*
* initialization and teardown functions for WRSM modules - called from
* driver _init and _fini
*/
extern void wrsm_nc_init(void);
extern int wrsm_nc_fini(void);
/*
* Functions which make up wrsm_nc_fini() - these can be called individually
* to separate checks from cleanup - called from driver _fini
*/
extern int wrsm_nc_check(void);
extern void wrsm_nc_cleanup(void);
#ifdef DEBUG
#define DEBUG_LOG
extern void dprintnodes(cnode_bitmask_t);
#define DPRINTNODES(c) dprintnodes(c)
extern kmutex_t wrsmdbglock;
extern int wrsmdbginit;
extern char wrsmdbgbuf[];
extern int wrsmdbgsize;
extern int wrsmdbgnext;
#else
#define DPRINTNODES(c)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _WRSM_COMMON_H */