fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _RDC_
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ksynch.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/kmem.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/conf.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/cmn_err.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/modctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/cred.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ddi.h>
5c5f137104b2d56181283389fa902220f2023809Richard Lowe#include <sys/sysmacros.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s_k.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_errors.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsc_thread.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DS_DDICT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "../contract.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/nsvers.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/sdt.h> /* dtrace is S10 or later */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdc.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdc_io.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdc_bitmap.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdc_ioctl.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdcsrv.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "rdc_diskq.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DIDINIT 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DIDNODES 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DIDCONFIG 0x04
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcopen(dev_t *devp, int flag, int otyp, cred_t *crp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcclose(dev_t dev, int flag, int otyp, cred_t *crp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcprint(dev_t dev, char *str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *crp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcattach(dev_info_t *dip, ddi_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcdetach(dev_info_t *dip, ddi_detach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdcgetinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void **result);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdc_clrkstat(void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * kstat interface
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic kstat_t *sndr_kstats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint sndr_info_stats_update(kstat_t *ksp, int rw);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic sndr_m_stats_t sndr_info_stats = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_MAXSETS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_MAXFBAS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_RPC_TIMEOUT, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_HEALTH_THRES, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_BITMAP_WRITES, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_CLNT_COTS_CALLS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_CLNT_CLTS_CALLS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_SVC_COTS_CALLS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_SVC_CLTS_CALLS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_MKSTAT_BITMAP_REF_DELAY, KSTAT_DATA_ULONG}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint rdc_info_stats_update(kstat_t *ksp, int rw);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic rdc_info_stats_t rdc_info_stats = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_FLAGS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_SYNCFLAGS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_BMPFLAGS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_SYNCPOS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_VOLSIZE, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_BITSSET, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_AUTOSYNC, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_MAXQFBAS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_MAXQITEMS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_FILE, KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_SECFILE, KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_BITMAP, KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_PRIMARY_HOST, KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_SECONDARY_HOST, KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_TYPE_FLAG, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_BMP_SIZE, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_DISK_STATUS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_IF_DOWN, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_IF_RPC_VERSION, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_ASYNC_BLOCK_HWM, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_ASYNC_ITEM_HWM, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_ASYNC_THROTTLE_DELAY, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_ASYNC_ITEMS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_ASYNC_BLOCKS, KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {RDC_IKSTAT_QUEUE_TYPE, KSTAT_DATA_CHAR}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct cb_ops rdc_cb_ops = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcopen,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcclose,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nulldev, /* no strategy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcprint,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no dump */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no read */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no write */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcioctl,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no devmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no mmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no segmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nochpoll,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_prop_op,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NULL, /* not STREAMS */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte D_NEW | D_MP | D_64BIT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CB_REV,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no aread */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no awrite */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct dev_ops rdc_ops = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DEVO_REV,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcgetinfo,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nulldev, /* identify */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nulldev, /* probe */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcattach,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcdetach,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodev, /* no reset */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &rdc_cb_ops,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (struct bus_ops *)NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct modldrv rdc_ldrv = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &mod_driverops,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "nws:Remote Mirror:" ISS_VERSION_STR,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &rdc_ops
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct modlinkage rdc_modlinkage = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MODREV_1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &rdc_ldrv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int sndr_major_rev = ISS_VERSION_MAJ;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int sndr_minor_rev = ISS_VERSION_MIN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int sndr_micro_rev = ISS_VERSION_MIC;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int sndr_baseline_rev = ISS_VERSION_NUM;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char sndr_version[16];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void *rdc_dip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _rdc_init_dev();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void _rdc_deinit_dev();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void rdc_link_down_free();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint rdc_bitmap_mode;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint rdc_auto_sync;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint rdc_max_sets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int rdc_health_thres;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekmutex_t rdc_sync_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_sync_event_t rdc_sync_event;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclock_t rdc_sync_event_timeout;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_sync_event_init()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_init(&rdc_sync_mutex, NULL, MUTEX_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_init(&rdc_sync_event.mutex, NULL, MUTEX_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cv_init(&rdc_sync_event.cv, NULL, CV_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cv_init(&rdc_sync_event.done_cv, NULL, CV_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sync_event.master[0] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sync_event.lbolt = (clock_t)0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sync_event_timeout = RDC_SYNC_EVENT_TIMEOUT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_sync_event_destroy()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_destroy(&rdc_sync_mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_destroy(&rdc_sync_event.mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cv_destroy(&rdc_sync_event.cv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cv_destroy(&rdc_sync_event.done_cv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_init(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mod_install(&rdc_modlinkage));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_fini(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mod_remove(&rdc_modlinkage));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_info(struct modinfo *modinfop)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mod_info(&rdc_modlinkage, modinfop));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte intptr_t flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int instance;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*CONSTCOND*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(sizeof (u_longlong_t) == 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd != DDI_ATTACH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_FAILURE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(sndr_version, _VERSION_, sizeof (sndr_version));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte instance = ddi_get_instance(dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_dip = dip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sync_event_init();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * rdc_max_sets must be set before calling _rdc_load().
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_max_sets = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "rdc_max_sets", 64);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (_rdc_init_dev()) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!rdc: _rdc_init_dev failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags |= DIDINIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (_rdc_load() != 0) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!rdc: _rdc_load failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (_rdc_configure()) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!rdc: _rdc_configure failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags |= DIDCONFIG;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_create_minor_node(dip, "rdc", S_IFCHR, instance, DDI_PSEUDO, 0)
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana != DDI_SUCCESS) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!rdc: could not create node.");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags |= DIDNODES;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_bitmap_mode = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_NOTPROM,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "rdc_bitmap_mode", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (rdc_bitmap_mode) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_BMP_AUTO: /* 0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_BMP_ALWAYS: /* 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_BMP_NEVER: /* 2 */
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!SNDR bitmap mode override");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_CONT,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!SNDR: bitmaps will only be written on shutdown\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default: /* unknown */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!SNDR: unknown bitmap mode %d - autodetecting mode",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana rdc_bitmap_mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_bitmap_mode = RDC_BMP_AUTO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_bitmap_init();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_auto_sync = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_NOTPROM,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "rdc_auto_sync", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_NOTPROM,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "rdc_health_thres", RDC_HEALTH_THRESHOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= RDC_MIN_HEALTH_THRES)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_health_thres = i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!value rdc_heath_thres from rdc.conf ignored "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "as it is smaller than the min value of %d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDC_MIN_HEALTH_THRES);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_set_driver_private(dip, (caddr_t)flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_report_dev(dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sndr_kstats = kstat_create(RDC_KSTAT_MODULE, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDC_KSTAT_MINFO, RDC_KSTAT_CLASS, KSTAT_TYPE_NAMED,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (sndr_m_stats_t) / sizeof (kstat_named_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sndr_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sndr_kstats->ks_data = &sndr_info_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sndr_kstats->ks_update = sndr_info_stats_update;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sndr_kstats->ks_private = &rdc_k_info[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(sndr_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!SNDR: module kstats failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteout:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DTRACE_PROBE(rdc_attach_failed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_set_driver_private(dip, (caddr_t)flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) rdcdetach(dip, DDI_DETACH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_FAILURE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcdetach(dev_info_t *dip, ddi_detach_cmd_t cmd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_u_info_t *urdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rdcd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte intptr_t flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd != DDI_DETACH) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DTRACE_PROBE(rdc_detach_unknown_cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_FAILURE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_k_info == NULL || rdc_u_info == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto cleanup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(&rdc_conf_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (rdcd = 0; rdcd < rdc_max_sets; rdcd++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc = &rdc_k_info[rdcd];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc = &rdc_u_info[rdcd];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IS_ENABLED(urdc) || krdc->devices) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_WARN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "!rdc: cannot detach, rdcd %d still in use", rdcd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&rdc_conf_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DTRACE_PROBE(rdc_detach_err_busy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_FAILURE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&rdc_conf_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecleanup:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags = (intptr_t)ddi_get_driver_private(dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flags & DIDNODES)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_remove_minor_node(dip, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sndr_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(sndr_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flags & DIDINIT)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _rdc_deinit_dev();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flags & DIDCONFIG) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) _rdc_deconfigure();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) _rdc_unload();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdcsrv_unload();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_sync_event_destroy();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_link_down_free();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_dip = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DDI_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcgetinfo(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc = DDI_FAILURE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (infocmd) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DDI_INFO_DEVT2DEVINFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *result = rdc_dip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = DDI_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DDI_INFO_DEVT2INSTANCE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We only have a single instance */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *result = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = DDI_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcopen(dev_t *devp, int flag, int otyp, cred_t *crp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcclose(dev_t dev, int flag, int otyp, cred_t *crp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcprint(dev_t dev, char *str)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int instance = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!rdc%d: %s", instance, str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconvert_ioctl_args(int cmd, intptr_t arg, int mode, _rdc_ioctl_t *args)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _rdc_ioctl32_t args32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &args32, sizeof (_rdc_ioctl32_t), mode))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero((void *)args, sizeof (_rdc_ioctl_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (cmd) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_CONFIG:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* _rdc_config_t * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg1 = (uint32_t)args32.arg1; /* pointer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg2 = (uint32_t)args32.arg2; /* size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->ustatus = (spcs_s_info_t)args32.ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_STATUS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* pointer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->ustatus = (spcs_s_info_t)args32.ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_ENABLE_SVR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* _rdc_svc_args * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_VERSION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* _rdc_version_t * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->ustatus = (spcs_s_info_t)args32.ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_SYNC_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* char * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg1 = (uint32_t)args32.arg1; /* char * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->ustatus = (spcs_s_info_t)args32.ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_LINK_DOWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* char * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->ustatus = (spcs_s_info_t)args32.ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_CREATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* svcpool_args * */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_WAIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_RUN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args->arg0 = (uint32_t)args32.arg0; /* int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build a 32bit rdc_set structure and copyout to the user level.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_status_copy32(const void *arg, void *usetp, size_t size, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_u_info_t *urdc = (rdc_u_info_t *)arg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_set32 set32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t tailsize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t tailsize32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(&set32, sizeof (set32));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tailsize = sizeof (struct rdc_addr32) -
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana offsetof(struct rdc_addr32, intf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* primary address structure, avoiding netbuf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&urdc->primary.intf[0], &set32.primary.intf[0], tailsize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* secondary address structure, avoiding netbuf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&urdc->secondary.intf[0], &set32.secondary.intf[0], tailsize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the rest, avoiding netconfig
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * note: the tail must be the same size in both structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tailsize = sizeof (struct rdc_set) - offsetof(struct rdc_set, flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ASSERT is calling for debug reason, and tailsize32 is only declared
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for ASSERT, put them under debug to avoid lint warning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tailsize32 = sizeof (struct rdc_set32) -
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana offsetof(struct rdc_set32, flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(tailsize == tailsize32);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&urdc->flags, &set32.flags, tailsize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copyout to user level */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ddi_copyout(&set32, usetp, size, mode));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Status ioctl.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcstatus(_rdc_ioctl_t *args, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*copyout)(const void *, void *, size_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_u_info_t *urdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disk_queue *dqp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *usetp; /* pointer to user rdc_set structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t size; /* sizeof user rdc_set structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t *maxsetsp; /* address of status->maxsets; */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int nset, max, i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_status32 status32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)args->arg0, &status32,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (status32), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte usetp = ((char *)args->arg0) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offsetof(struct rdc_status32, rdc_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte maxsetsp = (int32_t *)((char *)args->arg0 +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offsetof(struct rdc_status32, maxsets));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nset = status32.nset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size = sizeof (struct rdc_set32);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copyout = rdc_status_copy32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct rdc_status status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)args->arg0, &status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (status), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte usetp = ((char *)args->arg0) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offsetof(struct rdc_status, rdc_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte maxsetsp = (int32_t *)((char *)args->arg0 +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offsetof(struct rdc_status, maxsets));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nset = status.nset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size = sizeof (struct rdc_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copyout = ddi_copyout;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte max = min(nset, rdc_max_sets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, j = 0; i < max; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc = &rdc_u_info[i];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc = &rdc_k_info[i];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!IS_ENABLED(urdc))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sneak out qstate in urdc->flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * this is harmless because it's value is not used
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in urdc->flags. the real qstate is kept in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * group->diskq->disk_hdr.h.state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (RDC_IS_DISKQ(krdc->group)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dqp = &krdc->group->diskq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IS_QSTATE(dqp, RDC_QNOBLOCK))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->flags |= RDC_QNOBLOCK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*copyout)(urdc, usetp, size, mode) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->flags &= ~RDC_QNOBLOCK; /* clear qstate */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte usetp += size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copyout rdc_max_sets value */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout(&rdc_max_sets, maxsetsp, sizeof (*maxsetsp), mode) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copyout number of sets manipulated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*CONSTCOND*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(offsetof(struct rdc_status32, nset) == 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*CONSTCOND*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(offsetof(struct rdc_status, nset) == 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ddi_copyout(&j, (void *)args->arg0, sizeof (int), mode));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdcioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *crp, int *rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t kstatus = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _rdc_ioctl_t args;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int error;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd != RDC_STATUS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((error = drv_priv(crp)) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (error);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd == RDC_ASYNC6) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdc_async6((void *)arg, mode, rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd == RDC_CLRKSTAT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdc_clrkstat((void *)arg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd == RDC_STALL0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((int)arg > 1) || ((int)arg < 0))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_stallzero((int)arg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd == RDC_READGEN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdc_readgen((void *)arg, mode, rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd == RDC_BITMAPOP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_bitmap_op_t bmop;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_bitmap_op32_t bmop32;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_model_convert_from(mode & FMODELS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == DDI_MODEL_ILP32) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &bmop32, sizeof (bmop32),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bmop.offset = bmop32.offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bmop.op = bmop32.op;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(bmop.sechost, bmop32.sechost,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAX_RDC_HOST_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(bmop.secfile, bmop32.secfile,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NSC_MAXPATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bmop.len = bmop32.len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bmop.addr = (unsigned long)bmop32.addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &bmop, sizeof (bmop),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdc_bitmapset(bmop.op, bmop.sechost, bmop.secfile,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)bmop.addr, bmop.len, bmop.offset, mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rc = convert_ioctl_args(cmd, arg, mode, &args)) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &args,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (_rdc_ioctl_t), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstatus = spcs_s_kcreate();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!kstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ENOMEM);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (cmd) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_CREATE: {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct svcpool_args p;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &p, sizeof (p), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error = svc_pool_create(&p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_WAIT: {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &id, sizeof (id), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error = svc_wait(id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_POOL_RUN: {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)arg, &id, sizeof (id), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error = svc_do_run(id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_ENABLE_SVR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_DECL(rdc_svc_args, parms);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_INIT(parms, mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Only used by sndrd which does not use unistat */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void *)args.arg0, STRUCT_BUF(parms),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_SIZE(parms), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdc_start_server(STRUCT_BUF(parms), mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_STATUS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = rdcstatus(&args, mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_CONFIG:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = _rdc_config((void *)args.arg0, mode, kstatus, rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_copyoutf(&kstatus, args.ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_VERSION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_DECL(rdc_version, parms);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_INIT(parms, mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_FSET(parms, major, sndr_major_rev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_FSET(parms, minor, sndr_minor_rev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_FSET(parms, micro, sndr_micro_rev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte STRUCT_FSET(parms, baseline, sndr_baseline_rev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout(STRUCT_BUF(parms), (void *)args.arg0,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana STRUCT_SIZE(parms), mode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EFAULT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_LINK_DOWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* char *host from user */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = _rdc_link_down((void *)args.arg0, mode, kstatus, rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_copyoutf(&kstatus, args.ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case RDC_SYNC_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = _rdc_sync_event_wait((void *)args.arg0, (void *)args.arg1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode, kstatus, rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_copyoutf(&kstatus, args.ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = EINVAL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_kfree(kstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesndr_info_stats_update(kstat_t *ksp, int rw)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern int rdc_rpc_tmout;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern int rdc_health_thres;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern int rdc_bitmap_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern long rdc_clnt_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern long rdc_svc_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sndr_m_stats_t *info_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats = (sndr_m_stats_t *)(ksp->ks_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc = (rdc_k_info_t *)(ksp->ks_private);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no writes currently allowed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rw == KSTAT_WRITE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EACCES);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* default to READ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_maxsets.value.ul = rdc_max_sets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_maxfbas.value.ul = krdc->maxfbas;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_rpc_timeout.value.ul = rdc_rpc_tmout;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_health_thres.value.ul = rdc_health_thres;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_bitmap_writes.value.ul = krdc->bitmap_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_bitmap_ref_delay.value.ul = rdc_bitmap_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clts counters not implemented yet */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_clnt_cots_calls.value.ul = rdc_clnt_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_clnt_clts_calls.value.ul = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_svc_cots_calls.value.ul = rdc_svc_count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info_stats->m_svc_clts_calls.value.ul = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy tailsize-1 bytes of tail of s to s1.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_str_tail_cpy(char *s1, char *s, size_t tailsize)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* To avoid un-terminated string, max size is 16 - 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ssize_t offset = strlen(s) - (tailsize - 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (offset > 0) ? offset : 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ensure it's null terminated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strlcpy(s1, (const char *)(s + offset), tailsize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_info_stats_update(kstat_t *ksp, int rw)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats_t *rdc_info_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_u_info_t *urdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats = (rdc_info_stats_t *)(ksp->ks_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc = (rdc_k_info_t *)(ksp->ks_private);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc = &rdc_u_info[krdc->index];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no writes currently allowed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rw == KSTAT_WRITE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EACCES);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* default to READ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_flags.value.ul = urdc->flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_syncflags.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->sync_flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_bmpflags.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->bmap_flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_syncpos.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->sync_pos;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_volsize.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->volume_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_bits_set.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->bits_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_autosync.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->autosync;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_maxqfbas.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->maxqfbas;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_maxqitems.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte urdc->maxqitems;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_primary_vol,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->primary.file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_secondary_vol,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->secondary.file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_get_vflags(urdc) & RDC_PRIMARY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_bitmap,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->primary.bitmap);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_bitmap,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->secondary.bitmap);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_primary_intf,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->primary.intf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&rdc_info_stats->s_secondary_intf,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana urdc->secondary.intf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_type_flag.value.ul = krdc->type_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_bitmap_size.value.ul = krdc->bitmap_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_disk_status.value.ul = krdc->disk_status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->intf) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_if_if_down.value.ul = krdc->intf->if_down;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_if_rpc_version.value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->intf->rpc_version;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the type can change without disable/re-enable so... */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(rdc_info_stats->s_aqueue_type.value.c, KSTAT_DATA_CHAR_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (RDC_IS_MEMQ(krdc->group)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(rdc_info_stats->s_aqueue_type.value.c, "memory");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_blk_hwm.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->ra_queue.blocks_hwm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_itm_hwm.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->ra_queue.nitems_hwm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_throttle.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->ra_queue.throttle_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_items.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->ra_queue.nitems;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_blocks.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->ra_queue.blocks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (RDC_IS_DISKQ(krdc->group)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disk_queue *q = &krdc->group->diskq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_blk_hwm.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->diskq.blocks_hwm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_itm_hwm.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->diskq.nitems_hwm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_throttle.value.ul =
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana krdc->group->diskq.throttle_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_items.value.ul = QNITEMS(q);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info_stats->s_aqueue_blocks.value.ul = QBLOCKS(q);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(rdc_info_stats->s_aqueue_type.value.c, "disk");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_kstat_create(int index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int j = index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc = &rdc_k_info[index];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_u_info_t *urdc = &rdc_u_info[krdc->index];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size_t varsize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!krdc->set_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats = kstat_create(RDC_KSTAT_MODULE, j,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDC_KSTAT_INFO, RDC_KSTAT_CLASS, KSTAT_TYPE_NAMED,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (rdc_info_stats_t) / sizeof (kstat_named_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!krdc->set_kstats)
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!krdc:u_kstat null");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->set_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* calculate exact size of KSTAT_DATA_STRINGs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte varsize = strlen(urdc->primary.file) + 1
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana + strlen(urdc->secondary.file) + 1
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana + strlen(urdc->primary.intf) + 1
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana + strlen(urdc->secondary.intf) + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_get_vflags(urdc) & RDC_PRIMARY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte varsize += strlen(urdc->primary.bitmap) + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte varsize += strlen(urdc->secondary.bitmap) + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats->ks_data_size += varsize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats->ks_data = &rdc_info_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats->ks_update = rdc_info_stats_update;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats->ks_private = &rdc_k_info[j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(krdc->set_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!SNDR: k-kstats failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats = kstat_create(RDC_KSTAT_MODULE, j, NULL,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "disk", KSTAT_TYPE_IO, 1, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->io_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats->ks_lock = &krdc->kstat_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(krdc->io_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->bmp_kstats = kstat_create("sndrbmp", j, NULL,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "disk", KSTAT_TYPE_IO, 1, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->bmp_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->bmp_kstats->ks_lock = &krdc->bmp_kstat_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(krdc->bmp_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_kstat_delete(int index)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc = &rdc_k_info[index];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->set_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(krdc->set_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->set_kstats = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->io_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(krdc->io_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->bmp_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(krdc->bmp_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->bmp_kstats = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reset the io_kstat structure of the krdc specified
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * by the arg index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_clrkstat(void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_k_info_t *krdc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte index = (int)(unsigned long)arg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((index < 0) || (index >= rdc_max_sets)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc = &rdc_k_info[index];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->io_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(krdc->io_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats = kstat_create(RDC_KSTAT_MODULE, index, NULL,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "disk", KSTAT_TYPE_IO, 1, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->io_kstats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->io_kstats->ks_lock = &krdc->kstat_mutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(krdc->io_kstats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * clear the high water marks and throttle.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (krdc->group) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->group->ra_queue.nitems_hwm = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->group->ra_queue.blocks_hwm = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krdc->group->ra_queue.throttle_delay = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif