1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2021 Broadcom. All Rights Reserved. The term
4 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
7 #if !defined(__EFCT_XPORT_H__)
8 #define __EFCT_XPORT_H__
10 enum efct_xport_ctrl {
11 EFCT_XPORT_PORT_ONLINE = 1,
12 EFCT_XPORT_PORT_OFFLINE,
14 EFCT_XPORT_POST_NODE_EVENT,
19 enum efct_xport_status {
20 EFCT_XPORT_PORT_STATUS,
21 EFCT_XPORT_CONFIG_PORT_STATUS,
22 EFCT_XPORT_LINK_SPEED,
23 EFCT_XPORT_IS_SUPPORTED_LINK_SPEED,
24 EFCT_XPORT_LINK_STATISTICS,
25 EFCT_XPORT_LINK_STAT_RESET,
26 EFCT_XPORT_IS_QUIESCED
29 struct efct_xport_link_stats {
54 u32 link_failure_error_count;
55 u32 loss_of_sync_error_count;
56 u32 loss_of_signal_error_count;
57 u32 primitive_sequence_error_count;
58 u32 invalid_transmission_word_error_count;
60 u32 primitive_sequence_event_timeout_count;
61 u32 elastic_buffer_overrun_error_count;
62 u32 arbitration_fc_al_timeout_count;
63 u32 advertised_receive_bufftor_to_buffer_credit;
64 u32 current_receive_buffer_to_buffer_credit;
65 u32 advertised_transmit_buffer_to_buffer_credit;
66 u32 current_transmit_buffer_to_buffer_credit;
67 u32 received_eofa_count;
68 u32 received_eofdti_count;
69 u32 received_eofni_count;
70 u32 received_soff_count;
71 u32 received_dropped_no_aer_count;
72 u32 received_dropped_no_available_rpi_resources_count;
73 u32 received_dropped_no_available_xri_resources_count;
76 struct efct_xport_host_stats {
78 u32 transmit_kbyte_count;
79 u32 receive_kbyte_count;
80 u32 transmit_frame_count;
81 u32 receive_frame_count;
82 u32 transmit_sequence_count;
83 u32 receive_sequence_count;
84 u32 total_exchanges_originator;
85 u32 total_exchanges_responder;
86 u32 receive_p_bsy_count;
87 u32 receive_f_bsy_count;
88 u32 dropped_frames_due_to_no_rq_buffer_count;
89 u32 empty_rq_timeout_count;
90 u32 dropped_frames_due_to_no_xri_count;
91 u32 empty_xri_pool_count;
94 struct efct_xport_host_statistics {
95 struct completion done;
96 struct efct_xport_link_stats link_stats;
97 struct efct_xport_host_stats host_stats;
100 union efct_xport_stats_u {
102 struct efct_xport_host_statistics stats;
105 struct efct_xport_fcp_stats {
110 u64 control_requests;
115 /* wwpn requested by user for primary nport */
117 /* wwnn requested by user for primary nport */
121 /* number of allocated nodes */
123 /* used to track how often IO pool is empty */
124 atomic_t io_alloc_failed_count;
125 /* array of pointers to nodes */
126 struct efc_node **nodes;
128 /* Io pool and counts */
129 /* pointer to IO pool */
130 struct efct_io_pool *io_pool;
131 /* lock for io_pending_list */
132 spinlock_t io_pending_lock;
133 /* list of IOs waiting for HW resources
134 * lock: xport->io_pending_lock
135 * link: efct_io_s->io_pending_link
137 struct list_head io_pending_list;
138 /* count of totals IOS allocated */
139 atomic_t io_total_alloc;
140 /* count of totals IOS free'd */
141 atomic_t io_total_free;
142 /* count of totals IOS that were pended */
143 atomic_t io_total_pending;
144 /* count of active IOS */
145 atomic_t io_active_count;
146 /* count of pending IOS */
147 atomic_t io_pending_count;
148 /* non-zero if efct_scsi_check_pending is executing */
149 atomic_t io_pending_recursing;
152 /* requested link state */
153 u32 configured_link_state;
155 /* Timer for Statistics */
156 struct timer_list stats_timer;
157 union efct_xport_stats_u fc_xport_stats;
158 struct efct_xport_fcp_stats fcp_stats;
161 struct efct_rport_data {
162 struct efc_node *node;
166 efct_xport_alloc(struct efct *efct);
168 efct_xport_attach(struct efct_xport *xport);
170 efct_xport_initialize(struct efct_xport *xport);
172 efct_xport_detach(struct efct_xport *xport);
174 efct_xport_control(struct efct_xport *xport, enum efct_xport_ctrl cmd, ...);
176 efct_xport_status(struct efct_xport *xport, enum efct_xport_status cmd,
177 union efct_xport_stats_u *result);
179 efct_xport_free(struct efct_xport *xport);
181 struct scsi_transport_template *efct_attach_fc_transport(void);
182 struct scsi_transport_template *efct_attach_vport_fc_transport(void);
184 efct_release_fc_transport(struct scsi_transport_template *transport_template);
186 #endif /* __EFCT_XPORT_H__ */