Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2021 Broadcom. All Rights Reserved. The term
0004  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
0005  */
0006 
0007 #if !defined(__EFCT_XPORT_H__)
0008 #define __EFCT_XPORT_H__
0009 
0010 enum efct_xport_ctrl {
0011     EFCT_XPORT_PORT_ONLINE = 1,
0012     EFCT_XPORT_PORT_OFFLINE,
0013     EFCT_XPORT_SHUTDOWN,
0014     EFCT_XPORT_POST_NODE_EVENT,
0015     EFCT_XPORT_WWNN_SET,
0016     EFCT_XPORT_WWPN_SET,
0017 };
0018 
0019 enum efct_xport_status {
0020     EFCT_XPORT_PORT_STATUS,
0021     EFCT_XPORT_CONFIG_PORT_STATUS,
0022     EFCT_XPORT_LINK_SPEED,
0023     EFCT_XPORT_IS_SUPPORTED_LINK_SPEED,
0024     EFCT_XPORT_LINK_STATISTICS,
0025     EFCT_XPORT_LINK_STAT_RESET,
0026     EFCT_XPORT_IS_QUIESCED
0027 };
0028 
0029 struct efct_xport_link_stats {
0030     bool        rec;
0031     bool        gec;
0032     bool        w02of;
0033     bool        w03of;
0034     bool        w04of;
0035     bool        w05of;
0036     bool        w06of;
0037     bool        w07of;
0038     bool        w08of;
0039     bool        w09of;
0040     bool        w10of;
0041     bool        w11of;
0042     bool        w12of;
0043     bool        w13of;
0044     bool        w14of;
0045     bool        w15of;
0046     bool        w16of;
0047     bool        w17of;
0048     bool        w18of;
0049     bool        w19of;
0050     bool        w20of;
0051     bool        w21of;
0052     bool        clrc;
0053     bool        clof1;
0054     u32     link_failure_error_count;
0055     u32     loss_of_sync_error_count;
0056     u32     loss_of_signal_error_count;
0057     u32     primitive_sequence_error_count;
0058     u32     invalid_transmission_word_error_count;
0059     u32     crc_error_count;
0060     u32     primitive_sequence_event_timeout_count;
0061     u32     elastic_buffer_overrun_error_count;
0062     u32     arbitration_fc_al_timeout_count;
0063     u32     advertised_receive_bufftor_to_buffer_credit;
0064     u32     current_receive_buffer_to_buffer_credit;
0065     u32     advertised_transmit_buffer_to_buffer_credit;
0066     u32     current_transmit_buffer_to_buffer_credit;
0067     u32     received_eofa_count;
0068     u32     received_eofdti_count;
0069     u32     received_eofni_count;
0070     u32     received_soff_count;
0071     u32     received_dropped_no_aer_count;
0072     u32     received_dropped_no_available_rpi_resources_count;
0073     u32     received_dropped_no_available_xri_resources_count;
0074 };
0075 
0076 struct efct_xport_host_stats {
0077     bool        cc;
0078     u32     transmit_kbyte_count;
0079     u32     receive_kbyte_count;
0080     u32     transmit_frame_count;
0081     u32     receive_frame_count;
0082     u32     transmit_sequence_count;
0083     u32     receive_sequence_count;
0084     u32     total_exchanges_originator;
0085     u32     total_exchanges_responder;
0086     u32     receive_p_bsy_count;
0087     u32     receive_f_bsy_count;
0088     u32     dropped_frames_due_to_no_rq_buffer_count;
0089     u32     empty_rq_timeout_count;
0090     u32     dropped_frames_due_to_no_xri_count;
0091     u32     empty_xri_pool_count;
0092 };
0093 
0094 struct efct_xport_host_statistics {
0095     struct completion       done;
0096     struct efct_xport_link_stats    link_stats;
0097     struct efct_xport_host_stats    host_stats;
0098 };
0099 
0100 union efct_xport_stats_u {
0101     u32 value;
0102     struct efct_xport_host_statistics stats;
0103 };
0104 
0105 struct efct_xport_fcp_stats {
0106     u64     input_bytes;
0107     u64     output_bytes;
0108     u64     input_requests;
0109     u64     output_requests;
0110     u64     control_requests;
0111 };
0112 
0113 struct efct_xport {
0114     struct efct     *efct;
0115     /* wwpn requested by user for primary nport */
0116     u64         req_wwpn;
0117     /* wwnn requested by user for primary nport */
0118     u64         req_wwnn;
0119 
0120     /* Nodes */
0121     /* number of allocated nodes */
0122     u32         nodes_count;
0123     /* used to track how often IO pool is empty */
0124     atomic_t        io_alloc_failed_count;
0125     /* array of pointers to nodes */
0126     struct efc_node     **nodes;
0127 
0128     /* Io pool and counts */
0129     /* pointer to IO pool */
0130     struct efct_io_pool *io_pool;
0131     /* lock for io_pending_list */
0132     spinlock_t      io_pending_lock;
0133     /* list of IOs waiting for HW resources
0134      *  lock: xport->io_pending_lock
0135      *  link: efct_io_s->io_pending_link
0136      */
0137     struct list_head    io_pending_list;
0138     /* count of totals IOS allocated */
0139     atomic_t        io_total_alloc;
0140     /* count of totals IOS free'd */
0141     atomic_t        io_total_free;
0142     /* count of totals IOS that were pended */
0143     atomic_t        io_total_pending;
0144     /* count of active IOS */
0145     atomic_t        io_active_count;
0146     /* count of pending IOS */
0147     atomic_t        io_pending_count;
0148     /* non-zero if efct_scsi_check_pending is executing */
0149     atomic_t        io_pending_recursing;
0150 
0151     /* Port */
0152     /* requested link state */
0153     u32         configured_link_state;
0154 
0155     /* Timer for Statistics */
0156     struct timer_list   stats_timer;
0157     union efct_xport_stats_u fc_xport_stats;
0158     struct efct_xport_fcp_stats fcp_stats;
0159 };
0160 
0161 struct efct_rport_data {
0162     struct efc_node     *node;
0163 };
0164 
0165 struct efct_xport *
0166 efct_xport_alloc(struct efct *efct);
0167 int
0168 efct_xport_attach(struct efct_xport *xport);
0169 int
0170 efct_xport_initialize(struct efct_xport *xport);
0171 void
0172 efct_xport_detach(struct efct_xport *xport);
0173 int
0174 efct_xport_control(struct efct_xport *xport, enum efct_xport_ctrl cmd, ...);
0175 int
0176 efct_xport_status(struct efct_xport *xport, enum efct_xport_status cmd,
0177           union efct_xport_stats_u *result);
0178 void
0179 efct_xport_free(struct efct_xport *xport);
0180 
0181 struct scsi_transport_template *efct_attach_fc_transport(void);
0182 struct scsi_transport_template *efct_attach_vport_fc_transport(void);
0183 void
0184 efct_release_fc_transport(struct scsi_transport_template *transport_template);
0185 
0186 #endif /* __EFCT_XPORT_H__ */