Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_xport.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 /**
34  * @file
35  *
36  */
37 
38 #if !defined(__OCS_XPORT_H__)
39 #define __OCS_XPORT_H__
40 
41 /**
42  * @brief FCFI lookup/pending frames
43  */
44 typedef struct ocs_xport_fcfi_s {
45  ocs_lock_t pend_frames_lock;
46  ocs_list_t pend_frames;
47  uint32_t hold_frames:1; /*<< hold pending frames */
48  uint32_t pend_frames_processed; /*<< count of pending frames that were processed */
50 
51 /**
52  * @brief Structure to hold the information related to an RQ processing thread used
53  * to increase 40G performance.
54  */
55 typedef struct ocs_xport_rq_thread_info_s {
56  ocs_t *ocs;
57  uint8_t thread_started;
58  ocs_thread_t thread;
59  ocs_cbuf_t * seq_cbuf;
60  char thread_name[64];
62 
63 typedef enum {
71 
72 typedef enum {
82 
83 typedef struct ocs_xport_link_stats_s {
84  uint32_t rec:1,
85  gec:1,
86  w02of:1,
87  w03of:1,
88  w04of:1,
89  w05of:1,
90  w06of:1,
91  w07of:1,
92  w08of:1,
93  w09of:1,
94  w10of:1,
95  w11of:1,
96  w12of:1,
97  w13of:1,
98  w14of:1,
99  w15of:1,
100  w16of:1,
101  w17of:1,
102  w18of:1,
103  w19of:1,
104  w20of:1,
105  w21of:1,
106  resv0:8,
107  clrc:1,
108  clof:1;
114  uint32_t crc_error_count;
131  uint32_t lrr_count_local;
132  uint32_t lr_count_remote;
134 
135 typedef struct ocs_xport_host_stats_s {
136  uint32_t cc:1,
137  :31;
138  uint32_t transmit_kbyte_count;
153 
154 typedef struct ocs_xport_fcp_statistics_s {
155  uint64_t input_bytes;
156  uint64_t output_bytes;
157  uint64_t input_requests;
158  uint64_t output_requests;
159  uint64_t control_requests;
161 
162 typedef struct ocs_xport_host_statistics_s {
163  ocs_sem_t semaphore;
168 
169 typedef union ocs_xport {
170  uint32_t value;
173 /**
174  * @brief Transport private values
175  */
176 struct ocs_xport_s {
177  ocs_t *ocs;
178  uint64_t req_wwpn; /*<< wwpn requested by user for primary sport */
179  uint64_t req_wwnn; /*<< wwnn requested by user for primary sport */
180 
182 
183  /* Nodes */
184  uint32_t nodes_count; /**< number of allocated nodes */
185  ocs_node_t **nodes; /**< array of pointers to nodes */
186  ocs_list_t nodes_free_list; /**< linked list of free nodes */
187 
188  /* Io pool and counts */
189  ocs_io_pool_t *io_pool; /**< pointer to IO pool */
190  ocs_atomic_t io_alloc_failed_count; /**< used to track how often IO pool is empty */
191  ocs_lock_t io_pending_lock; /**< lock for io_pending_list */
192  ocs_list_t io_pending_list; /**< list of IOs waiting for HAL resources
193  ** lock: xport->io_pending_lock
194  ** link: ocs_io_t->io_pending_link
195  */
196  ocs_atomic_t io_total_alloc; /**< count of totals IOS allocated */
197  ocs_atomic_t io_total_free; /**< count of totals IOS free'd */
198  ocs_atomic_t io_total_pending; /**< count of totals IOS that were pended */
199  ocs_atomic_t io_active_count; /**< count of active IOS */
200  ocs_atomic_t io_pending_count; /**< count of pending IOS */
201  ocs_atomic_t io_pending_recursing; /**< non-zero if ocs_scsi_check_pending is executing */
202 
203  /* vport */
204  ocs_list_t vport_list; /**< list of VPORTS (NPIV) */
205 
206  /* Port */
207  uint32_t configured_link_state; /**< requested link state */
208 
209  /* RQ processing threads */
210  uint32_t num_rq_threads;
212 
213  bool fc_stats_timer_shutdown; /* TRUE if stats timer is to be shutdown */
214  ocs_timer_t fc_stats_timer; /**< Timer for Statistics */
217  ocs_lock_t fc_stats_lock;
218  uint32_t lip_count;
219 };
220 
221 
222 extern ocs_xport_t *ocs_xport_alloc(ocs_t *ocs);
223 extern int32_t ocs_xport_attach(ocs_xport_t *xport);
224 extern int32_t ocs_xport_initialize(ocs_xport_t *xport);
225 extern int32_t ocs_xport_detach(ocs_xport_t *xport);
226 extern int32_t ocs_xport_control(ocs_xport_t *xport, ocs_xport_ctrl_e cmd, ...);
227 extern int32_t ocs_xport_status(ocs_xport_t *xport, ocs_xport_status_e cmd, ocs_xport_stats_t *result);
228 extern void ocs_xport_free(ocs_xport_t *xport);
229 extern void ocs_xport_config_stats_timer(void *arg);
230 extern void ocs_device_stop_stats_timers(ocs_t *ocs);
231 extern int32_t ocs_xport_cb(void *arg, ocs_hal_xport_event_e event);
232 #endif // __OCS_XPORT_H__
ocs_xport_fcp_statistics_t fcp_stats
Definition: ocs_xport.h:166
ocs_t * ocs
Definition: ocs_xport.h:177
ocs_atomic_t io_total_pending
Definition: ocs_xport.h:198
uint32_t receive_kbyte_count
Definition: ocs_xport.h:139
ocs_lock_t io_pending_lock
Definition: ocs_xport.h:191
uint32_t total_exchanges_responder
Definition: ocs_xport.h:145
uint32_t pend_frames_processed
Definition: ocs_xport.h:48
uint32_t transmit_sequence_count
Definition: ocs_xport.h:142
void ocs_device_stop_stats_timers(ocs_t *ocs)
Definition: ocs_xport.c:1319
uint64_t req_wwpn
Definition: ocs_xport.h:178
ocs_atomic_t io_total_free
Definition: ocs_xport.h:197
ocs_xport_link_stats_t link_stats
Definition: ocs_xport.h:164
void ocs_xport_config_stats_timer(void *arg)
Get FC link and host Statistics periodically.
Definition: ocs_xport.c:1354
uint32_t dropped_frames_due_to_no_xri_count
Definition: ocs_xport.h:150
uint32_t receive_f_bsy_count
Definition: ocs_xport.h:147
ocs_atomic_t io_pending_count
Definition: ocs_xport.h:200
ocs_xport_rq_thread_info_t * rq_thread_info
Definition: ocs_xport.h:211
uint32_t uint32_t transmit_kbyte_count
Definition: ocs_xport.h:136
ocs_atomic_t io_pending_recursing
Definition: ocs_xport.h:201
int32_t ocs_xport_detach(ocs_xport_t *xport)
Detaches the transport from the device.
Definition: ocs_xport.c:735
ocs_list_t pend_frames
Definition: ocs_xport.h:46
uint32_t empty_xri_pool_count
Definition: ocs_xport.h:151
int32_t ocs_xport_attach(ocs_xport_t *xport)
Do as much allocation as possible, but do not initialization the device.
Definition: ocs_xport.c:193
Transport private values.
Definition: ocs_xport.h:176
ocs_lock_t pend_frames_lock
Definition: ocs_xport.h:45
ocs_timer_t fc_stats_timer
Definition: ocs_xport.h:214
int32_t ocs_xport_control(ocs_xport_t *xport, ocs_xport_ctrl_e cmd,...)
Perform transport attach function.
Definition: ocs_xport.c:866
ocs_xport_stats_t fc_stats
Definition: ocs_xport.h:215
uint32_t dropped_frames_due_to_no_rq_buffer_count
Definition: ocs_xport.h:148
ocs_hal_xport_event_e
Definition: ocs_hal.h:704
ocs_atomic_t io_alloc_failed_count
Definition: ocs_xport.h:190
ocs_atomic_t io_total_alloc
Definition: ocs_xport.h:196
uint32_t value
Definition: ocs_xport.h:170
ocs_io_pool_t * io_pool
Definition: ocs_xport.h:189
uint32_t total_exchanges_originator
Definition: ocs_xport.h:144
uint32_t receive_sequence_count
Definition: ocs_xport.h:143
ocs_xport_ctrl_e
Definition: ocs_xport.h:63
ocs_list_t io_pending_list
Definition: ocs_xport.h:192
int32_t ocs_xport_initialize(ocs_xport_t *xport)
Initializes the device.
Definition: ocs_xport.c:509
ocs_atomic_t io_active_count
Definition: ocs_xport.h:199
bool fc_stats_timer_shutdown
Definition: ocs_xport.h:213
uint32_t lip_count
Definition: ocs_xport.h:218
ocs_xport_status_e
Definition: ocs_xport.h:72
ocs_xport_stats_t fc_stats_sysfs
Definition: ocs_xport.h:216
ocs_list_t nodes_free_list
Definition: ocs_xport.h:186
uint64_t req_wwnn
Definition: ocs_xport.h:179
ocs_xport_fcfi_t fcfi[SLI4_MAX_FCFI]
Definition: ocs_xport.h:181
int32_t ocs_xport_cb(void *arg, ocs_hal_xport_event_e event)
callback function for xport from HAL.
Definition: ocs_xport.c:1428
ocs_xport_t * ocs_xport_alloc(ocs_t *ocs)
Allocate a transport object.
Definition: ocs_xport.c:71
FCFI lookup/pending frames.
Definition: ocs_xport.h:44
uint32_t nodes_count
Definition: ocs_xport.h:184
void ocs_xport_free(ocs_xport_t *xport)
Free a transport object.
Definition: ocs_xport.c:1394
ocs_xport_host_statistics_t stats
Definition: ocs_xport.h:171
#define SLI4_MAX_FCFI
Maximum value for a FCFI.
Definition: sli4_fc.h:52
int32_t ocs_xport_status(ocs_xport_t *xport, ocs_xport_status_e cmd, ocs_xport_stats_t *result)
Return status on a link.
Definition: ocs_xport.c:1073
uint32_t receive_p_bsy_count
Definition: ocs_xport.h:146
ocs_lock_t fc_stats_lock
Definition: ocs_xport.h:217
uint32_t num_rq_threads
Definition: ocs_xport.h:210
ocs_xport_host_stats_t host_stats
Definition: ocs_xport.h:165
uint32_t configured_link_state
Definition: ocs_xport.h:207
uint32_t transmit_frame_count
Definition: ocs_xport.h:140
ocs_node_t ** nodes
Definition: ocs_xport.h:185
uint32_t empty_rq_timeout_count
Definition: ocs_xport.h:149
ocs_list_t vport_list
Definition: ocs_xport.h:204
Structure to hold the information related to an RQ processing thread used to increase 40G performance...
Definition: ocs_xport.h:55
uint32_t receive_frame_count
Definition: ocs_xport.h:141