diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli4.h')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 146 |
1 files changed, 114 insertions, 32 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index b5f4ba1a5c27..4a35e7b9bc5b 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -22,13 +22,17 @@ | |||
22 | #define LPFC_RELEASE_NOTIFICATION_INTERVAL 32 | 22 | #define LPFC_RELEASE_NOTIFICATION_INTERVAL 32 |
23 | #define LPFC_GET_QE_REL_INT 32 | 23 | #define LPFC_GET_QE_REL_INT 32 |
24 | #define LPFC_RPI_LOW_WATER_MARK 10 | 24 | #define LPFC_RPI_LOW_WATER_MARK 10 |
25 | |||
26 | /* Amount of time in seconds for waiting FCF rediscovery to complete */ | ||
27 | #define LPFC_FCF_REDISCOVER_WAIT_TMO 2000 /* msec */ | ||
28 | |||
25 | /* Number of SGL entries can be posted in a 4KB nonembedded mbox command */ | 29 | /* Number of SGL entries can be posted in a 4KB nonembedded mbox command */ |
26 | #define LPFC_NEMBED_MBOX_SGL_CNT 254 | 30 | #define LPFC_NEMBED_MBOX_SGL_CNT 254 |
27 | 31 | ||
28 | /* Multi-queue arrangement for fast-path FCP work queues */ | 32 | /* Multi-queue arrangement for fast-path FCP work queues */ |
29 | #define LPFC_FN_EQN_MAX 8 | 33 | #define LPFC_FN_EQN_MAX 8 |
30 | #define LPFC_SP_EQN_DEF 1 | 34 | #define LPFC_SP_EQN_DEF 1 |
31 | #define LPFC_FP_EQN_DEF 1 | 35 | #define LPFC_FP_EQN_DEF 4 |
32 | #define LPFC_FP_EQN_MIN 1 | 36 | #define LPFC_FP_EQN_MIN 1 |
33 | #define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF) | 37 | #define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF) |
34 | 38 | ||
@@ -58,6 +62,16 @@ | |||
58 | #define LPFC_FCOE_FKA_ADV_PER 0 | 62 | #define LPFC_FCOE_FKA_ADV_PER 0 |
59 | #define LPFC_FCOE_FIP_PRIORITY 0x80 | 63 | #define LPFC_FCOE_FIP_PRIORITY 0x80 |
60 | 64 | ||
65 | #define sli4_sid_from_fc_hdr(fc_hdr) \ | ||
66 | ((fc_hdr)->fh_s_id[0] << 16 | \ | ||
67 | (fc_hdr)->fh_s_id[1] << 8 | \ | ||
68 | (fc_hdr)->fh_s_id[2]) | ||
69 | |||
70 | #define sli4_fctl_from_fc_hdr(fc_hdr) \ | ||
71 | ((fc_hdr)->fh_f_ctl[0] << 16 | \ | ||
72 | (fc_hdr)->fh_f_ctl[1] << 8 | \ | ||
73 | (fc_hdr)->fh_f_ctl[2]) | ||
74 | |||
61 | enum lpfc_sli4_queue_type { | 75 | enum lpfc_sli4_queue_type { |
62 | LPFC_EQ, | 76 | LPFC_EQ, |
63 | LPFC_GCQ, | 77 | LPFC_GCQ, |
@@ -110,44 +124,56 @@ struct lpfc_queue { | |||
110 | union sli4_qe qe[1]; /* array to index entries (must be last) */ | 124 | union sli4_qe qe[1]; /* array to index entries (must be last) */ |
111 | }; | 125 | }; |
112 | 126 | ||
113 | struct lpfc_cq_event { | ||
114 | struct list_head list; | ||
115 | union { | ||
116 | struct lpfc_mcqe mcqe_cmpl; | ||
117 | struct lpfc_acqe_link acqe_link; | ||
118 | struct lpfc_acqe_fcoe acqe_fcoe; | ||
119 | struct lpfc_acqe_dcbx acqe_dcbx; | ||
120 | struct lpfc_rcqe rcqe_cmpl; | ||
121 | struct sli4_wcqe_xri_aborted wcqe_axri; | ||
122 | } cqe; | ||
123 | }; | ||
124 | |||
125 | struct lpfc_sli4_link { | 127 | struct lpfc_sli4_link { |
126 | uint8_t speed; | 128 | uint8_t speed; |
127 | uint8_t duplex; | 129 | uint8_t duplex; |
128 | uint8_t status; | 130 | uint8_t status; |
129 | uint8_t physical; | 131 | uint8_t physical; |
130 | uint8_t fault; | 132 | uint8_t fault; |
133 | uint16_t logical_speed; | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | struct lpfc_fcf { | 136 | struct lpfc_fcf_rec { |
134 | uint8_t fabric_name[8]; | 137 | uint8_t fabric_name[8]; |
135 | uint8_t switch_name[8]; | 138 | uint8_t switch_name[8]; |
136 | uint8_t mac_addr[6]; | 139 | uint8_t mac_addr[6]; |
137 | uint16_t fcf_indx; | 140 | uint16_t fcf_indx; |
141 | uint32_t priority; | ||
142 | uint16_t vlan_id; | ||
143 | uint32_t addr_mode; | ||
144 | uint32_t flag; | ||
145 | #define BOOT_ENABLE 0x01 | ||
146 | #define RECORD_VALID 0x02 | ||
147 | }; | ||
148 | |||
149 | struct lpfc_fcf { | ||
138 | uint16_t fcfi; | 150 | uint16_t fcfi; |
139 | uint32_t fcf_flag; | 151 | uint32_t fcf_flag; |
140 | #define FCF_AVAILABLE 0x01 /* FCF available for discovery */ | 152 | #define FCF_AVAILABLE 0x01 /* FCF available for discovery */ |
141 | #define FCF_REGISTERED 0x02 /* FCF registered with FW */ | 153 | #define FCF_REGISTERED 0x02 /* FCF registered with FW */ |
142 | #define FCF_DISCOVERED 0x04 /* FCF discovery started */ | 154 | #define FCF_SCAN_DONE 0x04 /* FCF table scan done */ |
143 | #define FCF_BOOT_ENABLE 0x08 /* Boot bios use this FCF */ | 155 | #define FCF_IN_USE 0x08 /* Atleast one discovery completed */ |
144 | #define FCF_IN_USE 0x10 /* Atleast one discovery completed */ | 156 | #define FCF_INIT_DISC 0x10 /* Initial FCF discovery */ |
145 | #define FCF_VALID_VLAN 0x20 /* Use the vlan id specified */ | 157 | #define FCF_DEAD_DISC 0x20 /* FCF DEAD fast FCF failover discovery */ |
146 | uint32_t priority; | 158 | #define FCF_ACVL_DISC 0x40 /* All CVL fast FCF failover discovery */ |
159 | #define FCF_DISCOVERY (FCF_INIT_DISC | FCF_DEAD_DISC | FCF_ACVL_DISC) | ||
160 | #define FCF_REDISC_PEND 0x80 /* FCF rediscovery pending */ | ||
161 | #define FCF_REDISC_EVT 0x100 /* FCF rediscovery event to worker thread */ | ||
162 | #define FCF_REDISC_FOV 0x200 /* Post FCF rediscovery fast failover */ | ||
147 | uint32_t addr_mode; | 163 | uint32_t addr_mode; |
148 | uint16_t vlan_id; | 164 | uint16_t fcf_rr_init_indx; |
165 | struct lpfc_fcf_rec current_rec; | ||
166 | struct lpfc_fcf_rec failover_rec; | ||
167 | struct timer_list redisc_wait; | ||
168 | unsigned long *fcf_rr_bmask; /* Eligible FCF indexes for RR failover */ | ||
149 | }; | 169 | }; |
150 | 170 | ||
171 | /* | ||
172 | * Maximum FCF table index, it is for driver internal book keeping, it | ||
173 | * just needs to be no less than the supported HBA's FCF table size. | ||
174 | */ | ||
175 | #define LPFC_SLI4_FCF_TBL_INDX_MAX 32 | ||
176 | |||
151 | #define LPFC_REGION23_SIGNATURE "RG23" | 177 | #define LPFC_REGION23_SIGNATURE "RG23" |
152 | #define LPFC_REGION23_VERSION 1 | 178 | #define LPFC_REGION23_VERSION 1 |
153 | #define LPFC_REGION23_LAST_REC 0xff | 179 | #define LPFC_REGION23_LAST_REC 0xff |
@@ -166,7 +192,7 @@ struct lpfc_fip_param_hdr { | |||
166 | #define lpfc_fip_param_hdr_fipp_mode_SHIFT 6 | 192 | #define lpfc_fip_param_hdr_fipp_mode_SHIFT 6 |
167 | #define lpfc_fip_param_hdr_fipp_mode_MASK 0x3 | 193 | #define lpfc_fip_param_hdr_fipp_mode_MASK 0x3 |
168 | #define lpfc_fip_param_hdr_fipp_mode_WORD parm_flags | 194 | #define lpfc_fip_param_hdr_fipp_mode_WORD parm_flags |
169 | #define FIPP_MODE_ON 0x2 | 195 | #define FIPP_MODE_ON 0x1 |
170 | #define FIPP_MODE_OFF 0x0 | 196 | #define FIPP_MODE_OFF 0x0 |
171 | #define FIPP_VLAN_VALID 0x1 | 197 | #define FIPP_VLAN_VALID 0x1 |
172 | }; | 198 | }; |
@@ -250,7 +276,10 @@ struct lpfc_bmbx { | |||
250 | #define SLI4_CT_VFI 2 | 276 | #define SLI4_CT_VFI 2 |
251 | #define SLI4_CT_FCFI 3 | 277 | #define SLI4_CT_FCFI 3 |
252 | 278 | ||
253 | #define LPFC_SLI4_MAX_SEGMENT_SIZE 0x10000 | 279 | #define LPFC_SLI4_FL1_MAX_SEGMENT_SIZE 0x10000 |
280 | #define LPFC_SLI4_FL1_MAX_BUF_SIZE 0X2000 | ||
281 | #define LPFC_SLI4_MIN_BUF_SIZE 0x400 | ||
282 | #define LPFC_SLI4_MAX_BUF_SIZE 0x20000 | ||
254 | 283 | ||
255 | /* | 284 | /* |
256 | * SLI4 specific data structures | 285 | * SLI4 specific data structures |
@@ -284,6 +313,42 @@ struct lpfc_fcp_eq_hdl { | |||
284 | struct lpfc_hba *phba; | 313 | struct lpfc_hba *phba; |
285 | }; | 314 | }; |
286 | 315 | ||
316 | /* Port Capabilities for SLI4 Parameters */ | ||
317 | struct lpfc_pc_sli4_params { | ||
318 | uint32_t supported; | ||
319 | uint32_t if_type; | ||
320 | uint32_t sli_rev; | ||
321 | uint32_t sli_family; | ||
322 | uint32_t featurelevel_1; | ||
323 | uint32_t featurelevel_2; | ||
324 | uint32_t proto_types; | ||
325 | #define LPFC_SLI4_PROTO_FCOE 0x0000001 | ||
326 | #define LPFC_SLI4_PROTO_FC 0x0000002 | ||
327 | #define LPFC_SLI4_PROTO_NIC 0x0000004 | ||
328 | #define LPFC_SLI4_PROTO_ISCSI 0x0000008 | ||
329 | #define LPFC_SLI4_PROTO_RDMA 0x0000010 | ||
330 | uint32_t sge_supp_len; | ||
331 | uint32_t if_page_sz; | ||
332 | uint32_t rq_db_window; | ||
333 | uint32_t loopbk_scope; | ||
334 | uint32_t eq_pages_max; | ||
335 | uint32_t eqe_size; | ||
336 | uint32_t cq_pages_max; | ||
337 | uint32_t cqe_size; | ||
338 | uint32_t mq_pages_max; | ||
339 | uint32_t mqe_size; | ||
340 | uint32_t mq_elem_cnt; | ||
341 | uint32_t wq_pages_max; | ||
342 | uint32_t wqe_size; | ||
343 | uint32_t rq_pages_max; | ||
344 | uint32_t rqe_size; | ||
345 | uint32_t hdr_pages_max; | ||
346 | uint32_t hdr_size; | ||
347 | uint32_t hdr_pp_align; | ||
348 | uint32_t sgl_pages_max; | ||
349 | uint32_t sgl_pp_align; | ||
350 | }; | ||
351 | |||
287 | /* SLI4 HBA data structure entries */ | 352 | /* SLI4 HBA data structure entries */ |
288 | struct lpfc_sli4_hba { | 353 | struct lpfc_sli4_hba { |
289 | void __iomem *conf_regs_memmap_p; /* Kernel memory mapped address for | 354 | void __iomem *conf_regs_memmap_p; /* Kernel memory mapped address for |
@@ -295,10 +360,9 @@ struct lpfc_sli4_hba { | |||
295 | /* BAR0 PCI config space register memory map */ | 360 | /* BAR0 PCI config space register memory map */ |
296 | void __iomem *UERRLOregaddr; /* Address to UERR_STATUS_LO register */ | 361 | void __iomem *UERRLOregaddr; /* Address to UERR_STATUS_LO register */ |
297 | void __iomem *UERRHIregaddr; /* Address to UERR_STATUS_HI register */ | 362 | void __iomem *UERRHIregaddr; /* Address to UERR_STATUS_HI register */ |
298 | void __iomem *ONLINE0regaddr; /* Address to components of internal UE */ | 363 | void __iomem *UEMASKLOregaddr; /* Address to UE_MASK_LO register */ |
299 | void __iomem *ONLINE1regaddr; /* Address to components of internal UE */ | 364 | void __iomem *UEMASKHIregaddr; /* Address to UE_MASK_HI register */ |
300 | #define LPFC_ONLINE_NERR 0xFFFFFFFF | 365 | void __iomem *SLIINTFregaddr; /* Address to SLI_INTF register */ |
301 | void __iomem *SCRATCHPADregaddr; /* Address to scratchpad register */ | ||
302 | /* BAR1 FCoE function CSR register memory map */ | 366 | /* BAR1 FCoE function CSR register memory map */ |
303 | void __iomem *STAregaddr; /* Address to HST_STATE register */ | 367 | void __iomem *STAregaddr; /* Address to HST_STATE register */ |
304 | void __iomem *ISRregaddr; /* Address to HST_ISR register */ | 368 | void __iomem *ISRregaddr; /* Address to HST_ISR register */ |
@@ -311,6 +375,10 @@ struct lpfc_sli4_hba { | |||
311 | void __iomem *MQDBregaddr; /* Address to MQ_DOORBELL register */ | 375 | void __iomem *MQDBregaddr; /* Address to MQ_DOORBELL register */ |
312 | void __iomem *BMBXregaddr; /* Address to BootStrap MBX register */ | 376 | void __iomem *BMBXregaddr; /* Address to BootStrap MBX register */ |
313 | 377 | ||
378 | uint32_t ue_mask_lo; | ||
379 | uint32_t ue_mask_hi; | ||
380 | struct lpfc_register sli_intf; | ||
381 | struct lpfc_pc_sli4_params pc_sli4_params; | ||
314 | struct msix_entry *msix_entries; | 382 | struct msix_entry *msix_entries; |
315 | uint32_t cfg_eqn; | 383 | uint32_t cfg_eqn; |
316 | struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */ | 384 | struct lpfc_fcp_eq_hdl *fcp_eq_hdl; /* FCP per-WQ handle */ |
@@ -325,7 +393,6 @@ struct lpfc_sli4_hba { | |||
325 | struct lpfc_queue **fcp_cq;/* Fast-path FCP compl queue */ | 393 | struct lpfc_queue **fcp_cq;/* Fast-path FCP compl queue */ |
326 | struct lpfc_queue *mbx_cq; /* Slow-path mailbox complete queue */ | 394 | struct lpfc_queue *mbx_cq; /* Slow-path mailbox complete queue */ |
327 | struct lpfc_queue *els_cq; /* Slow-path ELS response complete queue */ | 395 | struct lpfc_queue *els_cq; /* Slow-path ELS response complete queue */ |
328 | struct lpfc_queue *rxq_cq; /* Slow-path unsolicited complete queue */ | ||
329 | 396 | ||
330 | /* Setup information for various queue parameters */ | 397 | /* Setup information for various queue parameters */ |
331 | int eq_esize; | 398 | int eq_esize; |
@@ -360,7 +427,7 @@ struct lpfc_sli4_hba { | |||
360 | unsigned long *rpi_bmask; | 427 | unsigned long *rpi_bmask; |
361 | uint16_t rpi_count; | 428 | uint16_t rpi_count; |
362 | struct lpfc_sli4_flags sli4_flags; | 429 | struct lpfc_sli4_flags sli4_flags; |
363 | struct list_head sp_rspiocb_work_queue; | 430 | struct list_head sp_queue_event; |
364 | struct list_head sp_cqe_event_pool; | 431 | struct list_head sp_cqe_event_pool; |
365 | struct list_head sp_asynce_work_queue; | 432 | struct list_head sp_asynce_work_queue; |
366 | struct list_head sp_fcp_xri_aborted_work_queue; | 433 | struct list_head sp_fcp_xri_aborted_work_queue; |
@@ -376,11 +443,18 @@ enum lpfc_sge_type { | |||
376 | SCSI_BUFF_TYPE | 443 | SCSI_BUFF_TYPE |
377 | }; | 444 | }; |
378 | 445 | ||
446 | enum lpfc_sgl_state { | ||
447 | SGL_FREED, | ||
448 | SGL_ALLOCATED, | ||
449 | SGL_XRI_ABORTED | ||
450 | }; | ||
451 | |||
379 | struct lpfc_sglq { | 452 | struct lpfc_sglq { |
380 | /* lpfc_sglqs are used in double linked lists */ | 453 | /* lpfc_sglqs are used in double linked lists */ |
381 | struct list_head list; | 454 | struct list_head list; |
382 | struct list_head clist; | 455 | struct list_head clist; |
383 | enum lpfc_sge_type buff_type; /* is this a scsi sgl */ | 456 | enum lpfc_sge_type buff_type; /* is this a scsi sgl */ |
457 | enum lpfc_sgl_state state; | ||
384 | uint16_t iotag; /* pre-assigned IO tag */ | 458 | uint16_t iotag; /* pre-assigned IO tag */ |
385 | uint16_t sli4_xritag; /* pre-assigned XRI, (OXID) tag. */ | 459 | uint16_t sli4_xritag; /* pre-assigned XRI, (OXID) tag. */ |
386 | struct sli4_sge *sgl; /* pre-assigned SGL */ | 460 | struct sli4_sge *sgl; /* pre-assigned SGL */ |
@@ -408,6 +482,8 @@ void lpfc_sli4_mbox_cmd_free(struct lpfc_hba *, struct lpfcMboxq *); | |||
408 | void lpfc_sli4_mbx_sge_set(struct lpfcMboxq *, uint32_t, dma_addr_t, uint32_t); | 482 | void lpfc_sli4_mbx_sge_set(struct lpfcMboxq *, uint32_t, dma_addr_t, uint32_t); |
409 | void lpfc_sli4_mbx_sge_get(struct lpfcMboxq *, uint32_t, | 483 | void lpfc_sli4_mbx_sge_get(struct lpfcMboxq *, uint32_t, |
410 | struct lpfc_mbx_sge *); | 484 | struct lpfc_mbx_sge *); |
485 | int lpfc_sli4_mbx_read_fcf_rec(struct lpfc_hba *, struct lpfcMboxq *, | ||
486 | uint16_t); | ||
411 | 487 | ||
412 | void lpfc_sli4_hba_reset(struct lpfc_hba *); | 488 | void lpfc_sli4_hba_reset(struct lpfc_hba *); |
413 | struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t, | 489 | struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t, |
@@ -450,6 +526,7 @@ int lpfc_sli4_alloc_rpi(struct lpfc_hba *); | |||
450 | void lpfc_sli4_free_rpi(struct lpfc_hba *, int); | 526 | void lpfc_sli4_free_rpi(struct lpfc_hba *, int); |
451 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); | 527 | void lpfc_sli4_remove_rpis(struct lpfc_hba *); |
452 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); | 528 | void lpfc_sli4_async_event_proc(struct lpfc_hba *); |
529 | void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); | ||
453 | int lpfc_sli4_resume_rpi(struct lpfc_nodelist *); | 530 | int lpfc_sli4_resume_rpi(struct lpfc_nodelist *); |
454 | void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *); | 531 | void lpfc_sli4_fcp_xri_abort_event_proc(struct lpfc_hba *); |
455 | void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *); | 532 | void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *); |
@@ -465,8 +542,13 @@ int lpfc_sli4_init_vpi(struct lpfc_hba *, uint16_t); | |||
465 | uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool); | 542 | uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool); |
466 | uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool); | 543 | uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool); |
467 | void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t); | 544 | void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t); |
468 | int lpfc_sli4_read_fcf_record(struct lpfc_hba *, uint16_t); | 545 | int lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *, uint16_t); |
469 | void lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *, LPFC_MBOXQ_t *); | 546 | int lpfc_sli4_fcf_rr_read_fcf_rec(struct lpfc_hba *, uint16_t); |
547 | int lpfc_sli4_read_fcf_rec(struct lpfc_hba *, uint16_t); | ||
548 | void lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *); | ||
549 | void lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *); | ||
550 | void lpfc_mbx_cmpl_read_fcf_rec(struct lpfc_hba *, LPFC_MBOXQ_t *); | ||
551 | int lpfc_sli4_unregister_fcf(struct lpfc_hba *); | ||
470 | int lpfc_sli4_post_status_check(struct lpfc_hba *); | 552 | int lpfc_sli4_post_status_check(struct lpfc_hba *); |
471 | uint8_t lpfc_sli4_mbox_opcode_get(struct lpfc_hba *, struct lpfcMboxq *); | 553 | uint8_t lpfc_sli4_mbox_opcode_get(struct lpfc_hba *, struct lpfcMboxq *); |
472 | 554 | ||