1 #ifndef ISCSI_TARGET_STAT_H
2 #define ISCSI_TARGET_STAT_H
3 
4 #include <linux/types.h>
5 #include <linux/spinlock.h>
6 #include <linux/socket.h>
7 
8 /*
9  * For struct iscsi_tiqn->tiqn_wwn default groups
10  */
11 extern struct config_item_type iscsi_stat_instance_cit;
12 extern struct config_item_type iscsi_stat_sess_err_cit;
13 extern struct config_item_type iscsi_stat_tgt_attr_cit;
14 extern struct config_item_type iscsi_stat_login_cit;
15 extern struct config_item_type iscsi_stat_logout_cit;
16 
17 /*
18  * For struct iscsi_session->se_sess default groups
19  */
20 extern struct config_item_type iscsi_stat_sess_cit;
21 
22 /* iSCSI session error types */
23 #define ISCSI_SESS_ERR_UNKNOWN		0
24 #define ISCSI_SESS_ERR_DIGEST		1
25 #define ISCSI_SESS_ERR_CXN_TIMEOUT	2
26 #define ISCSI_SESS_ERR_PDU_FORMAT	3
27 
28 /* iSCSI session error stats */
29 struct iscsi_sess_err_stats {
30 	spinlock_t	lock;
31 	u32		digest_errors;
32 	u32		cxn_timeout_errors;
33 	u32		pdu_format_errors;
34 	u32		last_sess_failure_type;
35 	char		last_sess_fail_rem_name[224];
36 } ____cacheline_aligned;
37 
38 /* iSCSI login failure types (sub oids) */
39 #define ISCSI_LOGIN_FAIL_OTHER		2
40 #define ISCSI_LOGIN_FAIL_REDIRECT	3
41 #define ISCSI_LOGIN_FAIL_AUTHORIZE	4
42 #define ISCSI_LOGIN_FAIL_AUTHENTICATE	5
43 #define ISCSI_LOGIN_FAIL_NEGOTIATE	6
44 
45 /* iSCSI login stats */
46 struct iscsi_login_stats {
47 	spinlock_t	lock;
48 	u32		accepts;
49 	u32		other_fails;
50 	u32		redirects;
51 	u32		authorize_fails;
52 	u32		authenticate_fails;
53 	u32		negotiate_fails;	/* used for notifications */
54 	u64		last_fail_time;		/* time stamp (jiffies) */
55 	u32		last_fail_type;
56 	int		last_intr_fail_ip_family;
57 	struct sockaddr_storage last_intr_fail_sockaddr;
58 	char		last_intr_fail_name[224];
59 } ____cacheline_aligned;
60 
61 /* iSCSI logout stats */
62 struct iscsi_logout_stats {
63 	spinlock_t	lock;
64 	u32		normal_logouts;
65 	u32		abnormal_logouts;
66 } ____cacheline_aligned;
67 
68 #endif   /*** ISCSI_TARGET_STAT_H ***/
69