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/*
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iSCSI Software Initiator
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap#define ISCSI_ICS_NAMES
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "iscsi.h" /* main header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekstat_item_t kstat_items_hba[KN_HBA_IDX_MAX] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_name", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_alias", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_sess", KSTAT_DATA_ULONG}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekstat_item_t kstat_items_sess[KN_SESS_IDX_MAX] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_state", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_oid", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_hba", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_conn", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_reset", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_pkt_pending", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cmd_sn", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cmd_sn_exp", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cmd_sn_max", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_target_name", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_target_alias", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_tpgt", KSTAT_DATA_ULONG}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekstat_item_t kstat_items_conn[KN_CONN_IDX_MAX] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_state", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cid", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_oid", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_session", KSTAT_DATA_STRING},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_err_header_digest", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_err_data_digest", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_err_connection_reset", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_err_protocol_error", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_tx_bytes", KSTAT_DATA_ULONGLONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_rx_bytes", KSTAT_DATA_ULONGLONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_cntr_qactive", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_stat_sn_exp", KSTAT_DATA_ULONG},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"_stat_sn_last", KSTAT_DATA_ULONG}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint iscsi_hba_kstat_update(kstat_t *ks, int rw);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint iscsi_sess_kstat_update(kstat_t *ks, int rw);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint iscsi_conn_kstat_update(kstat_t *ks, int rw);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * HBA
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_hba_kstat_init - This function registers with the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_hba_kstat_init(iscsi_hba_t *ihp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ks_name[KSTAT_STRLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_hba_stats_t *ihs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The name of the KSTAT structure is built.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ks_name, sizeof (ks_name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snprintf(ks_name, sizeof (ks_name) - 1, iSCSI_HBA_BASE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->hba_oid) >= sizeof (ks_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks = kstat_create(iSCSI_MODULE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get_instance(ihp->hba_dip), ks_name, iSCSI_CLASS_HBA,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_TYPE_NAMED, 0, KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ihp->stats.ks == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat creation failed for hba(%d)",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->hba_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihs = &ihp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks->ks_data = &ihp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks->ks_data_size = sizeof (ihp->stats.ks_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks->ks_ndata = KN_HBA_IDX_MAX;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < KN_HBA_IDX_MAX; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_init(&ihs->kn[i], kstat_items_hba[i]._name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_items_hba[i]._data_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks->ks_update = iscsi_hba_kstat_update;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp->stats.ks->ks_private = (void *)ihp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(ihp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_hba_kstat_term - This function deregisters from the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_hba_kstat_term(iscsi_hba_t *ihp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(ihp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_hba_kstat_update - This function update the kstat structure of the HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_hba_kstat_update(kstat_t *ks, int rw)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_hba_t *ihp = (iscsi_hba_t *)ks->ks_private;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_hba_stats_t *ihs = &ihp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rw == KSTAT_READ) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ihp->hba_name, ihs->name, ihp->hba_name_length);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ihp->hba_alias, ihs->alias, ihp->hba_alias_length);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihs->name[ihp->hba_name_length] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihs->alias[ihp->hba_alias_length] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&ihs->kn[KN_HBA_IDX_NAME],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)ihs->name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&ihs->kn[KN_HBA_IDX_ALIAS],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)ihs->alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rw_exit(&ihp->hba_sess_list_rwlock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Session
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_sess_kstat_init - This function registers with the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_sess_kstat_init(iscsi_sess_t *isp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_hba_t *ihp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ks_name[KSTAT_STRLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_sess_stats_t *iss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(isp != NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ihp = isp->sess_hba;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(ihp != NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The name of the KSTAT structure is built.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ks_name, sizeof (ks_name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snprintf(ks_name, sizeof (ks_name) - 1, iSCSI_SESS_BASE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_hba->hba_oid, isp->sess_oid) >= sizeof (ks_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat creation failed for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "session(%u)", isp->sess_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks = kstat_create(iSCSI_MODULE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get_instance(ihp->hba_dip), ks_name, iSCSI_CLASS_SESS,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_TYPE_NAMED, 0, KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (isp->stats.ks == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat creation failed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "for session(%u)", isp->sess_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss = &isp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks->ks_data = (void *)&isp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks->ks_data_size = sizeof (isp->stats.ks_data);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks->ks_ndata = KN_SESS_IDX_MAX;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < KN_SESS_IDX_MAX; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_init(&iss->kn[i], kstat_items_sess[i]._name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_items_sess[i]._data_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* The static information is updated immediately */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(iss->hba_str, sizeof (iss->hba_str));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ihp->stats.ks->ks_name, iss->hba_str, sizeof (iss->hba_str));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&iss->kn[KN_SESS_IDX_HBA],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)iss->hba_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_OID].value.ul = isp->sess_oid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks->ks_update = iscsi_sess_kstat_update;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks->ks_private = (void *)isp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* The IO KSTAT structure is created */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ks_name, sizeof (ks_name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snprintf(ks_name, sizeof (ks_name) - 1, iSCSI_SESS_IO_BASE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_hba->hba_oid, isp->sess_oid) >= sizeof (ks_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat createion failed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "for session(%u)", isp->sess_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(isp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks_io = kstat_create(iSCSI_MODULE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get_instance(ihp->hba_dip), ks_name, iSCSI_CLASS_SESS,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_TYPE_IO, 1, KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (isp->stats.ks_io == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(isp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat creation failed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "for session(%u)", isp->sess_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_init(&isp->stats.ks_io_lock, NULL, MUTEX_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks_io->ks_data = &isp->stats.ks_io_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->stats.ks_io->ks_lock = &isp->stats.ks_io_lock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(isp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(isp->stats.ks_io);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_sess_kstat_term - This function deregisters with the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_sess_kstat_term(iscsi_sess_t *isp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(isp->stats.ks_io);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_destroy(&isp->stats.ks_io_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(isp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_sess_kstat_update - This function update the kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure of the HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_sess_kstat_update(kstat_t *ks, int rw)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_sess_t *isp = (iscsi_sess_t *)ks->ks_private;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_sess_stats_t *iss = &isp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rw == KSTAT_READ) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* String indicating the state of the session */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ptr = iscsi_sess_state_str(isp->sess_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = strlen(ptr);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap if (len > (sizeof (iss->state_str) - 1)) {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap len = sizeof (iss->state_str) - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(iss->state_str, sizeof (iss->state_str));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ptr, iss->state_str, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &iss->kn[KN_SESS_IDX_STATE],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)iss->state_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Target name string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (isp->sess_name_length > sizeof (iss->target_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = sizeof (iss->target_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = isp->sess_name_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(iss->target_name, sizeof (iss->target_name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(isp->sess_name, iss->target_name, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&iss->kn[KN_SESS_IDX_TARGET_NAME],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)iss->target_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Target alias string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (isp->sess_alias_length > sizeof (iss->target_alias)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = sizeof (iss->target_alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = isp->sess_alias_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(iss->target_alias, sizeof (iss->target_alias));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(isp->sess_alias, iss->target_alias, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &iss->kn[KN_SESS_IDX_TARGET_ALIAS],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)iss->target_alias);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_CNTR_PKT_PENDING].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_queue_pending.count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_CMDSN].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_cmdsn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_EXPCMDSN].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_expcmdsn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_MAXCMDSN].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_maxcmdsn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iss->kn[KN_SESS_IDX_TPGT].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isp->sess_tpgt_conf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Connection
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_conn_kstat_init - This function registers with the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_conn_kstat_init(iscsi_conn_t *icp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_sess_t *isp = icp->conn_sess;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_hba_t *ihp = isp->sess_hba;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_conn_stats_t *ics;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ks_name[KSTAT_STRLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The name of the KSTAT structure is built.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ks_name, sizeof (ks_name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snprintf(ks_name, sizeof (ks_name) - 1, iSCSI_CONN_BASE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->conn_sess->sess_hba->hba_oid, icp->conn_sess->sess_oid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->conn_oid) >= sizeof (ks_name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks = kstat_create(iSCSI_MODULE_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get_instance(ihp->hba_dip), ks_name, iSCSI_CLASS_CONN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte KSTAT_TYPE_NAMED, 0, KSTAT_FLAG_VIRTUAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (icp->stats.ks == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_NOTE, "iscsi kstat creation failed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "for connection(%d)", icp->conn_oid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (TRUE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics = &icp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks->ks_data = (void *)ics;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks->ks_data_size = sizeof (*ics);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks->ks_ndata = KN_CONN_IDX_MAX;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < KN_CONN_IDX_MAX; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_init(&ics->kn[i], kstat_items_conn[i]._name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_items_conn[i]._data_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* The static information is updated immediately */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ics->sess_str, sizeof (ics->sess_str));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(isp->stats.ks->ks_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->sess_str,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (ics->sess_str));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&ics->kn[KN_CONN_IDX_SESS],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)ics->sess_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->kn[KN_CONN_IDX_OID].value.ul = isp->sess_oid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->kn[KN_CONN_IDX_CID].value.ul = icp->conn_cid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks->ks_update = iscsi_conn_kstat_update;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->stats.ks->ks_private = (void *)icp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_install(icp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_conn_kstat_term - This function deregisters with the kstat service.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_conn_kstat_term(iscsi_conn_t *icp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_delete(icp->stats.ks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_conn_kstat_update - This function update the kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure of the HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_conn_kstat_update(kstat_t *ks, int rw)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_conn_t *icp = (iscsi_conn_t *)ks->ks_private;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_conn_stats_t *ics = &icp->stats.ks_data;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rw == KSTAT_READ) {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap len = strlen(iscsi_ics_name[icp->conn_state]);
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap if (len > (sizeof (ics->state_str) - 1)) {
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap len = sizeof (ics->state_str) - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(ics->state_str, sizeof (ics->state_str));
30e7468f8f41aa30ada067b2c1d5d284046514daPeter Dunlap bcopy(iscsi_ics_name[icp->conn_state], ics->state_str, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_setstr(&ics->kn[KN_CONN_IDX_STATE],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (const char *)ics->state_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->kn[KN_CONN_IDX_CNTR_QACTIVE].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->conn_queue_active.count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->kn[KN_CONN_IDX_EXPSTATSN].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->conn_expstatsn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ics->kn[KN_CONN_IDX_LASTSTATSN].value.ul =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte icp->conn_laststatsn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}