xref: /openbmc/linux/drivers/scsi/fnic/fnic_stats.h (revision e6550b3e)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright 2013 Cisco Systems, Inc.  All rights reserved. */
3 #ifndef _FNIC_STATS_H_
4 #define _FNIC_STATS_H_
5 
6 struct stats_timestamps {
7 	struct timespec64 last_reset_time;
8 	struct timespec64 last_read_time;
9 };
10 
11 struct io_path_stats {
12 	atomic64_t active_ios;
13 	atomic64_t max_active_ios;
14 	atomic64_t io_completions;
15 	atomic64_t io_failures;
16 	atomic64_t ioreq_null;
17 	atomic64_t alloc_failures;
18 	atomic64_t sc_null;
19 	atomic64_t io_not_found;
20 	atomic64_t num_ios;
21 	atomic64_t io_btw_0_to_10_msec;
22 	atomic64_t io_btw_10_to_100_msec;
23 	atomic64_t io_btw_100_to_500_msec;
24 	atomic64_t io_btw_500_to_5000_msec;
25 	atomic64_t io_btw_5000_to_10000_msec;
26 	atomic64_t io_btw_10000_to_30000_msec;
27 	atomic64_t io_greater_than_30000_msec;
28 	atomic64_t current_max_io_time;
29 };
30 
31 struct abort_stats {
32 	atomic64_t aborts;
33 	atomic64_t abort_failures;
34 	atomic64_t abort_drv_timeouts;
35 	atomic64_t abort_fw_timeouts;
36 	atomic64_t abort_io_not_found;
37 	atomic64_t abort_issued_btw_0_to_6_sec;
38 	atomic64_t abort_issued_btw_6_to_20_sec;
39 	atomic64_t abort_issued_btw_20_to_30_sec;
40 	atomic64_t abort_issued_btw_30_to_40_sec;
41 	atomic64_t abort_issued_btw_40_to_50_sec;
42 	atomic64_t abort_issued_btw_50_to_60_sec;
43 	atomic64_t abort_issued_greater_than_60_sec;
44 };
45 
46 struct terminate_stats {
47 	atomic64_t terminates;
48 	atomic64_t max_terminates;
49 	atomic64_t terminate_drv_timeouts;
50 	atomic64_t terminate_fw_timeouts;
51 	atomic64_t terminate_io_not_found;
52 	atomic64_t terminate_failures;
53 };
54 
55 struct reset_stats {
56 	atomic64_t device_resets;
57 	atomic64_t device_reset_failures;
58 	atomic64_t device_reset_aborts;
59 	atomic64_t device_reset_timeouts;
60 	atomic64_t device_reset_terminates;
61 	atomic64_t fw_resets;
62 	atomic64_t fw_reset_completions;
63 	atomic64_t fw_reset_failures;
64 	atomic64_t fnic_resets;
65 	atomic64_t fnic_reset_completions;
66 	atomic64_t fnic_reset_failures;
67 };
68 
69 struct fw_stats {
70 	atomic64_t active_fw_reqs;
71 	atomic64_t max_fw_reqs;
72 	atomic64_t fw_out_of_resources;
73 	atomic64_t io_fw_errs;
74 };
75 
76 struct vlan_stats {
77 	atomic64_t vlan_disc_reqs;
78 	atomic64_t resp_withno_vlanID;
79 	atomic64_t sol_expiry_count;
80 	atomic64_t flogi_rejects;
81 };
82 
83 struct misc_stats {
84 	u64 last_isr_time;
85 	u64 last_ack_time;
86 	atomic64_t max_isr_jiffies;
87 	atomic64_t max_isr_time_ms;
88 	atomic64_t corr_work_done;
89 	atomic64_t isr_count;
90 	atomic64_t max_cq_entries;
91 	atomic64_t ack_index_out_of_range;
92 	atomic64_t data_count_mismatch;
93 	atomic64_t fcpio_timeout;
94 	atomic64_t fcpio_aborted;
95 	atomic64_t sgl_invalid;
96 	atomic64_t mss_invalid;
97 	atomic64_t abts_cpwq_alloc_failures;
98 	atomic64_t devrst_cpwq_alloc_failures;
99 	atomic64_t io_cpwq_alloc_failures;
100 	atomic64_t no_icmnd_itmf_cmpls;
101 	atomic64_t check_condition;
102 	atomic64_t queue_fulls;
103 	atomic64_t rport_not_ready;
104 	atomic64_t frame_errors;
105 	atomic64_t current_port_speed;
106 };
107 
108 struct fnic_stats {
109 	struct stats_timestamps stats_timestamps;
110 	struct io_path_stats io_stats;
111 	struct abort_stats abts_stats;
112 	struct terminate_stats term_stats;
113 	struct reset_stats reset_stats;
114 	struct fw_stats fw_stats;
115 	struct vlan_stats vlan_stats;
116 	struct misc_stats misc_stats;
117 };
118 
119 struct stats_debug_info {
120 	char *debug_buffer;
121 	void *i_private;
122 	int buf_size;
123 	int buffer_len;
124 };
125 
126 int fnic_get_stats_data(struct stats_debug_info *, struct fnic_stats *);
127 void fnic_stats_debugfs_init(struct fnic *);
128 void fnic_stats_debugfs_remove(struct fnic *);
129 #endif /* _FNIC_STATS_H_ */
130