#if !defined(__OCS_XPORT_H__)
#define __OCS_XPORT_H__
typedef struct ocs_xport_fcfi_s {
ocs_lock_t pend_frames_lock;
ocs_list_t pend_frames;
uint32_t hold_frames:1;
uint32_t pend_frames_processed;
} ocs_xport_fcfi_t;
typedef struct ocs_xport_rq_thread_info_s {
ocs_t *ocs;
uint8_t thread_started;
ocs_thread_t thread;
ocs_cbuf_t * seq_cbuf;
char thread_name[64];
} ocs_xport_rq_thread_info_t;
typedef enum {
OCS_XPORT_PORT_ONLINE=1,
OCS_XPORT_PORT_OFFLINE,
OCS_XPORT_SHUTDOWN,
OCS_XPORT_POST_NODE_EVENT,
OCS_XPORT_WWNN_SET,
OCS_XPORT_WWPN_SET,
} ocs_xport_ctrl_e;
typedef enum {
OCS_XPORT_PORT_STATUS,
OCS_XPORT_CONFIG_PORT_STATUS,
OCS_XPORT_LINK_SPEED,
OCS_XPORT_IS_SUPPORTED_LINK_SPEED,
OCS_XPORT_LINK_STATISTICS,
OCS_XPORT_LINK_STAT_RESET,
OCS_XPORT_IS_QUIESCED
} ocs_xport_status_e;
typedef struct ocs_xport_link_stats_s {
uint32_t rec:1,
gec:1,
w02of:1,
w03of:1,
w04of:1,
w05of:1,
w06of:1,
w07of:1,
w08of:1,
w09of:1,
w10of:1,
w11of:1,
w12of:1,
w13of:1,
w14of:1,
w15of:1,
w16of:1,
w17of:1,
w18of:1,
w19of:1,
w20of:1,
w21of:1,
resv0:8,
clrc:1,
clof:1;
uint32_t link_failure_error_count;
uint32_t loss_of_sync_error_count;
uint32_t loss_of_signal_error_count;
uint32_t primitive_sequence_error_count;
uint32_t invalid_transmission_word_error_count;
uint32_t crc_error_count;
uint32_t primitive_sequence_event_timeout_count;
uint32_t elastic_buffer_overrun_error_count;
uint32_t arbitration_fc_al_timout_count;
uint32_t advertised_receive_bufftor_to_buffer_credit;
uint32_t current_receive_buffer_to_buffer_credit;
uint32_t advertised_transmit_buffer_to_buffer_credit;
uint32_t current_transmit_buffer_to_buffer_credit;
uint32_t received_eofa_count;
uint32_t received_eofdti_count;
uint32_t received_eofni_count;
uint32_t received_soff_count;
uint32_t received_dropped_no_aer_count;
uint32_t received_dropped_no_available_rpi_resources_count;
uint32_t received_dropped_no_available_xri_resources_count;
} ocs_xport_link_stats_t;
typedef struct ocs_xport_host_stats_s {
uint32_t cc:1,
:31;
uint32_t transmit_kbyte_count;
uint32_t receive_kbyte_count;
uint32_t transmit_frame_count;
uint32_t receive_frame_count;
uint32_t transmit_sequence_count;
uint32_t receive_sequence_count;
uint32_t total_exchanges_originator;
uint32_t total_exchanges_responder;
uint32_t receive_p_bsy_count;
uint32_t receive_f_bsy_count;
uint32_t dropped_frames_due_to_no_rq_buffer_count;
uint32_t empty_rq_timeout_count;
uint32_t dropped_frames_due_to_no_xri_count;
uint32_t empty_xri_pool_count;
} ocs_xport_host_stats_t;
typedef struct ocs_xport_host_statistics_s {
ocs_sem_t semaphore;
ocs_xport_link_stats_t link_stats;
ocs_xport_host_stats_t host_stats;
} ocs_xport_host_statistics_t;
typedef union ocs_xport {
uint32_t value;
ocs_xport_host_statistics_t stats;
} ocs_xport_stats_t;
struct ocs_xport_s {
ocs_t *ocs;
uint64_t req_wwpn;
uint64_t req_wwnn;
ocs_xport_fcfi_t fcfi[SLI4_MAX_FCFI];
uint32_t nodes_count;
ocs_node_t **nodes;
ocs_list_t nodes_free_list;
ocs_io_pool_t *io_pool;
ocs_atomic_t io_alloc_failed_count;
ocs_lock_t io_pending_lock;
ocs_list_t io_pending_list;
ocs_atomic_t io_total_alloc;
ocs_atomic_t io_total_free;
ocs_atomic_t io_total_pending;
ocs_atomic_t io_active_count;
ocs_atomic_t io_pending_count;
ocs_atomic_t io_pending_recursing;
ocs_list_t vport_list;
uint32_t configured_link_state;
uint32_t num_rq_threads;
ocs_xport_rq_thread_info_t *rq_thread_info;
ocs_timer_t stats_timer;
ocs_xport_stats_t fc_xport_stats;
};
extern ocs_xport_t *ocs_xport_alloc(ocs_t *ocs);
extern int32_t ocs_xport_attach(ocs_xport_t *xport);
extern int32_t ocs_xport_initialize(ocs_xport_t *xport);
extern int32_t ocs_xport_detach(ocs_xport_t *xport);
extern int32_t ocs_xport_control(ocs_xport_t *xport, ocs_xport_ctrl_e cmd, ...);
extern int32_t ocs_xport_status(ocs_xport_t *xport, ocs_xport_status_e cmd, ocs_xport_stats_t *result);
extern void ocs_xport_free(ocs_xport_t *xport);
#endif