1e48354ceSNicholas Bellinger /******************************************************************************* 2e48354ceSNicholas Bellinger * Modern ConfigFS group context specific iSCSI statistics based on original 3e48354ceSNicholas Bellinger * iscsi_target_mib.c code 4e48354ceSNicholas Bellinger * 5e48354ceSNicholas Bellinger * Copyright (c) 2011 Rising Tide Systems 6e48354ceSNicholas Bellinger * 7e48354ceSNicholas Bellinger * Licensed to the Linux Foundation under the General Public License (GPL) version 2. 8e48354ceSNicholas Bellinger * 9e48354ceSNicholas Bellinger * Author: Nicholas A. Bellinger <nab@linux-iscsi.org> 10e48354ceSNicholas Bellinger * 11e48354ceSNicholas Bellinger * This program is free software; you can redistribute it and/or modify 12e48354ceSNicholas Bellinger * it under the terms of the GNU General Public License as published by 13e48354ceSNicholas Bellinger * the Free Software Foundation; either version 2 of the License, or 14e48354ceSNicholas Bellinger * (at your option) any later version. 15e48354ceSNicholas Bellinger * 16e48354ceSNicholas Bellinger * This program is distributed in the hope that it will be useful, 17e48354ceSNicholas Bellinger * but WITHOUT ANY WARRANTY; without even the implied warranty of 18e48354ceSNicholas Bellinger * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19e48354ceSNicholas Bellinger * GNU General Public License for more details. 20e48354ceSNicholas Bellinger ******************************************************************************/ 21e48354ceSNicholas Bellinger 22e48354ceSNicholas Bellinger #include <linux/configfs.h> 23c53181afSPaul Gortmaker #include <linux/export.h> 24e48354ceSNicholas Bellinger #include <scsi/iscsi_proto.h> 25e48354ceSNicholas Bellinger #include <target/target_core_base.h> 26e48354ceSNicholas Bellinger #include <target/configfs_macros.h> 27e48354ceSNicholas Bellinger 28e48354ceSNicholas Bellinger #include "iscsi_target_core.h" 29e48354ceSNicholas Bellinger #include "iscsi_target_parameters.h" 30e48354ceSNicholas Bellinger #include "iscsi_target_device.h" 31e48354ceSNicholas Bellinger #include "iscsi_target_tpg.h" 32e48354ceSNicholas Bellinger #include "iscsi_target_util.h" 33e48354ceSNicholas Bellinger #include "iscsi_target_stat.h" 34e48354ceSNicholas Bellinger 35e48354ceSNicholas Bellinger #ifndef INITIAL_JIFFIES 36e48354ceSNicholas Bellinger #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) 37e48354ceSNicholas Bellinger #endif 38e48354ceSNicholas Bellinger 39e48354ceSNicholas Bellinger /* Instance Attributes Table */ 40e48354ceSNicholas Bellinger #define ISCSI_INST_NUM_NODES 1 41e48354ceSNicholas Bellinger #define ISCSI_INST_DESCR "Storage Engine Target" 42e48354ceSNicholas Bellinger #define ISCSI_INST_LAST_FAILURE_TYPE 0 43e48354ceSNicholas Bellinger #define ISCSI_DISCONTINUITY_TIME 0 44e48354ceSNicholas Bellinger 45e48354ceSNicholas Bellinger #define ISCSI_NODE_INDEX 1 46e48354ceSNicholas Bellinger 47e48354ceSNicholas Bellinger #define ISPRINT(a) ((a >= ' ') && (a <= '~')) 48e48354ceSNicholas Bellinger 49e48354ceSNicholas Bellinger /**************************************************************************** 50e48354ceSNicholas Bellinger * iSCSI MIB Tables 51e48354ceSNicholas Bellinger ****************************************************************************/ 52e48354ceSNicholas Bellinger /* 53e48354ceSNicholas Bellinger * Instance Attributes Table 54e48354ceSNicholas Bellinger */ 55e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_instance, iscsi_wwn_stat_grps); 56e48354ceSNicholas Bellinger #define ISCSI_STAT_INSTANCE_ATTR(_name, _mode) \ 57e48354ceSNicholas Bellinger static struct iscsi_stat_instance_attribute \ 58e48354ceSNicholas Bellinger iscsi_stat_instance_##_name = \ 59e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 60e48354ceSNicholas Bellinger iscsi_stat_instance_show_attr_##_name, \ 61e48354ceSNicholas Bellinger iscsi_stat_instance_store_attr_##_name); 62e48354ceSNicholas Bellinger 63e48354ceSNicholas Bellinger #define ISCSI_STAT_INSTANCE_ATTR_RO(_name) \ 64e48354ceSNicholas Bellinger static struct iscsi_stat_instance_attribute \ 65e48354ceSNicholas Bellinger iscsi_stat_instance_##_name = \ 66e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 67e48354ceSNicholas Bellinger iscsi_stat_instance_show_attr_##_name); 68e48354ceSNicholas Bellinger 69e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_inst( 70e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 71e48354ceSNicholas Bellinger { 72e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 73e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 74e48354ceSNicholas Bellinger 75e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 76e48354ceSNicholas Bellinger } 77e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(inst); 78e48354ceSNicholas Bellinger 79e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_min_ver( 80e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 81e48354ceSNicholas Bellinger { 82e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); 83e48354ceSNicholas Bellinger } 84e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(min_ver); 85e48354ceSNicholas Bellinger 86e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_max_ver( 87e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 88e48354ceSNicholas Bellinger { 89e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); 90e48354ceSNicholas Bellinger } 91e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(max_ver); 92e48354ceSNicholas Bellinger 93e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_portals( 94e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 95e48354ceSNicholas Bellinger { 96e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 97e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 98e48354ceSNicholas Bellinger 99e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_num_tpg_nps); 100e48354ceSNicholas Bellinger } 101e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(portals); 102e48354ceSNicholas Bellinger 103e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_nodes( 104e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 105e48354ceSNicholas Bellinger { 106e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_INST_NUM_NODES); 107e48354ceSNicholas Bellinger } 108e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(nodes); 109e48354ceSNicholas Bellinger 110e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_sessions( 111e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 112e48354ceSNicholas Bellinger { 113e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 114e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 115e48354ceSNicholas Bellinger 116e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_nsessions); 117e48354ceSNicholas Bellinger } 118e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(sessions); 119e48354ceSNicholas Bellinger 120e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_fail_sess( 121e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 122e48354ceSNicholas Bellinger { 123e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 124e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 125e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 126e48354ceSNicholas Bellinger u32 sess_err_count; 127e48354ceSNicholas Bellinger 128e48354ceSNicholas Bellinger spin_lock_bh(&sess_err->lock); 129e48354ceSNicholas Bellinger sess_err_count = (sess_err->digest_errors + 130e48354ceSNicholas Bellinger sess_err->cxn_timeout_errors + 131e48354ceSNicholas Bellinger sess_err->pdu_format_errors); 132e48354ceSNicholas Bellinger spin_unlock_bh(&sess_err->lock); 133e48354ceSNicholas Bellinger 134e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", sess_err_count); 135e48354ceSNicholas Bellinger } 136e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(fail_sess); 137e48354ceSNicholas Bellinger 138e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_fail_type( 139e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 140e48354ceSNicholas Bellinger { 141e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 142e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 143e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 144e48354ceSNicholas Bellinger 145e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", 146e48354ceSNicholas Bellinger sess_err->last_sess_failure_type); 147e48354ceSNicholas Bellinger } 148e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(fail_type); 149e48354ceSNicholas Bellinger 150e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_fail_rem_name( 151e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 152e48354ceSNicholas Bellinger { 153e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 154e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 155e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 156e48354ceSNicholas Bellinger 157e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%s\n", 158e48354ceSNicholas Bellinger sess_err->last_sess_fail_rem_name[0] ? 159e48354ceSNicholas Bellinger sess_err->last_sess_fail_rem_name : NONE); 160e48354ceSNicholas Bellinger } 161e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(fail_rem_name); 162e48354ceSNicholas Bellinger 163e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_disc_time( 164e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 165e48354ceSNicholas Bellinger { 166e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DISCONTINUITY_TIME); 167e48354ceSNicholas Bellinger } 168e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(disc_time); 169e48354ceSNicholas Bellinger 170e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_description( 171e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 172e48354ceSNicholas Bellinger { 173e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%s\n", ISCSI_INST_DESCR); 174e48354ceSNicholas Bellinger } 175e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(description); 176e48354ceSNicholas Bellinger 177e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_vendor( 178e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 179e48354ceSNicholas Bellinger { 180e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "RisingTide Systems iSCSI-Target\n"); 181e48354ceSNicholas Bellinger } 182e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(vendor); 183e48354ceSNicholas Bellinger 184e48354ceSNicholas Bellinger static ssize_t iscsi_stat_instance_show_attr_version( 185e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 186e48354ceSNicholas Bellinger { 187e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%s\n", ISCSIT_VERSION); 188e48354ceSNicholas Bellinger } 189e48354ceSNicholas Bellinger ISCSI_STAT_INSTANCE_ATTR_RO(version); 190e48354ceSNicholas Bellinger 191e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_instance, iscsi_wwn_stat_grps, 192e48354ceSNicholas Bellinger iscsi_instance_group); 193e48354ceSNicholas Bellinger 194e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_instance_attrs[] = { 195e48354ceSNicholas Bellinger &iscsi_stat_instance_inst.attr, 196e48354ceSNicholas Bellinger &iscsi_stat_instance_min_ver.attr, 197e48354ceSNicholas Bellinger &iscsi_stat_instance_max_ver.attr, 198e48354ceSNicholas Bellinger &iscsi_stat_instance_portals.attr, 199e48354ceSNicholas Bellinger &iscsi_stat_instance_nodes.attr, 200e48354ceSNicholas Bellinger &iscsi_stat_instance_sessions.attr, 201e48354ceSNicholas Bellinger &iscsi_stat_instance_fail_sess.attr, 202e48354ceSNicholas Bellinger &iscsi_stat_instance_fail_type.attr, 203e48354ceSNicholas Bellinger &iscsi_stat_instance_fail_rem_name.attr, 204e48354ceSNicholas Bellinger &iscsi_stat_instance_disc_time.attr, 205e48354ceSNicholas Bellinger &iscsi_stat_instance_description.attr, 206e48354ceSNicholas Bellinger &iscsi_stat_instance_vendor.attr, 207e48354ceSNicholas Bellinger &iscsi_stat_instance_version.attr, 208e48354ceSNicholas Bellinger NULL, 209e48354ceSNicholas Bellinger }; 210e48354ceSNicholas Bellinger 211e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_instance_item_ops = { 212e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_instance_attr_show, 213e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_instance_attr_store, 214e48354ceSNicholas Bellinger }; 215e48354ceSNicholas Bellinger 216e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_instance_cit = { 217e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_instance_item_ops, 218e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_instance_attrs, 219e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 220e48354ceSNicholas Bellinger }; 221e48354ceSNicholas Bellinger 222e48354ceSNicholas Bellinger /* 223e48354ceSNicholas Bellinger * Instance Session Failure Stats Table 224e48354ceSNicholas Bellinger */ 225e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_sess_err, iscsi_wwn_stat_grps); 226e48354ceSNicholas Bellinger #define ISCSI_STAT_SESS_ERR_ATTR(_name, _mode) \ 227e48354ceSNicholas Bellinger static struct iscsi_stat_sess_err_attribute \ 228e48354ceSNicholas Bellinger iscsi_stat_sess_err_##_name = \ 229e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 230e48354ceSNicholas Bellinger iscsi_stat_sess_err_show_attr_##_name, \ 231e48354ceSNicholas Bellinger iscsi_stat_sess_err_store_attr_##_name); 232e48354ceSNicholas Bellinger 233e48354ceSNicholas Bellinger #define ISCSI_STAT_SESS_ERR_ATTR_RO(_name) \ 234e48354ceSNicholas Bellinger static struct iscsi_stat_sess_err_attribute \ 235e48354ceSNicholas Bellinger iscsi_stat_sess_err_##_name = \ 236e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 237e48354ceSNicholas Bellinger iscsi_stat_sess_err_show_attr_##_name); 238e48354ceSNicholas Bellinger 239e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_err_show_attr_inst( 240e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 241e48354ceSNicholas Bellinger { 242e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 243e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 244e48354ceSNicholas Bellinger 245e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 246e48354ceSNicholas Bellinger } 247e48354ceSNicholas Bellinger ISCSI_STAT_SESS_ERR_ATTR_RO(inst); 248e48354ceSNicholas Bellinger 249e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_err_show_attr_digest_errors( 250e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 251e48354ceSNicholas Bellinger { 252e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 253e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 254e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 255e48354ceSNicholas Bellinger 256e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", sess_err->digest_errors); 257e48354ceSNicholas Bellinger } 258e48354ceSNicholas Bellinger ISCSI_STAT_SESS_ERR_ATTR_RO(digest_errors); 259e48354ceSNicholas Bellinger 260e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_err_show_attr_cxn_errors( 261e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 262e48354ceSNicholas Bellinger { 263e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 264e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 265e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 266e48354ceSNicholas Bellinger 267e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", sess_err->cxn_timeout_errors); 268e48354ceSNicholas Bellinger } 269e48354ceSNicholas Bellinger ISCSI_STAT_SESS_ERR_ATTR_RO(cxn_errors); 270e48354ceSNicholas Bellinger 271e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_err_show_attr_format_errors( 272e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 273e48354ceSNicholas Bellinger { 274e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 275e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 276e48354ceSNicholas Bellinger struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; 277e48354ceSNicholas Bellinger 278e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", sess_err->pdu_format_errors); 279e48354ceSNicholas Bellinger } 280e48354ceSNicholas Bellinger ISCSI_STAT_SESS_ERR_ATTR_RO(format_errors); 281e48354ceSNicholas Bellinger 282e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_sess_err, iscsi_wwn_stat_grps, 283e48354ceSNicholas Bellinger iscsi_sess_err_group); 284e48354ceSNicholas Bellinger 285e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_sess_err_attrs[] = { 286e48354ceSNicholas Bellinger &iscsi_stat_sess_err_inst.attr, 287e48354ceSNicholas Bellinger &iscsi_stat_sess_err_digest_errors.attr, 288e48354ceSNicholas Bellinger &iscsi_stat_sess_err_cxn_errors.attr, 289e48354ceSNicholas Bellinger &iscsi_stat_sess_err_format_errors.attr, 290e48354ceSNicholas Bellinger NULL, 291e48354ceSNicholas Bellinger }; 292e48354ceSNicholas Bellinger 293e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_sess_err_item_ops = { 294e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_sess_err_attr_show, 295e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_sess_err_attr_store, 296e48354ceSNicholas Bellinger }; 297e48354ceSNicholas Bellinger 298e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_sess_err_cit = { 299e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_sess_err_item_ops, 300e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_sess_err_attrs, 301e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 302e48354ceSNicholas Bellinger }; 303e48354ceSNicholas Bellinger 304e48354ceSNicholas Bellinger /* 305e48354ceSNicholas Bellinger * Target Attributes Table 306e48354ceSNicholas Bellinger */ 307e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_tgt_attr, iscsi_wwn_stat_grps); 308e48354ceSNicholas Bellinger #define ISCSI_STAT_TGT_ATTR(_name, _mode) \ 309e48354ceSNicholas Bellinger static struct iscsi_stat_tgt_attr_attribute \ 310e48354ceSNicholas Bellinger iscsi_stat_tgt_attr_##_name = \ 311e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 312e48354ceSNicholas Bellinger iscsi_stat_tgt-attr_show_attr_##_name, \ 313e48354ceSNicholas Bellinger iscsi_stat_tgt_attr_store_attr_##_name); 314e48354ceSNicholas Bellinger 315e48354ceSNicholas Bellinger #define ISCSI_STAT_TGT_ATTR_RO(_name) \ 316e48354ceSNicholas Bellinger static struct iscsi_stat_tgt_attr_attribute \ 317e48354ceSNicholas Bellinger iscsi_stat_tgt_attr_##_name = \ 318e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 319e48354ceSNicholas Bellinger iscsi_stat_tgt_attr_show_attr_##_name); 320e48354ceSNicholas Bellinger 321e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_inst( 322e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 323e48354ceSNicholas Bellinger { 324e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 325e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 326e48354ceSNicholas Bellinger 327e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 328e48354ceSNicholas Bellinger } 329e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(inst); 330e48354ceSNicholas Bellinger 331e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_indx( 332e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 333e48354ceSNicholas Bellinger { 334e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); 335e48354ceSNicholas Bellinger } 336e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(indx); 337e48354ceSNicholas Bellinger 338e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_login_fails( 339e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 340e48354ceSNicholas Bellinger { 341e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 342e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 343e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 344e48354ceSNicholas Bellinger u32 fail_count; 345e48354ceSNicholas Bellinger 346e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 347e48354ceSNicholas Bellinger fail_count = (lstat->redirects + lstat->authorize_fails + 348e48354ceSNicholas Bellinger lstat->authenticate_fails + lstat->negotiate_fails + 349e48354ceSNicholas Bellinger lstat->other_fails); 350e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 351e48354ceSNicholas Bellinger 352e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", fail_count); 353e48354ceSNicholas Bellinger } 354e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(login_fails); 355e48354ceSNicholas Bellinger 356e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_time( 357e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 358e48354ceSNicholas Bellinger { 359e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 360e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 361e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 362e48354ceSNicholas Bellinger u32 last_fail_time; 363e48354ceSNicholas Bellinger 364e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 365e48354ceSNicholas Bellinger last_fail_time = lstat->last_fail_time ? 366e48354ceSNicholas Bellinger (u32)(((u32)lstat->last_fail_time - 367e48354ceSNicholas Bellinger INITIAL_JIFFIES) * 100 / HZ) : 0; 368e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 369e48354ceSNicholas Bellinger 370e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", last_fail_time); 371e48354ceSNicholas Bellinger } 372e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(last_fail_time); 373e48354ceSNicholas Bellinger 374e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_type( 375e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 376e48354ceSNicholas Bellinger { 377e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 378e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 379e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 380e48354ceSNicholas Bellinger u32 last_fail_type; 381e48354ceSNicholas Bellinger 382e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 383e48354ceSNicholas Bellinger last_fail_type = lstat->last_fail_type; 384e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 385e48354ceSNicholas Bellinger 386e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", last_fail_type); 387e48354ceSNicholas Bellinger } 388e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(last_fail_type); 389e48354ceSNicholas Bellinger 390e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_name( 391e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 392e48354ceSNicholas Bellinger { 393e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 394e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 395e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 396e48354ceSNicholas Bellinger unsigned char buf[224]; 397e48354ceSNicholas Bellinger 398e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 399e48354ceSNicholas Bellinger snprintf(buf, 224, "%s", lstat->last_intr_fail_name[0] ? 400e48354ceSNicholas Bellinger lstat->last_intr_fail_name : NONE); 401e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 402e48354ceSNicholas Bellinger 403e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%s\n", buf); 404e48354ceSNicholas Bellinger } 405e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(fail_intr_name); 406e48354ceSNicholas Bellinger 407e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr_type( 408e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 409e48354ceSNicholas Bellinger { 410e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 411e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 412e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 41307ea81b6SDan Carpenter int ret; 414e48354ceSNicholas Bellinger 415e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 41607ea81b6SDan Carpenter if (lstat->last_intr_fail_ip_family == AF_INET6) 41707ea81b6SDan Carpenter ret = snprintf(page, PAGE_SIZE, "ipv6\n"); 41807ea81b6SDan Carpenter else 41907ea81b6SDan Carpenter ret = snprintf(page, PAGE_SIZE, "ipv4\n"); 420e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 421e48354ceSNicholas Bellinger 42207ea81b6SDan Carpenter return ret; 423e48354ceSNicholas Bellinger } 424e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr_type); 425e48354ceSNicholas Bellinger 426e48354ceSNicholas Bellinger static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr( 427e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 428e48354ceSNicholas Bellinger { 429e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 430e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 431e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 4320e48e7a5SDan Carpenter int ret; 433e48354ceSNicholas Bellinger 434e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 435*dfecf611SChris Leech ret = snprintf(page, PAGE_SIZE, "%s\n", lstat->last_intr_fail_ip_addr); 436e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 437e48354ceSNicholas Bellinger 4380e48e7a5SDan Carpenter return ret; 439e48354ceSNicholas Bellinger } 440e48354ceSNicholas Bellinger ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr); 441e48354ceSNicholas Bellinger 442e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_tgt_attr, iscsi_wwn_stat_grps, 443e48354ceSNicholas Bellinger iscsi_tgt_attr_group); 444e48354ceSNicholas Bellinger 445e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_tgt_attr_attrs[] = { 446e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_inst.attr, 447e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_indx.attr, 448e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_login_fails.attr, 449e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_last_fail_time.attr, 450e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_last_fail_type.attr, 451e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_fail_intr_name.attr, 452e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_fail_intr_addr_type.attr, 453e48354ceSNicholas Bellinger &iscsi_stat_tgt_attr_fail_intr_addr.attr, 454e48354ceSNicholas Bellinger NULL, 455e48354ceSNicholas Bellinger }; 456e48354ceSNicholas Bellinger 457e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_tgt_attr_item_ops = { 458e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_tgt_attr_attr_show, 459e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_tgt_attr_attr_store, 460e48354ceSNicholas Bellinger }; 461e48354ceSNicholas Bellinger 462e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_tgt_attr_cit = { 463e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_tgt_attr_item_ops, 464e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_tgt_attr_attrs, 465e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 466e48354ceSNicholas Bellinger }; 467e48354ceSNicholas Bellinger 468e48354ceSNicholas Bellinger /* 469e48354ceSNicholas Bellinger * Target Login Stats Table 470e48354ceSNicholas Bellinger */ 471e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_login, iscsi_wwn_stat_grps); 472e48354ceSNicholas Bellinger #define ISCSI_STAT_LOGIN(_name, _mode) \ 473e48354ceSNicholas Bellinger static struct iscsi_stat_login_attribute \ 474e48354ceSNicholas Bellinger iscsi_stat_login_##_name = \ 475e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 476e48354ceSNicholas Bellinger iscsi_stat_login_show_attr_##_name, \ 477e48354ceSNicholas Bellinger iscsi_stat_login_store_attr_##_name); 478e48354ceSNicholas Bellinger 479e48354ceSNicholas Bellinger #define ISCSI_STAT_LOGIN_RO(_name) \ 480e48354ceSNicholas Bellinger static struct iscsi_stat_login_attribute \ 481e48354ceSNicholas Bellinger iscsi_stat_login_##_name = \ 482e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 483e48354ceSNicholas Bellinger iscsi_stat_login_show_attr_##_name); 484e48354ceSNicholas Bellinger 485e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_inst( 486e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 487e48354ceSNicholas Bellinger { 488e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 489e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 490e48354ceSNicholas Bellinger 491e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 492e48354ceSNicholas Bellinger } 493e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(inst); 494e48354ceSNicholas Bellinger 495e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_indx( 496e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 497e48354ceSNicholas Bellinger { 498e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); 499e48354ceSNicholas Bellinger } 500e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(indx); 501e48354ceSNicholas Bellinger 502e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_accepts( 503e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 504e48354ceSNicholas Bellinger { 505e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 506e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 507e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 508e48354ceSNicholas Bellinger ssize_t ret; 509e48354ceSNicholas Bellinger 510e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 511e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->accepts); 512e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 513e48354ceSNicholas Bellinger 514e48354ceSNicholas Bellinger return ret; 515e48354ceSNicholas Bellinger } 516e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(accepts); 517e48354ceSNicholas Bellinger 518e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_other_fails( 519e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 520e48354ceSNicholas Bellinger { 521e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 522e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 523e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 524e48354ceSNicholas Bellinger ssize_t ret; 525e48354ceSNicholas Bellinger 526e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 527e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->other_fails); 528e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 529e48354ceSNicholas Bellinger 530e48354ceSNicholas Bellinger return ret; 531e48354ceSNicholas Bellinger } 532e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(other_fails); 533e48354ceSNicholas Bellinger 534e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_redirects( 535e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 536e48354ceSNicholas Bellinger { 537e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 538e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 539e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 540e48354ceSNicholas Bellinger ssize_t ret; 541e48354ceSNicholas Bellinger 542e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 543e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->redirects); 544e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 545e48354ceSNicholas Bellinger 546e48354ceSNicholas Bellinger return ret; 547e48354ceSNicholas Bellinger } 548e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(redirects); 549e48354ceSNicholas Bellinger 550e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_authorize_fails( 551e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 552e48354ceSNicholas Bellinger { 553e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 554e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 555e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 556e48354ceSNicholas Bellinger ssize_t ret; 557e48354ceSNicholas Bellinger 558e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 559e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->authorize_fails); 560e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 561e48354ceSNicholas Bellinger 562e48354ceSNicholas Bellinger return ret; 563e48354ceSNicholas Bellinger } 564e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(authorize_fails); 565e48354ceSNicholas Bellinger 566e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_authenticate_fails( 567e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 568e48354ceSNicholas Bellinger { 569e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 570e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 571e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 572e48354ceSNicholas Bellinger ssize_t ret; 573e48354ceSNicholas Bellinger 574e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 575e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->authenticate_fails); 576e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 577e48354ceSNicholas Bellinger 578e48354ceSNicholas Bellinger return ret; 579e48354ceSNicholas Bellinger } 580e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(authenticate_fails); 581e48354ceSNicholas Bellinger 582e48354ceSNicholas Bellinger static ssize_t iscsi_stat_login_show_attr_negotiate_fails( 583e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 584e48354ceSNicholas Bellinger { 585e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 586e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 587e48354ceSNicholas Bellinger struct iscsi_login_stats *lstat = &tiqn->login_stats; 588e48354ceSNicholas Bellinger ssize_t ret; 589e48354ceSNicholas Bellinger 590e48354ceSNicholas Bellinger spin_lock(&lstat->lock); 591e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", lstat->negotiate_fails); 592e48354ceSNicholas Bellinger spin_unlock(&lstat->lock); 593e48354ceSNicholas Bellinger 594e48354ceSNicholas Bellinger return ret; 595e48354ceSNicholas Bellinger } 596e48354ceSNicholas Bellinger ISCSI_STAT_LOGIN_RO(negotiate_fails); 597e48354ceSNicholas Bellinger 598e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_login, iscsi_wwn_stat_grps, 599e48354ceSNicholas Bellinger iscsi_login_stats_group); 600e48354ceSNicholas Bellinger 601e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_login_stats_attrs[] = { 602e48354ceSNicholas Bellinger &iscsi_stat_login_inst.attr, 603e48354ceSNicholas Bellinger &iscsi_stat_login_indx.attr, 604e48354ceSNicholas Bellinger &iscsi_stat_login_accepts.attr, 605e48354ceSNicholas Bellinger &iscsi_stat_login_other_fails.attr, 606e48354ceSNicholas Bellinger &iscsi_stat_login_redirects.attr, 607e48354ceSNicholas Bellinger &iscsi_stat_login_authorize_fails.attr, 608e48354ceSNicholas Bellinger &iscsi_stat_login_authenticate_fails.attr, 609e48354ceSNicholas Bellinger &iscsi_stat_login_negotiate_fails.attr, 610e48354ceSNicholas Bellinger NULL, 611e48354ceSNicholas Bellinger }; 612e48354ceSNicholas Bellinger 613e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_login_stats_item_ops = { 614e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_login_attr_show, 615e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_login_attr_store, 616e48354ceSNicholas Bellinger }; 617e48354ceSNicholas Bellinger 618e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_login_cit = { 619e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_login_stats_item_ops, 620e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_login_stats_attrs, 621e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 622e48354ceSNicholas Bellinger }; 623e48354ceSNicholas Bellinger 624e48354ceSNicholas Bellinger /* 625e48354ceSNicholas Bellinger * Target Logout Stats Table 626e48354ceSNicholas Bellinger */ 627e48354ceSNicholas Bellinger 628e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_logout, iscsi_wwn_stat_grps); 629e48354ceSNicholas Bellinger #define ISCSI_STAT_LOGOUT(_name, _mode) \ 630e48354ceSNicholas Bellinger static struct iscsi_stat_logout_attribute \ 631e48354ceSNicholas Bellinger iscsi_stat_logout_##_name = \ 632e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 633e48354ceSNicholas Bellinger iscsi_stat_logout_show_attr_##_name, \ 634e48354ceSNicholas Bellinger iscsi_stat_logout_store_attr_##_name); 635e48354ceSNicholas Bellinger 636e48354ceSNicholas Bellinger #define ISCSI_STAT_LOGOUT_RO(_name) \ 637e48354ceSNicholas Bellinger static struct iscsi_stat_logout_attribute \ 638e48354ceSNicholas Bellinger iscsi_stat_logout_##_name = \ 639e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 640e48354ceSNicholas Bellinger iscsi_stat_logout_show_attr_##_name); 641e48354ceSNicholas Bellinger 642e48354ceSNicholas Bellinger static ssize_t iscsi_stat_logout_show_attr_inst( 643e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 644e48354ceSNicholas Bellinger { 645e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 646e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 647e48354ceSNicholas Bellinger 648e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 649e48354ceSNicholas Bellinger } 650e48354ceSNicholas Bellinger ISCSI_STAT_LOGOUT_RO(inst); 651e48354ceSNicholas Bellinger 652e48354ceSNicholas Bellinger static ssize_t iscsi_stat_logout_show_attr_indx( 653e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 654e48354ceSNicholas Bellinger { 655e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); 656e48354ceSNicholas Bellinger } 657e48354ceSNicholas Bellinger ISCSI_STAT_LOGOUT_RO(indx); 658e48354ceSNicholas Bellinger 659e48354ceSNicholas Bellinger static ssize_t iscsi_stat_logout_show_attr_normal_logouts( 660e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 661e48354ceSNicholas Bellinger { 662e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 663e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 664e48354ceSNicholas Bellinger struct iscsi_logout_stats *lstats = &tiqn->logout_stats; 665e48354ceSNicholas Bellinger 666e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", lstats->normal_logouts); 667e48354ceSNicholas Bellinger } 668e48354ceSNicholas Bellinger ISCSI_STAT_LOGOUT_RO(normal_logouts); 669e48354ceSNicholas Bellinger 670e48354ceSNicholas Bellinger static ssize_t iscsi_stat_logout_show_attr_abnormal_logouts( 671e48354ceSNicholas Bellinger struct iscsi_wwn_stat_grps *igrps, char *page) 672e48354ceSNicholas Bellinger { 673e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(igrps, 674e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_stat_grps); 675e48354ceSNicholas Bellinger struct iscsi_logout_stats *lstats = &tiqn->logout_stats; 676e48354ceSNicholas Bellinger 677e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", lstats->abnormal_logouts); 678e48354ceSNicholas Bellinger } 679e48354ceSNicholas Bellinger ISCSI_STAT_LOGOUT_RO(abnormal_logouts); 680e48354ceSNicholas Bellinger 681e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_logout, iscsi_wwn_stat_grps, 682e48354ceSNicholas Bellinger iscsi_logout_stats_group); 683e48354ceSNicholas Bellinger 684e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_logout_stats_attrs[] = { 685e48354ceSNicholas Bellinger &iscsi_stat_logout_inst.attr, 686e48354ceSNicholas Bellinger &iscsi_stat_logout_indx.attr, 687e48354ceSNicholas Bellinger &iscsi_stat_logout_normal_logouts.attr, 688e48354ceSNicholas Bellinger &iscsi_stat_logout_abnormal_logouts.attr, 689e48354ceSNicholas Bellinger NULL, 690e48354ceSNicholas Bellinger }; 691e48354ceSNicholas Bellinger 692e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_logout_stats_item_ops = { 693e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_logout_attr_show, 694e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_logout_attr_store, 695e48354ceSNicholas Bellinger }; 696e48354ceSNicholas Bellinger 697e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_logout_cit = { 698e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_logout_stats_item_ops, 699e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_logout_stats_attrs, 700e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 701e48354ceSNicholas Bellinger }; 702e48354ceSNicholas Bellinger 703e48354ceSNicholas Bellinger /* 704e48354ceSNicholas Bellinger * Session Stats Table 705e48354ceSNicholas Bellinger */ 706e48354ceSNicholas Bellinger 707e48354ceSNicholas Bellinger CONFIGFS_EATTR_STRUCT(iscsi_stat_sess, iscsi_node_stat_grps); 708e48354ceSNicholas Bellinger #define ISCSI_STAT_SESS(_name, _mode) \ 709e48354ceSNicholas Bellinger static struct iscsi_stat_sess_attribute \ 710e48354ceSNicholas Bellinger iscsi_stat_sess_##_name = \ 711e48354ceSNicholas Bellinger __CONFIGFS_EATTR(_name, _mode, \ 712e48354ceSNicholas Bellinger iscsi_stat_sess_show_attr_##_name, \ 713e48354ceSNicholas Bellinger iscsi_stat_sess_store_attr_##_name); 714e48354ceSNicholas Bellinger 715e48354ceSNicholas Bellinger #define ISCSI_STAT_SESS_RO(_name) \ 716e48354ceSNicholas Bellinger static struct iscsi_stat_sess_attribute \ 717e48354ceSNicholas Bellinger iscsi_stat_sess_##_name = \ 718e48354ceSNicholas Bellinger __CONFIGFS_EATTR_RO(_name, \ 719e48354ceSNicholas Bellinger iscsi_stat_sess_show_attr_##_name); 720e48354ceSNicholas Bellinger 721e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_inst( 722e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 723e48354ceSNicholas Bellinger { 724e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 725e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 726e48354ceSNicholas Bellinger struct se_wwn *wwn = acl->se_node_acl.se_tpg->se_tpg_wwn; 727e48354ceSNicholas Bellinger struct iscsi_tiqn *tiqn = container_of(wwn, 728e48354ceSNicholas Bellinger struct iscsi_tiqn, tiqn_wwn); 729e48354ceSNicholas Bellinger 730e48354ceSNicholas Bellinger return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); 731e48354ceSNicholas Bellinger } 732e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(inst); 733e48354ceSNicholas Bellinger 734e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_node( 735e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 736e48354ceSNicholas Bellinger { 737e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 738e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 739e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 740e48354ceSNicholas Bellinger struct iscsi_session *sess; 741e48354ceSNicholas Bellinger struct se_session *se_sess; 742e48354ceSNicholas Bellinger ssize_t ret = 0; 743e48354ceSNicholas Bellinger 744e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 745e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 746e48354ceSNicholas Bellinger if (se_sess) { 7478359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 748e48354ceSNicholas Bellinger if (sess) 749e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", 750e48354ceSNicholas Bellinger sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); 751e48354ceSNicholas Bellinger } 752e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 753e48354ceSNicholas Bellinger 754e48354ceSNicholas Bellinger return ret; 755e48354ceSNicholas Bellinger } 756e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(node); 757e48354ceSNicholas Bellinger 758e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_indx( 759e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 760e48354ceSNicholas Bellinger { 761e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 762e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 763e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 764e48354ceSNicholas Bellinger struct iscsi_session *sess; 765e48354ceSNicholas Bellinger struct se_session *se_sess; 766e48354ceSNicholas Bellinger ssize_t ret = 0; 767e48354ceSNicholas Bellinger 768e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 769e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 770e48354ceSNicholas Bellinger if (se_sess) { 7718359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 772e48354ceSNicholas Bellinger if (sess) 773e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", 774e48354ceSNicholas Bellinger sess->session_index); 775e48354ceSNicholas Bellinger } 776e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 777e48354ceSNicholas Bellinger 778e48354ceSNicholas Bellinger return ret; 779e48354ceSNicholas Bellinger } 780e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(indx); 781e48354ceSNicholas Bellinger 782e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_cmd_pdus( 783e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 784e48354ceSNicholas Bellinger { 785e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 786e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 787e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 788e48354ceSNicholas Bellinger struct iscsi_session *sess; 789e48354ceSNicholas Bellinger struct se_session *se_sess; 790e48354ceSNicholas Bellinger ssize_t ret = 0; 791e48354ceSNicholas Bellinger 792e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 793e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 794e48354ceSNicholas Bellinger if (se_sess) { 7958359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 796e48354ceSNicholas Bellinger if (sess) 797e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); 798e48354ceSNicholas Bellinger } 799e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 800e48354ceSNicholas Bellinger 801e48354ceSNicholas Bellinger return ret; 802e48354ceSNicholas Bellinger } 803e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(cmd_pdus); 804e48354ceSNicholas Bellinger 805e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_rsp_pdus( 806e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 807e48354ceSNicholas Bellinger { 808e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 809e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 810e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 811e48354ceSNicholas Bellinger struct iscsi_session *sess; 812e48354ceSNicholas Bellinger struct se_session *se_sess; 813e48354ceSNicholas Bellinger ssize_t ret = 0; 814e48354ceSNicholas Bellinger 815e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 816e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 817e48354ceSNicholas Bellinger if (se_sess) { 8188359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 819e48354ceSNicholas Bellinger if (sess) 820e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); 821e48354ceSNicholas Bellinger } 822e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 823e48354ceSNicholas Bellinger 824e48354ceSNicholas Bellinger return ret; 825e48354ceSNicholas Bellinger } 826e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(rsp_pdus); 827e48354ceSNicholas Bellinger 828e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_txdata_octs( 829e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 830e48354ceSNicholas Bellinger { 831e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 832e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 833e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 834e48354ceSNicholas Bellinger struct iscsi_session *sess; 835e48354ceSNicholas Bellinger struct se_session *se_sess; 836e48354ceSNicholas Bellinger ssize_t ret = 0; 837e48354ceSNicholas Bellinger 838e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 839e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 840e48354ceSNicholas Bellinger if (se_sess) { 8418359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 842e48354ceSNicholas Bellinger if (sess) 843e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%llu\n", 844e48354ceSNicholas Bellinger (unsigned long long)sess->tx_data_octets); 845e48354ceSNicholas Bellinger } 846e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 847e48354ceSNicholas Bellinger 848e48354ceSNicholas Bellinger return ret; 849e48354ceSNicholas Bellinger } 850e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(txdata_octs); 851e48354ceSNicholas Bellinger 852e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_rxdata_octs( 853e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 854e48354ceSNicholas Bellinger { 855e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 856e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 857e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 858e48354ceSNicholas Bellinger struct iscsi_session *sess; 859e48354ceSNicholas Bellinger struct se_session *se_sess; 860e48354ceSNicholas Bellinger ssize_t ret = 0; 861e48354ceSNicholas Bellinger 862e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 863e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 864e48354ceSNicholas Bellinger if (se_sess) { 8658359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 866e48354ceSNicholas Bellinger if (sess) 867e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%llu\n", 868e48354ceSNicholas Bellinger (unsigned long long)sess->rx_data_octets); 869e48354ceSNicholas Bellinger } 870e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 871e48354ceSNicholas Bellinger 872e48354ceSNicholas Bellinger return ret; 873e48354ceSNicholas Bellinger } 874e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(rxdata_octs); 875e48354ceSNicholas Bellinger 876e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors( 877e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 878e48354ceSNicholas Bellinger { 879e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 880e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 881e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 882e48354ceSNicholas Bellinger struct iscsi_session *sess; 883e48354ceSNicholas Bellinger struct se_session *se_sess; 884e48354ceSNicholas Bellinger ssize_t ret = 0; 885e48354ceSNicholas Bellinger 886e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 887e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 888e48354ceSNicholas Bellinger if (se_sess) { 8898359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 890e48354ceSNicholas Bellinger if (sess) 891e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", 892e48354ceSNicholas Bellinger sess->conn_digest_errors); 893e48354ceSNicholas Bellinger } 894e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 895e48354ceSNicholas Bellinger 896e48354ceSNicholas Bellinger return ret; 897e48354ceSNicholas Bellinger } 898e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(conn_digest_errors); 899e48354ceSNicholas Bellinger 900e48354ceSNicholas Bellinger static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors( 901e48354ceSNicholas Bellinger struct iscsi_node_stat_grps *igrps, char *page) 902e48354ceSNicholas Bellinger { 903e48354ceSNicholas Bellinger struct iscsi_node_acl *acl = container_of(igrps, 904e48354ceSNicholas Bellinger struct iscsi_node_acl, node_stat_grps); 905e48354ceSNicholas Bellinger struct se_node_acl *se_nacl = &acl->se_node_acl; 906e48354ceSNicholas Bellinger struct iscsi_session *sess; 907e48354ceSNicholas Bellinger struct se_session *se_sess; 908e48354ceSNicholas Bellinger ssize_t ret = 0; 909e48354ceSNicholas Bellinger 910e48354ceSNicholas Bellinger spin_lock_bh(&se_nacl->nacl_sess_lock); 911e48354ceSNicholas Bellinger se_sess = se_nacl->nacl_sess; 912e48354ceSNicholas Bellinger if (se_sess) { 9138359cf43SJörn Engel sess = se_sess->fabric_sess_ptr; 914e48354ceSNicholas Bellinger if (sess) 915e48354ceSNicholas Bellinger ret = snprintf(page, PAGE_SIZE, "%u\n", 916e48354ceSNicholas Bellinger sess->conn_timeout_errors); 917e48354ceSNicholas Bellinger } 918e48354ceSNicholas Bellinger spin_unlock_bh(&se_nacl->nacl_sess_lock); 919e48354ceSNicholas Bellinger 920e48354ceSNicholas Bellinger return ret; 921e48354ceSNicholas Bellinger } 922e48354ceSNicholas Bellinger ISCSI_STAT_SESS_RO(conn_timeout_errors); 923e48354ceSNicholas Bellinger 924e48354ceSNicholas Bellinger CONFIGFS_EATTR_OPS(iscsi_stat_sess, iscsi_node_stat_grps, 925e48354ceSNicholas Bellinger iscsi_sess_stats_group); 926e48354ceSNicholas Bellinger 927e48354ceSNicholas Bellinger static struct configfs_attribute *iscsi_stat_sess_stats_attrs[] = { 928e48354ceSNicholas Bellinger &iscsi_stat_sess_inst.attr, 929e48354ceSNicholas Bellinger &iscsi_stat_sess_node.attr, 930e48354ceSNicholas Bellinger &iscsi_stat_sess_indx.attr, 931e48354ceSNicholas Bellinger &iscsi_stat_sess_cmd_pdus.attr, 932e48354ceSNicholas Bellinger &iscsi_stat_sess_rsp_pdus.attr, 933e48354ceSNicholas Bellinger &iscsi_stat_sess_txdata_octs.attr, 934e48354ceSNicholas Bellinger &iscsi_stat_sess_rxdata_octs.attr, 935e48354ceSNicholas Bellinger &iscsi_stat_sess_conn_digest_errors.attr, 936e48354ceSNicholas Bellinger &iscsi_stat_sess_conn_timeout_errors.attr, 937e48354ceSNicholas Bellinger NULL, 938e48354ceSNicholas Bellinger }; 939e48354ceSNicholas Bellinger 940e48354ceSNicholas Bellinger static struct configfs_item_operations iscsi_stat_sess_stats_item_ops = { 941e48354ceSNicholas Bellinger .show_attribute = iscsi_stat_sess_attr_show, 942e48354ceSNicholas Bellinger .store_attribute = iscsi_stat_sess_attr_store, 943e48354ceSNicholas Bellinger }; 944e48354ceSNicholas Bellinger 945e48354ceSNicholas Bellinger struct config_item_type iscsi_stat_sess_cit = { 946e48354ceSNicholas Bellinger .ct_item_ops = &iscsi_stat_sess_stats_item_ops, 947e48354ceSNicholas Bellinger .ct_attrs = iscsi_stat_sess_stats_attrs, 948e48354ceSNicholas Bellinger .ct_owner = THIS_MODULE, 949e48354ceSNicholas Bellinger }; 950