fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Definitions for kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MKSTAT_CLNT_COTS_CALLS "clnt_cots_calls"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MKSTAT_CLNT_CLTS_CALLS "clnt_clts_calls"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MKSTAT_SVC_COTS_CALLS "svc_cots_calls"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MKSTAT_SVC_CLTS_CALLS "svc_clts_calls"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MKSTAT_BITMAP_REF_DELAY "bitmap_ref_delay"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_SECONDARY_HOST "secondary_host"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_IF_RPC_VERSION "if_rpc_version"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_ASYNC_THROTTLE_DELAY "async_throttle_delay"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_ASYNC_BLOCK_HWM "async_block_hwm"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_ASYNC_ITEM_HWM "async_item_hwm"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_ASYNC_ITEMS "async_queue_items"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IKSTAT_ASYNC_BLOCKS "async_queue_blocks"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Queue types
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_maxthreads_last < RDC_MAX_SYNC_THREADS) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_maxthreads_last > RDC_MAX_SYNC_THREADS) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n.avail_thr = RDC_MAX_SYNC_THREADS - n.active_thr; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (n.avail_thr < 0) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte n.avail_thr = RDC_MAX_SYNC_THREADS - n.active_thr; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int avail_thr; /* should be MAX_RDC_SYNC_THREADS - active */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Static server information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct sec_data *ri_secdata; /* sec data for rpcsec module */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ri_hostnamelen; /* server's hostname length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interface structure, including health monitoring.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rpcvers_t rpc_version; /* RPC protocol version in use */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int no_ping; /* set on secondary to hold off RPCs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int old_pulse; /* previous (current) pulse value */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* values for (rdc_aio_t *)->iostatus */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MAX_QBLOCKS 16384 /* 8MB temporary q for diskq to flush to */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_LOW_QBLOCKS 13927 /* roughly 85% of queue full */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_HALF_MQUEUE 8192 /* half of the memory queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int hwmhit; /* queue full hit? reset after hwm */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile nsc_size_t blocks; /* number of FBAs in q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile uint64_t nitems; /* number of items in q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile int inflbls; /* number of inflight blocks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile int inflitems; /* number of inflight items */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t nitems_hwm; /* highest items on queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t blocks_hwm; /* highest blocks on queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte long throttle_delay; /* Number of times we delayed x 2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bitmap header structures.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * These must be fixed size in all data models.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If we ever support little-endian machines (eg. Intel) we will need
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to add byte-swapping logic.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t refcntsize; /* size in bytes of each refcount */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef rdc_headerv5_t rdc_header_t; /* Current header type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_HDR_MAGIC RDC_HDR_V5 /* Current header magic number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_BITMAP_FBA 1 /* Offset at which the bitmap starts */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_BITREF_FBA(krdc) (RDC_BITMAP_FBA + FBA_LEN(krdc->bitmap_size))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC buffer header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t rdc_vsize; /* size of allocated nsc_vec_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_thrsync_t rdc_sync; /* for thread syncronization */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_VEC_ALLOC 0x1 /* local kmem vector for remote io */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ALLOC 0x2 /* rdc_bufp is nsc_buf_alloc'd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ASYNC_VEC 0x4 /* Keep tmp handle for async flusher */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_REMOTE_BUF 0x8 /* buffer alloc'd for remote io only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_NULL_BUF 0x10 /* tell diskq to only store io_hdr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ASYNC_BUF 0x20 /* this buf is to an async vol */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_NULLBUFREAD 0x0f000000 /* read because RDC_NULL_BUF detected */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define BUF_IS_ASYNC(h) (((h) != NULL) && (h)->rdc_flags & RDC_ASYNC_BUF)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_REMOTE(h) (((h) != NULL) && ((h)->rdc_flags & RDC_REMOTE_BUF) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* check a handle against a supplied pos/len pair */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((p) >= (h)->sb_pos) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* check a dset against a supplied pos/len pair */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (((p) >= (d)->pos) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC device info structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_iodev_t *bi_iodev; /* I/O device structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_orsrv; /* Reserves for other io provider */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_failed; /* Count of failed (faked) reserves */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_ofailed; /* Other io provider failed reserves */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_info_dev_s *id_next; /* forward link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _rdc_info_dev_t id_cache_dev; /* cached device info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _rdc_info_dev_t id_raw_dev; /* raw device info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_path_t *rp_tok; /* nsc_register_path token */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Values for id_flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ID_CLOSING 0x1 /* device is closing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * value for diskio.seq.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC group structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t unregistercv; /* wait for unregister */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rdc_addthrnum; /* number threads added to thr set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sleepq_t *sleepq; /* head of waiting tasks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dual use, the outgoing sequence number on the client.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The next expected sequence number on the server.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Protected by the ra_queue lock.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dual use, the last acknowledged sequence number.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used to ensure that the queue doesn't overflow on server
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and to stall transmissions on the client.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Protected by the ra_queue lock.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t diskqmutex; /* enables/disables/reserves */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t synccount; /* number of group members syncing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* group state */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_DISKQ_KILL 0x01 /* a force kill of diskq pending */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IS_DISKQ(grp) (grp->flags & RDC_DISKQUE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IS_MEMQ(grp) (grp->flags & RDC_MEMQUE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * These flags are used in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * aux_state field, and are used to track:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * AUXSYNCIP: When the code has a sync thread running, used instead
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the RC_SYNCING flag which gets cleared before the sync thread
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * terminates.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * AUXWRITE: Set when rdc_sync_write_thr is running, so the rdc_unintercept
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * code can wait until a one-to-many write has actually terminated.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_AUXSYNCIP 0x01 /* a sync is in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_AUXWRITE 0x02 /* I've got a write in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC kernel-private information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rpc_version; /* RPC version this set supps */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volatile int busy_count; /* ioctls in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_thrsync_t syncs; /* _rdc_sync thread tracking */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t maxfbas; /* returned from nsc_maxfbas */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t busycv; /* wait for ioctl to complete */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t closingcv; /* unregister_path/close */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_net_dataset *net_dataset; /* replaces hnds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_k_info *many_next; /* 1-to-many circular list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_k_info *multi_next; /* to multihop krdc */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_k_info *group_next; /* group circular list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags for _rdc_rsrv_devs()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which device(s) to reserve - integer bitmap.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_CACHE 0x1 /* data device in cache mode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device usage after reserve - integer flag.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_INTERNAL 0x1 /* reserve for rdc internal purposes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_EXTERNAL 0x2 /* reserve in response to io provider Attach */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Utility macro for nsc_*() io function returns.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_SUCCESS(rc) (((rc) == NSC_DONE) || ((rc) == NSC_HIT))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC file descriptor structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *rdc_info; /* devices info structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fd and rsrv macros
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RSRV(bi) (((bi)->bi_rsrv > 0) || ((bi)->bi_failed > 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ORSRV(bi) (((bi)->bi_orsrv > 0) || ((bi)->bi_ofailed > 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RFAILED(bi) (((bi)->bi_failed > 0) || ((bi)->bi_ofailed > 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_CRSRV(gcd) (IS_RSRV(&(gcd)->devices->id_cache_dev))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_RRSRV(gcd) (IS_RSRV(&(gcd)->devices->id_raw_dev))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IS_BMP(rdc) ((rdc)->rdc_type == RDC_BMP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IS_QUE(rdc) ((rdc)->rdc_type == RDC_QUE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_IS_RAW(rdc) (((rdc)->rdc_oflags & NSC_CACHE) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_U_FD(gcd) (IS_CRSRV(gcd) ? (gcd)->c_fd : (gcd)->r_fd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reply from remote read
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - convenience defines for the client side code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - keep this in sync with the readres structure in rdc_prot.h/.x
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flags for remote read rpc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _START must be a unique rpc, _DATA and _END may be OR-d together.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_RREAD_DATA 0x1 /* Intermediate rpc with data payload */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_RREAD_FAIL 0x8 /* Primary is failed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flags for remote write rpc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_RWRITE_FAIL 0x8 /* Primary is failed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * macro used to determine if the incomming sq, with sequence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * value x, should be placed before the sq with sequence value y.
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins * This has to account for integer wrap. We account for integer
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins * wrap by checking if the difference between x and y is within
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins * half of the maximum integer value (RDC_MAXINT) or not.
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins#define RDC_BITS(type) (RDC_BITSPERBYTE * (long)sizeof (type))
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins#define RDC_HIBITI ((unsigned)1 << (RDC_BITS(int) - 1))
d5508a7fb37e6b070e142ee081bec69a3d20bd6cThomas Atkins#define RDC_INFRONT(x, y) (((x < y) && ((y - x) < RDC_RANGE)) ? 1 : \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC user-visible information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RDC flags for set state / set cd RPC.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must remain compatible with rdc RPC protocol version v3.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * In kernel type flags (krdc->type_flag).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_DISABLEPEND 0x2 /* Suspend/Disable is in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_UNREGISTER 0x40 /* Unregister is in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_QDISABLEPEND 0x100 /* Q Suspend/Disable is in progress */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_ENABLED(urdc) ((IS_CONFIGURED(&rdc_k_info[(urdc)->index]) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_CONFIGURED(krdc) ((krdc)->type_flag & RDC_CONFIGURED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_MANY(krdc) ((krdc)->many_next != (krdc))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_MULTI(krdc) ((krdc)->multi_next != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_VALID_INDEX(index) ((index) >= 0 && (index) < rdc_max_sets && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_NOFLUSH 0 /* Do not do a flush when starting logging */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_NOREMOTE 0 /* Do no remote logging notifications */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_FLUSH 1 /* Do a flush when starting logging */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ALLREMOTE 2 /* Notify all remote group members */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_OTHERREMOTE 4 /* Notify all remote group members except */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the one corresponding to the current set, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* to prevent recursion in the case where */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the request was initiated from the remote */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_FORCE_GROUP 8 /* set all group memebers logging regardless */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Functions, vars
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int daemon_waiting; /* Daemon waiting in ioctl */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int kernel_waiting; /* Kernel waiting for daemon to reply */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern unsigned long rdc_async_timeout;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_stallzero(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct rdc_net_dataitem rdc_net_dataitem_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * These next two defines are the default value of the async queue size
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * They have been calculated to be 8MB of data with an average of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2K IO size
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MAXTHRES_QUEUE 16384 /* max # of fbas on async q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_MAX_QITEMS 4096 /* max # of items on async q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_ASYNCTHR 2 /* number of async threads */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RDC_RPC_MAX (RDC_MAXDATA + sizeof (net_data5) +\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* right now we can only trace 1m or less writes to the bitmap (32 bits wide) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* kstat interface */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Per module kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * only one instance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_maxsets; /* Max # of sndr sets */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_maxfbas; /* Max # of FBAS from nsctl */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_rpc_timeout; /* global RPC timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_health_thres; /* Health thread timeout */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_bitmap_writes; /* True for bitmap writes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_clnt_cots_calls; /* # of clnt COTS calls */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_clnt_clts_calls; /* # of clnt CLTS calls */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_svc_cots_calls; /* # of server COTS calls */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_svc_clts_calls; /* # of server CLTS calls */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t m_bitmap_ref_delay; /* # of bitmap ref overflows */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Per set kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * one instance per configured set
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_primary_vol; /* from rdc_set_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_secondary_vol; /* from rdc_set_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_primary_intf; /* from rdc_set_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_secondary_intf; /* from rdc_set_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_type_flag; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_bitmap_size; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_disk_status; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_if_rpc_version; /* from rdc_if_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_aqueue_blk_hwm; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_aqueue_itm_hwm; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t s_aqueue_throttle; /* from rdc_k_info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* i.e. 2.6- */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SunOS_5_6 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern volatile int net_exit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_size_t rdc_maxthres_queue; /* max # of fbas on async q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_max_qitems; /* max # of items on async q */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Macro to keep tabs on dataset memory usage.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_enqueue_write(rdc_k_info_t *, nsc_off_t, nsc_size_t, int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_net_state(int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_net_getbmap(int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_net_write(int, int, nsc_buf_t *, nsc_off_t, nsc_size_t, uint_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_net_read(int, int, nsc_buf_t *, nsc_off_t, nsc_size_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_remote_read(rdc_k_info_t *, nsc_buf_t *, nsc_off_t, nsc_size_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_multi_write(nsc_buf_t *, nsc_off_t, nsc_size_t, int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_start_server(struct rdc_svc_args *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern aio_buf_t *rdc_aio_buf_get(rdc_buf_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_aio_buf_del(rdc_buf_t *, rdc_k_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern aio_buf_t *rdc_aio_buf_add(int, rdc_buf_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_net_getstate(rdc_k_info_t *, int *, int *, int *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_drain_queue(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int flush_group_queue(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_lookup_bitmap(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_lookup_enabled(char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_rsrv_devs(rdc_k_info_t *, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void _rdc_unload(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_load(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_configure(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void _rdc_deconfigure(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void _rdc_async_throttle(rdc_k_info_t *, long);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_writer(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_dump_queue(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_isactive_if(struct netbuf *, struct netbuf *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern rdc_if_t *rdc_add_to_if(rdc_srv_t *, struct netbuf *, struct netbuf *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_set_if_vers(rdc_u_info_t *, rpcvers_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_print_svinfo(rdc_srv_t *, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern rdc_srv_t *rdc_create_svinfo(char *, struct netbuf *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void dup_rdc_netbuf(const struct netbuf *, struct netbuf *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_lor(const uchar_t *, uchar_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_set_flags_log(rdc_u_info_t *, int, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_group_log(rdc_k_info_t *krdc, int flush, char *why);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_config(void *, int, spcs_s_info_t, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_sync_event_wait(void *, void *, int, spcs_s_info_t, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_sync_event_notify(int, char *, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_link_down(void *, int, spcs_s_info_t, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_write_bitmap_fba(rdc_k_info_t *, nsc_off_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_bitmapset(int, char *, char *, void *, int, nsc_off_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern rdc_net_dataset_t *rdc_net_get_set(int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_net_put_set(int, rdc_net_dataset_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_net_del_set(int, rdc_net_dataset_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_net_free_set(rdc_k_info_t *, rdc_net_dataset_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_lookup_byhostdev(char *intf, char *file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_dump_dsets(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_readgen(void *, int, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _RDC_IO_H */