This source file includes following definitions.
- snic_stats_update_active_ios
- snic_stats_update_io_cmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef __SNIC_STATS_H
19 #define __SNIC_STATS_H
20
21 struct snic_io_stats {
22 atomic64_t active;
23 atomic64_t max_active;
24 atomic64_t max_sgl;
25 atomic64_t max_time;
26 atomic64_t max_qtime;
27 atomic64_t max_cmpl_time;
28 atomic64_t sgl_cnt[SNIC_MAX_SG_DESC_CNT];
29 atomic64_t max_io_sz;
30 atomic64_t compl;
31 atomic64_t fail;
32 atomic64_t req_null;
33 atomic64_t alloc_fail;
34 atomic64_t sc_null;
35 atomic64_t io_not_found;
36 atomic64_t num_ios;
37 };
38
39 struct snic_abort_stats {
40 atomic64_t num;
41 atomic64_t fail;
42 atomic64_t drv_tmo;
43 atomic64_t fw_tmo;
44 atomic64_t io_not_found;
45 atomic64_t q_fail;
46 };
47
48 struct snic_reset_stats {
49 atomic64_t dev_resets;
50 atomic64_t dev_reset_fail;
51 atomic64_t dev_reset_aborts;
52 atomic64_t dev_reset_tmo;
53 atomic64_t dev_reset_terms;
54 atomic64_t hba_resets;
55 atomic64_t hba_reset_cmpl;
56 atomic64_t hba_reset_fail;
57 atomic64_t snic_resets;
58 atomic64_t snic_reset_compl;
59 atomic64_t snic_reset_fail;
60 };
61
62 struct snic_fw_stats {
63 atomic64_t actv_reqs;
64 atomic64_t max_actv_reqs;
65 atomic64_t out_of_res;
66 atomic64_t io_errs;
67 atomic64_t scsi_errs;
68 };
69
70 struct snic_misc_stats {
71 u64 last_isr_time;
72 u64 last_ack_time;
73 atomic64_t ack_isr_cnt;
74 atomic64_t cmpl_isr_cnt;
75 atomic64_t errnotify_isr_cnt;
76 atomic64_t max_cq_ents;
77 atomic64_t data_cnt_mismat;
78 atomic64_t io_tmo;
79 atomic64_t io_aborted;
80 atomic64_t sgl_inval;
81 atomic64_t abts_wq_alloc_fail;
82 atomic64_t devrst_wq_alloc_fail;
83 atomic64_t wq_alloc_fail;
84 atomic64_t no_icmnd_itmf_cmpls;
85 atomic64_t io_under_run;
86 atomic64_t qfull;
87 atomic64_t qsz_rampup;
88 atomic64_t qsz_rampdown;
89 atomic64_t last_qsz;
90 atomic64_t tgt_not_rdy;
91 };
92
93 struct snic_stats {
94 struct snic_io_stats io;
95 struct snic_abort_stats abts;
96 struct snic_reset_stats reset;
97 struct snic_fw_stats fw;
98 struct snic_misc_stats misc;
99 atomic64_t io_cmpl_skip;
100 };
101
102 void snic_stats_debugfs_init(struct snic *);
103 void snic_stats_debugfs_remove(struct snic *);
104
105
106 static inline void
107 snic_stats_update_active_ios(struct snic_stats *s_stats)
108 {
109 struct snic_io_stats *io = &s_stats->io;
110 int nr_active_ios;
111
112 nr_active_ios = atomic64_read(&io->active);
113 if (atomic64_read(&io->max_active) < nr_active_ios)
114 atomic64_set(&io->max_active, nr_active_ios);
115
116 atomic64_inc(&io->num_ios);
117 }
118
119
120 static inline void
121 snic_stats_update_io_cmpl(struct snic_stats *s_stats)
122 {
123 atomic64_dec(&s_stats->io.active);
124 if (unlikely(atomic64_read(&s_stats->io_cmpl_skip)))
125 atomic64_dec(&s_stats->io_cmpl_skip);
126 else
127 atomic64_inc(&s_stats->io.compl);
128 }
129 #endif