aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc.h')
-rw-r--r--drivers/scsi/lpfc/lpfc.h235
1 files changed, 149 insertions, 86 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 82e8f90c4617..8d718964f281 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -19,6 +19,8 @@
19 * included with this package. * 19 * included with this package. *
20 *******************************************************************/ 20 *******************************************************************/
21 21
22#include <scsi/scsi_host.h>
23
22struct lpfc_sli2_slim; 24struct lpfc_sli2_slim;
23 25
24 26
@@ -165,48 +167,143 @@ struct lpfc_sysfs_mbox {
165 struct lpfcMboxq * mbox; 167 struct lpfcMboxq * mbox;
166}; 168};
167 169
170struct lpfc_hba;
171
172enum discovery_state {
173 LPFC_STATE_UNKNOWN = 0, /* HBA state is unknown */
174 LPFC_LOCAL_CFG_LINK = 6, /* local NPORT Id configured */
175 LPFC_FLOGI = 7, /* FLOGI sent to Fabric */
176 LPFC_FABRIC_CFG_LINK = 8, /* Fabric assigned NPORT Id
177 * configured */
178 LPFC_NS_REG = 9, /* Register with NameServer */
179 LPFC_NS_QRY = 10, /* Query NameServer for NPort ID list */
180 LPFC_BUILD_DISC_LIST = 11, /* Build ADISC and PLOGI lists for
181 * device authentication / discovery */
182 LPFC_DISC_AUTH = 12, /* Processing ADISC list */
183 LPFC_VPORT_READY = 32,
184};
185
186enum hba_state {
187 LPFC_LINK_UNKNOWN = 0, /* HBA state is unknown */
188 LPFC_WARM_START = 1, /* HBA state after selective reset */
189 LPFC_INIT_START = 2, /* Initial state after board reset */
190 LPFC_INIT_MBX_CMDS = 3, /* Initialize HBA with mbox commands */
191 LPFC_LINK_DOWN = 4, /* HBA initialized, link is down */
192 LPFC_LINK_UP = 5, /* Link is up - issue READ_LA */
193 LPFC_CLEAR_LA = 13, /* authentication cmplt - issue
194 * CLEAR_LA */
195 LPFC_HBA_ERROR = -1
196};
197
198struct lpfc_vport {
199 struct list_head listentry;
200 struct lpfc_hba *phba;
201 uint8_t port_type;
202#define LPFC_PHYSICAL_PORT 1
203#define LPFC_NPIV_PORT 2
204#define LPFC_FABRIC_PORT 3
205 enum discovery_state port_state;
206
207
208 uint32_t fc_flag; /* FC flags */
209/* Several of these flags are HBA centric and should be moved to
210 * phba->link_flag (e.g. FC_PTP, FC_PUBLIC_LOOP)
211 */
212#define FC_PT2PT 0x1 /* pt2pt with no fabric */
213#define FC_PT2PT_PLOGI 0x2 /* pt2pt initiate PLOGI */
214#define FC_DISC_TMO 0x4 /* Discovery timer running */
215#define FC_PUBLIC_LOOP 0x8 /* Public loop */
216#define FC_LBIT 0x10 /* LOGIN bit in loopinit set */
217#define FC_RSCN_MODE 0x20 /* RSCN cmd rcv'ed */
218#define FC_NLP_MORE 0x40 /* More node to process in node tbl */
219#define FC_OFFLINE_MODE 0x80 /* Interface is offline for diag */
220#define FC_FABRIC 0x100 /* We are fabric attached */
221#define FC_ESTABLISH_LINK 0x200 /* Reestablish Link */
222#define FC_RSCN_DISCOVERY 0x400 /* Authenticate all devices after RSCN*/
223#define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
224#define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
225#define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
226#define FC_BYPASSED_MODE 0x20000 /* NPort is in bypassed mode */
227
228 struct list_head fc_nodes;
229
230 /* Keep counters for the number of entries in each list. */
231 uint16_t fc_plogi_cnt;
232 uint16_t fc_adisc_cnt;
233 uint16_t fc_reglogin_cnt;
234 uint16_t fc_prli_cnt;
235 uint16_t fc_unmap_cnt;
236 uint16_t fc_map_cnt;
237 uint16_t fc_npr_cnt;
238 uint16_t fc_unused_cnt;
239 struct serv_parm fc_sparam; /* buffer for our service parameters */
240
241 uint32_t fc_myDID; /* fibre channel S_ID */
242 uint32_t fc_prevDID; /* previous fibre channel S_ID */
243
244 int32_t stopped; /* HBA has not been restarted since last ERATT */
245 uint8_t fc_linkspeed; /* Link speed after last READ_LA */
246
247 uint32_t num_disc_nodes; /*in addition to hba_state */
248
249 uint32_t fc_nlp_cnt; /* outstanding NODELIST requests */
250 uint32_t fc_rscn_id_cnt; /* count of RSCNs payloads in list */
251 struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
252 struct lpfc_name fc_nodename; /* fc nodename */
253 struct lpfc_name fc_portname; /* fc portname */
254
255 struct lpfc_work_evt disc_timeout_evt;
256
257 struct timer_list fc_disctmo; /* Discovery rescue timer */
258 uint8_t fc_ns_retry; /* retries for fabric nameserver */
259 uint32_t fc_prli_sent; /* cntr for outstanding PRLIs */
260
261 spinlock_t work_port_lock;
262 uint32_t work_port_events; /* Timeout to be handled */
263#define WORKER_DISC_TMO 0x1 /* Discovery timeout */
264#define WORKER_ELS_TMO 0x2 /* ELS timeout */
265#define WORKER_MBOX_TMO 0x4 /* MBOX timeout */
266#define WORKER_FDMI_TMO 0x8 /* FDMI timeout */
267
268 struct timer_list fc_fdmitmo;
269 struct timer_list els_tmofunc;
270
271 int unreg_vpi_cmpl;
272
273 uint8_t load_flag;
274#define FC_LOADING 0x1 /* HBA in process of loading drvr */
275#define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */
276
277};
278
168struct lpfc_hba { 279struct lpfc_hba {
169 struct lpfc_sli sli; 280 struct lpfc_sli sli;
281
282 enum hba_state link_state;
283 uint32_t link_flag; /* link state flags */
284#define LS_LOOPBACK_MODE 0x40000 /* NPort is in Loopback mode */
285 /* This flag is set while issuing */
286 /* INIT_LINK mailbox command */
287#define LS_IGNORE_ERATT 0x80000 /* intr handler should ignore ERATT */
288
289 uint32_t pgpOffset; /* PGP offset within host memory */
290
170 struct lpfc_sli2_slim *slim2p; 291 struct lpfc_sli2_slim *slim2p;
292 struct lpfc_dmabuf hbqslimp;
293
171 dma_addr_t slim2p_mapping; 294 dma_addr_t slim2p_mapping;
295
296
172 uint16_t pci_cfg_value; 297 uint16_t pci_cfg_value;
173 298
174 int32_t hba_state;
175
176#define LPFC_STATE_UNKNOWN 0 /* HBA state is unknown */
177#define LPFC_WARM_START 1 /* HBA state after selective reset */
178#define LPFC_INIT_START 2 /* Initial state after board reset */
179#define LPFC_INIT_MBX_CMDS 3 /* Initialize HBA with mbox commands */
180#define LPFC_LINK_DOWN 4 /* HBA initialized, link is down */
181#define LPFC_LINK_UP 5 /* Link is up - issue READ_LA */
182#define LPFC_LOCAL_CFG_LINK 6 /* local NPORT Id configured */
183#define LPFC_FLOGI 7 /* FLOGI sent to Fabric */
184#define LPFC_FABRIC_CFG_LINK 8 /* Fabric assigned NPORT Id
185 configured */
186#define LPFC_NS_REG 9 /* Register with NameServer */
187#define LPFC_NS_QRY 10 /* Query NameServer for NPort ID list */
188#define LPFC_BUILD_DISC_LIST 11 /* Build ADISC and PLOGI lists for
189 * device authentication / discovery */
190#define LPFC_DISC_AUTH 12 /* Processing ADISC list */
191#define LPFC_CLEAR_LA 13 /* authentication cmplt - issue
192 CLEAR_LA */
193#define LPFC_HBA_READY 32
194#define LPFC_HBA_ERROR -1
195 299
196 int32_t stopped; /* HBA has not been restarted since last ERATT */
197 uint8_t fc_linkspeed; /* Link speed after last READ_LA */ 300 uint8_t fc_linkspeed; /* Link speed after last READ_LA */
198 301
199 uint32_t fc_eventTag; /* event tag for link attention */ 302 uint32_t fc_eventTag; /* event tag for link attention */
200 uint32_t fc_prli_sent; /* cntr for outstanding PRLIs */
201 303
202 uint32_t num_disc_nodes; /*in addition to hba_state */
203 304
204 struct timer_list fc_estabtmo; /* link establishment timer */ 305 struct timer_list fc_estabtmo; /* link establishment timer */
205 struct timer_list fc_disctmo; /* Discovery rescue timer */
206 struct timer_list fc_fdmitmo; /* fdmi timer */
207 /* These fields used to be binfo */ 306 /* These fields used to be binfo */
208 struct lpfc_name fc_nodename; /* fc nodename */
209 struct lpfc_name fc_portname; /* fc portname */
210 uint32_t fc_pref_DID; /* preferred D_ID */ 307 uint32_t fc_pref_DID; /* preferred D_ID */
211 uint8_t fc_pref_ALPA; /* preferred AL_PA */ 308 uint8_t fc_pref_ALPA; /* preferred AL_PA */
212 uint32_t fc_edtov; /* E_D_TOV timer value */ 309 uint32_t fc_edtov; /* E_D_TOV timer value */
@@ -216,61 +313,21 @@ struct lpfc_hba {
216 uint32_t fc_altov; /* AL_TOV timer value */ 313 uint32_t fc_altov; /* AL_TOV timer value */
217 uint32_t fc_crtov; /* C_R_TOV timer value */ 314 uint32_t fc_crtov; /* C_R_TOV timer value */
218 uint32_t fc_citov; /* C_I_TOV timer value */ 315 uint32_t fc_citov; /* C_I_TOV timer value */
219 uint32_t fc_myDID; /* fibre channel S_ID */
220 uint32_t fc_prevDID; /* previous fibre channel S_ID */
221 316
222 struct serv_parm fc_sparam; /* buffer for our service parameters */
223 struct serv_parm fc_fabparam; /* fabric service parameters buffer */ 317 struct serv_parm fc_fabparam; /* fabric service parameters buffer */
224 uint8_t alpa_map[128]; /* AL_PA map from READ_LA */ 318 uint8_t alpa_map[128]; /* AL_PA map from READ_LA */
225 319
226 uint8_t fc_ns_retry; /* retries for fabric nameserver */
227 uint32_t fc_nlp_cnt; /* outstanding NODELIST requests */
228 uint32_t fc_rscn_id_cnt; /* count of RSCNs payloads in list */
229 struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
230 uint32_t lmt; 320 uint32_t lmt;
231 uint32_t fc_flag; /* FC flags */
232#define FC_PT2PT 0x1 /* pt2pt with no fabric */
233#define FC_PT2PT_PLOGI 0x2 /* pt2pt initiate PLOGI */
234#define FC_DISC_TMO 0x4 /* Discovery timer running */
235#define FC_PUBLIC_LOOP 0x8 /* Public loop */
236#define FC_LBIT 0x10 /* LOGIN bit in loopinit set */
237#define FC_RSCN_MODE 0x20 /* RSCN cmd rcv'ed */
238#define FC_NLP_MORE 0x40 /* More node to process in node tbl */
239#define FC_OFFLINE_MODE 0x80 /* Interface is offline for diag */
240#define FC_FABRIC 0x100 /* We are fabric attached */
241#define FC_ESTABLISH_LINK 0x200 /* Reestablish Link */
242#define FC_RSCN_DISCOVERY 0x400 /* Authenticate all devices after RSCN*/
243#define FC_BLOCK_MGMT_IO 0x800 /* Don't allow mgmt mbx or iocb cmds */
244#define FC_LOADING 0x1000 /* HBA in process of loading drvr */
245#define FC_UNLOADING 0x2000 /* HBA in process of unloading drvr */
246#define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
247#define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
248#define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
249#define FC_BYPASSED_MODE 0x20000 /* NPort is in bypassed mode */
250#define FC_LOOPBACK_MODE 0x40000 /* NPort is in Loopback mode */
251 /* This flag is set while issuing */
252 /* INIT_LINK mailbox command */
253#define FC_IGNORE_ERATT 0x80000 /* intr handler should ignore ERATT */
254 321
255 uint32_t fc_topology; /* link topology, from LINK INIT */ 322 uint32_t fc_topology; /* link topology, from LINK INIT */
256 323
257 struct lpfc_stats fc_stat; 324 struct lpfc_stats fc_stat;
258 325
259 struct list_head fc_nodes;
260
261 /* Keep counters for the number of entries in each list. */
262 uint16_t fc_plogi_cnt;
263 uint16_t fc_adisc_cnt;
264 uint16_t fc_reglogin_cnt;
265 uint16_t fc_prli_cnt;
266 uint16_t fc_unmap_cnt;
267 uint16_t fc_map_cnt;
268 uint16_t fc_npr_cnt;
269 uint16_t fc_unused_cnt;
270 struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */ 326 struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */
271 uint32_t nport_event_cnt; /* timestamp for nlplist entry */ 327 uint32_t nport_event_cnt; /* timestamp for nlplist entry */
272 328
273 uint32_t wwnn[2]; 329 uint8_t wwnn[8];
330 uint8_t wwpn[8];
274 uint32_t RandomData[7]; 331 uint32_t RandomData[7];
275 332
276 uint32_t cfg_log_verbose; 333 uint32_t cfg_log_verbose;
@@ -304,18 +361,12 @@ struct lpfc_hba {
304 361
305 lpfc_vpd_t vpd; /* vital product data */ 362 lpfc_vpd_t vpd; /* vital product data */
306 363
307 struct Scsi_Host *host;
308 struct pci_dev *pcidev; 364 struct pci_dev *pcidev;
309 struct list_head work_list; 365 struct list_head work_list;
310 uint32_t work_ha; /* Host Attention Bits for WT */ 366 uint32_t work_ha; /* Host Attention Bits for WT */
311 uint32_t work_ha_mask; /* HA Bits owned by WT */ 367 uint32_t work_ha_mask; /* HA Bits owned by WT */
312 uint32_t work_hs; /* HS stored in case of ERRAT */ 368 uint32_t work_hs; /* HS stored in case of ERRAT */
313 uint32_t work_status[2]; /* Extra status from SLIM */ 369 uint32_t work_status[2]; /* Extra status from SLIM */
314 uint32_t work_hba_events; /* Timeout to be handled */
315#define WORKER_DISC_TMO 0x1 /* Discovery timeout */
316#define WORKER_ELS_TMO 0x2 /* ELS timeout */
317#define WORKER_MBOX_TMO 0x4 /* MBOX timeout */
318#define WORKER_FDMI_TMO 0x8 /* FDMI timeout */
319 370
320 wait_queue_head_t *work_wait; 371 wait_queue_head_t *work_wait;
321 struct task_struct *worker_thread; 372 struct task_struct *worker_thread;
@@ -353,7 +404,6 @@ struct lpfc_hba {
353 uint8_t soft_wwn_enable; 404 uint8_t soft_wwn_enable;
354 405
355 struct timer_list fcp_poll_timer; 406 struct timer_list fcp_poll_timer;
356 struct timer_list els_tmofunc;
357 407
358 /* 408 /*
359 * stat counters 409 * stat counters
@@ -370,6 +420,7 @@ struct lpfc_hba {
370 uint32_t total_scsi_bufs; 420 uint32_t total_scsi_bufs;
371 struct list_head lpfc_iocb_list; 421 struct list_head lpfc_iocb_list;
372 uint32_t total_iocbq_bufs; 422 uint32_t total_iocbq_bufs;
423 spinlock_t hbalock;
373 424
374 /* pci_mem_pools */ 425 /* pci_mem_pools */
375 struct pci_pool *lpfc_scsi_dma_buf_pool; 426 struct pci_pool *lpfc_scsi_dma_buf_pool;
@@ -380,21 +431,33 @@ struct lpfc_hba {
380 mempool_t *nlp_mem_pool; 431 mempool_t *nlp_mem_pool;
381 432
382 struct fc_host_statistics link_stats; 433 struct fc_host_statistics link_stats;
434 struct list_head port_list;
435 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
383}; 436};
384 437
438static inline struct Scsi_Host *
439lpfc_shost_from_vport(struct lpfc_vport *vport)
440{
441 return container_of((void *) vport, struct Scsi_Host, hostdata[0]);
442}
443
385static inline void 444static inline void
386lpfc_set_loopback_flag(struct lpfc_hba *phba) { 445lpfc_set_loopback_flag(struct lpfc_hba *phba)
446{
387 if (phba->cfg_topology == FLAGS_LOCAL_LB) 447 if (phba->cfg_topology == FLAGS_LOCAL_LB)
388 phba->fc_flag |= FC_LOOPBACK_MODE; 448 phba->link_flag |= LS_LOOPBACK_MODE;
389 else 449 else
390 phba->fc_flag &= ~FC_LOOPBACK_MODE; 450 phba->link_flag &= ~LS_LOOPBACK_MODE;
451}
452
453static inline int
454lpfc_is_link_up(struct lpfc_hba *phba)
455{
456 return phba->link_state == LPFC_LINK_UP ||
457 phba->link_state == LPFC_CLEAR_LA;
391} 458}
392 459
393struct rnidrsp { 460
394 void *buf;
395 uint32_t uniqueid;
396 struct list_head list;
397 uint32_t data;
398};
399 461
400#define FC_REG_DUMP_EVENT 0x10 /* Register for Dump events */ 462#define FC_REG_DUMP_EVENT 0x10 /* Register for Dump events */
463