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