1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 267f091f2SSagi Grimberg #ifndef ISCSI_TARGET_STAT_H 367f091f2SSagi Grimberg #define ISCSI_TARGET_STAT_H 467f091f2SSagi Grimberg 58dcf07beSBart Van Assche #include <linux/types.h> 68dcf07beSBart Van Assche #include <linux/spinlock.h> 78dcf07beSBart Van Assche #include <linux/socket.h> 88dcf07beSBart Van Assche 967f091f2SSagi Grimberg /* 1067f091f2SSagi Grimberg * For struct iscsi_tiqn->tiqn_wwn default groups 1167f091f2SSagi Grimberg */ 12ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_instance_cit; 13ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_sess_err_cit; 14ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_tgt_attr_cit; 15ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_login_cit; 16ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_logout_cit; 1767f091f2SSagi Grimberg 1867f091f2SSagi Grimberg /* 1967f091f2SSagi Grimberg * For struct iscsi_session->se_sess default groups 2067f091f2SSagi Grimberg */ 21ece550b5SBhumika Goyal extern const struct config_item_type iscsi_stat_sess_cit; 2267f091f2SSagi Grimberg 2367f091f2SSagi Grimberg /* iSCSI session error types */ 2467f091f2SSagi Grimberg #define ISCSI_SESS_ERR_UNKNOWN 0 2567f091f2SSagi Grimberg #define ISCSI_SESS_ERR_DIGEST 1 2667f091f2SSagi Grimberg #define ISCSI_SESS_ERR_CXN_TIMEOUT 2 2767f091f2SSagi Grimberg #define ISCSI_SESS_ERR_PDU_FORMAT 3 2867f091f2SSagi Grimberg 2967f091f2SSagi Grimberg /* iSCSI session error stats */ 3067f091f2SSagi Grimberg struct iscsi_sess_err_stats { 3167f091f2SSagi Grimberg spinlock_t lock; 3267f091f2SSagi Grimberg u32 digest_errors; 3367f091f2SSagi Grimberg u32 cxn_timeout_errors; 3467f091f2SSagi Grimberg u32 pdu_format_errors; 3567f091f2SSagi Grimberg u32 last_sess_failure_type; 36df711553SDavid Disseldorp char last_sess_fail_rem_name[ISCSI_IQN_LEN]; 3767f091f2SSagi Grimberg } ____cacheline_aligned; 3867f091f2SSagi Grimberg 3967f091f2SSagi Grimberg /* iSCSI login failure types (sub oids) */ 4067f091f2SSagi Grimberg #define ISCSI_LOGIN_FAIL_OTHER 2 4167f091f2SSagi Grimberg #define ISCSI_LOGIN_FAIL_REDIRECT 3 4267f091f2SSagi Grimberg #define ISCSI_LOGIN_FAIL_AUTHORIZE 4 4367f091f2SSagi Grimberg #define ISCSI_LOGIN_FAIL_AUTHENTICATE 5 4467f091f2SSagi Grimberg #define ISCSI_LOGIN_FAIL_NEGOTIATE 6 4567f091f2SSagi Grimberg 4667f091f2SSagi Grimberg /* iSCSI login stats */ 4767f091f2SSagi Grimberg struct iscsi_login_stats { 4867f091f2SSagi Grimberg spinlock_t lock; 4967f091f2SSagi Grimberg u32 accepts; 5067f091f2SSagi Grimberg u32 other_fails; 5167f091f2SSagi Grimberg u32 redirects; 5267f091f2SSagi Grimberg u32 authorize_fails; 5367f091f2SSagi Grimberg u32 authenticate_fails; 5467f091f2SSagi Grimberg u32 negotiate_fails; /* used for notifications */ 5567f091f2SSagi Grimberg u64 last_fail_time; /* time stamp (jiffies) */ 5667f091f2SSagi Grimberg u32 last_fail_type; 5767f091f2SSagi Grimberg int last_intr_fail_ip_family; 5813a3cf08SAndy Grover struct sockaddr_storage last_intr_fail_sockaddr; 59df711553SDavid Disseldorp char last_intr_fail_name[ISCSI_IQN_LEN]; 6067f091f2SSagi Grimberg } ____cacheline_aligned; 6167f091f2SSagi Grimberg 6267f091f2SSagi Grimberg /* iSCSI logout stats */ 6367f091f2SSagi Grimberg struct iscsi_logout_stats { 6467f091f2SSagi Grimberg spinlock_t lock; 6567f091f2SSagi Grimberg u32 normal_logouts; 6667f091f2SSagi Grimberg u32 abnormal_logouts; 6767f091f2SSagi Grimberg } ____cacheline_aligned; 6867f091f2SSagi Grimberg 6967f091f2SSagi Grimberg #endif /*** ISCSI_TARGET_STAT_H ***/ 70