18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2013 Cisco Systems, Inc.  All rights reserved.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This program is free software; you may redistribute it and/or modify
58c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by
68c2ecf20Sopenharmony_ci * the Free Software Foundation; version 2 of the License.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
98c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
118c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
128c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
148c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
158c2ecf20Sopenharmony_ci * SOFTWARE.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#ifndef _FNIC_STATS_H_
188c2ecf20Sopenharmony_ci#define _FNIC_STATS_H_
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct stats_timestamps {
218c2ecf20Sopenharmony_ci	struct timespec64 last_reset_time;
228c2ecf20Sopenharmony_ci	struct timespec64 last_read_time;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct io_path_stats {
268c2ecf20Sopenharmony_ci	atomic64_t active_ios;
278c2ecf20Sopenharmony_ci	atomic64_t max_active_ios;
288c2ecf20Sopenharmony_ci	atomic64_t io_completions;
298c2ecf20Sopenharmony_ci	atomic64_t io_failures;
308c2ecf20Sopenharmony_ci	atomic64_t ioreq_null;
318c2ecf20Sopenharmony_ci	atomic64_t alloc_failures;
328c2ecf20Sopenharmony_ci	atomic64_t sc_null;
338c2ecf20Sopenharmony_ci	atomic64_t io_not_found;
348c2ecf20Sopenharmony_ci	atomic64_t num_ios;
358c2ecf20Sopenharmony_ci	atomic64_t io_btw_0_to_10_msec;
368c2ecf20Sopenharmony_ci	atomic64_t io_btw_10_to_100_msec;
378c2ecf20Sopenharmony_ci	atomic64_t io_btw_100_to_500_msec;
388c2ecf20Sopenharmony_ci	atomic64_t io_btw_500_to_5000_msec;
398c2ecf20Sopenharmony_ci	atomic64_t io_btw_5000_to_10000_msec;
408c2ecf20Sopenharmony_ci	atomic64_t io_btw_10000_to_30000_msec;
418c2ecf20Sopenharmony_ci	atomic64_t io_greater_than_30000_msec;
428c2ecf20Sopenharmony_ci	atomic64_t current_max_io_time;
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistruct abort_stats {
468c2ecf20Sopenharmony_ci	atomic64_t aborts;
478c2ecf20Sopenharmony_ci	atomic64_t abort_failures;
488c2ecf20Sopenharmony_ci	atomic64_t abort_drv_timeouts;
498c2ecf20Sopenharmony_ci	atomic64_t abort_fw_timeouts;
508c2ecf20Sopenharmony_ci	atomic64_t abort_io_not_found;
518c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_0_to_6_sec;
528c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_6_to_20_sec;
538c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_20_to_30_sec;
548c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_30_to_40_sec;
558c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_40_to_50_sec;
568c2ecf20Sopenharmony_ci	atomic64_t abort_issued_btw_50_to_60_sec;
578c2ecf20Sopenharmony_ci	atomic64_t abort_issued_greater_than_60_sec;
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistruct terminate_stats {
618c2ecf20Sopenharmony_ci	atomic64_t terminates;
628c2ecf20Sopenharmony_ci	atomic64_t max_terminates;
638c2ecf20Sopenharmony_ci	atomic64_t terminate_drv_timeouts;
648c2ecf20Sopenharmony_ci	atomic64_t terminate_fw_timeouts;
658c2ecf20Sopenharmony_ci	atomic64_t terminate_io_not_found;
668c2ecf20Sopenharmony_ci	atomic64_t terminate_failures;
678c2ecf20Sopenharmony_ci};
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cistruct reset_stats {
708c2ecf20Sopenharmony_ci	atomic64_t device_resets;
718c2ecf20Sopenharmony_ci	atomic64_t device_reset_failures;
728c2ecf20Sopenharmony_ci	atomic64_t device_reset_aborts;
738c2ecf20Sopenharmony_ci	atomic64_t device_reset_timeouts;
748c2ecf20Sopenharmony_ci	atomic64_t device_reset_terminates;
758c2ecf20Sopenharmony_ci	atomic64_t fw_resets;
768c2ecf20Sopenharmony_ci	atomic64_t fw_reset_completions;
778c2ecf20Sopenharmony_ci	atomic64_t fw_reset_failures;
788c2ecf20Sopenharmony_ci	atomic64_t fnic_resets;
798c2ecf20Sopenharmony_ci	atomic64_t fnic_reset_completions;
808c2ecf20Sopenharmony_ci	atomic64_t fnic_reset_failures;
818c2ecf20Sopenharmony_ci};
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_cistruct fw_stats {
848c2ecf20Sopenharmony_ci	atomic64_t active_fw_reqs;
858c2ecf20Sopenharmony_ci	atomic64_t max_fw_reqs;
868c2ecf20Sopenharmony_ci	atomic64_t fw_out_of_resources;
878c2ecf20Sopenharmony_ci	atomic64_t io_fw_errs;
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_cistruct vlan_stats {
918c2ecf20Sopenharmony_ci	atomic64_t vlan_disc_reqs;
928c2ecf20Sopenharmony_ci	atomic64_t resp_withno_vlanID;
938c2ecf20Sopenharmony_ci	atomic64_t sol_expiry_count;
948c2ecf20Sopenharmony_ci	atomic64_t flogi_rejects;
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistruct misc_stats {
988c2ecf20Sopenharmony_ci	u64 last_isr_time;
998c2ecf20Sopenharmony_ci	u64 last_ack_time;
1008c2ecf20Sopenharmony_ci	atomic64_t max_isr_jiffies;
1018c2ecf20Sopenharmony_ci	atomic64_t max_isr_time_ms;
1028c2ecf20Sopenharmony_ci	atomic64_t corr_work_done;
1038c2ecf20Sopenharmony_ci	atomic64_t isr_count;
1048c2ecf20Sopenharmony_ci	atomic64_t max_cq_entries;
1058c2ecf20Sopenharmony_ci	atomic64_t ack_index_out_of_range;
1068c2ecf20Sopenharmony_ci	atomic64_t data_count_mismatch;
1078c2ecf20Sopenharmony_ci	atomic64_t fcpio_timeout;
1088c2ecf20Sopenharmony_ci	atomic64_t fcpio_aborted;
1098c2ecf20Sopenharmony_ci	atomic64_t sgl_invalid;
1108c2ecf20Sopenharmony_ci	atomic64_t mss_invalid;
1118c2ecf20Sopenharmony_ci	atomic64_t abts_cpwq_alloc_failures;
1128c2ecf20Sopenharmony_ci	atomic64_t devrst_cpwq_alloc_failures;
1138c2ecf20Sopenharmony_ci	atomic64_t io_cpwq_alloc_failures;
1148c2ecf20Sopenharmony_ci	atomic64_t no_icmnd_itmf_cmpls;
1158c2ecf20Sopenharmony_ci	atomic64_t check_condition;
1168c2ecf20Sopenharmony_ci	atomic64_t queue_fulls;
1178c2ecf20Sopenharmony_ci	atomic64_t rport_not_ready;
1188c2ecf20Sopenharmony_ci	atomic64_t frame_errors;
1198c2ecf20Sopenharmony_ci	atomic64_t current_port_speed;
1208c2ecf20Sopenharmony_ci};
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_cistruct fnic_stats {
1238c2ecf20Sopenharmony_ci	struct stats_timestamps stats_timestamps;
1248c2ecf20Sopenharmony_ci	struct io_path_stats io_stats;
1258c2ecf20Sopenharmony_ci	struct abort_stats abts_stats;
1268c2ecf20Sopenharmony_ci	struct terminate_stats term_stats;
1278c2ecf20Sopenharmony_ci	struct reset_stats reset_stats;
1288c2ecf20Sopenharmony_ci	struct fw_stats fw_stats;
1298c2ecf20Sopenharmony_ci	struct vlan_stats vlan_stats;
1308c2ecf20Sopenharmony_ci	struct misc_stats misc_stats;
1318c2ecf20Sopenharmony_ci};
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_cistruct stats_debug_info {
1348c2ecf20Sopenharmony_ci	char *debug_buffer;
1358c2ecf20Sopenharmony_ci	void *i_private;
1368c2ecf20Sopenharmony_ci	int buf_size;
1378c2ecf20Sopenharmony_ci	int buffer_len;
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciint fnic_get_stats_data(struct stats_debug_info *, struct fnic_stats *);
1418c2ecf20Sopenharmony_civoid fnic_stats_debugfs_init(struct fnic *);
1428c2ecf20Sopenharmony_civoid fnic_stats_debugfs_remove(struct fnic *);
1438c2ecf20Sopenharmony_ci#endif /* _FNIC_STATS_H_ */
144