162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef ISCSI_TARGET_STAT_H 362306a36Sopenharmony_ci#define ISCSI_TARGET_STAT_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/types.h> 662306a36Sopenharmony_ci#include <linux/spinlock.h> 762306a36Sopenharmony_ci#include <linux/socket.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci/* 1062306a36Sopenharmony_ci * For struct iscsi_tiqn->tiqn_wwn default groups 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_instance_cit; 1362306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_sess_err_cit; 1462306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_tgt_attr_cit; 1562306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_login_cit; 1662306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_logout_cit; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* 1962306a36Sopenharmony_ci * For struct iscsi_session->se_sess default groups 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ciextern const struct config_item_type iscsi_stat_sess_cit; 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* iSCSI session error types */ 2462306a36Sopenharmony_ci#define ISCSI_SESS_ERR_UNKNOWN 0 2562306a36Sopenharmony_ci#define ISCSI_SESS_ERR_DIGEST 1 2662306a36Sopenharmony_ci#define ISCSI_SESS_ERR_CXN_TIMEOUT 2 2762306a36Sopenharmony_ci#define ISCSI_SESS_ERR_PDU_FORMAT 3 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* iSCSI session error stats */ 3062306a36Sopenharmony_cistruct iscsi_sess_err_stats { 3162306a36Sopenharmony_ci spinlock_t lock; 3262306a36Sopenharmony_ci u32 digest_errors; 3362306a36Sopenharmony_ci u32 cxn_timeout_errors; 3462306a36Sopenharmony_ci u32 pdu_format_errors; 3562306a36Sopenharmony_ci u32 last_sess_failure_type; 3662306a36Sopenharmony_ci char last_sess_fail_rem_name[ISCSI_IQN_LEN]; 3762306a36Sopenharmony_ci} ____cacheline_aligned; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* iSCSI login failure types (sub oids) */ 4062306a36Sopenharmony_ci#define ISCSI_LOGIN_FAIL_OTHER 2 4162306a36Sopenharmony_ci#define ISCSI_LOGIN_FAIL_REDIRECT 3 4262306a36Sopenharmony_ci#define ISCSI_LOGIN_FAIL_AUTHORIZE 4 4362306a36Sopenharmony_ci#define ISCSI_LOGIN_FAIL_AUTHENTICATE 5 4462306a36Sopenharmony_ci#define ISCSI_LOGIN_FAIL_NEGOTIATE 6 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci/* iSCSI login stats */ 4762306a36Sopenharmony_cistruct iscsi_login_stats { 4862306a36Sopenharmony_ci spinlock_t lock; 4962306a36Sopenharmony_ci u32 accepts; 5062306a36Sopenharmony_ci u32 other_fails; 5162306a36Sopenharmony_ci u32 redirects; 5262306a36Sopenharmony_ci u32 authorize_fails; 5362306a36Sopenharmony_ci u32 authenticate_fails; 5462306a36Sopenharmony_ci u32 negotiate_fails; /* used for notifications */ 5562306a36Sopenharmony_ci u64 last_fail_time; /* time stamp (jiffies) */ 5662306a36Sopenharmony_ci u32 last_fail_type; 5762306a36Sopenharmony_ci int last_intr_fail_ip_family; 5862306a36Sopenharmony_ci struct sockaddr_storage last_intr_fail_sockaddr; 5962306a36Sopenharmony_ci char last_intr_fail_name[ISCSI_IQN_LEN]; 6062306a36Sopenharmony_ci} ____cacheline_aligned; 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* iSCSI logout stats */ 6362306a36Sopenharmony_cistruct iscsi_logout_stats { 6462306a36Sopenharmony_ci spinlock_t lock; 6562306a36Sopenharmony_ci u32 normal_logouts; 6662306a36Sopenharmony_ci u32 abnormal_logouts; 6762306a36Sopenharmony_ci} ____cacheline_aligned; 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#endif /*** ISCSI_TARGET_STAT_H ***/ 70