diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-06-17 20:56:37 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-17 23:06:27 -0400 |
commit | ed957684294618602b48f1950b0c9bbcb036583f (patch) | |
tree | 4e88dbb2e55013f973ad94099e2963dd507ea719 /drivers/scsi | |
parent | 2e0fef85e098f6794956b8b80b111179fbb4cbb7 (diff) |
[SCSI] lpfc: NPIV: add SLI-3 interface
NPIV support is only available via new adapter interface extensions,
termed SLI-3. This interface changes some of the basic behaviors such
as command and response ring element sizes and data structures, as
well as a change in buffer posting. Note: the new firmware extensions
are found only on our mid-range and enterprise 4Gig adapters - so NPIV
support is available only on these newer adapters. The latest firmware
can be downloaded from the Emulex support page.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 35 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 14 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 183 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 273 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 79 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw.h | 397 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 68 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 176 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 29 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 36 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 698 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.h | 25 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_version.h | 2 |
14 files changed, 1522 insertions, 495 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 8d718964f281..74f4d18842cc 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -63,6 +63,11 @@ struct lpfc_dma_pool { | |||
63 | uint32_t current_count; | 63 | uint32_t current_count; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | struct hbq_dmabuf { | ||
67 | struct lpfc_dmabuf dbuf; | ||
68 | uint32_t tag; | ||
69 | }; | ||
70 | |||
66 | /* Priority bit. Set value to exceed low water mark in lpfc_mem. */ | 71 | /* Priority bit. Set value to exceed low water mark in lpfc_mem. */ |
67 | #define MEM_PRI 0x100 | 72 | #define MEM_PRI 0x100 |
68 | 73 | ||
@@ -276,8 +281,25 @@ struct lpfc_vport { | |||
276 | 281 | ||
277 | }; | 282 | }; |
278 | 283 | ||
284 | |||
285 | struct hbq_s { | ||
286 | uint16_t entry_count; /* Current number of HBQ slots */ | ||
287 | uint32_t next_hbqPutIdx; /* Index to next HBQ slot to use */ | ||
288 | uint32_t hbqPutIdx; /* HBQ slot to use */ | ||
289 | uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */ | ||
290 | }; | ||
291 | |||
292 | #define MAX_HBQS 16 | ||
293 | |||
279 | struct lpfc_hba { | 294 | struct lpfc_hba { |
280 | struct lpfc_sli sli; | 295 | struct lpfc_sli sli; |
296 | uint32_t sli_rev; /* SLI2 or SLI3 */ | ||
297 | uint32_t sli3_options; /* Mask of enabled SLI3 options */ | ||
298 | #define LPFC_SLI3_ENABLED 0x01 | ||
299 | #define LPFC_SLI3_HBQ_ENABLED 0x02 | ||
300 | #define LPFC_SLI3_INB_ENABLED 0x04 | ||
301 | uint32_t iocb_cmd_size; | ||
302 | uint32_t iocb_rsp_size; | ||
281 | 303 | ||
282 | enum hba_state link_state; | 304 | enum hba_state link_state; |
283 | uint32_t link_flag; /* link state flags */ | 305 | uint32_t link_flag; /* link state flags */ |
@@ -286,8 +308,6 @@ struct lpfc_hba { | |||
286 | /* INIT_LINK mailbox command */ | 308 | /* INIT_LINK mailbox command */ |
287 | #define LS_IGNORE_ERATT 0x80000 /* intr handler should ignore ERATT */ | 309 | #define LS_IGNORE_ERATT 0x80000 /* intr handler should ignore ERATT */ |
288 | 310 | ||
289 | uint32_t pgpOffset; /* PGP offset within host memory */ | ||
290 | |||
291 | struct lpfc_sli2_slim *slim2p; | 311 | struct lpfc_sli2_slim *slim2p; |
292 | struct lpfc_dmabuf hbqslimp; | 312 | struct lpfc_dmabuf hbqslimp; |
293 | 313 | ||
@@ -371,6 +391,12 @@ struct lpfc_hba { | |||
371 | wait_queue_head_t *work_wait; | 391 | wait_queue_head_t *work_wait; |
372 | struct task_struct *worker_thread; | 392 | struct task_struct *worker_thread; |
373 | 393 | ||
394 | struct hbq_dmabuf *hbq_buffer_pool; | ||
395 | uint32_t hbq_buffer_count; | ||
396 | uint32_t hbq_buff_count; /* Current hbq buffers */ | ||
397 | uint32_t hbq_count; /* Count of configured HBQs */ | ||
398 | struct hbq_s hbqs[MAX_HBQS]; /* local copy of hbq indicies */ | ||
399 | |||
374 | unsigned long pci_bar0_map; /* Physical address for PCI BAR0 */ | 400 | unsigned long pci_bar0_map; /* Physical address for PCI BAR0 */ |
375 | unsigned long pci_bar2_map; /* Physical address for PCI BAR2 */ | 401 | unsigned long pci_bar2_map; /* Physical address for PCI BAR2 */ |
376 | void __iomem *slim_memmap_p; /* Kernel memory mapped address for | 402 | void __iomem *slim_memmap_p; /* Kernel memory mapped address for |
@@ -385,6 +411,10 @@ struct lpfc_hba { | |||
385 | reg */ | 411 | reg */ |
386 | void __iomem *HCregaddr; /* virtual address for host ctl reg */ | 412 | void __iomem *HCregaddr; /* virtual address for host ctl reg */ |
387 | 413 | ||
414 | struct lpfc_hgp __iomem *host_gp; /* Host side get/put pointers */ | ||
415 | uint32_t __iomem *hbq_put; /* Address in SLIM to HBQ put ptrs */ | ||
416 | uint32_t __iomem *hbq_get; /* Address in SLIM to HBQ get ptrs */ | ||
417 | |||
388 | int brd_no; /* FC board number */ | 418 | int brd_no; /* FC board number */ |
389 | 419 | ||
390 | char SerialNumber[32]; /* adapter Serial Number */ | 420 | char SerialNumber[32]; /* adapter Serial Number */ |
@@ -425,6 +455,7 @@ struct lpfc_hba { | |||
425 | /* pci_mem_pools */ | 455 | /* pci_mem_pools */ |
426 | struct pci_pool *lpfc_scsi_dma_buf_pool; | 456 | struct pci_pool *lpfc_scsi_dma_buf_pool; |
427 | struct pci_pool *lpfc_mbuf_pool; | 457 | struct pci_pool *lpfc_mbuf_pool; |
458 | struct pci_pool *lpfc_hbq_pool; | ||
428 | struct lpfc_dma_pool lpfc_mbuf_safety_pool; | 459 | struct lpfc_dma_pool lpfc_mbuf_safety_pool; |
429 | 460 | ||
430 | mempool_t *mbox_mem_pool; | 461 | mempool_t *mbox_mem_pool; |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 0081cffd9280..776930727058 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -138,6 +138,10 @@ void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
138 | LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); | 138 | LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); |
139 | int lpfc_mbox_tmo_val(struct lpfc_hba *, int); | 139 | int lpfc_mbox_tmo_val(struct lpfc_hba *, int); |
140 | 140 | ||
141 | void lpfc_config_hbq(struct lpfc_hba *, struct lpfc_hbq_init *, uint32_t , | ||
142 | LPFC_MBOXQ_t *); | ||
143 | struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t); | ||
144 | |||
141 | int lpfc_mem_alloc(struct lpfc_hba *); | 145 | int lpfc_mem_alloc(struct lpfc_hba *); |
142 | void lpfc_mem_free(struct lpfc_hba *); | 146 | void lpfc_mem_free(struct lpfc_hba *); |
143 | 147 | ||
@@ -172,6 +176,12 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *, | |||
172 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, | 176 | struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *, |
173 | struct lpfc_sli_ring *, | 177 | struct lpfc_sli_ring *, |
174 | dma_addr_t); | 178 | dma_addr_t); |
179 | int lpfc_sli_hbqbuf_fill_hbq(struct lpfc_hba *); | ||
180 | void lpfc_sli_hbqbuf_free(struct lpfc_hba *, void *, dma_addr_t); | ||
181 | void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *); | ||
182 | struct hbq_dmabuf *lpfc_sli_hbqbuf_find(struct lpfc_hba *, uint32_t); | ||
183 | void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *); | ||
184 | int lpfc_sli_hbq_size(void); | ||
175 | int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, | 185 | int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *, |
176 | struct lpfc_iocbq *); | 186 | struct lpfc_iocbq *); |
177 | int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, | 187 | int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t, |
@@ -198,6 +208,9 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba, | |||
198 | struct lpfc_iocbq * cmdiocb, | 208 | struct lpfc_iocbq * cmdiocb, |
199 | struct lpfc_iocbq * rspiocb); | 209 | struct lpfc_iocbq * rspiocb); |
200 | 210 | ||
211 | void *lpfc_hbq_alloc(struct lpfc_hba *, int, dma_addr_t *); | ||
212 | void lpfc_hbq_free(struct lpfc_hba *, void *, dma_addr_t); | ||
213 | |||
201 | void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); | 214 | void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *); |
202 | void __lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t); | 215 | void __lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t); |
203 | void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t); | 216 | void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t); |
@@ -213,6 +226,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *); | |||
213 | extern struct class_device_attribute *lpfc_hba_attrs[]; | 226 | extern struct class_device_attribute *lpfc_hba_attrs[]; |
214 | extern struct scsi_host_template lpfc_template; | 227 | extern struct scsi_host_template lpfc_template; |
215 | extern struct fc_function_template lpfc_transport_functions; | 228 | extern struct fc_function_template lpfc_transport_functions; |
229 | extern int lpfc_sli_mode; | ||
216 | 230 | ||
217 | void lpfc_get_hba_sym_node_name(struct lpfc_hba *phba, uint8_t *symbp); | 231 | void lpfc_get_hba_sym_node_name(struct lpfc_hba *phba, uint8_t *symbp); |
218 | void lpfc_terminate_rport_io(struct fc_rport *); | 232 | void lpfc_terminate_rport_io(struct fc_rport *); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index dc25a53524c4..e8ed5d7ccf9f 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -58,25 +58,66 @@ static char *lpfc_release_version = LPFC_DRIVER_VERSION; | |||
58 | /* | 58 | /* |
59 | * lpfc_ct_unsol_event | 59 | * lpfc_ct_unsol_event |
60 | */ | 60 | */ |
61 | static void | ||
62 | lpfc_ct_unsol_buffer(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq, | ||
63 | struct lpfc_dmabuf *mp, uint32_t size) | ||
64 | { | ||
65 | if (!mp) { | ||
66 | printk(KERN_ERR "%s (%d): Unsolited CT, no buffer, " | ||
67 | "piocbq = %p, status = x%x, mp = %p, size = %d\n", | ||
68 | __FUNCTION__, __LINE__, | ||
69 | piocbq, piocbq->iocb.ulpStatus, mp, size); | ||
70 | } | ||
71 | |||
72 | printk(KERN_ERR "%s (%d): Ignoring unsolicted CT piocbq = %p, " | ||
73 | "buffer = %p, size = %d, status = x%x\n", | ||
74 | __FUNCTION__, __LINE__, | ||
75 | piocbq, mp, size, | ||
76 | piocbq->iocb.ulpStatus); | ||
77 | } | ||
78 | |||
79 | static void | ||
80 | lpfc_ct_ignore_hbq_buffer(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq, | ||
81 | struct hbq_dmabuf *sp, uint32_t size) | ||
82 | { | ||
83 | struct lpfc_dmabuf *mp = NULL; | ||
84 | |||
85 | mp = sp ? &sp->dbuf : NULL; | ||
86 | if (!mp) { | ||
87 | printk(KERN_ERR "%s (%d): Unsolited CT, no " | ||
88 | "HBQ buffer, piocbq = %p, status = x%x\n", | ||
89 | __FUNCTION__, __LINE__, | ||
90 | piocbq, piocbq->iocb.ulpStatus); | ||
91 | } else { | ||
92 | lpfc_ct_unsol_buffer(phba, piocbq, mp, size); | ||
93 | printk(KERN_ERR "%s (%d): Ignoring unsolicted CT " | ||
94 | "piocbq = %p, buffer = %p, size = %d, " | ||
95 | "status = x%x\n", | ||
96 | __FUNCTION__, __LINE__, | ||
97 | piocbq, mp, size, piocbq->iocb.ulpStatus); | ||
98 | } | ||
99 | } | ||
100 | |||
61 | void | 101 | void |
62 | lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 102 | lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
63 | struct lpfc_iocbq *piocbq) | 103 | struct lpfc_iocbq *piocbq) |
64 | { | 104 | { |
65 | 105 | struct lpfc_dmabuf *mp = NULL; | |
66 | struct lpfc_iocbq *next_piocbq; | 106 | struct hbq_dmabuf *sp = NULL; |
67 | struct lpfc_dmabuf *pmbuf = NULL; | ||
68 | struct lpfc_dmabuf *matp = NULL, *next_matp; | ||
69 | uint32_t ctx = 0, size = 0, cnt = 0; | ||
70 | IOCB_t *icmd = &piocbq->iocb; | 107 | IOCB_t *icmd = &piocbq->iocb; |
71 | IOCB_t *save_icmd = icmd; | 108 | int i; |
72 | int i, go_exit = 0; | 109 | struct lpfc_iocbq *iocbq; |
73 | struct list_head head; | 110 | dma_addr_t paddr; |
111 | uint32_t size; | ||
74 | 112 | ||
75 | if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) && | 113 | if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) && |
76 | ((icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING)) { | 114 | ((icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING)) { |
77 | /* Not enough posted buffers; Try posting more buffers */ | 115 | /* Not enough posted buffers; Try posting more buffers */ |
78 | phba->fc_stat.NoRcvBuf++; | 116 | phba->fc_stat.NoRcvBuf++; |
79 | lpfc_post_buffer(phba, pring, 0, 1); | 117 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) |
118 | lpfc_sli_hbqbuf_fill_hbq(phba); | ||
119 | else | ||
120 | lpfc_post_buffer(phba, pring, 0, 1); | ||
80 | return; | 121 | return; |
81 | } | 122 | } |
82 | 123 | ||
@@ -86,62 +127,62 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
86 | if (icmd->ulpBdeCount == 0) | 127 | if (icmd->ulpBdeCount == 0) |
87 | return; | 128 | return; |
88 | 129 | ||
89 | INIT_LIST_HEAD(&head); | 130 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { |
90 | list_add_tail(&head, &piocbq->list); | 131 | list_for_each_entry(iocbq, &piocbq->list, list) { |
91 | 132 | icmd = &iocbq->iocb; | |
92 | list_for_each_entry_safe(piocbq, next_piocbq, &head, list) { | 133 | if (icmd->ulpBdeCount == 0) { |
93 | icmd = &piocbq->iocb; | 134 | printk(KERN_ERR "%s (%d): Unsolited CT, no " |
94 | if (ctx == 0) | 135 | "BDE, iocbq = %p, status = x%x\n", |
95 | ctx = (uint32_t) (icmd->ulpContext); | 136 | __FUNCTION__, __LINE__, |
96 | if (icmd->ulpBdeCount == 0) | 137 | iocbq, iocbq->iocb.ulpStatus); |
97 | continue; | 138 | continue; |
98 | |||
99 | for (i = 0; i < icmd->ulpBdeCount; i++) { | ||
100 | matp = lpfc_sli_ringpostbuf_get(phba, pring, | ||
101 | getPaddr(icmd->un. | ||
102 | cont64[i]. | ||
103 | addrHigh, | ||
104 | icmd->un. | ||
105 | cont64[i]. | ||
106 | addrLow)); | ||
107 | if (!matp) { | ||
108 | /* Insert lpfc log message here */ | ||
109 | lpfc_post_buffer(phba, pring, cnt, 1); | ||
110 | go_exit = 1; | ||
111 | goto ct_unsol_event_exit_piocbq; | ||
112 | } | 139 | } |
113 | 140 | ||
114 | /* Typically for Unsolicited CT requests */ | 141 | size = icmd->un.cont64[0].tus.f.bdeSize; |
115 | if (!pmbuf) { | 142 | sp = lpfc_sli_hbqbuf_find(phba, icmd->un.ulpWord[3]); |
116 | pmbuf = matp; | 143 | if (sp) |
117 | INIT_LIST_HEAD(&pmbuf->list); | 144 | phba->hbq_buff_count--; |
118 | } else | 145 | lpfc_ct_ignore_hbq_buffer(phba, iocbq, sp, size); |
119 | list_add_tail(&matp->list, &pmbuf->list); | 146 | lpfc_sli_free_hbq(phba, sp); |
147 | if (icmd->ulpBdeCount == 2) { | ||
148 | sp = lpfc_sli_hbqbuf_find(phba, | ||
149 | icmd->un.ulpWord[15]); | ||
150 | if (sp) | ||
151 | phba->hbq_buff_count--; | ||
152 | lpfc_ct_ignore_hbq_buffer(phba, iocbq, sp, | ||
153 | size); | ||
154 | lpfc_sli_free_hbq(phba, sp); | ||
155 | } | ||
120 | 156 | ||
121 | size += icmd->un.cont64[i].tus.f.bdeSize; | ||
122 | cnt++; | ||
123 | } | 157 | } |
158 | lpfc_sli_hbqbuf_fill_hbq(phba); | ||
159 | } else { | ||
160 | struct lpfc_iocbq *next; | ||
161 | |||
162 | list_for_each_entry_safe(iocbq, next, &piocbq->list, list) { | ||
163 | icmd = &iocbq->iocb; | ||
164 | if (icmd->ulpBdeCount == 0) { | ||
165 | printk(KERN_ERR "%s (%d): Unsolited CT, no " | ||
166 | "BDE, iocbq = %p, status = x%x\n", | ||
167 | __FUNCTION__, __LINE__, | ||
168 | iocbq, iocbq->iocb.ulpStatus); | ||
169 | continue; | ||
170 | } | ||
124 | 171 | ||
125 | icmd->ulpBdeCount = 0; | 172 | for (i = 0; i < icmd->ulpBdeCount; i++) { |
126 | } | 173 | paddr = getPaddr(icmd->un.cont64[i].addrHigh, |
127 | 174 | icmd->un.cont64[i].addrLow); | |
128 | lpfc_post_buffer(phba, pring, cnt, 1); | 175 | mp = lpfc_sli_ringpostbuf_get(phba, pring, |
129 | if (save_icmd->ulpStatus) { | 176 | paddr); |
130 | go_exit = 1; | 177 | size = icmd->un.cont64[i].tus.f.bdeSize; |
131 | } | 178 | lpfc_ct_unsol_buffer(phba, piocbq, mp, size); |
132 | 179 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | |
133 | ct_unsol_event_exit_piocbq: | 180 | kfree(mp); |
134 | list_del(&head); | 181 | } |
135 | if (pmbuf) { | 182 | list_del(&iocbq->list); |
136 | list_for_each_entry_safe(matp, next_matp, &pmbuf->list, list) { | 183 | lpfc_sli_release_iocbq(phba, iocbq); |
137 | lpfc_mbuf_free(phba, matp->virt, matp->phys); | ||
138 | list_del(&matp->list); | ||
139 | kfree(matp); | ||
140 | } | 184 | } |
141 | lpfc_mbuf_free(phba, pmbuf->virt, pmbuf->phys); | ||
142 | kfree(pmbuf); | ||
143 | } | 185 | } |
144 | return; | ||
145 | } | 186 | } |
146 | 187 | ||
147 | static void | 188 | static void |
@@ -364,9 +405,7 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) | |||
364 | vport->fc_flag, | 405 | vport->fc_flag, |
365 | vport->fc_rscn_id_cnt); | 406 | vport->fc_rscn_id_cnt); |
366 | } else { | 407 | } else { |
367 | lpfc_printf_log(phba, | 408 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
368 | KERN_INFO, | ||
369 | LOG_DISCOVERY, | ||
370 | "%d:0239 Skip x%x NameServer " | 409 | "%d:0239 Skip x%x NameServer " |
371 | "Rsp Data: x%x x%x x%x\n", | 410 | "Rsp Data: x%x x%x x%x\n", |
372 | phba->brd_no, | 411 | phba->brd_no, |
@@ -717,12 +756,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
717 | ndlp = lpfc_findnode_did(vport, FDMI_DID); | 756 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
718 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 757 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
719 | /* FDMI rsp failed */ | 758 | /* FDMI rsp failed */ |
720 | lpfc_printf_log(phba, | 759 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
721 | KERN_INFO, | 760 | "%d:0220 FDMI rsp failed Data: x%x\n", |
722 | LOG_DISCOVERY, | 761 | phba->brd_no, be16_to_cpu(fdmi_cmd)); |
723 | "%d:0220 FDMI rsp failed Data: x%x\n", | ||
724 | phba->brd_no, | ||
725 | be16_to_cpu(fdmi_cmd)); | ||
726 | } | 762 | } |
727 | 763 | ||
728 | switch (be16_to_cpu(fdmi_cmd)) { | 764 | switch (be16_to_cpu(fdmi_cmd)) { |
@@ -791,9 +827,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
791 | INIT_LIST_HEAD(&bmp->list); | 827 | INIT_LIST_HEAD(&bmp->list); |
792 | 828 | ||
793 | /* FDMI request */ | 829 | /* FDMI request */ |
794 | lpfc_printf_log(phba, | 830 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
795 | KERN_INFO, | ||
796 | LOG_DISCOVERY, | ||
797 | "%d:0218 FDMI Request Data: x%x x%x x%x\n", | 831 | "%d:0218 FDMI Request Data: x%x x%x x%x\n", |
798 | phba->brd_no, | 832 | phba->brd_no, |
799 | vport->fc_flag, vport->port_state, cmdcode); | 833 | vport->fc_flag, vport->port_state, cmdcode); |
@@ -1120,12 +1154,9 @@ fdmi_cmd_free_mp: | |||
1120 | kfree(mp); | 1154 | kfree(mp); |
1121 | fdmi_cmd_exit: | 1155 | fdmi_cmd_exit: |
1122 | /* Issue FDMI request failed */ | 1156 | /* Issue FDMI request failed */ |
1123 | lpfc_printf_log(phba, | 1157 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
1124 | KERN_INFO, | ||
1125 | LOG_DISCOVERY, | ||
1126 | "%d:0244 Issue FDMI request failed Data: x%x\n", | 1158 | "%d:0244 Issue FDMI request failed Data: x%x\n", |
1127 | phba->brd_no, | 1159 | phba->brd_no, cmdcode); |
1128 | cmdcode); | ||
1129 | return 1; | 1160 | return 1; |
1130 | } | 1161 | } |
1131 | 1162 | ||
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 0af33bead302..d48247b3b654 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -45,9 +45,7 @@ lpfc_els_chk_latt(struct lpfc_vport *vport) | |||
45 | { | 45 | { |
46 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 46 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
47 | struct lpfc_hba *phba = vport->phba; | 47 | struct lpfc_hba *phba = vport->phba; |
48 | LPFC_MBOXQ_t *mbox; | ||
49 | uint32_t ha_copy; | 48 | uint32_t ha_copy; |
50 | int rc; | ||
51 | 49 | ||
52 | if (vport->port_state >= LPFC_VPORT_READY || | 50 | if (vport->port_state >= LPFC_VPORT_READY || |
53 | phba->link_state == LPFC_LINK_DOWN) | 51 | phba->link_state == LPFC_LINK_DOWN) |
@@ -76,20 +74,7 @@ lpfc_els_chk_latt(struct lpfc_vport *vport) | |||
76 | spin_unlock_irq(shost->host_lock); | 74 | spin_unlock_irq(shost->host_lock); |
77 | 75 | ||
78 | if (phba->link_state != LPFC_CLEAR_LA) { | 76 | if (phba->link_state != LPFC_CLEAR_LA) { |
79 | if ((mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL))) { | 77 | lpfc_issue_clear_la(phba, vport); |
80 | phba->link_state = LPFC_CLEAR_LA; | ||
81 | lpfc_clear_la(phba, mbox); | ||
82 | mbox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | ||
83 | mbox->vport = vport; | ||
84 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
85 | __FUNCTION__, __LINE__); | ||
86 | rc = lpfc_sli_issue_mbox(phba, mbox, | ||
87 | (MBX_NOWAIT | MBX_STOP_IOCB)); | ||
88 | if (rc == MBX_NOT_FINISHED) { | ||
89 | mempool_free(mbox, phba->mbox_mem_pool); | ||
90 | phba->link_state = LPFC_HBA_ERROR; | ||
91 | } | ||
92 | } | ||
93 | } | 78 | } |
94 | 79 | ||
95 | return 1; | 80 | return 1; |
@@ -153,8 +138,8 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp, | |||
153 | /* Allocate buffer for Buffer ptr list */ | 138 | /* Allocate buffer for Buffer ptr list */ |
154 | pbuflist = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); | 139 | pbuflist = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); |
155 | if (pbuflist) | 140 | if (pbuflist) |
156 | pbuflist->virt = lpfc_mbuf_alloc(phba, MEM_PRI, | 141 | pbuflist->virt = lpfc_mbuf_alloc(phba, MEM_PRI, |
157 | &pbuflist->phys); | 142 | &pbuflist->phys); |
158 | if (pbuflist == 0 || pbuflist->virt == 0) { | 143 | if (pbuflist == 0 || pbuflist->virt == 0) { |
159 | lpfc_sli_release_iocbq(phba, elsiocb); | 144 | lpfc_sli_release_iocbq(phba, elsiocb); |
160 | lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys); | 145 | lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys); |
@@ -289,6 +274,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
289 | vport->port_state = LPFC_FABRIC_CFG_LINK; | 274 | vport->port_state = LPFC_FABRIC_CFG_LINK; |
290 | lpfc_config_link(phba, mbox); | 275 | lpfc_config_link(phba, mbox); |
291 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 276 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
277 | mbox->vport = vport; | ||
292 | 278 | ||
293 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); | 279 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); |
294 | if (rc == MBX_NOT_FINISHED) | 280 | if (rc == MBX_NOT_FINISHED) |
@@ -364,6 +350,7 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
364 | lpfc_config_link(phba, mbox); | 350 | lpfc_config_link(phba, mbox); |
365 | 351 | ||
366 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 352 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
353 | mbox->vport = vport; | ||
367 | rc = lpfc_sli_issue_mbox(phba, mbox, | 354 | rc = lpfc_sli_issue_mbox(phba, mbox, |
368 | MBX_NOWAIT | MBX_STOP_IOCB); | 355 | MBX_NOWAIT | MBX_STOP_IOCB); |
369 | if (rc == MBX_NOT_FINISHED) { | 356 | if (rc == MBX_NOT_FINISHED) { |
@@ -714,8 +701,10 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
714 | 701 | ||
715 | irsp = &rspiocb->iocb; | 702 | irsp = &rspiocb->iocb; |
716 | ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); | 703 | ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); |
717 | if (!ndlp) | 704 | |
705 | if (!ndlp) { | ||
718 | goto out; | 706 | goto out; |
707 | } | ||
719 | 708 | ||
720 | /* Since ndlp can be freed in the disc state machine, note if this node | 709 | /* Since ndlp can be freed in the disc state machine, note if this node |
721 | * is being used during discovery. | 710 | * is being used during discovery. |
@@ -1110,9 +1099,8 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1110 | /* If we get here, there is nothing left to wait for */ | 1099 | /* If we get here, there is nothing left to wait for */ |
1111 | if (vport->port_state < LPFC_VPORT_READY && | 1100 | if (vport->port_state < LPFC_VPORT_READY && |
1112 | phba->link_state != LPFC_CLEAR_LA) { | 1101 | phba->link_state != LPFC_CLEAR_LA) { |
1113 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | 1102 | if (vport->port_type == LPFC_PHYSICAL_PORT) |
1114 | lpfc_issue_clear_la(phba, vport); | 1103 | lpfc_issue_clear_la(phba, vport); |
1115 | } | ||
1116 | } else { | 1104 | } else { |
1117 | lpfc_rscn_disc(vport); | 1105 | lpfc_rscn_disc(vport); |
1118 | } | 1106 | } |
@@ -1420,6 +1408,27 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry) | |||
1420 | return 0; | 1408 | return 0; |
1421 | } | 1409 | } |
1422 | 1410 | ||
1411 | static void | ||
1412 | lpfc_end_rscn(struct lpfc_vport *vport) | ||
1413 | { | ||
1414 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | ||
1415 | |||
1416 | if (vport->fc_flag & FC_RSCN_MODE) { | ||
1417 | /* | ||
1418 | * Check to see if more RSCNs came in while we were | ||
1419 | * processing this one. | ||
1420 | */ | ||
1421 | if (vport->fc_rscn_id_cnt || | ||
1422 | (vport->fc_flag & FC_RSCN_DISCOVERY) != 0) | ||
1423 | lpfc_els_handle_rscn(vport); | ||
1424 | else { | ||
1425 | spin_lock_irq(shost->host_lock); | ||
1426 | vport->fc_flag &= ~FC_RSCN_MODE; | ||
1427 | spin_unlock_irq(shost->host_lock); | ||
1428 | } | ||
1429 | } | ||
1430 | } | ||
1431 | |||
1423 | void | 1432 | void |
1424 | lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp) | 1433 | lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp) |
1425 | { | 1434 | { |
@@ -1449,24 +1458,7 @@ lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp) | |||
1449 | vport->fc_flag &= ~FC_NDISC_ACTIVE; | 1458 | vport->fc_flag &= ~FC_NDISC_ACTIVE; |
1450 | spin_unlock_irq(shost->host_lock); | 1459 | spin_unlock_irq(shost->host_lock); |
1451 | lpfc_can_disctmo(vport); | 1460 | lpfc_can_disctmo(vport); |
1452 | if (vport->fc_flag & FC_RSCN_MODE) { | 1461 | lpfc_end_rscn(vport); |
1453 | /* | ||
1454 | * Check to see if more RSCNs | ||
1455 | * came in while we were | ||
1456 | * processing this one. | ||
1457 | */ | ||
1458 | if (!vport->fc_rscn_id_cnt && | ||
1459 | !(vport->fc_flag & | ||
1460 | FC_RSCN_DISCOVERY)) { | ||
1461 | spin_lock_irq(shost->host_lock); | ||
1462 | vport->fc_flag &= ~FC_RSCN_MODE; | ||
1463 | spin_unlock_irq( | ||
1464 | shost->host_lock); | ||
1465 | } | ||
1466 | else { | ||
1467 | lpfc_els_handle_rscn(vport); | ||
1468 | } | ||
1469 | } | ||
1470 | } | 1462 | } |
1471 | } | 1463 | } |
1472 | } | 1464 | } |
@@ -1689,6 +1681,9 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
1689 | retry = 0; | 1681 | retry = 0; |
1690 | } | 1682 | } |
1691 | 1683 | ||
1684 | if ((vport->load_flag & FC_UNLOADING) != 0) | ||
1685 | retry = 0; | ||
1686 | |||
1692 | if (retry) { | 1687 | if (retry) { |
1693 | 1688 | ||
1694 | /* Retry ELS command <elsCmd> to remote NPORT <did> */ | 1689 | /* Retry ELS command <elsCmd> to remote NPORT <did> */ |
@@ -2141,9 +2136,7 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, | |||
2141 | 2136 | ||
2142 | cmdsize = sizeof (uint32_t) + sizeof (PRLI); | 2137 | cmdsize = sizeof (uint32_t) + sizeof (PRLI); |
2143 | elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp, | 2138 | elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp, |
2144 | ndlp->nlp_DID, | 2139 | ndlp->nlp_DID, (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK))); |
2145 | (ELS_CMD_ACC | | ||
2146 | (ELS_CMD_PRLI & ~ELS_RSP_MASK))); | ||
2147 | if (!elsiocb) | 2140 | if (!elsiocb) |
2148 | return 1; | 2141 | return 1; |
2149 | 2142 | ||
@@ -2361,8 +2354,12 @@ lpfc_els_flush_rscn(struct lpfc_vport *vport) | |||
2361 | 2354 | ||
2362 | for (i = 0; i < vport->fc_rscn_id_cnt; i++) { | 2355 | for (i = 0; i < vport->fc_rscn_id_cnt; i++) { |
2363 | mp = vport->fc_rscn_id_list[i]; | 2356 | mp = vport->fc_rscn_id_list[i]; |
2364 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 2357 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) |
2365 | kfree(mp); | 2358 | lpfc_sli_hbqbuf_free(phba, mp->virt, mp->phys); |
2359 | else { | ||
2360 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
2361 | kfree(mp); | ||
2362 | } | ||
2366 | vport->fc_rscn_id_list[i] = NULL; | 2363 | vport->fc_rscn_id_list[i] = NULL; |
2367 | } | 2364 | } |
2368 | spin_lock_irq(shost->host_lock); | 2365 | spin_lock_irq(shost->host_lock); |
@@ -2486,9 +2483,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2486 | cmd &= ELS_CMD_MASK; | 2483 | cmd &= ELS_CMD_MASK; |
2487 | 2484 | ||
2488 | /* RSCN received */ | 2485 | /* RSCN received */ |
2489 | lpfc_printf_log(phba, | 2486 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
2490 | KERN_INFO, | ||
2491 | LOG_DISCOVERY, | ||
2492 | "%d:0214 RSCN received Data: x%x x%x x%x x%x\n", | 2487 | "%d:0214 RSCN received Data: x%x x%x x%x x%x\n", |
2493 | phba->brd_no, vport->fc_flag, payload_len, *lp, | 2488 | phba->brd_no, vport->fc_flag, payload_len, *lp, |
2494 | vport->fc_rscn_id_cnt); | 2489 | vport->fc_rscn_id_cnt); |
@@ -2581,9 +2576,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport) | |||
2581 | lpfc_set_disctmo(vport); | 2576 | lpfc_set_disctmo(vport); |
2582 | 2577 | ||
2583 | /* RSCN processed */ | 2578 | /* RSCN processed */ |
2584 | lpfc_printf_log(phba, | 2579 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
2585 | KERN_INFO, | ||
2586 | LOG_DISCOVERY, | ||
2587 | "%d:0215 RSCN processed Data: x%x x%x x%x x%x\n", | 2580 | "%d:0215 RSCN processed Data: x%x x%x x%x x%x\n", |
2588 | phba->brd_no, | 2581 | phba->brd_no, |
2589 | vport->fc_flag, 0, vport->fc_rscn_id_cnt, | 2582 | vport->fc_flag, 0, vport->fc_rscn_id_cnt, |
@@ -2683,6 +2676,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
2683 | phba->cfg_link_speed); | 2676 | phba->cfg_link_speed); |
2684 | mbox->mb.un.varInitLnk.lipsr_AL_PA = 0; | 2677 | mbox->mb.un.varInitLnk.lipsr_AL_PA = 0; |
2685 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 2678 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
2679 | mbox->vport = vport; | ||
2686 | rc = lpfc_sli_issue_mbox | 2680 | rc = lpfc_sli_issue_mbox |
2687 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 2681 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
2688 | lpfc_set_loopback_flag(phba); | 2682 | lpfc_set_loopback_flag(phba); |
@@ -2837,10 +2831,8 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2837 | 2831 | ||
2838 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; | 2832 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; |
2839 | phba->fc_stat.elsXmitACC++; | 2833 | phba->fc_stat.elsXmitACC++; |
2840 | 2834 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) | |
2841 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | ||
2842 | lpfc_els_free_iocb(phba, elsiocb); | 2835 | lpfc_els_free_iocb(phba, elsiocb); |
2843 | } | ||
2844 | return; | 2836 | return; |
2845 | } | 2837 | } |
2846 | 2838 | ||
@@ -3015,9 +3007,7 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3015 | fp = (FARP *) lp; | 3007 | fp = (FARP *) lp; |
3016 | 3008 | ||
3017 | /* FARP-REQ received from DID <did> */ | 3009 | /* FARP-REQ received from DID <did> */ |
3018 | lpfc_printf_log(phba, | 3010 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3019 | KERN_INFO, | ||
3020 | LOG_ELS, | ||
3021 | "%d:0601 FARP-REQ received from DID x%x\n", | 3011 | "%d:0601 FARP-REQ received from DID x%x\n", |
3022 | phba->brd_no, did); | 3012 | phba->brd_no, did); |
3023 | 3013 | ||
@@ -3077,12 +3067,9 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3077 | 3067 | ||
3078 | cmd = *lp++; | 3068 | cmd = *lp++; |
3079 | /* FARP-RSP received from DID <did> */ | 3069 | /* FARP-RSP received from DID <did> */ |
3080 | lpfc_printf_log(phba, | 3070 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3081 | KERN_INFO, | ||
3082 | LOG_ELS, | ||
3083 | "%d:0600 FARP-RSP received from DID x%x\n", | 3071 | "%d:0600 FARP-RSP received from DID x%x\n", |
3084 | phba->brd_no, did); | 3072 | phba->brd_no, did); |
3085 | |||
3086 | /* ACCEPT the Farp resp request */ | 3073 | /* ACCEPT the Farp resp request */ |
3087 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); | 3074 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); |
3088 | 3075 | ||
@@ -3102,8 +3089,9 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
3102 | struct lpfc_hba *phba = vport->phba; | 3089 | struct lpfc_hba *phba = vport->phba; |
3103 | 3090 | ||
3104 | /* FAN received */ | 3091 | /* FAN received */ |
3105 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, "%d:0265 FAN received\n", | 3092 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3106 | phba->brd_no); | 3093 | "%d:0265 FAN received\n", |
3094 | phba->brd_no); | ||
3107 | 3095 | ||
3108 | icmd = &cmdiocb->iocb; | 3096 | icmd = &cmdiocb->iocb; |
3109 | did = icmd->un.elsreq64.remoteID; | 3097 | did = icmd->un.elsreq64.remoteID; |
@@ -3332,79 +3320,40 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) | |||
3332 | return; | 3320 | return; |
3333 | } | 3321 | } |
3334 | 3322 | ||
3335 | void | 3323 | static void |
3336 | lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 3324 | lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
3337 | struct lpfc_iocbq *elsiocb) | 3325 | struct lpfc_vport *vport, struct lpfc_dmabuf *mp, |
3326 | struct lpfc_iocbq *elsiocb) | ||
3338 | { | 3327 | { |
3339 | struct lpfc_sli *psli; | ||
3340 | struct lpfc_nodelist *ndlp; | 3328 | struct lpfc_nodelist *ndlp; |
3341 | struct lpfc_dmabuf *mp = NULL; | ||
3342 | uint32_t *lp; | ||
3343 | IOCB_t *icmd; | ||
3344 | struct ls_rjt stat; | 3329 | struct ls_rjt stat; |
3330 | uint32_t *lp; | ||
3345 | uint32_t cmd, did, newnode, rjt_err = 0; | 3331 | uint32_t cmd, did, newnode, rjt_err = 0; |
3346 | uint32_t drop_cmd = 0; /* by default do NOT drop received cmd */ | 3332 | IOCB_t *icmd = &elsiocb->iocb; |
3347 | struct lpfc_vport *vport = NULL; | ||
3348 | |||
3349 | psli = &phba->sli; | ||
3350 | icmd = &elsiocb->iocb; | ||
3351 | 3333 | ||
3352 | if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) && | 3334 | if (!vport || !mp) |
3353 | ((icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING)) { | ||
3354 | phba->fc_stat.NoRcvBuf++; | ||
3355 | /* Not enough posted buffers; Try posting more buffers */ | ||
3356 | lpfc_post_buffer(phba, pring, 0, 1); | ||
3357 | return; | ||
3358 | } | ||
3359 | |||
3360 | /* If there are no BDEs associated with this IOCB, | ||
3361 | * there is nothing to do. | ||
3362 | */ | ||
3363 | if (icmd->ulpBdeCount == 0) | ||
3364 | return; | ||
3365 | |||
3366 | /* type of ELS cmd is first 32bit word in packet */ | ||
3367 | mp = lpfc_sli_ringpostbuf_get(phba, pring, | ||
3368 | getPaddr(icmd->un.cont64[0].addrHigh, | ||
3369 | icmd->un.cont64[0].addrLow)); | ||
3370 | if (mp == 0) { | ||
3371 | drop_cmd = 1; | ||
3372 | goto dropit; | 3335 | goto dropit; |
3373 | } | ||
3374 | |||
3375 | vport = phba->pport; | ||
3376 | 3336 | ||
3377 | newnode = 0; | 3337 | newnode = 0; |
3378 | lp = (uint32_t *) mp->virt; | 3338 | lp = (uint32_t *) mp->virt; |
3379 | cmd = *lp++; | 3339 | cmd = *lp++; |
3380 | lpfc_post_buffer(phba, &psli->ring[LPFC_ELS_RING], 1, 1); | 3340 | if ((phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) == 0) |
3341 | lpfc_post_buffer(phba, pring, 1, 1); | ||
3381 | 3342 | ||
3382 | if (icmd->ulpStatus) { | 3343 | if (icmd->ulpStatus) |
3383 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3384 | kfree(mp); | ||
3385 | drop_cmd = 1; | ||
3386 | goto dropit; | 3344 | goto dropit; |
3387 | } | ||
3388 | 3345 | ||
3389 | /* Check to see if link went down during discovery */ | 3346 | /* Check to see if link went down during discovery */ |
3390 | if (lpfc_els_chk_latt(vport)) { | 3347 | if (lpfc_els_chk_latt(vport)) |
3391 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3392 | kfree(mp); | ||
3393 | drop_cmd = 1; | ||
3394 | goto dropit; | 3348 | goto dropit; |
3395 | } | ||
3396 | 3349 | ||
3397 | did = icmd->un.rcvels.remoteID; | 3350 | did = icmd->un.rcvels.remoteID; |
3398 | ndlp = lpfc_findnode_did(vport, did); | 3351 | ndlp = lpfc_findnode_did(vport, did); |
3399 | if (!ndlp) { | 3352 | if (!ndlp) { |
3400 | /* Cannot find existing Fabric ndlp, so allocate a new one */ | 3353 | /* Cannot find existing Fabric ndlp, so allocate a new one */ |
3401 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 3354 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
3402 | if (!ndlp) { | 3355 | if (!ndlp) |
3403 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3404 | kfree(mp); | ||
3405 | drop_cmd = 1; | ||
3406 | goto dropit; | 3356 | goto dropit; |
3407 | } | ||
3408 | 3357 | ||
3409 | lpfc_nlp_init(vport, ndlp, did); | 3358 | lpfc_nlp_init(vport, ndlp, did); |
3410 | newnode = 1; | 3359 | newnode = 1; |
@@ -3428,7 +3377,7 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3428 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 3377 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
3429 | "%d:0112 ELS command x%x received from NPORT x%x " | 3378 | "%d:0112 ELS command x%x received from NPORT x%x " |
3430 | "Data: x%x\n", phba->brd_no, cmd, did, | 3379 | "Data: x%x\n", phba->brd_no, cmd, did, |
3431 | vport->port_state); | 3380 | vport->port_state); |
3432 | 3381 | ||
3433 | switch (cmd) { | 3382 | switch (cmd) { |
3434 | case ELS_CMD_PLOGI: | 3383 | case ELS_CMD_PLOGI: |
@@ -3537,8 +3486,9 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3537 | 3486 | ||
3538 | /* Unknown ELS command <elsCmd> received from NPORT <did> */ | 3487 | /* Unknown ELS command <elsCmd> received from NPORT <did> */ |
3539 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3488 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
3540 | "%d:0115 Unknown ELS command x%x received from " | 3489 | "%d:0115 Unknown ELS command x%x " |
3541 | "NPORT x%x\n", phba->brd_no, cmd, did); | 3490 | "received from NPORT x%x\n", |
3491 | phba->brd_no, cmd, did); | ||
3542 | if (newnode) | 3492 | if (newnode) |
3543 | lpfc_drop_node(vport, ndlp); | 3493 | lpfc_drop_node(vport, ndlp); |
3544 | break; | 3494 | break; |
@@ -3553,20 +3503,89 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3553 | lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp); | 3503 | lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp); |
3554 | } | 3504 | } |
3555 | 3505 | ||
3506 | return; | ||
3507 | |||
3508 | dropit: | ||
3509 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | ||
3510 | "%d:0111 Dropping received ELS cmd " | ||
3511 | "Data: x%x x%x x%x\n", | ||
3512 | phba->brd_no, | ||
3513 | icmd->ulpStatus, icmd->un.ulpWord[4], | ||
3514 | icmd->ulpTimeout); | ||
3515 | phba->fc_stat.elsRcvDrop++; | ||
3516 | } | ||
3517 | |||
3518 | |||
3519 | void | ||
3520 | lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | ||
3521 | struct lpfc_iocbq *elsiocb) | ||
3522 | { | ||
3523 | struct lpfc_vport *vport = phba->pport; | ||
3524 | struct lpfc_dmabuf *mp = NULL; | ||
3525 | IOCB_t *icmd = &elsiocb->iocb; | ||
3526 | struct hbq_dmabuf *sp = NULL; | ||
3527 | dma_addr_t paddr; | ||
3528 | |||
3529 | if ((icmd->ulpStatus == IOSTAT_LOCAL_REJECT) && | ||
3530 | ((icmd->un.ulpWord[4] & 0xff) == IOERR_RCV_BUFFER_WAITING)) { | ||
3531 | phba->fc_stat.NoRcvBuf++; | ||
3532 | /* Not enough posted buffers; Try posting more buffers */ | ||
3533 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) | ||
3534 | lpfc_sli_hbqbuf_fill_hbq(phba); | ||
3535 | else | ||
3536 | lpfc_post_buffer(phba, pring, 0, 1); | ||
3537 | return; | ||
3538 | } | ||
3539 | |||
3540 | /* If there are no BDEs associated with this IOCB, | ||
3541 | * there is nothing to do. | ||
3542 | */ | ||
3543 | if (icmd->ulpBdeCount == 0) | ||
3544 | return; | ||
3545 | |||
3546 | /* type of ELS cmd is first 32bit word in packet */ | ||
3547 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { | ||
3548 | paddr = getPaddr(icmd->un.cont64[0].addrHigh, | ||
3549 | icmd->un.cont64[0].addrLow); | ||
3550 | sp = lpfc_sli_hbqbuf_find(phba, icmd->un.ulpWord[3]); | ||
3551 | if (sp) | ||
3552 | phba->hbq_buff_count--; | ||
3553 | mp = sp ? &sp->dbuf : NULL; | ||
3554 | } else { | ||
3555 | paddr = getPaddr(icmd->un.cont64[0].addrHigh, | ||
3556 | icmd->un.cont64[0].addrLow); | ||
3557 | mp = lpfc_sli_ringpostbuf_get(phba, pring, paddr); | ||
3558 | } | ||
3559 | |||
3560 | lpfc_els_unsol_buffer(phba, pring, vport, mp, elsiocb); | ||
3561 | |||
3556 | lpfc_nlp_put(elsiocb->context1); | 3562 | lpfc_nlp_put(elsiocb->context1); |
3557 | elsiocb->context1 = NULL; | 3563 | elsiocb->context1 = NULL; |
3558 | if (elsiocb->context2) { | 3564 | if (elsiocb->context2) { |
3559 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 3565 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) |
3560 | kfree(mp); | 3566 | lpfc_sli_free_hbq(phba, sp); |
3567 | else { | ||
3568 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3569 | kfree(mp); | ||
3570 | } | ||
3561 | } | 3571 | } |
3562 | dropit: | 3572 | |
3563 | /* check if need to drop received ELS cmd */ | 3573 | /* RCV_ELS64_CX provide for 2 BDEs - process 2nd if included */ |
3564 | if (drop_cmd == 1) { | 3574 | if ((phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) != 0 && |
3565 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3575 | icmd->ulpBdeCount == 2) { |
3566 | "%d:0111 Dropping received ELS cmd " | 3576 | sp = lpfc_sli_hbqbuf_find(phba, icmd->un.ulpWord[15]); |
3567 | "Data: x%x x%x x%x\n", phba->brd_no, | 3577 | if (sp) |
3568 | icmd->ulpStatus, icmd->un.ulpWord[4], | 3578 | phba->hbq_buff_count--; |
3569 | icmd->ulpTimeout); | 3579 | mp = sp ? &sp->dbuf : NULL; |
3570 | phba->fc_stat.elsRcvDrop++; | 3580 | lpfc_els_unsol_buffer(phba, pring, vport, mp, elsiocb); |
3581 | /* free mp if we are done with it */ | ||
3582 | if (elsiocb->context2) { | ||
3583 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) | ||
3584 | lpfc_sli_free_hbq(phba, sp); | ||
3585 | else { | ||
3586 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
3587 | kfree(mp); | ||
3588 | } | ||
3589 | } | ||
3571 | } | 3590 | } |
3572 | } | 3591 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index dee875ee6165..20b2a4905daa 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -232,9 +232,9 @@ static void | |||
232 | lpfc_work_done(struct lpfc_hba *phba) | 232 | lpfc_work_done(struct lpfc_hba *phba) |
233 | { | 233 | { |
234 | struct lpfc_sli_ring *pring; | 234 | struct lpfc_sli_ring *pring; |
235 | int i; | ||
236 | uint32_t ha_copy, control, work_port_events; | 235 | uint32_t ha_copy, control, work_port_events; |
237 | struct lpfc_vport *vport; | 236 | struct lpfc_vport *vport; |
237 | int i; | ||
238 | 238 | ||
239 | spin_lock_irq(&phba->hbalock); | 239 | spin_lock_irq(&phba->hbalock); |
240 | ha_copy = phba->work_ha; | 240 | ha_copy = phba->work_ha; |
@@ -303,9 +303,9 @@ check_work_wait_done(struct lpfc_hba *phba) | |||
303 | struct lpfc_vport *vport = phba->pport; | 303 | struct lpfc_vport *vport = phba->pport; |
304 | int rc = 0; | 304 | int rc = 0; |
305 | 305 | ||
306 | |||
307 | if (!vport) | 306 | if (!vport) |
308 | return 0; | 307 | return 0; |
308 | |||
309 | spin_lock_irq(&phba->hbalock); | 309 | spin_lock_irq(&phba->hbalock); |
310 | 310 | ||
311 | if (phba->work_ha || | 311 | if (phba->work_ha || |
@@ -354,6 +354,7 @@ lpfc_workq_post_event(struct lpfc_hba *phba, void *arg1, void *arg2, | |||
354 | uint32_t evt) | 354 | uint32_t evt) |
355 | { | 355 | { |
356 | struct lpfc_work_evt *evtp; | 356 | struct lpfc_work_evt *evtp; |
357 | unsigned long flags; | ||
357 | 358 | ||
358 | /* | 359 | /* |
359 | * All Mailbox completions and LPFC_ELS_RING rcv ring IOCB events will | 360 | * All Mailbox completions and LPFC_ELS_RING rcv ring IOCB events will |
@@ -367,11 +368,11 @@ lpfc_workq_post_event(struct lpfc_hba *phba, void *arg1, void *arg2, | |||
367 | evtp->evt_arg2 = arg2; | 368 | evtp->evt_arg2 = arg2; |
368 | evtp->evt = evt; | 369 | evtp->evt = evt; |
369 | 370 | ||
370 | spin_lock_irq(&phba->hbalock); | 371 | spin_lock_irqsave(&phba->hbalock, flags); |
371 | list_add_tail(&evtp->evt_listp, &phba->work_list); | 372 | list_add_tail(&evtp->evt_listp, &phba->work_list); |
372 | if (phba->work_wait) | 373 | if (phba->work_wait) |
373 | wake_up(phba->work_wait); | 374 | wake_up(phba->work_wait); |
374 | spin_unlock_irq(&phba->hbalock); | 375 | spin_unlock_irqrestore(&phba->hbalock, flags); |
375 | 376 | ||
376 | return 1; | 377 | return 1; |
377 | } | 378 | } |
@@ -401,6 +402,7 @@ lpfc_linkdown(struct lpfc_hba *phba) | |||
401 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 402 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
402 | if (mb) { | 403 | if (mb) { |
403 | lpfc_unreg_did(phba, 0xffffffff, mb); | 404 | lpfc_unreg_did(phba, 0xffffffff, mb); |
405 | mb->vport = vport; | ||
404 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 406 | mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
405 | if (lpfc_sli_issue_mbox(phba, mb, (MBX_NOWAIT | MBX_STOP_IOCB)) | 407 | if (lpfc_sli_issue_mbox(phba, mb, (MBX_NOWAIT | MBX_STOP_IOCB)) |
406 | == MBX_NOT_FINISHED) { | 408 | == MBX_NOT_FINISHED) { |
@@ -433,6 +435,7 @@ lpfc_linkdown(struct lpfc_hba *phba) | |||
433 | if (mb) { | 435 | if (mb) { |
434 | lpfc_config_link(phba, mb); | 436 | lpfc_config_link(phba, mb); |
435 | mb->mbox_cmpl=lpfc_sli_def_mbox_cmpl; | 437 | mb->mbox_cmpl=lpfc_sli_def_mbox_cmpl; |
438 | mb->vport = vport; | ||
436 | if (lpfc_sli_issue_mbox(phba, mb, | 439 | if (lpfc_sli_issue_mbox(phba, mb, |
437 | (MBX_NOWAIT | MBX_STOP_IOCB)) | 440 | (MBX_NOWAIT | MBX_STOP_IOCB)) |
438 | == MBX_NOT_FINISHED) { | 441 | == MBX_NOT_FINISHED) { |
@@ -550,15 +553,11 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
550 | spin_unlock_irq(shost->host_lock); | 553 | spin_unlock_irq(shost->host_lock); |
551 | } | 554 | } |
552 | 555 | ||
553 | printk(KERN_ERR "%s (%d): vport ready\n", | ||
554 | __FUNCTION__, __LINE__); | ||
555 | vport->port_state = LPFC_VPORT_READY; | 556 | vport->port_state = LPFC_VPORT_READY; |
556 | 557 | ||
557 | out: | 558 | out: |
558 | /* Device Discovery completes */ | 559 | /* Device Discovery completes */ |
559 | lpfc_printf_log(phba, | 560 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
560 | KERN_INFO, | ||
561 | LOG_DISCOVERY, | ||
562 | "%d:0225 Device Discovery completes\n", | 561 | "%d:0225 Device Discovery completes\n", |
563 | phba->brd_no); | 562 | phba->brd_no); |
564 | 563 | ||
@@ -632,8 +631,6 @@ out: | |||
632 | phba->brd_no, vport->port_state); | 631 | phba->brd_no, vport->port_state); |
633 | 632 | ||
634 | lpfc_clear_la(phba, pmb); | 633 | lpfc_clear_la(phba, pmb); |
635 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
636 | __FUNCTION__, __LINE__); | ||
637 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | 634 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; |
638 | pmb->vport = vport; | 635 | pmb->vport = vport; |
639 | rc = lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); | 636 | rc = lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); |
@@ -643,8 +640,6 @@ out: | |||
643 | psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 640 | psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
644 | psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 641 | psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
645 | psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 642 | psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
646 | printk(KERN_ERR "%s (%d): vport ready\n", | ||
647 | __FUNCTION__, __LINE__); | ||
648 | vport->port_state = LPFC_VPORT_READY; | 643 | vport->port_state = LPFC_VPORT_READY; |
649 | } | 644 | } |
650 | return; | 645 | return; |
@@ -702,8 +697,6 @@ out: | |||
702 | struct lpfc_sli_ring *next_ring = &psli->ring[psli->next_ring]; | 697 | struct lpfc_sli_ring *next_ring = &psli->ring[psli->next_ring]; |
703 | 698 | ||
704 | lpfc_clear_la(phba, pmb); | 699 | lpfc_clear_la(phba, pmb); |
705 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
706 | __FUNCTION__, __LINE__); | ||
707 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | 700 | pmb->mbox_cmpl = lpfc_mbx_cmpl_clear_la; |
708 | pmb->vport = vport; | 701 | pmb->vport = vport; |
709 | if (lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)) | 702 | if (lpfc_sli_issue_mbox(phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)) |
@@ -713,8 +706,6 @@ out: | |||
713 | extra_ring->flag &= ~LPFC_STOP_IOCB_EVENT; | 706 | extra_ring->flag &= ~LPFC_STOP_IOCB_EVENT; |
714 | fcp_ring->flag &= ~LPFC_STOP_IOCB_EVENT; | 707 | fcp_ring->flag &= ~LPFC_STOP_IOCB_EVENT; |
715 | next_ring->flag &= ~LPFC_STOP_IOCB_EVENT; | 708 | next_ring->flag &= ~LPFC_STOP_IOCB_EVENT; |
716 | printk(KERN_ERR "%s (%d): vport ready\n", | ||
717 | __FUNCTION__, __LINE__); | ||
718 | vport->port_state = LPFC_VPORT_READY; | 709 | vport->port_state = LPFC_VPORT_READY; |
719 | } | 710 | } |
720 | } else { | 711 | } else { |
@@ -875,12 +866,9 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
875 | 866 | ||
876 | /* Check for error */ | 867 | /* Check for error */ |
877 | if (mb->mbxStatus) { | 868 | if (mb->mbxStatus) { |
878 | lpfc_printf_log(phba, | 869 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
879 | KERN_INFO, | ||
880 | LOG_LINK_EVENT, | ||
881 | "%d:1307 READ_LA mbox error x%x state x%x\n", | 870 | "%d:1307 READ_LA mbox error x%x state x%x\n", |
882 | phba->brd_no, | 871 | phba->brd_no, mb->mbxStatus, vport->port_state); |
883 | mb->mbxStatus, vport->port_state); | ||
884 | lpfc_mbx_issue_link_down(phba); | 872 | lpfc_mbx_issue_link_down(phba); |
885 | phba->link_state = LPFC_HBA_ERROR; | 873 | phba->link_state = LPFC_HBA_ERROR; |
886 | goto lpfc_mbx_cmpl_read_la_free_mbuf; | 874 | goto lpfc_mbx_cmpl_read_la_free_mbuf; |
@@ -955,7 +943,6 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
955 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) pmb->context1; | 943 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) pmb->context1; |
956 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2; | 944 | struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) pmb->context2; |
957 | 945 | ||
958 | |||
959 | pmb->context1 = NULL; | 946 | pmb->context1 = NULL; |
960 | 947 | ||
961 | /* Good status, call state machine */ | 948 | /* Good status, call state machine */ |
@@ -1553,6 +1540,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
1553 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1540 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
1554 | if (mbox) { | 1541 | if (mbox) { |
1555 | lpfc_unreg_login(phba, ndlp->nlp_rpi, mbox); | 1542 | lpfc_unreg_login(phba, ndlp->nlp_rpi, mbox); |
1543 | mbox->vport = vport; | ||
1556 | mbox->mbox_cmpl=lpfc_sli_def_mbox_cmpl; | 1544 | mbox->mbox_cmpl=lpfc_sli_def_mbox_cmpl; |
1557 | rc = lpfc_sli_issue_mbox | 1545 | rc = lpfc_sli_issue_mbox |
1558 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 1546 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
@@ -1925,8 +1913,6 @@ lpfc_disc_start(struct lpfc_vport *vport) | |||
1925 | if (vport->port_state < LPFC_VPORT_READY && !clear_la_pending) { | 1913 | if (vport->port_state < LPFC_VPORT_READY && !clear_la_pending) { |
1926 | if (vport->port_type == LPFC_PHYSICAL_PORT) { | 1914 | if (vport->port_type == LPFC_PHYSICAL_PORT) { |
1927 | /* If we get here, there is nothing to ADISC */ | 1915 | /* If we get here, there is nothing to ADISC */ |
1928 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
1929 | __FUNCTION__, __LINE__); | ||
1930 | lpfc_issue_clear_la(phba, vport); | 1916 | lpfc_issue_clear_la(phba, vport); |
1931 | } else if (!(vport->fc_flag & FC_ABORT_DISCOVERY)) { | 1917 | } else if (!(vport->fc_flag & FC_ABORT_DISCOVERY)) { |
1932 | 1918 | ||
@@ -1940,8 +1926,6 @@ lpfc_disc_start(struct lpfc_vport *vport) | |||
1940 | vport->fc_flag &= ~FC_NDISC_ACTIVE; | 1926 | vport->fc_flag &= ~FC_NDISC_ACTIVE; |
1941 | spin_unlock_irq(shost->host_lock); | 1927 | spin_unlock_irq(shost->host_lock); |
1942 | } | 1928 | } |
1943 | printk(KERN_ERR "%s (%d): vport ready\n", | ||
1944 | __FUNCTION__, __LINE__); | ||
1945 | vport->port_state = LPFC_VPORT_READY; | 1929 | vport->port_state = LPFC_VPORT_READY; |
1946 | } | 1930 | } |
1947 | } else { | 1931 | } else { |
@@ -2095,13 +2079,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2095 | if (!(vport->fc_flag & FC_DISC_TMO)) | 2079 | if (!(vport->fc_flag & FC_DISC_TMO)) |
2096 | return; | 2080 | return; |
2097 | 2081 | ||
2098 | |||
2099 | spin_lock_irq(shost->host_lock); | 2082 | spin_lock_irq(shost->host_lock); |
2100 | vport->fc_flag &= ~FC_DISC_TMO; | 2083 | vport->fc_flag &= ~FC_DISC_TMO; |
2101 | spin_unlock_irq(shost->host_lock); | 2084 | spin_unlock_irq(shost->host_lock); |
2102 | 2085 | ||
2103 | printk(KERN_ERR "%s (%d): link_state = %d, port_state = %d\n", | ||
2104 | __FUNCTION__, __LINE__, phba->link_state, vport->port_state); | ||
2105 | switch (vport->port_state) { | 2086 | switch (vport->port_state) { |
2106 | 2087 | ||
2107 | case LPFC_LOCAL_CFG_LINK: | 2088 | case LPFC_LOCAL_CFG_LINK: |
@@ -2109,9 +2090,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2109 | * FAN | 2090 | * FAN |
2110 | */ | 2091 | */ |
2111 | /* FAN timeout */ | 2092 | /* FAN timeout */ |
2112 | lpfc_printf_log(phba, | 2093 | lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY, |
2113 | KERN_WARNING, | ||
2114 | LOG_DISCOVERY, | ||
2115 | "%d:0221 FAN timeout\n", | 2094 | "%d:0221 FAN timeout\n", |
2116 | phba->brd_no); | 2095 | phba->brd_no); |
2117 | 2096 | ||
@@ -2138,9 +2117,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2138 | case LPFC_FLOGI: | 2117 | case LPFC_FLOGI: |
2139 | /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ | 2118 | /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */ |
2140 | /* Initial FLOGI timeout */ | 2119 | /* Initial FLOGI timeout */ |
2141 | lpfc_printf_log(phba, | 2120 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2142 | KERN_ERR, | ||
2143 | LOG_DISCOVERY, | ||
2144 | "%d:0222 Initial FLOGI timeout\n", | 2121 | "%d:0222 Initial FLOGI timeout\n", |
2145 | phba->brd_no); | 2122 | phba->brd_no); |
2146 | 2123 | ||
@@ -2203,8 +2180,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2203 | 2180 | ||
2204 | phba->link_state = LPFC_CLEAR_LA; | 2181 | phba->link_state = LPFC_CLEAR_LA; |
2205 | lpfc_clear_la(phba, clearlambox); | 2182 | lpfc_clear_la(phba, clearlambox); |
2206 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
2207 | __FUNCTION__, __LINE__); | ||
2208 | clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | 2183 | clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; |
2209 | clearlambox->vport = vport; | 2184 | clearlambox->vport = vport; |
2210 | rc = lpfc_sli_issue_mbox(phba, clearlambox, | 2185 | rc = lpfc_sli_issue_mbox(phba, clearlambox, |
@@ -2230,6 +2205,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2230 | lpfc_init_link(phba, initlinkmbox, phba->cfg_topology, | 2205 | lpfc_init_link(phba, initlinkmbox, phba->cfg_topology, |
2231 | phba->cfg_link_speed); | 2206 | phba->cfg_link_speed); |
2232 | initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0; | 2207 | initlinkmbox->mb.un.varInitLnk.lipsr_AL_PA = 0; |
2208 | initlinkmbox->vport = vport; | ||
2233 | rc = lpfc_sli_issue_mbox(phba, initlinkmbox, | 2209 | rc = lpfc_sli_issue_mbox(phba, initlinkmbox, |
2234 | (MBX_NOWAIT | MBX_STOP_IOCB)); | 2210 | (MBX_NOWAIT | MBX_STOP_IOCB)); |
2235 | lpfc_set_loopback_flag(phba); | 2211 | lpfc_set_loopback_flag(phba); |
@@ -2240,9 +2216,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2240 | 2216 | ||
2241 | case LPFC_DISC_AUTH: | 2217 | case LPFC_DISC_AUTH: |
2242 | /* Node Authentication timeout */ | 2218 | /* Node Authentication timeout */ |
2243 | lpfc_printf_log(phba, | 2219 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2244 | KERN_ERR, | ||
2245 | LOG_DISCOVERY, | ||
2246 | "%d:0227 Node Authentication timeout\n", | 2220 | "%d:0227 Node Authentication timeout\n", |
2247 | phba->brd_no); | 2221 | phba->brd_no); |
2248 | lpfc_disc_flush_list(vport); | 2222 | lpfc_disc_flush_list(vport); |
@@ -2259,8 +2233,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2259 | } | 2233 | } |
2260 | phba->link_state = LPFC_CLEAR_LA; | 2234 | phba->link_state = LPFC_CLEAR_LA; |
2261 | lpfc_clear_la(phba, clearlambox); | 2235 | lpfc_clear_la(phba, clearlambox); |
2262 | printk(KERN_ERR "%s (%d): do clear_la\n", | ||
2263 | __FUNCTION__, __LINE__); | ||
2264 | clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; | 2236 | clearlambox->mbox_cmpl = lpfc_mbx_cmpl_clear_la; |
2265 | clearlambox->vport = vport; | 2237 | clearlambox->vport = vport; |
2266 | rc = lpfc_sli_issue_mbox(phba, clearlambox, | 2238 | rc = lpfc_sli_issue_mbox(phba, clearlambox, |
@@ -2273,9 +2245,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2273 | 2245 | ||
2274 | case LPFC_VPORT_READY: | 2246 | case LPFC_VPORT_READY: |
2275 | if (vport->fc_flag & FC_RSCN_MODE) { | 2247 | if (vport->fc_flag & FC_RSCN_MODE) { |
2276 | lpfc_printf_log(phba, | 2248 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2277 | KERN_ERR, | ||
2278 | LOG_DISCOVERY, | ||
2279 | "%d:0231 RSCN timeout Data: x%x x%x\n", | 2249 | "%d:0231 RSCN timeout Data: x%x x%x\n", |
2280 | phba->brd_no, | 2250 | phba->brd_no, |
2281 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); | 2251 | vport->fc_ns_retry, LPFC_MAX_NS_RETRY); |
@@ -2291,13 +2261,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2291 | case LPFC_STATE_UNKNOWN: | 2261 | case LPFC_STATE_UNKNOWN: |
2292 | case LPFC_NS_REG: | 2262 | case LPFC_NS_REG: |
2293 | case LPFC_BUILD_DISC_LIST: | 2263 | case LPFC_BUILD_DISC_LIST: |
2294 | lpfc_printf_log(phba, | 2264 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2295 | KERN_ERR, | ||
2296 | LOG_DISCOVERY, | ||
2297 | "%d:0229 Unexpected discovery timeout, vport " | 2265 | "%d:0229 Unexpected discovery timeout, vport " |
2298 | "State x%x\n", | 2266 | "State x%x\n", |
2299 | vport->port_state, | 2267 | vport->port_state, phba->brd_no); |
2300 | phba->brd_no); | ||
2301 | 2268 | ||
2302 | break; | 2269 | break; |
2303 | } | 2270 | } |
@@ -2305,9 +2272,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2305 | switch (phba->link_state) { | 2272 | switch (phba->link_state) { |
2306 | case LPFC_CLEAR_LA: | 2273 | case LPFC_CLEAR_LA: |
2307 | /* CLEAR LA timeout */ | 2274 | /* CLEAR LA timeout */ |
2308 | lpfc_printf_log(phba, | 2275 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2309 | KERN_ERR, | ||
2310 | LOG_DISCOVERY, | ||
2311 | "%d:0228 CLEAR LA timeout\n", | 2276 | "%d:0228 CLEAR LA timeout\n", |
2312 | phba->brd_no); | 2277 | phba->brd_no); |
2313 | clrlaerr = 1; | 2278 | clrlaerr = 1; |
@@ -2320,9 +2285,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2320 | case LPFC_LINK_DOWN: | 2285 | case LPFC_LINK_DOWN: |
2321 | case LPFC_LINK_UP: | 2286 | case LPFC_LINK_UP: |
2322 | case LPFC_HBA_ERROR: | 2287 | case LPFC_HBA_ERROR: |
2323 | lpfc_printf_log(phba, | 2288 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
2324 | KERN_ERR, | ||
2325 | LOG_DISCOVERY, | ||
2326 | "%d:0230 Unexpected timeout, hba link " | 2289 | "%d:0230 Unexpected timeout, hba link " |
2327 | "state x%x\n", | 2290 | "state x%x\n", |
2328 | phba->brd_no, phba->link_state); | 2291 | phba->brd_no, phba->link_state); |
@@ -2335,8 +2298,6 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
2335 | psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 2298 | psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
2336 | psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 2299 | psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
2337 | psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; | 2300 | psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; |
2338 | printk(KERN_ERR "%s (%d): vport ready\n", | ||
2339 | __FUNCTION__, __LINE__); | ||
2340 | vport->port_state = LPFC_VPORT_READY; | 2301 | vport->port_state = LPFC_VPORT_READY; |
2341 | } | 2302 | } |
2342 | 2303 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index c4be6dc00c4c..430416805e85 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -59,6 +59,11 @@ | |||
59 | #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24 | 59 | #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24 |
60 | #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32 | 60 | #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32 |
61 | 61 | ||
62 | #define SLI2_IOCB_CMD_SIZE 32 | ||
63 | #define SLI2_IOCB_RSP_SIZE 32 | ||
64 | #define SLI3_IOCB_CMD_SIZE 128 | ||
65 | #define SLI3_IOCB_RSP_SIZE 64 | ||
66 | |||
62 | /* Common Transport structures and definitions */ | 67 | /* Common Transport structures and definitions */ |
63 | 68 | ||
64 | union CtRevisionId { | 69 | union CtRevisionId { |
@@ -1255,6 +1260,7 @@ typedef struct { /* FireFly BIU registers */ | |||
1255 | #define MBX_CONFIG_FARP 0x25 | 1260 | #define MBX_CONFIG_FARP 0x25 |
1256 | #define MBX_BEACON 0x2A | 1261 | #define MBX_BEACON 0x2A |
1257 | 1262 | ||
1263 | #define MBX_CONFIG_HBQ 0x7C | ||
1258 | #define MBX_LOAD_AREA 0x81 | 1264 | #define MBX_LOAD_AREA 0x81 |
1259 | #define MBX_RUN_BIU_DIAG64 0x84 | 1265 | #define MBX_RUN_BIU_DIAG64 0x84 |
1260 | #define MBX_CONFIG_PORT 0x88 | 1266 | #define MBX_CONFIG_PORT 0x88 |
@@ -1334,6 +1340,10 @@ typedef struct { /* FireFly BIU registers */ | |||
1334 | #define CMD_FCP_TRECEIVE64_CX 0xA1 | 1340 | #define CMD_FCP_TRECEIVE64_CX 0xA1 |
1335 | #define CMD_FCP_TRSP64_CX 0xA3 | 1341 | #define CMD_FCP_TRSP64_CX 0xA3 |
1336 | 1342 | ||
1343 | #define CMD_IOCB_RCV_SEQ64_CX 0xB5 | ||
1344 | #define CMD_IOCB_RCV_ELS64_CX 0xB7 | ||
1345 | #define CMD_IOCB_RCV_CONT64_CX 0xBB | ||
1346 | |||
1337 | #define CMD_GEN_REQUEST64_CR 0xC2 | 1347 | #define CMD_GEN_REQUEST64_CR 0xC2 |
1338 | #define CMD_GEN_REQUEST64_CX 0xC3 | 1348 | #define CMD_GEN_REQUEST64_CX 0xC3 |
1339 | 1349 | ||
@@ -1560,6 +1570,7 @@ typedef struct { | |||
1560 | #define FLAGS_TOPOLOGY_MODE_PT_PT 0x02 /* Attempt pt-pt only */ | 1570 | #define FLAGS_TOPOLOGY_MODE_PT_PT 0x02 /* Attempt pt-pt only */ |
1561 | #define FLAGS_TOPOLOGY_MODE_LOOP 0x04 /* Attempt loop only */ | 1571 | #define FLAGS_TOPOLOGY_MODE_LOOP 0x04 /* Attempt loop only */ |
1562 | #define FLAGS_TOPOLOGY_MODE_PT_LOOP 0x06 /* Attempt pt-pt then loop */ | 1572 | #define FLAGS_TOPOLOGY_MODE_PT_LOOP 0x06 /* Attempt pt-pt then loop */ |
1573 | #define FLAGS_UNREG_LOGIN_ALL 0x08 /* UNREG_LOGIN all on link down */ | ||
1563 | #define FLAGS_LIRP_LILP 0x80 /* LIRP / LILP is disabled */ | 1574 | #define FLAGS_LIRP_LILP 0x80 /* LIRP / LILP is disabled */ |
1564 | 1575 | ||
1565 | #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ | 1576 | #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ |
@@ -1817,6 +1828,13 @@ typedef struct { | |||
1817 | structure */ | 1828 | structure */ |
1818 | struct ulp_bde64 sp64; | 1829 | struct ulp_bde64 sp64; |
1819 | } un; | 1830 | } un; |
1831 | #ifdef __BIG_ENDIAN_BITFIELD | ||
1832 | uint16_t rsvd3; | ||
1833 | uint16_t vpi; | ||
1834 | #else /* __LITTLE_ENDIAN_BITFIELD */ | ||
1835 | uint16_t vpi; | ||
1836 | uint16_t rsvd3; | ||
1837 | #endif | ||
1820 | } READ_SPARM_VAR; | 1838 | } READ_SPARM_VAR; |
1821 | 1839 | ||
1822 | /* Structure for MB Command READ_STATUS (14) */ | 1840 | /* Structure for MB Command READ_STATUS (14) */ |
@@ -1917,11 +1935,17 @@ typedef struct { | |||
1917 | #ifdef __BIG_ENDIAN_BITFIELD | 1935 | #ifdef __BIG_ENDIAN_BITFIELD |
1918 | uint32_t cv:1; | 1936 | uint32_t cv:1; |
1919 | uint32_t rr:1; | 1937 | uint32_t rr:1; |
1920 | uint32_t rsvd1:29; | 1938 | uint32_t rsvd2:2; |
1939 | uint32_t v3req:1; | ||
1940 | uint32_t v3rsp:1; | ||
1941 | uint32_t rsvd1:25; | ||
1921 | uint32_t rv:1; | 1942 | uint32_t rv:1; |
1922 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 1943 | #else /* __LITTLE_ENDIAN_BITFIELD */ |
1923 | uint32_t rv:1; | 1944 | uint32_t rv:1; |
1924 | uint32_t rsvd1:29; | 1945 | uint32_t rsvd1:25; |
1946 | uint32_t v3rsp:1; | ||
1947 | uint32_t v3req:1; | ||
1948 | uint32_t rsvd2:2; | ||
1925 | uint32_t rr:1; | 1949 | uint32_t rr:1; |
1926 | uint32_t cv:1; | 1950 | uint32_t cv:1; |
1927 | #endif | 1951 | #endif |
@@ -1971,8 +1995,8 @@ typedef struct { | |||
1971 | uint8_t sli1FwName[16]; | 1995 | uint8_t sli1FwName[16]; |
1972 | uint32_t sli2FwRev; | 1996 | uint32_t sli2FwRev; |
1973 | uint8_t sli2FwName[16]; | 1997 | uint8_t sli2FwName[16]; |
1974 | uint32_t rsvd2; | 1998 | uint32_t sli3Feat; |
1975 | uint32_t RandomData[7]; | 1999 | uint32_t RandomData[6]; |
1976 | } READ_REV_VAR; | 2000 | } READ_REV_VAR; |
1977 | 2001 | ||
1978 | /* Structure for MB Command READ_LINK_STAT (18) */ | 2002 | /* Structure for MB Command READ_LINK_STAT (18) */ |
@@ -2012,6 +2036,14 @@ typedef struct { | |||
2012 | struct ulp_bde64 sp64; | 2036 | struct ulp_bde64 sp64; |
2013 | } un; | 2037 | } un; |
2014 | 2038 | ||
2039 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2040 | uint16_t rsvd6; | ||
2041 | uint16_t vpi; | ||
2042 | #else /* __LITTLE_ENDIAN_BITFIELD */ | ||
2043 | uint16_t vpi; | ||
2044 | uint16_t rsvd6; | ||
2045 | #endif | ||
2046 | |||
2015 | } REG_LOGIN_VAR; | 2047 | } REG_LOGIN_VAR; |
2016 | 2048 | ||
2017 | /* Word 30 contents for REG_LOGIN */ | 2049 | /* Word 30 contents for REG_LOGIN */ |
@@ -2036,9 +2068,21 @@ typedef struct { | |||
2036 | #ifdef __BIG_ENDIAN_BITFIELD | 2068 | #ifdef __BIG_ENDIAN_BITFIELD |
2037 | uint16_t rsvd1; | 2069 | uint16_t rsvd1; |
2038 | uint16_t rpi; | 2070 | uint16_t rpi; |
2071 | uint32_t rsvd2; | ||
2072 | uint32_t rsvd3; | ||
2073 | uint32_t rsvd4; | ||
2074 | uint32_t rsvd5; | ||
2075 | uint16_t rsvd6; | ||
2076 | uint16_t vpi; | ||
2039 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 2077 | #else /* __LITTLE_ENDIAN_BITFIELD */ |
2040 | uint16_t rpi; | 2078 | uint16_t rpi; |
2041 | uint16_t rsvd1; | 2079 | uint16_t rsvd1; |
2080 | uint32_t rsvd2; | ||
2081 | uint32_t rsvd3; | ||
2082 | uint32_t rsvd4; | ||
2083 | uint32_t rsvd5; | ||
2084 | uint16_t vpi; | ||
2085 | uint16_t rsvd6; | ||
2042 | #endif | 2086 | #endif |
2043 | } UNREG_LOGIN_VAR; | 2087 | } UNREG_LOGIN_VAR; |
2044 | 2088 | ||
@@ -2046,6 +2090,17 @@ typedef struct { | |||
2046 | 2090 | ||
2047 | typedef struct { | 2091 | typedef struct { |
2048 | uint32_t did; | 2092 | uint32_t did; |
2093 | uint32_t rsvd2; | ||
2094 | uint32_t rsvd3; | ||
2095 | uint32_t rsvd4; | ||
2096 | uint32_t rsvd5; | ||
2097 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2098 | uint16_t rsvd6; | ||
2099 | uint16_t vpi; | ||
2100 | #else | ||
2101 | uint16_t vpi; | ||
2102 | uint16_t rsvd6; | ||
2103 | #endif | ||
2049 | } UNREG_D_ID_VAR; | 2104 | } UNREG_D_ID_VAR; |
2050 | 2105 | ||
2051 | /* Structure for MB Command READ_LA (21) */ | 2106 | /* Structure for MB Command READ_LA (21) */ |
@@ -2177,13 +2232,240 @@ typedef struct { | |||
2177 | #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */ | 2232 | #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */ |
2178 | #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */ | 2233 | #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */ |
2179 | 2234 | ||
2235 | struct hbq_mask { | ||
2236 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2237 | uint8_t tmatch; | ||
2238 | uint8_t tmask; | ||
2239 | uint8_t rctlmatch; | ||
2240 | uint8_t rctlmask; | ||
2241 | #else /* __LITTLE_ENDIAN */ | ||
2242 | uint8_t rctlmask; | ||
2243 | uint8_t rctlmatch; | ||
2244 | uint8_t tmask; | ||
2245 | uint8_t tmatch; | ||
2246 | #endif | ||
2247 | }; | ||
2248 | |||
2249 | |||
2250 | /* Structure for MB Command CONFIG_HBQ (7c) */ | ||
2251 | |||
2252 | struct config_hbq_var { | ||
2253 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2254 | uint32_t rsvd1 :7; | ||
2255 | uint32_t recvNotify :1; /* Receive Notification */ | ||
2256 | uint32_t numMask :8; /* # Mask Entries */ | ||
2257 | uint32_t profile :8; /* Selection Profile */ | ||
2258 | uint32_t rsvd2 :8; | ||
2259 | #else /* __LITTLE_ENDIAN */ | ||
2260 | uint32_t rsvd2 :8; | ||
2261 | uint32_t profile :8; /* Selection Profile */ | ||
2262 | uint32_t numMask :8; /* # Mask Entries */ | ||
2263 | uint32_t recvNotify :1; /* Receive Notification */ | ||
2264 | uint32_t rsvd1 :7; | ||
2265 | #endif | ||
2266 | |||
2267 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2268 | uint32_t hbqId :16; | ||
2269 | uint32_t rsvd3 :12; | ||
2270 | uint32_t ringMask :4; | ||
2271 | #else /* __LITTLE_ENDIAN */ | ||
2272 | uint32_t ringMask :4; | ||
2273 | uint32_t rsvd3 :12; | ||
2274 | uint32_t hbqId :16; | ||
2275 | #endif | ||
2276 | |||
2277 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2278 | uint32_t entry_count :16; | ||
2279 | uint32_t rsvd4 :8; | ||
2280 | uint32_t headerLen :8; | ||
2281 | #else /* __LITTLE_ENDIAN */ | ||
2282 | uint32_t headerLen :8; | ||
2283 | uint32_t rsvd4 :8; | ||
2284 | uint32_t entry_count :16; | ||
2285 | #endif | ||
2286 | |||
2287 | uint32_t hbqaddrLow; | ||
2288 | uint32_t hbqaddrHigh; | ||
2289 | |||
2290 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2291 | uint32_t rsvd5 :31; | ||
2292 | uint32_t logEntry :1; | ||
2293 | #else /* __LITTLE_ENDIAN */ | ||
2294 | uint32_t logEntry :1; | ||
2295 | uint32_t rsvd5 :31; | ||
2296 | #endif | ||
2297 | |||
2298 | uint32_t rsvd6; /* w7 */ | ||
2299 | uint32_t rsvd7; /* w8 */ | ||
2300 | uint32_t rsvd8; /* w9 */ | ||
2301 | |||
2302 | struct hbq_mask hbqMasks[6]; | ||
2303 | |||
2304 | |||
2305 | union { | ||
2306 | uint32_t allprofiles[12]; | ||
2307 | |||
2308 | struct { | ||
2309 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2310 | uint32_t seqlenoff :16; | ||
2311 | uint32_t maxlen :16; | ||
2312 | #else /* __LITTLE_ENDIAN */ | ||
2313 | uint32_t maxlen :16; | ||
2314 | uint32_t seqlenoff :16; | ||
2315 | #endif | ||
2316 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2317 | uint32_t rsvd1 :28; | ||
2318 | uint32_t seqlenbcnt :4; | ||
2319 | #else /* __LITTLE_ENDIAN */ | ||
2320 | uint32_t seqlenbcnt :4; | ||
2321 | uint32_t rsvd1 :28; | ||
2322 | #endif | ||
2323 | uint32_t rsvd[10]; | ||
2324 | } profile2; | ||
2325 | |||
2326 | struct { | ||
2327 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2328 | uint32_t seqlenoff :16; | ||
2329 | uint32_t maxlen :16; | ||
2330 | #else /* __LITTLE_ENDIAN */ | ||
2331 | uint32_t maxlen :16; | ||
2332 | uint32_t seqlenoff :16; | ||
2333 | #endif | ||
2334 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2335 | uint32_t cmdcodeoff :28; | ||
2336 | uint32_t rsvd1 :12; | ||
2337 | uint32_t seqlenbcnt :4; | ||
2338 | #else /* __LITTLE_ENDIAN */ | ||
2339 | uint32_t seqlenbcnt :4; | ||
2340 | uint32_t rsvd1 :12; | ||
2341 | uint32_t cmdcodeoff :28; | ||
2342 | #endif | ||
2343 | uint32_t cmdmatch[8]; | ||
2344 | |||
2345 | uint32_t rsvd[2]; | ||
2346 | } profile3; | ||
2347 | |||
2348 | struct { | ||
2349 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2350 | uint32_t seqlenoff :16; | ||
2351 | uint32_t maxlen :16; | ||
2352 | #else /* __LITTLE_ENDIAN */ | ||
2353 | uint32_t maxlen :16; | ||
2354 | uint32_t seqlenoff :16; | ||
2355 | #endif | ||
2356 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2357 | uint32_t cmdcodeoff :28; | ||
2358 | uint32_t rsvd1 :12; | ||
2359 | uint32_t seqlenbcnt :4; | ||
2360 | #else /* __LITTLE_ENDIAN */ | ||
2361 | uint32_t seqlenbcnt :4; | ||
2362 | uint32_t rsvd1 :12; | ||
2363 | uint32_t cmdcodeoff :28; | ||
2364 | #endif | ||
2365 | uint32_t cmdmatch[8]; | ||
2366 | |||
2367 | uint32_t rsvd[2]; | ||
2368 | } profile5; | ||
2369 | |||
2370 | } profiles; | ||
2371 | |||
2372 | }; | ||
2373 | |||
2374 | |||
2180 | 2375 | ||
2181 | /* Structure for MB Command CONFIG_PORT (0x88) */ | 2376 | /* Structure for MB Command CONFIG_PORT (0x88) */ |
2182 | typedef struct { | 2377 | typedef struct { |
2183 | uint32_t pcbLen; | 2378 | #ifdef __BIG_ENDIAN_BITFIELD |
2379 | uint32_t cBE : 1; | ||
2380 | uint32_t cET : 1; | ||
2381 | uint32_t cHpcb : 1; | ||
2382 | uint32_t cMA : 1; | ||
2383 | uint32_t sli_mode : 4; | ||
2384 | uint32_t pcbLen : 24; /* bit 23:0 of memory based port | ||
2385 | * config block */ | ||
2386 | #else /* __LITTLE_ENDIAN */ | ||
2387 | uint32_t pcbLen : 24; /* bit 23:0 of memory based port | ||
2388 | * config block */ | ||
2389 | uint32_t sli_mode : 4; | ||
2390 | uint32_t cMA : 1; | ||
2391 | uint32_t cHpcb : 1; | ||
2392 | uint32_t cET : 1; | ||
2393 | uint32_t cBE : 1; | ||
2394 | #endif | ||
2395 | |||
2184 | uint32_t pcbLow; /* bit 31:0 of memory based port config block */ | 2396 | uint32_t pcbLow; /* bit 31:0 of memory based port config block */ |
2185 | uint32_t pcbHigh; /* bit 63:32 of memory based port config block */ | 2397 | uint32_t pcbHigh; /* bit 63:32 of memory based port config block */ |
2186 | uint32_t hbainit[5]; | 2398 | uint32_t hbainit[6]; |
2399 | |||
2400 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2401 | uint32_t rsvd : 24; /* Reserved */ | ||
2402 | uint32_t cmv : 1; /* Configure Max VPIs */ | ||
2403 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | ||
2404 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | ||
2405 | uint32_t chbs : 1; /* Cofigure Host Backing store */ | ||
2406 | uint32_t cinb : 1; /* Enable Interrupt Notification Block */ | ||
2407 | uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */ | ||
2408 | uint32_t cmx : 1; /* Configure Max XRIs */ | ||
2409 | uint32_t cmr : 1; /* Configure Max RPIs */ | ||
2410 | #else /* __LITTLE_ENDIAN */ | ||
2411 | uint32_t cmr : 1; /* Configure Max RPIs */ | ||
2412 | uint32_t cmx : 1; /* Configure Max XRIs */ | ||
2413 | uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */ | ||
2414 | uint32_t cinb : 1; /* Enable Interrupt Notification Block */ | ||
2415 | uint32_t chbs : 1; /* Cofigure Host Backing store */ | ||
2416 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | ||
2417 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | ||
2418 | uint32_t cmv : 1; /* Configure Max VPIs */ | ||
2419 | uint32_t rsvd : 24; /* Reserved */ | ||
2420 | #endif | ||
2421 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2422 | uint32_t rsvd2 : 24; /* Reserved */ | ||
2423 | uint32_t gmv : 1; /* Grant Max VPIs */ | ||
2424 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | ||
2425 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | ||
2426 | uint32_t ghbs : 1; /* Grant Host Backing Store */ | ||
2427 | uint32_t ginb : 1; /* Grant Interrupt Notification Block */ | ||
2428 | uint32_t gerbm : 1; /* Grant ERBM Request */ | ||
2429 | uint32_t gmx : 1; /* Grant Max XRIs */ | ||
2430 | uint32_t gmr : 1; /* Grant Max RPIs */ | ||
2431 | #else /* __LITTLE_ENDIAN */ | ||
2432 | uint32_t gmr : 1; /* Grant Max RPIs */ | ||
2433 | uint32_t gmx : 1; /* Grant Max XRIs */ | ||
2434 | uint32_t gerbm : 1; /* Grant ERBM Request */ | ||
2435 | uint32_t ginb : 1; /* Grant Interrupt Notification Block */ | ||
2436 | uint32_t ghbs : 1; /* Grant Host Backing Store */ | ||
2437 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | ||
2438 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | ||
2439 | uint32_t gmv : 1; /* Grant Max VPIs */ | ||
2440 | uint32_t rsvd2 : 24; /* Reserved */ | ||
2441 | #endif | ||
2442 | |||
2443 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2444 | uint32_t max_rpi : 16; /* Max RPIs Port should configure */ | ||
2445 | uint32_t max_xri : 16; /* Max XRIs Port should configure */ | ||
2446 | #else /* __LITTLE_ENDIAN */ | ||
2447 | uint32_t max_xri : 16; /* Max XRIs Port should configure */ | ||
2448 | uint32_t max_rpi : 16; /* Max RPIs Port should configure */ | ||
2449 | #endif | ||
2450 | |||
2451 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2452 | uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */ | ||
2453 | uint32_t rsvd3 : 16; /* Max HBQs Host expect to configure */ | ||
2454 | #else /* __LITTLE_ENDIAN */ | ||
2455 | uint32_t rsvd3 : 16; /* Max HBQs Host expect to configure */ | ||
2456 | uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */ | ||
2457 | #endif | ||
2458 | |||
2459 | uint32_t rsvd4; /* Reserved */ | ||
2460 | |||
2461 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2462 | uint32_t rsvd5 : 16; /* Reserved */ | ||
2463 | uint32_t max_vpi : 16; /* Max number of virt N-Ports */ | ||
2464 | #else /* __LITTLE_ENDIAN */ | ||
2465 | uint32_t max_vpi : 16; /* Max number of virt N-Ports */ | ||
2466 | uint32_t rsvd5 : 16; /* Reserved */ | ||
2467 | #endif | ||
2468 | |||
2187 | } CONFIG_PORT_VAR; | 2469 | } CONFIG_PORT_VAR; |
2188 | 2470 | ||
2189 | /* SLI-2 Port Control Block */ | 2471 | /* SLI-2 Port Control Block */ |
@@ -2261,33 +2543,38 @@ typedef struct { | |||
2261 | #define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t)) | 2543 | #define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t)) |
2262 | 2544 | ||
2263 | typedef union { | 2545 | typedef union { |
2264 | uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; | 2546 | uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/ |
2265 | LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ | 2547 | * feature/max ring number |
2266 | READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ | 2548 | */ |
2267 | WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ | 2549 | LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */ |
2550 | READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */ | ||
2551 | WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */ | ||
2268 | BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ | 2552 | BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */ |
2269 | INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ | 2553 | INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */ |
2270 | DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ | 2554 | DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */ |
2271 | CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ | 2555 | CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */ |
2272 | PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ | 2556 | PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */ |
2273 | CONFIG_RING_VAR varCfgRing; /* cmd = 9 (CONFIG_RING) */ | 2557 | CONFIG_RING_VAR varCfgRing; /* cmd = 9 (CONFIG_RING) */ |
2274 | RESET_RING_VAR varRstRing; /* cmd = 10 (RESET_RING) */ | 2558 | RESET_RING_VAR varRstRing; /* cmd = 10 (RESET_RING) */ |
2275 | READ_CONFIG_VAR varRdConfig; /* cmd = 11 (READ_CONFIG) */ | 2559 | READ_CONFIG_VAR varRdConfig; /* cmd = 11 (READ_CONFIG) */ |
2276 | READ_RCONF_VAR varRdRConfig; /* cmd = 12 (READ_RCONFIG) */ | 2560 | READ_RCONF_VAR varRdRConfig; /* cmd = 12 (READ_RCONFIG) */ |
2277 | READ_SPARM_VAR varRdSparm; /* cmd = 13 (READ_SPARM(64)) */ | 2561 | READ_SPARM_VAR varRdSparm; /* cmd = 13 (READ_SPARM(64)) */ |
2278 | READ_STATUS_VAR varRdStatus; /* cmd = 14 (READ_STATUS) */ | 2562 | READ_STATUS_VAR varRdStatus; /* cmd = 14 (READ_STATUS) */ |
2279 | READ_RPI_VAR varRdRPI; /* cmd = 15 (READ_RPI(64)) */ | 2563 | READ_RPI_VAR varRdRPI; /* cmd = 15 (READ_RPI(64)) */ |
2280 | READ_XRI_VAR varRdXRI; /* cmd = 16 (READ_XRI) */ | 2564 | READ_XRI_VAR varRdXRI; /* cmd = 16 (READ_XRI) */ |
2281 | READ_REV_VAR varRdRev; /* cmd = 17 (READ_REV) */ | 2565 | READ_REV_VAR varRdRev; /* cmd = 17 (READ_REV) */ |
2282 | READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */ | 2566 | READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */ |
2283 | REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */ | 2567 | REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */ |
2284 | UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */ | 2568 | UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */ |
2285 | READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */ | 2569 | READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */ |
2286 | CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */ | 2570 | CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */ |
2287 | DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */ | 2571 | DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */ |
2288 | UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */ | 2572 | UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */ |
2289 | CONFIG_FARP_VAR varCfgFarp; /* cmd = 0x25 (CONFIG_FARP) NEW_FEATURE */ | 2573 | CONFIG_FARP_VAR varCfgFarp; /* cmd = 0x25 (CONFIG_FARP) |
2290 | CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */ | 2574 | * NEW_FEATURE |
2575 | */ | ||
2576 | struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */ | ||
2577 | CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */ | ||
2291 | } MAILVARIANTS; | 2578 | } MAILVARIANTS; |
2292 | 2579 | ||
2293 | /* | 2580 | /* |
@@ -2304,16 +2591,30 @@ struct lpfc_pgp { | |||
2304 | __le32 rspPutInx; | 2591 | __le32 rspPutInx; |
2305 | }; | 2592 | }; |
2306 | 2593 | ||
2307 | typedef struct _SLI2_DESC { | 2594 | struct sli2_desc { |
2308 | struct lpfc_hgp host[MAX_RINGS]; | ||
2309 | uint32_t unused1[16]; | 2595 | uint32_t unused1[16]; |
2596 | struct lpfc_hgp host[MAX_RINGS]; | ||
2597 | struct lpfc_pgp port[MAX_RINGS]; | ||
2598 | }; | ||
2599 | |||
2600 | struct sli3_desc { | ||
2601 | struct lpfc_hgp host[MAX_RINGS]; | ||
2602 | uint32_t reserved[8]; | ||
2603 | uint32_t hbq_put[16]; | ||
2604 | }; | ||
2605 | |||
2606 | struct sli3_pgp { | ||
2310 | struct lpfc_pgp port[MAX_RINGS]; | 2607 | struct lpfc_pgp port[MAX_RINGS]; |
2311 | } SLI2_DESC; | 2608 | uint32_t hbq_get[16]; |
2609 | }; | ||
2312 | 2610 | ||
2313 | typedef union { | 2611 | typedef union { |
2314 | SLI2_DESC s2; | 2612 | struct sli2_desc s2; |
2613 | struct sli3_desc s3; | ||
2614 | struct sli3_pgp s3_pgp; | ||
2315 | } SLI_VAR; | 2615 | } SLI_VAR; |
2316 | 2616 | ||
2617 | |||
2317 | typedef struct { | 2618 | typedef struct { |
2318 | #ifdef __BIG_ENDIAN_BITFIELD | 2619 | #ifdef __BIG_ENDIAN_BITFIELD |
2319 | uint16_t mbxStatus; | 2620 | uint16_t mbxStatus; |
@@ -2617,6 +2918,23 @@ typedef struct { | |||
2617 | uint32_t fcpt_Length; /* transfer ready for IWRITE */ | 2918 | uint32_t fcpt_Length; /* transfer ready for IWRITE */ |
2618 | } FCPT_FIELDS64; | 2919 | } FCPT_FIELDS64; |
2619 | 2920 | ||
2921 | /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7) | ||
2922 | or CMD_IOCB_RCV_SEQ64_CX (0xB5) */ | ||
2923 | |||
2924 | struct rcv_sli3 { | ||
2925 | uint32_t word8Rsvd; | ||
2926 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2927 | uint16_t vpi; | ||
2928 | uint16_t word9Rsvd; | ||
2929 | #else /* __LITTLE_ENDIAN */ | ||
2930 | uint16_t word9Rsvd; | ||
2931 | uint16_t vpi; | ||
2932 | #endif | ||
2933 | uint32_t word10Rsvd; | ||
2934 | uint32_t acc_len; /* accumulated length */ | ||
2935 | struct ulp_bde64 bde2; | ||
2936 | }; | ||
2937 | |||
2620 | typedef struct _IOCB { /* IOCB structure */ | 2938 | typedef struct _IOCB { /* IOCB structure */ |
2621 | union { | 2939 | union { |
2622 | GENERIC_RSP grsp; /* Generic response */ | 2940 | GENERIC_RSP grsp; /* Generic response */ |
@@ -2631,8 +2949,8 @@ typedef struct _IOCB { /* IOCB structure */ | |||
2631 | 2949 | ||
2632 | /* SLI-2 structures */ | 2950 | /* SLI-2 structures */ |
2633 | 2951 | ||
2634 | struct ulp_bde64 cont64[2]; /* up to 2 64 bit continuation | 2952 | struct ulp_bde64 cont64[2]; /* up to 2 64 bit continuation |
2635 | bde_64s */ | 2953 | * bde_64s */ |
2636 | ELS_REQUEST64 elsreq64; /* ELS_REQUEST template */ | 2954 | ELS_REQUEST64 elsreq64; /* ELS_REQUEST template */ |
2637 | GEN_REQUEST64 genreq64; /* GEN_REQUEST template */ | 2955 | GEN_REQUEST64 genreq64; /* GEN_REQUEST template */ |
2638 | RCV_ELS_REQ64 rcvels64; /* RCV_ELS_REQ template */ | 2956 | RCV_ELS_REQ64 rcvels64; /* RCV_ELS_REQ template */ |
@@ -2693,7 +3011,16 @@ typedef struct _IOCB { /* IOCB structure */ | |||
2693 | uint32_t ulpXS:1; | 3011 | uint32_t ulpXS:1; |
2694 | uint32_t ulpTimeout:8; | 3012 | uint32_t ulpTimeout:8; |
2695 | #endif | 3013 | #endif |
3014 | union { | ||
3015 | struct rcv_sli3 rcvsli3; /* words 8 - 15 */ | ||
3016 | uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */ | ||
3017 | } unsli3; | ||
3018 | |||
3019 | #define ulpCt_h ulpXS | ||
3020 | #define ulpCt_l ulpFCP2Rcvy | ||
2696 | 3021 | ||
3022 | #define IOCB_FCP 1 /* IOCB is used for FCP ELS cmds-ulpRsvByte */ | ||
3023 | #define IOCB_IP 2 /* IOCB is used for IP ELS cmds */ | ||
2697 | #define PARM_UNUSED 0 /* PU field (Word 4) not used */ | 3024 | #define PARM_UNUSED 0 /* PU field (Word 4) not used */ |
2698 | #define PARM_REL_OFF 1 /* PU field (Word 4) = R. O. */ | 3025 | #define PARM_REL_OFF 1 /* PU field (Word 4) = R. O. */ |
2699 | #define PARM_READ_CHECK 2 /* PU field (Word 4) = Data Transfer Length */ | 3026 | #define PARM_READ_CHECK 2 /* PU field (Word 4) = Data Transfer Length */ |
@@ -2724,21 +3051,33 @@ typedef struct _IOCB { /* IOCB structure */ | |||
2724 | 3051 | ||
2725 | } IOCB_t; | 3052 | } IOCB_t; |
2726 | 3053 | ||
3054 | /* Structure used for a single HBQ entry */ | ||
3055 | struct lpfc_hbq_entry { | ||
3056 | struct ulp_bde64 bde; | ||
3057 | uint32_t buffer_tag; | ||
3058 | }; | ||
3059 | |||
2727 | 3060 | ||
2728 | #define SLI1_SLIM_SIZE (4 * 1024) | 3061 | #define SLI1_SLIM_SIZE (4 * 1024) |
2729 | 3062 | ||
2730 | /* Up to 498 IOCBs will fit into 16k | 3063 | /* Up to 498 IOCBs will fit into 16k |
2731 | * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384 | 3064 | * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384 |
2732 | */ | 3065 | */ |
2733 | #define SLI2_SLIM_SIZE (16 * 1024) | 3066 | #define SLI2_SLIM_SIZE (64 * 1024) |
2734 | 3067 | ||
2735 | /* Maximum IOCBs that will fit in SLI2 slim */ | 3068 | /* Maximum IOCBs that will fit in SLI2 slim */ |
2736 | #define MAX_SLI2_IOCB 498 | 3069 | #define MAX_SLI2_IOCB 498 |
3070 | #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \ | ||
3071 | (sizeof(MAILBOX_t) + sizeof(PCB_t))) | ||
3072 | |||
3073 | /* HBQ entries are 4 words each = 4k */ | ||
3074 | #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) * \ | ||
3075 | lpfc_sli_hbq_count()) | ||
2737 | 3076 | ||
2738 | struct lpfc_sli2_slim { | 3077 | struct lpfc_sli2_slim { |
2739 | MAILBOX_t mbx; | 3078 | MAILBOX_t mbx; |
2740 | PCB_t pcb; | 3079 | PCB_t pcb; |
2741 | IOCB_t IOCBs[MAX_SLI2_IOCB]; | 3080 | IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE]; |
2742 | }; | 3081 | }; |
2743 | 3082 | ||
2744 | /* | 3083 | /* |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index e11c4cda0f3f..e50c5ad252f9 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -49,6 +49,12 @@ static int lpfc_post_rcv_buf(struct lpfc_hba *); | |||
49 | static struct scsi_transport_template *lpfc_transport_template = NULL; | 49 | static struct scsi_transport_template *lpfc_transport_template = NULL; |
50 | static DEFINE_IDR(lpfc_hba_index); | 50 | static DEFINE_IDR(lpfc_hba_index); |
51 | 51 | ||
52 | int lpfc_sli_mode = 0; | ||
53 | module_param(lpfc_sli_mode, int, 0); | ||
54 | MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:" | ||
55 | " 0 - auto (SLI-3 if supported)," | ||
56 | " 2 - select SLI-2 even on SLI-3 capable HBAs," | ||
57 | " 3 - select SLI-3"); | ||
52 | 58 | ||
53 | 59 | ||
54 | /************************************************************************/ | 60 | /************************************************************************/ |
@@ -102,9 +108,7 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
102 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 108 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
103 | 109 | ||
104 | if (rc != MBX_SUCCESS) { | 110 | if (rc != MBX_SUCCESS) { |
105 | lpfc_printf_log(phba, | 111 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, |
106 | KERN_ERR, | ||
107 | LOG_MBOX, | ||
108 | "%d:0324 Config Port initialization " | 112 | "%d:0324 Config Port initialization " |
109 | "error, mbxCmd x%x READ_NVPARM, " | 113 | "error, mbxCmd x%x READ_NVPARM, " |
110 | "mbxStatus x%x\n", | 114 | "mbxStatus x%x\n", |
@@ -123,9 +127,7 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
123 | lpfc_read_rev(phba, pmb); | 127 | lpfc_read_rev(phba, pmb); |
124 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 128 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
125 | if (rc != MBX_SUCCESS) { | 129 | if (rc != MBX_SUCCESS) { |
126 | lpfc_printf_log(phba, | 130 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
127 | KERN_ERR, | ||
128 | LOG_INIT, | ||
129 | "%d:0439 Adapter failed to init, mbxCmd x%x " | 131 | "%d:0439 Adapter failed to init, mbxCmd x%x " |
130 | "READ_REV, mbxStatus x%x\n", | 132 | "READ_REV, mbxStatus x%x\n", |
131 | phba->brd_no, | 133 | phba->brd_no, |
@@ -148,6 +150,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba) | |||
148 | return -ERESTART; | 150 | return -ERESTART; |
149 | } | 151 | } |
150 | 152 | ||
153 | if (phba->sli_rev == 3 && !mb->un.varRdRev.v3rsp) | ||
154 | return -EINVAL; | ||
155 | |||
151 | /* Save information as VPD data */ | 156 | /* Save information as VPD data */ |
152 | vp->rev.rBit = 1; | 157 | vp->rev.rBit = 1; |
153 | vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev; | 158 | vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev; |
@@ -236,10 +241,9 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
236 | 241 | ||
237 | /* Get login parameters for NID. */ | 242 | /* Get login parameters for NID. */ |
238 | lpfc_read_sparam(phba, pmb); | 243 | lpfc_read_sparam(phba, pmb); |
244 | pmb->vport = vport; | ||
239 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 245 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
240 | lpfc_printf_log(phba, | 246 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
241 | KERN_ERR, | ||
242 | LOG_INIT, | ||
243 | "%d:0448 Adapter failed init, mbxCmd x%x " | 247 | "%d:0448 Adapter failed init, mbxCmd x%x " |
244 | "READ_SPARM mbxStatus x%x\n", | 248 | "READ_SPARM mbxStatus x%x\n", |
245 | phba->brd_no, | 249 | phba->brd_no, |
@@ -296,10 +300,9 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
296 | } | 300 | } |
297 | 301 | ||
298 | lpfc_read_config(phba, pmb); | 302 | lpfc_read_config(phba, pmb); |
303 | pmb->vport = vport; | ||
299 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | 304 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { |
300 | lpfc_printf_log(phba, | 305 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
301 | KERN_ERR, | ||
302 | LOG_INIT, | ||
303 | "%d:0453 Adapter failed to init, mbxCmd x%x " | 306 | "%d:0453 Adapter failed to init, mbxCmd x%x " |
304 | "READ_CONFIG, mbxStatus x%x\n", | 307 | "READ_CONFIG, mbxStatus x%x\n", |
305 | phba->brd_no, | 308 | phba->brd_no, |
@@ -331,9 +334,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
331 | || ((phba->cfg_link_speed == LINK_SPEED_10G) | 334 | || ((phba->cfg_link_speed == LINK_SPEED_10G) |
332 | && !(phba->lmt & LMT_10Gb))) { | 335 | && !(phba->lmt & LMT_10Gb))) { |
333 | /* Reset link speed to auto */ | 336 | /* Reset link speed to auto */ |
334 | lpfc_printf_log(phba, | 337 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, |
335 | KERN_WARNING, | ||
336 | LOG_LINK_EVENT, | ||
337 | "%d:1302 Invalid speed for this board: " | 338 | "%d:1302 Invalid speed for this board: " |
338 | "Reset link speed to auto: x%x\n", | 339 | "Reset link speed to auto: x%x\n", |
339 | phba->brd_no, | 340 | phba->brd_no, |
@@ -352,7 +353,8 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
352 | psli->ring[psli->next_ring].flag |= LPFC_STOP_IOCB_EVENT; | 353 | psli->ring[psli->next_ring].flag |= LPFC_STOP_IOCB_EVENT; |
353 | 354 | ||
354 | /* Post receive buffers for desired rings */ | 355 | /* Post receive buffers for desired rings */ |
355 | lpfc_post_rcv_buf(phba); | 356 | if (phba->sli_rev != 3) |
357 | lpfc_post_rcv_buf(phba); | ||
356 | 358 | ||
357 | /* Enable appropriate host interrupts */ | 359 | /* Enable appropriate host interrupts */ |
358 | spin_lock_irq(&phba->hbalock); | 360 | spin_lock_irq(&phba->hbalock); |
@@ -383,12 +385,11 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
383 | 385 | ||
384 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); | 386 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); |
385 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 387 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
388 | pmb->vport = vport; | ||
386 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | 389 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); |
387 | lpfc_set_loopback_flag(phba); | 390 | lpfc_set_loopback_flag(phba); |
388 | if (rc != MBX_SUCCESS) { | 391 | if (rc != MBX_SUCCESS) { |
389 | lpfc_printf_log(phba, | 392 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
390 | KERN_ERR, | ||
391 | LOG_INIT, | ||
392 | "%d:0454 Adapter failed to init, mbxCmd x%x " | 393 | "%d:0454 Adapter failed to init, mbxCmd x%x " |
393 | "INIT_LINK, mbxStatus x%x\n", | 394 | "INIT_LINK, mbxStatus x%x\n", |
394 | phba->brd_no, | 395 | phba->brd_no, |
@@ -630,9 +631,7 @@ lpfc_handle_latt_err_exit: | |||
630 | 631 | ||
631 | /* The other case is an error from issue_mbox */ | 632 | /* The other case is an error from issue_mbox */ |
632 | if (rc == -ENOMEM) | 633 | if (rc == -ENOMEM) |
633 | lpfc_printf_log(phba, | 634 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
634 | KERN_WARNING, | ||
635 | LOG_MBOX, | ||
636 | "%d:0300 READ_LA: no buffers\n", | 635 | "%d:0300 READ_LA: no buffers\n", |
637 | phba->brd_no); | 636 | phba->brd_no); |
638 | 637 | ||
@@ -658,9 +657,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) | |||
658 | return 0; | 657 | return 0; |
659 | 658 | ||
660 | /* Vital Product */ | 659 | /* Vital Product */ |
661 | lpfc_printf_log(phba, | 660 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
662 | KERN_INFO, | ||
663 | LOG_INIT, | ||
664 | "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", | 661 | "%d:0455 Vital Product Data: x%x x%x x%x x%x\n", |
665 | phba->brd_no, | 662 | phba->brd_no, |
666 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], | 663 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], |
@@ -1221,9 +1218,7 @@ lpfc_online(struct lpfc_hba *phba) | |||
1221 | if (!(vport->fc_flag & FC_OFFLINE_MODE)) | 1218 | if (!(vport->fc_flag & FC_OFFLINE_MODE)) |
1222 | return 0; | 1219 | return 0; |
1223 | 1220 | ||
1224 | lpfc_printf_log(phba, | 1221 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, |
1225 | KERN_WARNING, | ||
1226 | LOG_INIT, | ||
1227 | "%d:0458 Bring Adapter online\n", | 1222 | "%d:0458 Bring Adapter online\n", |
1228 | phba->brd_no); | 1223 | phba->brd_no); |
1229 | 1224 | ||
@@ -1633,13 +1628,22 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1633 | 1628 | ||
1634 | memset(phba->slim2p, 0, SLI2_SLIM_SIZE); | 1629 | memset(phba->slim2p, 0, SLI2_SLIM_SIZE); |
1635 | 1630 | ||
1631 | phba->hbqslimp.virt = dma_alloc_coherent(&phba->pcidev->dev, | ||
1632 | lpfc_sli_hbq_size(), | ||
1633 | &phba->hbqslimp.phys, | ||
1634 | GFP_KERNEL); | ||
1635 | if (!phba->hbqslimp.virt) | ||
1636 | goto out_free_slim; | ||
1637 | |||
1638 | memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); | ||
1639 | |||
1636 | /* Initialize the SLI Layer to run with lpfc HBAs. */ | 1640 | /* Initialize the SLI Layer to run with lpfc HBAs. */ |
1637 | lpfc_sli_setup(phba); | 1641 | lpfc_sli_setup(phba); |
1638 | lpfc_sli_queue_setup(phba); | 1642 | lpfc_sli_queue_setup(phba); |
1639 | 1643 | ||
1640 | error = lpfc_mem_alloc(phba); | 1644 | error = lpfc_mem_alloc(phba); |
1641 | if (error) | 1645 | if (error) |
1642 | goto out_free_slim; | 1646 | goto out_free_hbqslimp; |
1643 | 1647 | ||
1644 | /* Initialize and populate the iocb list per host. */ | 1648 | /* Initialize and populate the iocb list per host. */ |
1645 | INIT_LIST_HEAD(&phba->lpfc_iocb_list); | 1649 | INIT_LIST_HEAD(&phba->lpfc_iocb_list); |
@@ -1753,6 +1757,9 @@ out_free_iocbq: | |||
1753 | phba->total_iocbq_bufs--; | 1757 | phba->total_iocbq_bufs--; |
1754 | } | 1758 | } |
1755 | lpfc_mem_free(phba); | 1759 | lpfc_mem_free(phba); |
1760 | out_free_hbqslimp: | ||
1761 | dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, | ||
1762 | phba->hbqslimp.phys); | ||
1756 | out_free_slim: | 1763 | out_free_slim: |
1757 | dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p, | 1764 | dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p, |
1758 | phba->slim2p_mapping); | 1765 | phba->slim2p_mapping); |
@@ -1811,6 +1818,9 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
1811 | lpfc_scsi_free(phba); | 1818 | lpfc_scsi_free(phba); |
1812 | lpfc_mem_free(phba); | 1819 | lpfc_mem_free(phba); |
1813 | 1820 | ||
1821 | dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, | ||
1822 | phba->hbqslimp.phys); | ||
1823 | |||
1814 | /* Free resources associated with SLI2 interface */ | 1824 | /* Free resources associated with SLI2 interface */ |
1815 | dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, | 1825 | dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, |
1816 | phba->slim2p, phba->slim2p_mapping); | 1826 | phba->slim2p, phba->slim2p_mapping); |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 86757ec53057..977799c2b2c2 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -232,6 +232,7 @@ lpfc_init_link(struct lpfc_hba * phba, | |||
232 | mb->mbxCommand = (volatile uint8_t)MBX_INIT_LINK; | 232 | mb->mbxCommand = (volatile uint8_t)MBX_INIT_LINK; |
233 | mb->mbxOwner = OWN_HOST; | 233 | mb->mbxOwner = OWN_HOST; |
234 | mb->un.varInitLnk.fabric_AL_PA = phba->fc_pref_ALPA; | 234 | mb->un.varInitLnk.fabric_AL_PA = phba->fc_pref_ALPA; |
235 | mb->un.varInitLnk.link_flags |= FLAGS_UNREG_LOGIN_ALL; | ||
235 | return; | 236 | return; |
236 | } | 237 | } |
237 | 238 | ||
@@ -418,6 +419,10 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba) | |||
418 | for (i = 0; i < psli->num_rings; i++) { | 419 | for (i = 0; i < psli->num_rings; i++) { |
419 | pring = &psli->ring[i]; | 420 | pring = &psli->ring[i]; |
420 | 421 | ||
422 | pring->sizeCiocb = phba->sli_rev == 3 ? SLI3_IOCB_CMD_SIZE: | ||
423 | SLI2_IOCB_CMD_SIZE; | ||
424 | pring->sizeRiocb = phba->sli_rev == 3 ? SLI3_IOCB_RSP_SIZE: | ||
425 | SLI2_IOCB_RSP_SIZE; | ||
421 | /* A ring MUST have both cmd and rsp entries defined to be | 426 | /* A ring MUST have both cmd and rsp entries defined to be |
422 | valid */ | 427 | valid */ |
423 | if ((pring->numCiocb == 0) || (pring->numRiocb == 0)) { | 428 | if ((pring->numCiocb == 0) || (pring->numRiocb == 0)) { |
@@ -432,8 +437,7 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba) | |||
432 | continue; | 437 | continue; |
433 | } | 438 | } |
434 | /* Command ring setup for ring */ | 439 | /* Command ring setup for ring */ |
435 | pring->cmdringaddr = | 440 | pring->cmdringaddr = (void *)&phba->slim2p->IOCBs[iocbCnt]; |
436 | (void *)&phba->slim2p->IOCBs[iocbCnt]; | ||
437 | pcbp->rdsc[i].cmdEntries = pring->numCiocb; | 441 | pcbp->rdsc[i].cmdEntries = pring->numCiocb; |
438 | 442 | ||
439 | offset = (uint8_t *)&phba->slim2p->IOCBs[iocbCnt] - | 443 | offset = (uint8_t *)&phba->slim2p->IOCBs[iocbCnt] - |
@@ -444,8 +448,7 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba) | |||
444 | iocbCnt += pring->numCiocb; | 448 | iocbCnt += pring->numCiocb; |
445 | 449 | ||
446 | /* Response ring setup for ring */ | 450 | /* Response ring setup for ring */ |
447 | pring->rspringaddr = | 451 | pring->rspringaddr = (void *)&phba->slim2p->IOCBs[iocbCnt]; |
448 | (void *)&phba->slim2p->IOCBs[iocbCnt]; | ||
449 | 452 | ||
450 | pcbp->rdsc[i].rspEntries = pring->numRiocb; | 453 | pcbp->rdsc[i].rspEntries = pring->numRiocb; |
451 | offset = (uint8_t *)&phba->slim2p->IOCBs[iocbCnt] - | 454 | offset = (uint8_t *)&phba->slim2p->IOCBs[iocbCnt] - |
@@ -463,11 +466,103 @@ lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
463 | MAILBOX_t *mb = &pmb->mb; | 466 | MAILBOX_t *mb = &pmb->mb; |
464 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | 467 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); |
465 | mb->un.varRdRev.cv = 1; | 468 | mb->un.varRdRev.cv = 1; |
469 | mb->un.varRdRev.v3req = 1; /* Request SLI3 info */ | ||
466 | mb->mbxCommand = MBX_READ_REV; | 470 | mb->mbxCommand = MBX_READ_REV; |
467 | mb->mbxOwner = OWN_HOST; | 471 | mb->mbxOwner = OWN_HOST; |
468 | return; | 472 | return; |
469 | } | 473 | } |
470 | 474 | ||
475 | static void | ||
476 | lpfc_build_hbq_profile2(struct config_hbq_var *hbqmb, | ||
477 | struct lpfc_hbq_init *hbq_desc) | ||
478 | { | ||
479 | hbqmb->profiles.profile2.seqlenbcnt = hbq_desc->seqlenbcnt; | ||
480 | hbqmb->profiles.profile2.maxlen = hbq_desc->maxlen; | ||
481 | hbqmb->profiles.profile2.seqlenoff = hbq_desc->seqlenoff; | ||
482 | } | ||
483 | |||
484 | static void | ||
485 | lpfc_build_hbq_profile3(struct config_hbq_var *hbqmb, | ||
486 | struct lpfc_hbq_init *hbq_desc) | ||
487 | { | ||
488 | hbqmb->profiles.profile3.seqlenbcnt = hbq_desc->seqlenbcnt; | ||
489 | hbqmb->profiles.profile3.maxlen = hbq_desc->maxlen; | ||
490 | hbqmb->profiles.profile3.cmdcodeoff = hbq_desc->cmdcodeoff; | ||
491 | hbqmb->profiles.profile3.seqlenoff = hbq_desc->seqlenoff; | ||
492 | memcpy(&hbqmb->profiles.profile3.cmdmatch, hbq_desc->cmdmatch, | ||
493 | sizeof(hbqmb->profiles.profile3.cmdmatch)); | ||
494 | } | ||
495 | |||
496 | static void | ||
497 | lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb, | ||
498 | struct lpfc_hbq_init *hbq_desc) | ||
499 | { | ||
500 | hbqmb->profiles.profile5.seqlenbcnt = hbq_desc->seqlenbcnt; | ||
501 | hbqmb->profiles.profile5.maxlen = hbq_desc->maxlen; | ||
502 | hbqmb->profiles.profile5.cmdcodeoff = hbq_desc->cmdcodeoff; | ||
503 | hbqmb->profiles.profile5.seqlenoff = hbq_desc->seqlenoff; | ||
504 | memcpy(&hbqmb->profiles.profile5.cmdmatch, hbq_desc->cmdmatch, | ||
505 | sizeof(hbqmb->profiles.profile5.cmdmatch)); | ||
506 | } | ||
507 | |||
508 | void | ||
509 | lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc, | ||
510 | uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb) | ||
511 | { | ||
512 | int i; | ||
513 | MAILBOX_t *mb = &pmb->mb; | ||
514 | struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; | ||
515 | |||
516 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | ||
517 | hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ | ||
518 | hbqmb->recvNotify = hbq_desc->rn; /* Receive | ||
519 | * Notification */ | ||
520 | hbqmb->numMask = hbq_desc->mask_count; /* # R_CTL/TYPE masks | ||
521 | * # in words 0-19 */ | ||
522 | hbqmb->profile = hbq_desc->profile; /* Selection profile: | ||
523 | * 0 = all, | ||
524 | * 7 = logentry */ | ||
525 | hbqmb->ringMask = hbq_desc->ring_mask; /* Binds HBQ to a ring | ||
526 | * e.g. Ring0=b0001, | ||
527 | * ring2=b0100 */ | ||
528 | hbqmb->headerLen = hbq_desc->headerLen; /* 0 if not profile 4 | ||
529 | * or 5 */ | ||
530 | hbqmb->logEntry = hbq_desc->logEntry; /* Set to 1 if this | ||
531 | * HBQ will be used | ||
532 | * for LogEntry | ||
533 | * buffers */ | ||
534 | hbqmb->hbqaddrLow = putPaddrLow(phba->hbqslimp.phys) + | ||
535 | hbq_entry_index * sizeof(struct lpfc_hbq_entry); | ||
536 | hbqmb->hbqaddrHigh = putPaddrHigh(phba->hbqslimp.phys); | ||
537 | |||
538 | mb->mbxCommand = MBX_CONFIG_HBQ; | ||
539 | mb->mbxOwner = OWN_HOST; | ||
540 | |||
541 | /* Copy info for profiles 2,3,5. Other | ||
542 | * profiles this area is reserved | ||
543 | */ | ||
544 | if (hbq_desc->profile == 2) | ||
545 | lpfc_build_hbq_profile2(hbqmb, hbq_desc); | ||
546 | else if (hbq_desc->profile == 3) | ||
547 | lpfc_build_hbq_profile3(hbqmb, hbq_desc); | ||
548 | else if (hbq_desc->profile == 5) | ||
549 | lpfc_build_hbq_profile5(hbqmb, hbq_desc); | ||
550 | |||
551 | /* Return if no rctl / type masks for this HBQ */ | ||
552 | if (!hbq_desc->mask_count) | ||
553 | return; | ||
554 | |||
555 | /* Otherwise we setup specific rctl / type masks for this HBQ */ | ||
556 | for (i = 0; i < hbq_desc->mask_count; i++) { | ||
557 | hbqmb->hbqMasks[i].tmatch = hbq_desc->hbqMasks[i].tmatch; | ||
558 | hbqmb->hbqMasks[i].tmask = hbq_desc->hbqMasks[i].tmask; | ||
559 | hbqmb->hbqMasks[i].rctlmatch = hbq_desc->hbqMasks[i].rctlmatch; | ||
560 | hbqmb->hbqMasks[i].rctlmask = hbq_desc->hbqMasks[i].rctlmask; | ||
561 | } | ||
562 | |||
563 | return; | ||
564 | } | ||
565 | |||
471 | void | 566 | void |
472 | lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb) | 567 | lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb) |
473 | { | 568 | { |
@@ -512,13 +607,14 @@ lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb) | |||
512 | void | 607 | void |
513 | lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | 608 | lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) |
514 | { | 609 | { |
610 | MAILBOX_t __iomem *mb_slim = (MAILBOX_t __iomem *) phba->MBslimaddr; | ||
515 | MAILBOX_t *mb = &pmb->mb; | 611 | MAILBOX_t *mb = &pmb->mb; |
516 | dma_addr_t pdma_addr; | 612 | dma_addr_t pdma_addr; |
517 | uint32_t bar_low, bar_high; | 613 | uint32_t bar_low, bar_high; |
518 | size_t offset; | 614 | size_t offset; |
519 | struct lpfc_hgp hgp; | 615 | struct lpfc_hgp hgp; |
520 | void __iomem *to_slim; | ||
521 | int i; | 616 | int i; |
617 | uint32_t pgp_offset; | ||
522 | 618 | ||
523 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); | 619 | memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); |
524 | mb->mbxCommand = MBX_CONFIG_PORT; | 620 | mb->mbxCommand = MBX_CONFIG_PORT; |
@@ -531,12 +627,21 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
531 | mb->un.varCfgPort.pcbLow = putPaddrLow(pdma_addr); | 627 | mb->un.varCfgPort.pcbLow = putPaddrLow(pdma_addr); |
532 | mb->un.varCfgPort.pcbHigh = putPaddrHigh(pdma_addr); | 628 | mb->un.varCfgPort.pcbHigh = putPaddrHigh(pdma_addr); |
533 | 629 | ||
630 | /* If HBA supports SLI=3 ask for it */ | ||
631 | |||
632 | mb->un.varCfgPort.sli_mode = phba->sli_rev; | ||
633 | if (phba->sli_rev == 3) { | ||
634 | mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ | ||
635 | mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ | ||
636 | } | ||
637 | |||
534 | /* Now setup pcb */ | 638 | /* Now setup pcb */ |
535 | phba->slim2p->pcb.type = TYPE_NATIVE_SLI2; | 639 | phba->slim2p->pcb.type = TYPE_NATIVE_SLI2; |
536 | phba->slim2p->pcb.feature = FEATURE_INITIAL_SLI2; | 640 | phba->slim2p->pcb.feature = FEATURE_INITIAL_SLI2; |
537 | 641 | ||
538 | /* Setup Mailbox pointers */ | 642 | /* Setup Mailbox pointers */ |
539 | phba->slim2p->pcb.mailBoxSize = sizeof(MAILBOX_t); | 643 | phba->slim2p->pcb.mailBoxSize = offsetof(MAILBOX_t, us) + |
644 | sizeof(struct sli2_desc); | ||
540 | offset = (uint8_t *)&phba->slim2p->mbx - (uint8_t *)phba->slim2p; | 645 | offset = (uint8_t *)&phba->slim2p->mbx - (uint8_t *)phba->slim2p; |
541 | pdma_addr = phba->slim2p_mapping + offset; | 646 | pdma_addr = phba->slim2p_mapping + offset; |
542 | phba->slim2p->pcb.mbAddrHigh = putPaddrHigh(pdma_addr); | 647 | phba->slim2p->pcb.mbAddrHigh = putPaddrHigh(pdma_addr); |
@@ -564,29 +669,70 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
564 | pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_0, &bar_low); | 669 | pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_0, &bar_low); |
565 | pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_1, &bar_high); | 670 | pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_1, &bar_high); |
566 | 671 | ||
672 | /* | ||
673 | * Set up HGP - Port Memory | ||
674 | * | ||
675 | * The port expects the host get/put pointers to reside in memory | ||
676 | * following the "non-diagnostic" mode mailbox (32 words, 0x80 bytes) | ||
677 | * area of SLIM. In SLI-2 mode, there's an additional 16 reserved | ||
678 | * words (0x40 bytes). This area is not reserved if HBQs are | ||
679 | * configured in SLI-3. | ||
680 | * | ||
681 | * CR0Put - SLI2(no HBQs) = 0xc0, With HBQs = 0x80 | ||
682 | * RR0Get 0xc4 0x84 | ||
683 | * CR1Put 0xc8 0x88 | ||
684 | * RR1Get 0xcc 0x8c | ||
685 | * CR2Put 0xd0 0x90 | ||
686 | * RR2Get 0xd4 0x94 | ||
687 | * CR3Put 0xd8 0x98 | ||
688 | * RR3Get 0xdc 0x9c | ||
689 | * | ||
690 | * Reserved 0xa0-0xbf | ||
691 | * If HBQs configured: | ||
692 | * HBQ 0 Put ptr 0xc0 | ||
693 | * HBQ 1 Put ptr 0xc4 | ||
694 | * HBQ 2 Put ptr 0xc8 | ||
695 | * ...... | ||
696 | * HBQ(M-1)Put Pointer 0xc0+(M-1)*4 | ||
697 | * | ||
698 | */ | ||
699 | |||
700 | if (phba->sli_rev == 3) { | ||
701 | phba->host_gp = &mb_slim->us.s3.host[0]; | ||
702 | phba->hbq_put = &mb_slim->us.s3.hbq_put[0]; | ||
703 | } else { | ||
704 | phba->host_gp = &mb_slim->us.s2.host[0]; | ||
705 | phba->hbq_put = NULL; | ||
706 | } | ||
567 | 707 | ||
568 | /* mask off BAR0's flag bits 0 - 3 */ | 708 | /* mask off BAR0's flag bits 0 - 3 */ |
569 | phba->slim2p->pcb.hgpAddrLow = (bar_low & PCI_BASE_ADDRESS_MEM_MASK) + | 709 | phba->slim2p->pcb.hgpAddrLow = (bar_low & PCI_BASE_ADDRESS_MEM_MASK) + |
570 | (SLIMOFF*sizeof(uint32_t)); | 710 | (void __iomem *) phba->host_gp - |
711 | (void __iomem *)phba->MBslimaddr; | ||
571 | if (bar_low & PCI_BASE_ADDRESS_MEM_TYPE_64) | 712 | if (bar_low & PCI_BASE_ADDRESS_MEM_TYPE_64) |
572 | phba->slim2p->pcb.hgpAddrHigh = bar_high; | 713 | phba->slim2p->pcb.hgpAddrHigh = bar_high; |
573 | else | 714 | else |
574 | phba->slim2p->pcb.hgpAddrHigh = 0; | 715 | phba->slim2p->pcb.hgpAddrHigh = 0; |
575 | /* write HGP data to SLIM at the required longword offset */ | 716 | /* write HGP data to SLIM at the required longword offset */ |
576 | memset(&hgp, 0, sizeof(struct lpfc_hgp)); | 717 | memset(&hgp, 0, sizeof(struct lpfc_hgp)); |
577 | to_slim = phba->MBslimaddr + (SLIMOFF*sizeof (uint32_t)); | ||
578 | 718 | ||
579 | for (i=0; i < phba->sli.num_rings; i++) { | 719 | for (i=0; i < phba->sli.num_rings; i++) { |
580 | lpfc_memcpy_to_slim(to_slim, &hgp, sizeof(struct lpfc_hgp)); | 720 | lpfc_memcpy_to_slim(phba->host_gp + i, &hgp, |
581 | to_slim += sizeof (struct lpfc_hgp); | 721 | sizeof(*phba->host_gp)); |
582 | } | 722 | } |
583 | 723 | ||
584 | /* Setup Port Group ring pointer */ | 724 | /* Setup Port Group ring pointer */ |
585 | offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port - | 725 | if (phba->sli_rev == 3) |
586 | (uint8_t *)phba->slim2p; | 726 | pgp_offset = (uint8_t *)&phba->slim2p->mbx.us.s3_pgp.port - |
587 | pdma_addr = phba->slim2p_mapping + offset; | 727 | (uint8_t *)phba->slim2p; |
728 | else | ||
729 | pgp_offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port - | ||
730 | (uint8_t *)phba->slim2p; | ||
731 | |||
732 | pdma_addr = phba->slim2p_mapping + pgp_offset; | ||
588 | phba->slim2p->pcb.pgpAddrHigh = putPaddrHigh(pdma_addr); | 733 | phba->slim2p->pcb.pgpAddrHigh = putPaddrHigh(pdma_addr); |
589 | phba->slim2p->pcb.pgpAddrLow = putPaddrLow(pdma_addr); | 734 | phba->slim2p->pcb.pgpAddrLow = putPaddrLow(pdma_addr); |
735 | phba->hbq_get = &phba->slim2p->mbx.us.s3_pgp.hbq_get[0]; | ||
590 | 736 | ||
591 | /* Use callback routine to setp rings in the pcb */ | 737 | /* Use callback routine to setp rings in the pcb */ |
592 | lpfc_config_pcb_setup(phba); | 738 | lpfc_config_pcb_setup(phba); |
@@ -603,10 +749,6 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
603 | /* Swap PCB if needed */ | 749 | /* Swap PCB if needed */ |
604 | lpfc_sli_pcimem_bcopy(&phba->slim2p->pcb, &phba->slim2p->pcb, | 750 | lpfc_sli_pcimem_bcopy(&phba->slim2p->pcb, &phba->slim2p->pcb, |
605 | sizeof (PCB_t)); | 751 | sizeof (PCB_t)); |
606 | |||
607 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | ||
608 | "%d:0405 Service Level Interface (SLI) 2 selected\n", | ||
609 | phba->brd_no); | ||
610 | } | 752 | } |
611 | 753 | ||
612 | void | 754 | void |
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3aa1dff15446..435dc2ec9357 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -82,8 +82,16 @@ lpfc_mem_alloc(struct lpfc_hba * phba) | |||
82 | if (!phba->nlp_mem_pool) | 82 | if (!phba->nlp_mem_pool) |
83 | goto fail_free_mbox_pool; | 83 | goto fail_free_mbox_pool; |
84 | 84 | ||
85 | phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool",phba->pcidev, | ||
86 | LPFC_BPL_SIZE, 8, 0); | ||
87 | if (!phba->lpfc_hbq_pool) | ||
88 | goto fail_free_nlp_mem_pool; | ||
89 | |||
85 | return 0; | 90 | return 0; |
86 | 91 | ||
92 | fail_free_nlp_mem_pool: | ||
93 | mempool_destroy(phba->nlp_mem_pool); | ||
94 | phba->nlp_mem_pool = NULL; | ||
87 | fail_free_mbox_pool: | 95 | fail_free_mbox_pool: |
88 | mempool_destroy(phba->mbox_mem_pool); | 96 | mempool_destroy(phba->mbox_mem_pool); |
89 | phba->mbox_mem_pool = NULL; | 97 | phba->mbox_mem_pool = NULL; |
@@ -111,6 +119,8 @@ lpfc_mem_free(struct lpfc_hba * phba) | |||
111 | struct lpfc_dmabuf *mp; | 119 | struct lpfc_dmabuf *mp; |
112 | int i; | 120 | int i; |
113 | 121 | ||
122 | lpfc_sli_hbqbuf_free_all(phba); | ||
123 | |||
114 | spin_lock_irq(&phba->hbalock); | 124 | spin_lock_irq(&phba->hbalock); |
115 | list_for_each_entry_safe(mbox, next_mbox, &psli->mboxq, list) { | 125 | list_for_each_entry_safe(mbox, next_mbox, &psli->mboxq, list) { |
116 | mp = (struct lpfc_dmabuf *) (mbox->context1); | 126 | mp = (struct lpfc_dmabuf *) (mbox->context1); |
@@ -140,12 +150,14 @@ lpfc_mem_free(struct lpfc_hba * phba) | |||
140 | pool->elements[i].phys); | 150 | pool->elements[i].phys); |
141 | kfree(pool->elements); | 151 | kfree(pool->elements); |
142 | 152 | ||
153 | pci_pool_destroy(phba->lpfc_hbq_pool); | ||
143 | mempool_destroy(phba->nlp_mem_pool); | 154 | mempool_destroy(phba->nlp_mem_pool); |
144 | mempool_destroy(phba->mbox_mem_pool); | 155 | mempool_destroy(phba->mbox_mem_pool); |
145 | 156 | ||
146 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); | 157 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); |
147 | pci_pool_destroy(phba->lpfc_mbuf_pool); | 158 | pci_pool_destroy(phba->lpfc_mbuf_pool); |
148 | 159 | ||
160 | phba->lpfc_hbq_pool = NULL; | ||
149 | phba->nlp_mem_pool = NULL; | 161 | phba->nlp_mem_pool = NULL; |
150 | phba->mbox_mem_pool = NULL; | 162 | phba->mbox_mem_pool = NULL; |
151 | phba->lpfc_scsi_dma_buf_pool = NULL; | 163 | phba->lpfc_scsi_dma_buf_pool = NULL; |
@@ -201,3 +213,20 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) | |||
201 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 213 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
202 | return; | 214 | return; |
203 | } | 215 | } |
216 | |||
217 | |||
218 | void * | ||
219 | lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) | ||
220 | { | ||
221 | void *ret; | ||
222 | ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | void | ||
227 | lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) | ||
228 | { | ||
229 | pci_pool_free(phba->lpfc_hbq_pool, virt, dma); | ||
230 | return; | ||
231 | } | ||
232 | |||
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index e6452b88d958..b1727481a1e6 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -255,9 +255,8 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
255 | /* Start discovery - this should just do | 255 | /* Start discovery - this should just do |
256 | CLEAR_LA */ | 256 | CLEAR_LA */ |
257 | lpfc_disc_start(vport); | 257 | lpfc_disc_start(vport); |
258 | } else { | 258 | } else |
259 | lpfc_initial_flogi(vport); | 259 | lpfc_initial_flogi(vport); |
260 | } | ||
261 | } else { | 260 | } else { |
262 | stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY; | 261 | stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY; |
263 | stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; | 262 | stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; |
@@ -279,19 +278,16 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
279 | icmd = &cmdiocb->iocb; | 278 | icmd = &cmdiocb->iocb; |
280 | 279 | ||
281 | /* PLOGI chkparm OK */ | 280 | /* PLOGI chkparm OK */ |
282 | lpfc_printf_log(phba, | 281 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
283 | KERN_INFO, | ||
284 | LOG_ELS, | ||
285 | "%d:0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", | 282 | "%d:0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", |
286 | phba->brd_no, | 283 | phba->brd_no, |
287 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, | 284 | ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, |
288 | ndlp->nlp_rpi); | 285 | ndlp->nlp_rpi); |
289 | 286 | ||
290 | if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) { | 287 | if (phba->cfg_fcp_class == 2 && sp->cls2.classValid) |
291 | ndlp->nlp_fcp_info |= CLASS2; | 288 | ndlp->nlp_fcp_info |= CLASS2; |
292 | } else { | 289 | else |
293 | ndlp->nlp_fcp_info |= CLASS3; | 290 | ndlp->nlp_fcp_info |= CLASS3; |
294 | } | ||
295 | 291 | ||
296 | ndlp->nlp_class_sup = 0; | 292 | ndlp->nlp_class_sup = 0; |
297 | if (sp->cls1.classValid) | 293 | if (sp->cls1.classValid) |
@@ -327,6 +323,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
327 | goto out; | 323 | goto out; |
328 | lpfc_config_link(phba, mbox); | 324 | lpfc_config_link(phba, mbox); |
329 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 325 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
326 | mbox->vport = vport; | ||
330 | rc = lpfc_sli_issue_mbox | 327 | rc = lpfc_sli_issue_mbox |
331 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 328 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
332 | if (rc == MBX_NOT_FINISHED) { | 329 | if (rc == MBX_NOT_FINISHED) { |
@@ -544,9 +541,7 @@ static uint32_t | |||
544 | lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | 541 | lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
545 | void *arg, uint32_t evt) | 542 | void *arg, uint32_t evt) |
546 | { | 543 | { |
547 | lpfc_printf_log(vport->phba, | 544 | lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY, |
548 | KERN_ERR, | ||
549 | LOG_DISCOVERY, | ||
550 | "%d:0253 Illegal State Transition: node x%x event x%x, " | 545 | "%d:0253 Illegal State Transition: node x%x event x%x, " |
551 | "state x%x Data: x%x x%x\n", | 546 | "state x%x Data: x%x x%x\n", |
552 | vport->phba->brd_no, | 547 | vport->phba->brd_no, |
@@ -728,9 +723,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, | |||
728 | goto out; | 723 | goto out; |
729 | 724 | ||
730 | /* PLOGI chkparm OK */ | 725 | /* PLOGI chkparm OK */ |
731 | lpfc_printf_log(phba, | 726 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
732 | KERN_INFO, | ||
733 | LOG_ELS, | ||
734 | "%d:0121 PLOGI chkparm OK " | 727 | "%d:0121 PLOGI chkparm OK " |
735 | "Data: x%x x%x x%x x%x\n", | 728 | "Data: x%x x%x x%x x%x\n", |
736 | phba->brd_no, | 729 | phba->brd_no, |
@@ -1105,9 +1098,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, | |||
1105 | 1098 | ||
1106 | if (mb->mbxStatus) { | 1099 | if (mb->mbxStatus) { |
1107 | /* RegLogin failed */ | 1100 | /* RegLogin failed */ |
1108 | lpfc_printf_log(phba, | 1101 | lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, |
1109 | KERN_ERR, | ||
1110 | LOG_DISCOVERY, | ||
1111 | "%d:0246 RegLogin failed Data: x%x x%x x%x\n", | 1102 | "%d:0246 RegLogin failed Data: x%x x%x x%x\n", |
1112 | phba->brd_no, | 1103 | phba->brd_no, |
1113 | did, mb->mbxStatus, vport->port_state); | 1104 | did, mb->mbxStatus, vport->port_state); |
@@ -1470,15 +1461,12 @@ static uint32_t | |||
1470 | lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | 1461 | lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, |
1471 | void *arg, uint32_t evt) | 1462 | void *arg, uint32_t evt) |
1472 | { | 1463 | { |
1473 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | ||
1474 | struct lpfc_hba *phba = vport->phba; | 1464 | struct lpfc_hba *phba = vport->phba; |
1475 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; | 1465 | struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; |
1476 | 1466 | ||
1477 | /* flush the target */ | 1467 | /* flush the target */ |
1478 | spin_lock_irq(shost->host_lock); | ||
1479 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], | 1468 | lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], |
1480 | ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); | 1469 | ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT); |
1481 | spin_unlock_irq(shost->host_lock); | ||
1482 | 1470 | ||
1483 | /* Treat like rcv logo */ | 1471 | /* Treat like rcv logo */ |
1484 | lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); | 1472 | lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO); |
@@ -1926,9 +1914,7 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1926 | cur_state = ndlp->nlp_state; | 1914 | cur_state = ndlp->nlp_state; |
1927 | 1915 | ||
1928 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ | 1916 | /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ |
1929 | lpfc_printf_log(phba, | 1917 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
1930 | KERN_INFO, | ||
1931 | LOG_DISCOVERY, | ||
1932 | "%d:0211 DSM in event x%x on NPort x%x in state %d " | 1918 | "%d:0211 DSM in event x%x on NPort x%x in state %d " |
1933 | "Data: x%x\n", | 1919 | "Data: x%x\n", |
1934 | phba->brd_no, | 1920 | phba->brd_no, |
@@ -1938,9 +1924,7 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1938 | rc = (func) (vport, ndlp, arg, evt); | 1924 | rc = (func) (vport, ndlp, arg, evt); |
1939 | 1925 | ||
1940 | /* DSM out state <rc> on NPort <nlp_DID> */ | 1926 | /* DSM out state <rc> on NPort <nlp_DID> */ |
1941 | lpfc_printf_log(phba, | 1927 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
1942 | KERN_INFO, | ||
1943 | LOG_DISCOVERY, | ||
1944 | "%d:0212 DSM out state %d on NPort x%x Data: x%x\n", | 1928 | "%d:0212 DSM out state %d on NPort x%x Data: x%x\n", |
1945 | phba->brd_no, | 1929 | phba->brd_no, |
1946 | rc, ndlp->nlp_DID, ndlp->nlp_flag); | 1930 | rc, ndlp->nlp_DID, ndlp->nlp_flag); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 6db7ad83cc39..90c88733a4f5 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -840,7 +840,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
840 | cmnd->result = ScsiResult(DID_BUS_BUSY, 0); | 840 | cmnd->result = ScsiResult(DID_BUS_BUSY, 0); |
841 | goto out_fail_command; | 841 | goto out_fail_command; |
842 | } | 842 | } |
843 | lpfc_cmd = lpfc_get_scsi_buf (phba); | 843 | lpfc_cmd = lpfc_get_scsi_buf(phba); |
844 | if (lpfc_cmd == NULL) { | 844 | if (lpfc_cmd == NULL) { |
845 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, | 845 | lpfc_printf_log(phba, KERN_INFO, LOG_FCP, |
846 | "%d:0707 driver's buffer pool is empty, " | 846 | "%d:0707 driver's buffer pool is empty, " |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 1edac15eed40..6e0b42bcebe7 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -65,6 +65,25 @@ typedef enum _lpfc_iocb_type { | |||
65 | LPFC_ABORT_IOCB | 65 | LPFC_ABORT_IOCB |
66 | } lpfc_iocb_type; | 66 | } lpfc_iocb_type; |
67 | 67 | ||
68 | /* | ||
69 | * SLI-2/SLI-3 provide different sized iocbs. Given a pointer to the start of | ||
70 | * the ring, and the slot number of the desired iocb entry, calc a pointer to | ||
71 | * that entry. | ||
72 | */ | ||
73 | static inline IOCB_t * | ||
74 | lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | ||
75 | { | ||
76 | return (IOCB_t *) (((char *) pring->cmdringaddr) + | ||
77 | pring->cmdidx * phba->iocb_cmd_size); | ||
78 | } | ||
79 | |||
80 | static inline IOCB_t * | ||
81 | lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | ||
82 | { | ||
83 | return (IOCB_t *) (((char *) pring->rspringaddr) + | ||
84 | pring->rspidx * phba->iocb_rsp_size); | ||
85 | } | ||
86 | |||
68 | static struct lpfc_iocbq * | 87 | static struct lpfc_iocbq * |
69 | __lpfc_sli_get_iocbq(struct lpfc_hba *phba) | 88 | __lpfc_sli_get_iocbq(struct lpfc_hba *phba) |
70 | { | 89 | { |
@@ -180,6 +199,9 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd) | |||
180 | case CMD_RCV_ELS_REQ_CX: | 199 | case CMD_RCV_ELS_REQ_CX: |
181 | case CMD_RCV_SEQUENCE64_CX: | 200 | case CMD_RCV_SEQUENCE64_CX: |
182 | case CMD_RCV_ELS_REQ64_CX: | 201 | case CMD_RCV_ELS_REQ64_CX: |
202 | case CMD_IOCB_RCV_SEQ64_CX: | ||
203 | case CMD_IOCB_RCV_ELS64_CX: | ||
204 | case CMD_IOCB_RCV_CONT64_CX: | ||
183 | type = LPFC_UNSOL_IOCB; | 205 | type = LPFC_UNSOL_IOCB; |
184 | break; | 206 | break; |
185 | default: | 207 | default: |
@@ -191,14 +213,19 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd) | |||
191 | } | 213 | } |
192 | 214 | ||
193 | static int | 215 | static int |
194 | lpfc_sli_ring_map(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 216 | lpfc_sli_ring_map(struct lpfc_hba *phba) |
195 | { | 217 | { |
196 | struct lpfc_sli *psli = &phba->sli; | 218 | struct lpfc_sli *psli = &phba->sli; |
197 | MAILBOX_t *pmbox = &pmb->mb; | 219 | LPFC_MBOXQ_t *pmb; |
198 | int i, rc; | 220 | MAILBOX_t *pmbox; |
221 | int i, rc, ret = 0; | ||
199 | 222 | ||
223 | pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
224 | if (!pmb) | ||
225 | return -ENOMEM; | ||
226 | pmbox = &pmb->mb; | ||
227 | phba->link_state = LPFC_INIT_MBX_CMDS; | ||
200 | for (i = 0; i < psli->num_rings; i++) { | 228 | for (i = 0; i < psli->num_rings; i++) { |
201 | phba->link_state = LPFC_INIT_MBX_CMDS; | ||
202 | lpfc_config_ring(phba, i, pmb); | 229 | lpfc_config_ring(phba, i, pmb); |
203 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 230 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
204 | if (rc != MBX_SUCCESS) { | 231 | if (rc != MBX_SUCCESS) { |
@@ -213,10 +240,12 @@ lpfc_sli_ring_map(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
213 | pmbox->mbxStatus, | 240 | pmbox->mbxStatus, |
214 | i); | 241 | i); |
215 | phba->link_state = LPFC_HBA_ERROR; | 242 | phba->link_state = LPFC_HBA_ERROR; |
216 | return -ENXIO; | 243 | ret = -ENXIO; |
244 | break; | ||
217 | } | 245 | } |
218 | } | 246 | } |
219 | return 0; | 247 | mempool_free(pmb, phba->mbox_mem_pool); |
248 | return ret; | ||
220 | } | 249 | } |
221 | 250 | ||
222 | static int | 251 | static int |
@@ -255,9 +284,10 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
255 | static IOCB_t * | 284 | static IOCB_t * |
256 | lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | 285 | lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) |
257 | { | 286 | { |
258 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 287 | struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? |
288 | &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : | ||
289 | &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
259 | uint32_t max_cmd_idx = pring->numCiocb; | 290 | uint32_t max_cmd_idx = pring->numCiocb; |
260 | IOCB_t *iocb = NULL; | ||
261 | 291 | ||
262 | if ((pring->next_cmdidx == pring->cmdidx) && | 292 | if ((pring->next_cmdidx == pring->cmdidx) && |
263 | (++pring->next_cmdidx >= max_cmd_idx)) | 293 | (++pring->next_cmdidx >= max_cmd_idx)) |
@@ -291,9 +321,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
291 | return NULL; | 321 | return NULL; |
292 | } | 322 | } |
293 | 323 | ||
294 | iocb = IOCB_ENTRY(pring->cmdringaddr, pring->cmdidx); | 324 | return lpfc_cmd_iocb(phba, pring); |
295 | |||
296 | return iocb; | ||
297 | } | 325 | } |
298 | 326 | ||
299 | uint16_t | 327 | uint16_t |
@@ -390,8 +418,7 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
390 | * driver will put a command into. | 418 | * driver will put a command into. |
391 | */ | 419 | */ |
392 | pring->cmdidx = pring->next_cmdidx; | 420 | pring->cmdidx = pring->next_cmdidx; |
393 | writel(pring->cmdidx, phba->MBslimaddr | 421 | writel(pring->cmdidx, &phba->host_gp[pring->ringno].cmdPutInx); |
394 | + (SLIMOFF + (pring->ringno * 2)) * 4); | ||
395 | } | 422 | } |
396 | 423 | ||
397 | static void | 424 | static void |
@@ -462,7 +489,9 @@ lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
462 | static void | 489 | static void |
463 | lpfc_sli_turn_on_ring(struct lpfc_hba *phba, int ringno) | 490 | lpfc_sli_turn_on_ring(struct lpfc_hba *phba, int ringno) |
464 | { | 491 | { |
465 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[ringno]; | 492 | struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? |
493 | &phba->slim2p->mbx.us.s3_pgp.port[ringno] : | ||
494 | &phba->slim2p->mbx.us.s2.port[ringno]; | ||
466 | unsigned long iflags; | 495 | unsigned long iflags; |
467 | 496 | ||
468 | /* If the ring is active, flag it */ | 497 | /* If the ring is active, flag it */ |
@@ -481,6 +510,168 @@ lpfc_sli_turn_on_ring(struct lpfc_hba *phba, int ringno) | |||
481 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 510 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
482 | } | 511 | } |
483 | 512 | ||
513 | struct lpfc_hbq_entry * | ||
514 | lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | ||
515 | { | ||
516 | struct hbq_s *hbqp = &phba->hbqs[hbqno]; | ||
517 | |||
518 | if (hbqp->next_hbqPutIdx == hbqp->hbqPutIdx && | ||
519 | ++hbqp->next_hbqPutIdx >= hbqp->entry_count) | ||
520 | hbqp->next_hbqPutIdx = 0; | ||
521 | |||
522 | if (unlikely(hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx)) { | ||
523 | uint32_t raw_index = readl(&phba->hbq_get[hbqno]); | ||
524 | uint32_t getidx = le32_to_cpu(raw_index); | ||
525 | |||
526 | hbqp->local_hbqGetIdx = getidx; | ||
527 | |||
528 | if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) { | ||
529 | lpfc_printf_log(phba, KERN_ERR, | ||
530 | LOG_SLI, | ||
531 | "%d:1802 HBQ %d: local_hbqGetIdx " | ||
532 | "%u is > than hbqp->entry_count %u\n", | ||
533 | phba->brd_no, hbqno, | ||
534 | hbqp->local_hbqGetIdx, | ||
535 | hbqp->entry_count); | ||
536 | |||
537 | phba->link_state = LPFC_HBA_ERROR; | ||
538 | return NULL; | ||
539 | } | ||
540 | |||
541 | if (hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx) | ||
542 | return NULL; | ||
543 | } | ||
544 | |||
545 | return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx; | ||
546 | } | ||
547 | |||
548 | void | ||
549 | lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) | ||
550 | { | ||
551 | uint32_t i; | ||
552 | |||
553 | if (!phba->hbq_buffer_pool) | ||
554 | return; | ||
555 | /* Return all memory used by all HBQs */ | ||
556 | for (i = 0; i < phba->hbq_buffer_count; i++) { | ||
557 | lpfc_hbq_free(phba, phba->hbq_buffer_pool[i].dbuf.virt, | ||
558 | phba->hbq_buffer_pool[i].dbuf.phys); | ||
559 | } | ||
560 | kfree(phba->hbq_buffer_pool); | ||
561 | phba->hbq_buffer_pool = NULL; | ||
562 | } | ||
563 | |||
564 | static void | ||
565 | lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno, | ||
566 | struct hbq_dmabuf *hbq_buf_desc) | ||
567 | { | ||
568 | struct lpfc_hbq_entry *hbqe; | ||
569 | |||
570 | /* Get next HBQ entry slot to use */ | ||
571 | hbqe = lpfc_sli_next_hbq_slot(phba, hbqno); | ||
572 | if (hbqe) { | ||
573 | struct hbq_s *hbqp = &phba->hbqs[hbqno]; | ||
574 | |||
575 | hbqe->bde.addrHigh = putPaddrHigh(hbq_buf_desc->dbuf.phys); | ||
576 | hbqe->bde.addrLow = putPaddrLow(hbq_buf_desc->dbuf.phys); | ||
577 | hbqe->bde.tus.f.bdeSize = FCELSSIZE; | ||
578 | hbqe->bde.tus.f.bdeFlags = 0; | ||
579 | hbqe->buffer_tag = hbq_buf_desc->tag; | ||
580 | /* Sync SLIM */ | ||
581 | hbqp->hbqPutIdx = hbqp->next_hbqPutIdx; | ||
582 | writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno); | ||
583 | /* flush */ | ||
584 | readl(phba->hbq_put + hbqno); | ||
585 | phba->hbq_buff_count++; | ||
586 | } | ||
587 | } | ||
588 | |||
589 | static void | ||
590 | lpfc_sli_fill_hbq(struct lpfc_hba *phba, uint32_t hbqno, uint32_t buffer_index) | ||
591 | { | ||
592 | struct hbq_dmabuf *hbq_buf_desc; | ||
593 | uint32_t i; | ||
594 | |||
595 | for (i = 0; i < phba->hbqs[hbqno].entry_count; i++) { | ||
596 | /* Search hbqbufq, from the begining, | ||
597 | * looking for an unused entry | ||
598 | */ | ||
599 | phba->hbq_buffer_pool[buffer_index + i].tag |= hbqno << 16; | ||
600 | hbq_buf_desc = phba->hbq_buffer_pool + buffer_index + i; | ||
601 | lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buf_desc); | ||
602 | } | ||
603 | } | ||
604 | |||
605 | int | ||
606 | lpfc_sli_hbqbuf_fill_hbq(struct lpfc_hba *phba) | ||
607 | { | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | static int | ||
612 | lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba) | ||
613 | { | ||
614 | uint32_t buffer_index = 0; | ||
615 | uint32_t hbqno; | ||
616 | |||
617 | /* Populate HBQ entries */ | ||
618 | for (hbqno = 0; hbqno < phba->hbq_count; ++hbqno) { | ||
619 | /* Find ring associated with HBQ */ | ||
620 | |||
621 | lpfc_sli_fill_hbq(phba, hbqno, buffer_index); | ||
622 | buffer_index += phba->hbqs[hbqno].entry_count; | ||
623 | } | ||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | struct hbq_dmabuf * | ||
628 | lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) | ||
629 | { | ||
630 | if ((tag & 0xffff) < phba->hbq_buffer_count) | ||
631 | return phba->hbq_buffer_pool + (tag & 0xffff); | ||
632 | |||
633 | lpfc_printf_log(phba, KERN_ERR, | ||
634 | LOG_SLI, | ||
635 | "%d:1803 Bad hbq tag. Data: x%x x%x\n", | ||
636 | phba->brd_no, tag, | ||
637 | phba->hbq_buffer_count); | ||
638 | return NULL; | ||
639 | } | ||
640 | |||
641 | void | ||
642 | lpfc_sli_hbqbuf_free(struct lpfc_hba *phba, void *virt, dma_addr_t phys) | ||
643 | { | ||
644 | uint32_t i, hbqno; | ||
645 | |||
646 | for (i = 0; i < phba->hbq_buffer_count; i++) { | ||
647 | /* Search hbqbufq, from the begining, looking for a match on | ||
648 | phys */ | ||
649 | if (phba->hbq_buffer_pool[i].dbuf.phys == phys) { | ||
650 | hbqno = phba->hbq_buffer_pool[i].tag >> 16; | ||
651 | lpfc_sli_hbq_to_firmware(phba, hbqno, | ||
652 | phba->hbq_buffer_pool + i); | ||
653 | return; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | lpfc_printf_log(phba, KERN_ERR, | ||
658 | LOG_SLI, | ||
659 | "%d:1804 Cannot find virtual addr for " | ||
660 | "mapped buf. Data x%llx\n", | ||
661 | phba->brd_no, (unsigned long long) phys); | ||
662 | } | ||
663 | |||
664 | void | ||
665 | lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp) | ||
666 | { | ||
667 | uint32_t hbqno; | ||
668 | |||
669 | if (sp) { | ||
670 | hbqno = sp->tag >> 16; | ||
671 | lpfc_sli_hbq_to_firmware(phba, hbqno, sp); | ||
672 | } | ||
673 | } | ||
674 | |||
484 | static int | 675 | static int |
485 | lpfc_sli_chk_mbx_command(uint8_t mbxCommand) | 676 | lpfc_sli_chk_mbx_command(uint8_t mbxCommand) |
486 | { | 677 | { |
@@ -757,7 +948,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
757 | match = 0; | 948 | match = 0; |
758 | irsp = &(saveq->iocb); | 949 | irsp = &(saveq->iocb); |
759 | if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) | 950 | if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) |
760 | || (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX)) { | 951 | || (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) |
952 | || (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX) | ||
953 | || (irsp->ulpCommand == CMD_IOCB_RCV_CONT64_CX)) { | ||
761 | Rctl = FC_ELS_REQ; | 954 | Rctl = FC_ELS_REQ; |
762 | Type = FC_ELS_DATA; | 955 | Type = FC_ELS_DATA; |
763 | } else { | 956 | } else { |
@@ -769,7 +962,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
769 | 962 | ||
770 | /* Firmware Workaround */ | 963 | /* Firmware Workaround */ |
771 | if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) && | 964 | if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) && |
772 | (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX)) { | 965 | (irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX || |
966 | irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) { | ||
773 | Rctl = FC_ELS_REQ; | 967 | Rctl = FC_ELS_REQ; |
774 | Type = FC_ELS_DATA; | 968 | Type = FC_ELS_DATA; |
775 | w5p->hcsw.Rctl = Rctl; | 969 | w5p->hcsw.Rctl = Rctl; |
@@ -906,7 +1100,10 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
906 | static void | 1100 | static void |
907 | lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | 1101 | lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) |
908 | { | 1102 | { |
909 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1103 | struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? |
1104 | &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : | ||
1105 | &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
1106 | |||
910 | /* | 1107 | /* |
911 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | 1108 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then |
912 | * rsp ring <portRspMax> | 1109 | * rsp ring <portRspMax> |
@@ -945,14 +1142,15 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
945 | uint32_t portRspPut, portRspMax; | 1142 | uint32_t portRspPut, portRspMax; |
946 | int type; | 1143 | int type; |
947 | uint32_t rsp_cmpl = 0; | 1144 | uint32_t rsp_cmpl = 0; |
948 | void __iomem *to_slim; | ||
949 | uint32_t ha_copy; | 1145 | uint32_t ha_copy; |
950 | unsigned long iflags; | 1146 | unsigned long iflags; |
951 | 1147 | ||
952 | pring->stats.iocb_event++; | 1148 | pring->stats.iocb_event++; |
953 | 1149 | ||
954 | /* The driver assumes SLI-2 mode */ | 1150 | pgp = (phba->sli_rev == 3) ? |
955 | pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1151 | &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : |
1152 | &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
1153 | |||
956 | 1154 | ||
957 | /* | 1155 | /* |
958 | * The next available response entry should never exceed the maximum | 1156 | * The next available response entry should never exceed the maximum |
@@ -967,9 +1165,7 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
967 | 1165 | ||
968 | rmb(); | 1166 | rmb(); |
969 | while (pring->rspidx != portRspPut) { | 1167 | while (pring->rspidx != portRspPut) { |
970 | 1168 | entry = lpfc_resp_iocb(phba, pring); | |
971 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); | ||
972 | |||
973 | if (++pring->rspidx >= portRspMax) | 1169 | if (++pring->rspidx >= portRspMax) |
974 | pring->rspidx = 0; | 1170 | pring->rspidx = 0; |
975 | 1171 | ||
@@ -1050,9 +1246,7 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1050 | * been updated, sync the pgp->rspPutInx and fetch the new port | 1246 | * been updated, sync the pgp->rspPutInx and fetch the new port |
1051 | * response put pointer. | 1247 | * response put pointer. |
1052 | */ | 1248 | */ |
1053 | to_slim = phba->MBslimaddr + | 1249 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1054 | (SLIMOFF + (pring->ringno * 2) + 1) * 4; | ||
1055 | writeb(pring->rspidx, to_slim); | ||
1056 | 1250 | ||
1057 | if (pring->rspidx == portRspPut) | 1251 | if (pring->rspidx == portRspPut) |
1058 | portRspPut = le32_to_cpu(pgp->rspPutInx); | 1252 | portRspPut = le32_to_cpu(pgp->rspPutInx); |
@@ -1096,7 +1290,9 @@ static int | |||
1096 | lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | 1290 | lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, |
1097 | struct lpfc_sli_ring *pring, uint32_t mask) | 1291 | struct lpfc_sli_ring *pring, uint32_t mask) |
1098 | { | 1292 | { |
1099 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1293 | struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? |
1294 | &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : | ||
1295 | &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
1100 | IOCB_t *irsp = NULL; | 1296 | IOCB_t *irsp = NULL; |
1101 | IOCB_t *entry = NULL; | 1297 | IOCB_t *entry = NULL; |
1102 | struct lpfc_iocbq *cmdiocbq = NULL; | 1298 | struct lpfc_iocbq *cmdiocbq = NULL; |
@@ -1107,7 +1303,6 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1107 | lpfc_iocb_type type; | 1303 | lpfc_iocb_type type; |
1108 | unsigned long iflag; | 1304 | unsigned long iflag; |
1109 | uint32_t rsp_cmpl = 0; | 1305 | uint32_t rsp_cmpl = 0; |
1110 | void __iomem *to_slim; | ||
1111 | 1306 | ||
1112 | spin_lock_irqsave(&phba->hbalock, iflag); | 1307 | spin_lock_irqsave(&phba->hbalock, iflag); |
1113 | pring->stats.iocb_event++; | 1308 | pring->stats.iocb_event++; |
@@ -1131,14 +1326,14 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1131 | * structure. The copy involves a byte-swap since the | 1326 | * structure. The copy involves a byte-swap since the |
1132 | * network byte order and pci byte orders are different. | 1327 | * network byte order and pci byte orders are different. |
1133 | */ | 1328 | */ |
1134 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); | 1329 | entry = lpfc_resp_iocb(phba, pring); |
1135 | 1330 | ||
1136 | if (++pring->rspidx >= portRspMax) | 1331 | if (++pring->rspidx >= portRspMax) |
1137 | pring->rspidx = 0; | 1332 | pring->rspidx = 0; |
1138 | 1333 | ||
1139 | lpfc_sli_pcimem_bcopy((uint32_t *) entry, | 1334 | lpfc_sli_pcimem_bcopy((uint32_t *) entry, |
1140 | (uint32_t *) &rspiocbq.iocb, | 1335 | (uint32_t *) &rspiocbq.iocb, |
1141 | sizeof(IOCB_t)); | 1336 | phba->iocb_rsp_size); |
1142 | INIT_LIST_HEAD(&(rspiocbq.list)); | 1337 | INIT_LIST_HEAD(&(rspiocbq.list)); |
1143 | irsp = &rspiocbq.iocb; | 1338 | irsp = &rspiocbq.iocb; |
1144 | 1339 | ||
@@ -1222,9 +1417,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1222 | * been updated, sync the pgp->rspPutInx and fetch the new port | 1417 | * been updated, sync the pgp->rspPutInx and fetch the new port |
1223 | * response put pointer. | 1418 | * response put pointer. |
1224 | */ | 1419 | */ |
1225 | to_slim = phba->MBslimaddr + | 1420 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1226 | (SLIMOFF + (pring->ringno * 2) + 1) * 4; | ||
1227 | writel(pring->rspidx, to_slim); | ||
1228 | 1421 | ||
1229 | if (pring->rspidx == portRspPut) | 1422 | if (pring->rspidx == portRspPut) |
1230 | portRspPut = le32_to_cpu(pgp->rspPutInx); | 1423 | portRspPut = le32_to_cpu(pgp->rspPutInx); |
@@ -1258,7 +1451,9 @@ int | |||
1258 | lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | 1451 | lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, |
1259 | struct lpfc_sli_ring *pring, uint32_t mask) | 1452 | struct lpfc_sli_ring *pring, uint32_t mask) |
1260 | { | 1453 | { |
1261 | struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno]; | 1454 | struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? |
1455 | &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] : | ||
1456 | &phba->slim2p->mbx.us.s2.port[pring->ringno]; | ||
1262 | IOCB_t *entry; | 1457 | IOCB_t *entry; |
1263 | IOCB_t *irsp = NULL; | 1458 | IOCB_t *irsp = NULL; |
1264 | struct lpfc_iocbq *rspiocbp = NULL; | 1459 | struct lpfc_iocbq *rspiocbp = NULL; |
@@ -1271,7 +1466,6 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1271 | uint32_t portRspPut, portRspMax; | 1466 | uint32_t portRspPut, portRspMax; |
1272 | int rc = 1; | 1467 | int rc = 1; |
1273 | unsigned long iflag; | 1468 | unsigned long iflag; |
1274 | void __iomem *to_slim; | ||
1275 | 1469 | ||
1276 | spin_lock_irqsave(&phba->hbalock, iflag); | 1470 | spin_lock_irqsave(&phba->hbalock, iflag); |
1277 | pring->stats.iocb_event++; | 1471 | pring->stats.iocb_event++; |
@@ -1287,9 +1481,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1287 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | 1481 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then |
1288 | * rsp ring <portRspMax> | 1482 | * rsp ring <portRspMax> |
1289 | */ | 1483 | */ |
1290 | lpfc_printf_log(phba, | 1484 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1291 | KERN_ERR, | ||
1292 | LOG_SLI, | ||
1293 | "%d:0303 Ring %d handler: portRspPut %d " | 1485 | "%d:0303 Ring %d handler: portRspPut %d " |
1294 | "is bigger then rsp ring %d\n", | 1486 | "is bigger then rsp ring %d\n", |
1295 | phba->brd_no, | 1487 | phba->brd_no, |
@@ -1319,7 +1511,8 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1319 | * the ulpLe field is set, the entire Command has been | 1511 | * the ulpLe field is set, the entire Command has been |
1320 | * received. | 1512 | * received. |
1321 | */ | 1513 | */ |
1322 | entry = IOCB_ENTRY(pring->rspringaddr, pring->rspidx); | 1514 | entry = lpfc_resp_iocb(phba, pring); |
1515 | |||
1323 | rspiocbp = __lpfc_sli_get_iocbq(phba); | 1516 | rspiocbp = __lpfc_sli_get_iocbq(phba); |
1324 | if (rspiocbp == NULL) { | 1517 | if (rspiocbp == NULL) { |
1325 | printk(KERN_ERR "%s: out of buffers! Failing " | 1518 | printk(KERN_ERR "%s: out of buffers! Failing " |
@@ -1327,15 +1520,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1327 | break; | 1520 | break; |
1328 | } | 1521 | } |
1329 | 1522 | ||
1330 | lpfc_sli_pcimem_bcopy(entry, &rspiocbp->iocb, sizeof(IOCB_t)); | 1523 | lpfc_sli_pcimem_bcopy(entry, &rspiocbp->iocb, |
1524 | phba->iocb_rsp_size); | ||
1331 | irsp = &rspiocbp->iocb; | 1525 | irsp = &rspiocbp->iocb; |
1332 | 1526 | ||
1333 | if (++pring->rspidx >= portRspMax) | 1527 | if (++pring->rspidx >= portRspMax) |
1334 | pring->rspidx = 0; | 1528 | pring->rspidx = 0; |
1335 | 1529 | ||
1336 | to_slim = phba->MBslimaddr + (SLIMOFF + (pring->ringno * 2) | 1530 | writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); |
1337 | + 1) * 4; | ||
1338 | writel(pring->rspidx, to_slim); | ||
1339 | 1531 | ||
1340 | if (list_empty(&(pring->iocb_continueq))) { | 1532 | if (list_empty(&(pring->iocb_continueq))) { |
1341 | list_add(&rspiocbp->list, &(pring->iocb_continueq)); | 1533 | list_add(&rspiocbp->list, &(pring->iocb_continueq)); |
@@ -1361,21 +1553,31 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1361 | 1553 | ||
1362 | if (irsp->ulpStatus) { | 1554 | if (irsp->ulpStatus) { |
1363 | /* Rsp ring <ringno> error: IOCB */ | 1555 | /* Rsp ring <ringno> error: IOCB */ |
1364 | lpfc_printf_log(phba, | 1556 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1365 | KERN_WARNING, | 1557 | "%d:0328 Rsp Ring %d error: " |
1366 | LOG_SLI, | 1558 | "IOCB Data: " |
1367 | "%d:0328 Rsp Ring %d error: IOCB Data: " | 1559 | "x%x x%x x%x x%x " |
1368 | "x%x x%x x%x x%x x%x x%x x%x x%x\n", | 1560 | "x%x x%x x%x x%x " |
1369 | phba->brd_no, | 1561 | "x%x x%x x%x x%x " |
1370 | pring->ringno, | 1562 | "x%x x%x x%x x%x\n", |
1371 | irsp->un.ulpWord[0], | 1563 | phba->brd_no, |
1372 | irsp->un.ulpWord[1], | 1564 | pring->ringno, |
1373 | irsp->un.ulpWord[2], | 1565 | irsp->un.ulpWord[0], |
1374 | irsp->un.ulpWord[3], | 1566 | irsp->un.ulpWord[1], |
1375 | irsp->un.ulpWord[4], | 1567 | irsp->un.ulpWord[2], |
1376 | irsp->un.ulpWord[5], | 1568 | irsp->un.ulpWord[3], |
1377 | *(((uint32_t *) irsp) + 6), | 1569 | irsp->un.ulpWord[4], |
1378 | *(((uint32_t *) irsp) + 7)); | 1570 | irsp->un.ulpWord[5], |
1571 | *(((uint32_t *) irsp) + 6), | ||
1572 | *(((uint32_t *) irsp) + 7), | ||
1573 | *(((uint32_t *) irsp) + 8), | ||
1574 | *(((uint32_t *) irsp) + 9), | ||
1575 | *(((uint32_t *) irsp) + 10), | ||
1576 | *(((uint32_t *) irsp) + 11), | ||
1577 | *(((uint32_t *) irsp) + 12), | ||
1578 | *(((uint32_t *) irsp) + 13), | ||
1579 | *(((uint32_t *) irsp) + 14), | ||
1580 | *(((uint32_t *) irsp) + 15)); | ||
1379 | } | 1581 | } |
1380 | 1582 | ||
1381 | /* | 1583 | /* |
@@ -1659,13 +1861,9 @@ lpfc_sli_brdkill(struct lpfc_hba *phba) | |||
1659 | psli = &phba->sli; | 1861 | psli = &phba->sli; |
1660 | 1862 | ||
1661 | /* Kill HBA */ | 1863 | /* Kill HBA */ |
1662 | lpfc_printf_log(phba, | 1864 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
1663 | KERN_INFO, | ||
1664 | LOG_SLI, | ||
1665 | "%d:0329 Kill HBA Data: x%x x%x\n", | 1865 | "%d:0329 Kill HBA Data: x%x x%x\n", |
1666 | phba->brd_no, | 1866 | phba->brd_no, phba->pport->port_state, psli->sli_flag); |
1667 | phba->pport->port_state, | ||
1668 | psli->sli_flag); | ||
1669 | 1867 | ||
1670 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, | 1868 | if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, |
1671 | GFP_KERNEL)) == 0) | 1869 | GFP_KERNEL)) == 0) |
@@ -1857,13 +2055,10 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
1857 | if (i++ >= 20) { | 2055 | if (i++ >= 20) { |
1858 | /* Adapter failed to init, timeout, status reg | 2056 | /* Adapter failed to init, timeout, status reg |
1859 | <status> */ | 2057 | <status> */ |
1860 | lpfc_printf_log(phba, | 2058 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1861 | KERN_ERR, | ||
1862 | LOG_INIT, | ||
1863 | "%d:0436 Adapter failed to init, " | 2059 | "%d:0436 Adapter failed to init, " |
1864 | "timeout, status reg x%x\n", | 2060 | "timeout, status reg x%x\n", |
1865 | phba->brd_no, | 2061 | phba->brd_no, status); |
1866 | status); | ||
1867 | phba->link_state = LPFC_HBA_ERROR; | 2062 | phba->link_state = LPFC_HBA_ERROR; |
1868 | return -ETIMEDOUT; | 2063 | return -ETIMEDOUT; |
1869 | } | 2064 | } |
@@ -1873,9 +2068,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
1873 | /* ERROR: During chipset initialization */ | 2068 | /* ERROR: During chipset initialization */ |
1874 | /* Adapter failed to init, chipset, status reg | 2069 | /* Adapter failed to init, chipset, status reg |
1875 | <status> */ | 2070 | <status> */ |
1876 | lpfc_printf_log(phba, | 2071 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1877 | KERN_ERR, | ||
1878 | LOG_INIT, | ||
1879 | "%d:0437 Adapter failed to init, " | 2072 | "%d:0437 Adapter failed to init, " |
1880 | "chipset, status reg x%x\n", | 2073 | "chipset, status reg x%x\n", |
1881 | phba->brd_no, | 2074 | phba->brd_no, |
@@ -1905,9 +2098,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
1905 | if (status & HS_FFERM) { | 2098 | if (status & HS_FFERM) { |
1906 | /* ERROR: During chipset initialization */ | 2099 | /* ERROR: During chipset initialization */ |
1907 | /* Adapter failed to init, chipset, status reg <status> */ | 2100 | /* Adapter failed to init, chipset, status reg <status> */ |
1908 | lpfc_printf_log(phba, | 2101 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1909 | KERN_ERR, | ||
1910 | LOG_INIT, | ||
1911 | "%d:0438 Adapter failed to init, chipset, " | 2102 | "%d:0438 Adapter failed to init, chipset, " |
1912 | "status reg x%x\n", | 2103 | "status reg x%x\n", |
1913 | phba->brd_no, | 2104 | phba->brd_no, |
@@ -1926,8 +2117,145 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
1926 | return 0; | 2117 | return 0; |
1927 | } | 2118 | } |
1928 | 2119 | ||
2120 | static struct hbq_dmabuf * | ||
2121 | lpfc_alloc_hbq_buffers(struct lpfc_hba *phba, int count) | ||
2122 | { | ||
2123 | struct hbq_dmabuf *hbq_buffer_pool; | ||
2124 | int i; | ||
2125 | |||
2126 | hbq_buffer_pool = kmalloc(count * sizeof(struct hbq_dmabuf), | ||
2127 | GFP_KERNEL); | ||
2128 | if (!hbq_buffer_pool) | ||
2129 | goto out; | ||
2130 | |||
2131 | for (i = 0; i < count; ++i) { | ||
2132 | hbq_buffer_pool[i].dbuf.virt = | ||
2133 | lpfc_hbq_alloc(phba, MEM_PRI, | ||
2134 | &hbq_buffer_pool[i].dbuf.phys); | ||
2135 | if (hbq_buffer_pool[i].dbuf.virt == NULL) | ||
2136 | goto alloc_failed; | ||
2137 | hbq_buffer_pool[i].tag = i; | ||
2138 | } | ||
2139 | goto out; | ||
2140 | |||
2141 | alloc_failed: | ||
2142 | while (--i >= 0) | ||
2143 | lpfc_hbq_free(phba, hbq_buffer_pool[i].dbuf.virt, | ||
2144 | hbq_buffer_pool[i].dbuf.phys); | ||
2145 | kfree(hbq_buffer_pool); | ||
2146 | hbq_buffer_pool = NULL; | ||
2147 | |||
2148 | out: | ||
2149 | phba->hbq_buffer_pool = hbq_buffer_pool; | ||
2150 | return hbq_buffer_pool; | ||
2151 | } | ||
2152 | |||
2153 | static struct lpfc_hbq_init lpfc_els_hbq = { | ||
2154 | .rn = 1, | ||
2155 | .entry_count = 1200, | ||
2156 | .mask_count = 0, | ||
2157 | .profile = 0, | ||
2158 | .ring_mask = 1 << LPFC_ELS_RING, | ||
2159 | }; | ||
2160 | |||
2161 | static struct lpfc_hbq_init *lpfc_hbq_definitions[] = { | ||
2162 | &lpfc_els_hbq, | ||
2163 | }; | ||
2164 | |||
2165 | static int | ||
2166 | lpfc_sli_hbq_count(void) | ||
2167 | { | ||
2168 | return ARRAY_SIZE(lpfc_hbq_definitions); | ||
2169 | } | ||
2170 | |||
2171 | static int | ||
2172 | lpfc_sli_hbq_entry_count(void) | ||
2173 | { | ||
2174 | int hbq_count = lpfc_sli_hbq_count(); | ||
2175 | int count = 0; | ||
2176 | int i; | ||
2177 | |||
2178 | for (i = 0; i < hbq_count; ++i) | ||
2179 | count += lpfc_hbq_definitions[i]->entry_count; | ||
2180 | return count; | ||
2181 | } | ||
2182 | |||
1929 | int | 2183 | int |
1930 | lpfc_sli_hba_setup(struct lpfc_hba *phba) | 2184 | lpfc_sli_hbq_size(void) |
2185 | { | ||
2186 | return lpfc_sli_hbq_entry_count() * sizeof(struct lpfc_hbq_entry); | ||
2187 | } | ||
2188 | |||
2189 | static int | ||
2190 | lpfc_sli_hbq_setup(struct lpfc_hba *phba) | ||
2191 | { | ||
2192 | int hbq_count = lpfc_sli_hbq_count(); | ||
2193 | LPFC_MBOXQ_t *pmb; | ||
2194 | MAILBOX_t *pmbox; | ||
2195 | uint32_t hbqno; | ||
2196 | uint32_t hbq_entry_index; | ||
2197 | uint32_t hbq_buffer_count; | ||
2198 | |||
2199 | /* count hbq buffers */ | ||
2200 | hbq_buffer_count = lpfc_sli_hbq_entry_count(); | ||
2201 | if (!lpfc_alloc_hbq_buffers(phba, hbq_buffer_count)) | ||
2202 | return -ENOMEM; | ||
2203 | |||
2204 | phba->hbq_buffer_count = hbq_buffer_count; | ||
2205 | |||
2206 | /* Get a Mailbox buffer to setup mailbox | ||
2207 | * commands for HBA initialization | ||
2208 | */ | ||
2209 | pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
2210 | |||
2211 | if (!pmb) | ||
2212 | return -ENOMEM; | ||
2213 | |||
2214 | pmbox = &pmb->mb; | ||
2215 | |||
2216 | /* Initialize the struct lpfc_sli_hbq structure for each hbq */ | ||
2217 | phba->link_state = LPFC_INIT_MBX_CMDS; | ||
2218 | |||
2219 | hbq_entry_index = 0; | ||
2220 | for (hbqno = 0; hbqno < hbq_count; ++hbqno) { | ||
2221 | phba->hbqs[hbqno].next_hbqPutIdx = 0; | ||
2222 | phba->hbqs[hbqno].hbqPutIdx = 0; | ||
2223 | phba->hbqs[hbqno].local_hbqGetIdx = 0; | ||
2224 | phba->hbqs[hbqno].entry_count = | ||
2225 | lpfc_hbq_definitions[hbqno]->entry_count; | ||
2226 | lpfc_config_hbq(phba, lpfc_hbq_definitions[hbqno], | ||
2227 | hbq_entry_index, pmb); | ||
2228 | hbq_entry_index += phba->hbqs[hbqno].entry_count; | ||
2229 | |||
2230 | if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { | ||
2231 | /* Adapter failed to init, mbxCmd <cmd> CFG_RING, | ||
2232 | mbxStatus <status>, ring <num> */ | ||
2233 | |||
2234 | lpfc_printf_log(phba, KERN_ERR, | ||
2235 | LOG_SLI, | ||
2236 | "%d:1805 Adapter failed to init. " | ||
2237 | "Data: x%x x%x x%x\n", | ||
2238 | phba->brd_no, pmbox->mbxCommand, | ||
2239 | pmbox->mbxStatus, hbqno); | ||
2240 | |||
2241 | phba->link_state = LPFC_HBA_ERROR; | ||
2242 | mempool_free(pmb, phba->mbox_mem_pool); | ||
2243 | /* Free all HBQ memory */ | ||
2244 | lpfc_sli_hbqbuf_free_all(phba); | ||
2245 | return ENXIO; | ||
2246 | } | ||
2247 | } | ||
2248 | phba->hbq_count = hbq_count; | ||
2249 | |||
2250 | /* Initially populate or replenish the HBQs */ | ||
2251 | lpfc_sli_hbqbuf_fill_hbqs(phba); | ||
2252 | mempool_free(pmb, phba->mbox_mem_pool); | ||
2253 | |||
2254 | return 0; | ||
2255 | } | ||
2256 | |||
2257 | static int | ||
2258 | lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode) | ||
1931 | { | 2259 | { |
1932 | LPFC_MBOXQ_t *pmb; | 2260 | LPFC_MBOXQ_t *pmb; |
1933 | uint32_t resetcount = 0, rc = 0, done = 0; | 2261 | uint32_t resetcount = 0, rc = 0, done = 0; |
@@ -1938,6 +2266,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
1938 | return -ENOMEM; | 2266 | return -ENOMEM; |
1939 | } | 2267 | } |
1940 | 2268 | ||
2269 | phba->sli_rev = sli_mode; | ||
1941 | while (resetcount < 2 && !done) { | 2270 | while (resetcount < 2 && !done) { |
1942 | spin_lock_irq(&phba->hbalock); | 2271 | spin_lock_irq(&phba->hbalock); |
1943 | phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE; | 2272 | phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE; |
@@ -1954,14 +2283,14 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
1954 | spin_unlock_irq(&phba->hbalock); | 2283 | spin_unlock_irq(&phba->hbalock); |
1955 | resetcount++; | 2284 | resetcount++; |
1956 | 2285 | ||
1957 | /* Call pre CONFIG_PORT mailbox command initialization. A value of 0 | 2286 | /* Call pre CONFIG_PORT mailbox command initialization. A |
1958 | * means the call was successful. Any other nonzero value is a failure, | 2287 | * value of 0 means the call was successful. Any other |
1959 | * but if ERESTART is returned, the driver may reset the HBA and try | 2288 | * nonzero value is a failure, but if ERESTART is returned, |
1960 | * again. | 2289 | * the driver may reset the HBA and try again. |
1961 | */ | 2290 | */ |
1962 | rc = lpfc_config_port_prep(phba); | 2291 | rc = lpfc_config_port_prep(phba); |
1963 | if (rc == -ERESTART) { | 2292 | if (rc == -ERESTART) { |
1964 | phba->pport->port_state = 0; | 2293 | phba->link_state = LPFC_LINK_UNKNOWN; |
1965 | continue; | 2294 | continue; |
1966 | } else if (rc) { | 2295 | } else if (rc) { |
1967 | break; | 2296 | break; |
@@ -1970,39 +2299,116 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) | |||
1970 | phba->link_state = LPFC_INIT_MBX_CMDS; | 2299 | phba->link_state = LPFC_INIT_MBX_CMDS; |
1971 | lpfc_config_port(phba, pmb); | 2300 | lpfc_config_port(phba, pmb); |
1972 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 2301 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
1973 | if (rc == MBX_SUCCESS) | 2302 | if (rc != MBX_SUCCESS) { |
1974 | done = 1; | ||
1975 | else { | ||
1976 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2303 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1977 | "%d:0442 Adapter failed to init, mbxCmd x%x " | 2304 | "%d:0442 Adapter failed to init, " |
1978 | "CONFIG_PORT, mbxStatus x%x Data: x%x\n", | 2305 | "mbxCmd x%x CONFIG_PORT, mbxStatus " |
1979 | phba->brd_no, pmb->mb.mbxCommand, | 2306 | "x%x Data: x%x\n", |
1980 | pmb->mb.mbxStatus, 0); | 2307 | phba->brd_no, pmb->mb.mbxCommand, |
2308 | pmb->mb.mbxStatus, 0); | ||
1981 | spin_lock_irq(&phba->hbalock); | 2309 | spin_lock_irq(&phba->hbalock); |
1982 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; | 2310 | phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; |
1983 | spin_unlock_irq(&phba->hbalock); | 2311 | spin_unlock_irq(&phba->hbalock); |
1984 | rc = -ENXIO; | 2312 | rc = -ENXIO; |
2313 | } else { | ||
2314 | done = 1; | ||
2315 | /* DBG: Do we need max_vpi, reg_vpi for that matter | ||
2316 | phba->max_vpi = 0; | ||
2317 | */ | ||
1985 | } | 2318 | } |
1986 | } | 2319 | } |
1987 | if (!done) | 2320 | |
2321 | if (!done) { | ||
2322 | rc = -EINVAL; | ||
2323 | goto do_prep_failed; | ||
2324 | } | ||
2325 | |||
2326 | if ((pmb->mb.un.varCfgPort.sli_mode == 3) && | ||
2327 | (!pmb->mb.un.varCfgPort.cMA)) { | ||
2328 | rc = -ENXIO; | ||
2329 | goto do_prep_failed; | ||
2330 | } | ||
2331 | return rc; | ||
2332 | |||
2333 | do_prep_failed: | ||
2334 | mempool_free(pmb, phba->mbox_mem_pool); | ||
2335 | return rc; | ||
2336 | } | ||
2337 | |||
2338 | int | ||
2339 | lpfc_sli_hba_setup(struct lpfc_hba *phba) | ||
2340 | { | ||
2341 | uint32_t rc; | ||
2342 | int mode = 3; | ||
2343 | |||
2344 | switch (lpfc_sli_mode) { | ||
2345 | case 2: | ||
2346 | mode = 2; | ||
2347 | break; | ||
2348 | case 0: | ||
2349 | case 3: | ||
2350 | break; | ||
2351 | default: | ||
2352 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | ||
2353 | "%d:1819 Unrecognized lpfc_sli_mode " | ||
2354 | "parameter: %d.\n", | ||
2355 | phba->brd_no, lpfc_sli_mode); | ||
2356 | |||
2357 | break; | ||
2358 | } | ||
2359 | |||
2360 | rc = lpfc_do_config_port(phba, mode); | ||
2361 | if (rc && lpfc_sli_mode == 3) | ||
2362 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | ||
2363 | "%d:1820 Unable to select SLI-3. " | ||
2364 | "Not supported by adapter.\n", | ||
2365 | phba->brd_no); | ||
2366 | if (rc && mode != 2) | ||
2367 | rc = lpfc_do_config_port(phba, 2); | ||
2368 | if (rc) | ||
1988 | goto lpfc_sli_hba_setup_error; | 2369 | goto lpfc_sli_hba_setup_error; |
1989 | 2370 | ||
1990 | rc = lpfc_sli_ring_map(phba, pmb); | 2371 | if (phba->sli_rev == 3) { |
2372 | phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; | ||
2373 | phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; | ||
2374 | phba->sli3_options |= LPFC_SLI3_ENABLED; | ||
2375 | phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED; | ||
2376 | |||
2377 | } else { | ||
2378 | phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; | ||
2379 | phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; | ||
2380 | phba->sli3_options = 0x0; | ||
2381 | } | ||
2382 | |||
2383 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | ||
2384 | "%d:0444 Firmware in SLI %x mode.\n", | ||
2385 | phba->brd_no, phba->sli_rev); | ||
2386 | rc = lpfc_sli_ring_map(phba); | ||
1991 | 2387 | ||
1992 | if (rc) | 2388 | if (rc) |
1993 | goto lpfc_sli_hba_setup_error; | 2389 | goto lpfc_sli_hba_setup_error; |
1994 | 2390 | ||
2391 | /* Init HBQs */ | ||
2392 | |||
2393 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { | ||
2394 | rc = lpfc_sli_hbq_setup(phba); | ||
2395 | if (rc) | ||
2396 | goto lpfc_sli_hba_setup_error; | ||
2397 | } | ||
2398 | |||
1995 | phba->sli.sli_flag |= LPFC_PROCESS_LA; | 2399 | phba->sli.sli_flag |= LPFC_PROCESS_LA; |
1996 | 2400 | ||
1997 | rc = lpfc_config_port_post(phba); | 2401 | rc = lpfc_config_port_post(phba); |
1998 | if (rc) | 2402 | if (rc) |
1999 | goto lpfc_sli_hba_setup_error; | 2403 | goto lpfc_sli_hba_setup_error; |
2000 | 2404 | ||
2001 | goto lpfc_sli_hba_setup_exit; | 2405 | return rc; |
2002 | lpfc_sli_hba_setup_error: | 2406 | |
2407 | lpfc_sli_hba_setup_error: | ||
2003 | phba->link_state = LPFC_HBA_ERROR; | 2408 | phba->link_state = LPFC_HBA_ERROR; |
2004 | lpfc_sli_hba_setup_exit: | 2409 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
2005 | mempool_free(pmb, phba->mbox_mem_pool); | 2410 | "%d:0445 Firmware initialization failed\n", |
2411 | phba->brd_no); | ||
2006 | return rc; | 2412 | return rc; |
2007 | } | 2413 | } |
2008 | 2414 | ||
@@ -2027,7 +2433,7 @@ lpfc_mbox_timeout(unsigned long ptr) | |||
2027 | uint32_t tmo_posted; | 2433 | uint32_t tmo_posted; |
2028 | 2434 | ||
2029 | spin_lock_irqsave(&phba->pport->work_port_lock, iflag); | 2435 | spin_lock_irqsave(&phba->pport->work_port_lock, iflag); |
2030 | tmo_posted = (phba->pport->work_port_events & WORKER_MBOX_TMO) == 0; | 2436 | tmo_posted = (phba->pport->work_port_events & WORKER_MBOX_TMO); |
2031 | if (!tmo_posted) | 2437 | if (!tmo_posted) |
2032 | phba->pport->work_port_events |= WORKER_MBOX_TMO; | 2438 | phba->pport->work_port_events |= WORKER_MBOX_TMO; |
2033 | spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); | 2439 | spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); |
@@ -2051,9 +2457,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
2051 | } | 2457 | } |
2052 | 2458 | ||
2053 | /* Mbox cmd <mbxCommand> timeout */ | 2459 | /* Mbox cmd <mbxCommand> timeout */ |
2054 | lpfc_printf_log(phba, | 2460 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
2055 | KERN_ERR, | ||
2056 | LOG_MBOX | LOG_SLI, | ||
2057 | "%d:0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", | 2461 | "%d:0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", |
2058 | phba->brd_no, | 2462 | phba->brd_no, |
2059 | mb->mbxCommand, | 2463 | mb->mbxCommand, |
@@ -2105,13 +2509,25 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2105 | volatile uint32_t word0, ldata; | 2509 | volatile uint32_t word0, ldata; |
2106 | void __iomem *to_slim; | 2510 | void __iomem *to_slim; |
2107 | 2511 | ||
2512 | if (pmbox->mbox_cmpl && pmbox->mbox_cmpl != lpfc_sli_def_mbox_cmpl && | ||
2513 | pmbox->mbox_cmpl != lpfc_sli_wake_mbox_wait) { | ||
2514 | if(!pmbox->vport) { | ||
2515 | lpfc_printf_log(phba, KERN_ERR, | ||
2516 | LOG_MBOX, | ||
2517 | "%d:1806 Mbox x%x failed. No vport\n", | ||
2518 | phba->brd_no, | ||
2519 | pmbox->mb.mbxCommand); | ||
2520 | dump_stack(); | ||
2521 | return MBXERR_ERROR; | ||
2522 | } | ||
2523 | } | ||
2524 | |||
2108 | /* If the PCI channel is in offline state, do not post mbox. */ | 2525 | /* If the PCI channel is in offline state, do not post mbox. */ |
2109 | if (unlikely(pci_channel_offline(phba->pcidev))) | 2526 | if (unlikely(pci_channel_offline(phba->pcidev))) |
2110 | return MBX_NOT_FINISHED; | 2527 | return MBX_NOT_FINISHED; |
2111 | 2528 | ||
2112 | spin_lock_irqsave(&phba->hbalock, drvr_flag); | 2529 | spin_lock_irqsave(&phba->hbalock, drvr_flag); |
2113 | psli = &phba->sli; | 2530 | psli = &phba->sli; |
2114 | |||
2115 | mb = &pmbox->mb; | 2531 | mb = &pmbox->mb; |
2116 | status = MBX_SUCCESS; | 2532 | status = MBX_SUCCESS; |
2117 | 2533 | ||
@@ -2172,15 +2588,11 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2172 | lpfc_mbox_put(phba, pmbox); | 2588 | lpfc_mbox_put(phba, pmbox); |
2173 | 2589 | ||
2174 | /* Mbox cmd issue - BUSY */ | 2590 | /* Mbox cmd issue - BUSY */ |
2175 | lpfc_printf_log(phba, | 2591 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2176 | KERN_INFO, | ||
2177 | LOG_MBOX | LOG_SLI, | ||
2178 | "%d:0308 Mbox cmd issue - BUSY Data: x%x x%x x%x x%x\n", | 2592 | "%d:0308 Mbox cmd issue - BUSY Data: x%x x%x x%x x%x\n", |
2179 | phba->brd_no, | 2593 | phba->brd_no, |
2180 | mb->mbxCommand, | 2594 | mb->mbxCommand, phba->pport->port_state, |
2181 | phba->pport->port_state, | 2595 | psli->sli_flag, flag); |
2182 | psli->sli_flag, | ||
2183 | flag); | ||
2184 | 2596 | ||
2185 | psli->slistat.mbox_busy++; | 2597 | psli->slistat.mbox_busy++; |
2186 | spin_unlock_irqrestore(&phba->hbalock, drvr_flag); | 2598 | spin_unlock_irqrestore(&phba->hbalock, drvr_flag); |
@@ -2223,15 +2635,11 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
2223 | } | 2635 | } |
2224 | 2636 | ||
2225 | /* Mailbox cmd <cmd> issue */ | 2637 | /* Mailbox cmd <cmd> issue */ |
2226 | lpfc_printf_log(phba, | 2638 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, |
2227 | KERN_INFO, | ||
2228 | LOG_MBOX | LOG_SLI, | ||
2229 | "%d:0309 Mailbox cmd x%x issue Data: x%x x%x x%x\n", | 2639 | "%d:0309 Mailbox cmd x%x issue Data: x%x x%x x%x\n", |
2230 | phba->brd_no, | 2640 | phba->brd_no, |
2231 | mb->mbxCommand, | 2641 | mb->mbxCommand, phba->pport->port_state, |
2232 | phba->pport->port_state, | 2642 | psli->sli_flag, flag); |
2233 | psli->sli_flag, | ||
2234 | flag); | ||
2235 | 2643 | ||
2236 | psli->slistat.mbox_cmd++; | 2644 | psli->slistat.mbox_cmd++; |
2237 | evtctr = psli->slistat.mbox_event; | 2645 | evtctr = psli->slistat.mbox_event; |
@@ -2526,7 +2934,7 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba) | |||
2526 | int | 2934 | int |
2527 | lpfc_sli_setup(struct lpfc_hba *phba) | 2935 | lpfc_sli_setup(struct lpfc_hba *phba) |
2528 | { | 2936 | { |
2529 | int i, totiocb = 0; | 2937 | int i, totiocbsize = 0; |
2530 | struct lpfc_sli *psli = &phba->sli; | 2938 | struct lpfc_sli *psli = &phba->sli; |
2531 | struct lpfc_sli_ring *pring; | 2939 | struct lpfc_sli_ring *pring; |
2532 | 2940 | ||
@@ -2551,9 +2959,15 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
2551 | pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; | 2959 | pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; |
2552 | pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; | 2960 | pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; |
2553 | pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES; | 2961 | pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES; |
2962 | pring->sizeCiocb = (phba->sli_rev == 3) ? | ||
2963 | SLI3_IOCB_CMD_SIZE : | ||
2964 | SLI2_IOCB_CMD_SIZE; | ||
2965 | pring->sizeRiocb = (phba->sli_rev == 3) ? | ||
2966 | SLI3_IOCB_RSP_SIZE : | ||
2967 | SLI2_IOCB_RSP_SIZE; | ||
2554 | pring->iotag_ctr = 0; | 2968 | pring->iotag_ctr = 0; |
2555 | pring->iotag_max = | 2969 | pring->iotag_max = |
2556 | (phba->cfg_hba_queue_depth * 2); | 2970 | (phba->cfg_hba_queue_depth * 2); |
2557 | pring->fast_iotag = pring->iotag_max; | 2971 | pring->fast_iotag = pring->iotag_max; |
2558 | pring->num_mask = 0; | 2972 | pring->num_mask = 0; |
2559 | break; | 2973 | break; |
@@ -2561,6 +2975,12 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
2561 | /* numCiocb and numRiocb are used in config_port */ | 2975 | /* numCiocb and numRiocb are used in config_port */ |
2562 | pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES; | 2976 | pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES; |
2563 | pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES; | 2977 | pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES; |
2978 | pring->sizeCiocb = (phba->sli_rev == 3) ? | ||
2979 | SLI3_IOCB_CMD_SIZE : | ||
2980 | SLI2_IOCB_CMD_SIZE; | ||
2981 | pring->sizeRiocb = (phba->sli_rev == 3) ? | ||
2982 | SLI3_IOCB_RSP_SIZE : | ||
2983 | SLI2_IOCB_RSP_SIZE; | ||
2564 | pring->iotag_max = phba->cfg_hba_queue_depth; | 2984 | pring->iotag_max = phba->cfg_hba_queue_depth; |
2565 | pring->num_mask = 0; | 2985 | pring->num_mask = 0; |
2566 | break; | 2986 | break; |
@@ -2568,6 +2988,12 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
2568 | /* numCiocb and numRiocb are used in config_port */ | 2988 | /* numCiocb and numRiocb are used in config_port */ |
2569 | pring->numCiocb = SLI2_IOCB_CMD_R2_ENTRIES; | 2989 | pring->numCiocb = SLI2_IOCB_CMD_R2_ENTRIES; |
2570 | pring->numRiocb = SLI2_IOCB_RSP_R2_ENTRIES; | 2990 | pring->numRiocb = SLI2_IOCB_RSP_R2_ENTRIES; |
2991 | pring->sizeCiocb = (phba->sli_rev == 3) ? | ||
2992 | SLI3_IOCB_CMD_SIZE : | ||
2993 | SLI2_IOCB_CMD_SIZE; | ||
2994 | pring->sizeRiocb = (phba->sli_rev == 3) ? | ||
2995 | SLI3_IOCB_RSP_SIZE : | ||
2996 | SLI2_IOCB_RSP_SIZE; | ||
2571 | pring->fast_iotag = 0; | 2997 | pring->fast_iotag = 0; |
2572 | pring->iotag_ctr = 0; | 2998 | pring->iotag_ctr = 0; |
2573 | pring->iotag_max = 4096; | 2999 | pring->iotag_max = 4096; |
@@ -2576,36 +3002,38 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
2576 | pring->prt[0].rctl = FC_ELS_REQ; | 3002 | pring->prt[0].rctl = FC_ELS_REQ; |
2577 | pring->prt[0].type = FC_ELS_DATA; | 3003 | pring->prt[0].type = FC_ELS_DATA; |
2578 | pring->prt[0].lpfc_sli_rcv_unsol_event = | 3004 | pring->prt[0].lpfc_sli_rcv_unsol_event = |
2579 | lpfc_els_unsol_event; | 3005 | lpfc_els_unsol_event; |
2580 | pring->prt[1].profile = 0; /* Mask 1 */ | 3006 | pring->prt[1].profile = 0; /* Mask 1 */ |
2581 | pring->prt[1].rctl = FC_ELS_RSP; | 3007 | pring->prt[1].rctl = FC_ELS_RSP; |
2582 | pring->prt[1].type = FC_ELS_DATA; | 3008 | pring->prt[1].type = FC_ELS_DATA; |
2583 | pring->prt[1].lpfc_sli_rcv_unsol_event = | 3009 | pring->prt[1].lpfc_sli_rcv_unsol_event = |
2584 | lpfc_els_unsol_event; | 3010 | lpfc_els_unsol_event; |
2585 | pring->prt[2].profile = 0; /* Mask 2 */ | 3011 | pring->prt[2].profile = 0; /* Mask 2 */ |
2586 | /* NameServer Inquiry */ | 3012 | /* NameServer Inquiry */ |
2587 | pring->prt[2].rctl = FC_UNSOL_CTL; | 3013 | pring->prt[2].rctl = FC_UNSOL_CTL; |
2588 | /* NameServer */ | 3014 | /* NameServer */ |
2589 | pring->prt[2].type = FC_COMMON_TRANSPORT_ULP; | 3015 | pring->prt[2].type = FC_COMMON_TRANSPORT_ULP; |
2590 | pring->prt[2].lpfc_sli_rcv_unsol_event = | 3016 | pring->prt[2].lpfc_sli_rcv_unsol_event = |
2591 | lpfc_ct_unsol_event; | 3017 | lpfc_ct_unsol_event; |
2592 | pring->prt[3].profile = 0; /* Mask 3 */ | 3018 | pring->prt[3].profile = 0; /* Mask 3 */ |
2593 | /* NameServer response */ | 3019 | /* NameServer response */ |
2594 | pring->prt[3].rctl = FC_SOL_CTL; | 3020 | pring->prt[3].rctl = FC_SOL_CTL; |
2595 | /* NameServer */ | 3021 | /* NameServer */ |
2596 | pring->prt[3].type = FC_COMMON_TRANSPORT_ULP; | 3022 | pring->prt[3].type = FC_COMMON_TRANSPORT_ULP; |
2597 | pring->prt[3].lpfc_sli_rcv_unsol_event = | 3023 | pring->prt[3].lpfc_sli_rcv_unsol_event = |
2598 | lpfc_ct_unsol_event; | 3024 | lpfc_ct_unsol_event; |
2599 | break; | 3025 | break; |
2600 | } | 3026 | } |
2601 | totiocb += (pring->numCiocb + pring->numRiocb); | 3027 | totiocbsize += (pring->numCiocb * pring->sizeCiocb) + |
3028 | (pring->numRiocb * pring->sizeRiocb); | ||
2602 | } | 3029 | } |
2603 | if (totiocb > MAX_SLI2_IOCB) { | 3030 | if (totiocbsize > MAX_SLIM_IOCB_SIZE) { |
2604 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ | 3031 | /* Too many cmd / rsp ring entries in SLI2 SLIM */ |
2605 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3032 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2606 | "%d:0462 Too many cmd / rsp ring entries in " | 3033 | "%d:0462 Too many cmd / rsp ring entries in " |
2607 | "SLI2 SLIM Data: x%x x%x\n", | 3034 | "SLI2 SLIM Data: x%x x%lx\n", |
2608 | phba->brd_no, totiocb, MAX_SLI2_IOCB); | 3035 | phba->brd_no, totiocbsize, |
3036 | (unsigned long) MAX_SLIM_IOCB_SIZE); | ||
2609 | } | 3037 | } |
2610 | if (phba->cfg_multi_ring_support == 2) | 3038 | if (phba->cfg_multi_ring_support == 2) |
2611 | lpfc_extra_ring_setup(phba); | 3039 | lpfc_extra_ring_setup(phba); |
@@ -2689,6 +3117,7 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
2689 | phba->pport->work_port_events &= ~WORKER_MBOX_TMO; | 3117 | phba->pport->work_port_events &= ~WORKER_MBOX_TMO; |
2690 | spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); | 3118 | spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); |
2691 | 3119 | ||
3120 | spin_lock_irqsave(&phba->hbalock, flags); | ||
2692 | pmb = psli->mbox_active; | 3121 | pmb = psli->mbox_active; |
2693 | if (pmb) { | 3122 | if (pmb) { |
2694 | psli->mbox_active = NULL; | 3123 | psli->mbox_active = NULL; |
@@ -2708,6 +3137,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
2708 | } | 3137 | } |
2709 | INIT_LIST_HEAD(&psli->mboxq); | 3138 | INIT_LIST_HEAD(&psli->mboxq); |
2710 | 3139 | ||
3140 | /* Free all HBQ memory */ | ||
3141 | lpfc_sli_hbqbuf_free_all(phba); | ||
3142 | |||
2711 | return 1; | 3143 | return 1; |
2712 | } | 3144 | } |
2713 | 3145 | ||
@@ -3075,11 +3507,9 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
3075 | retval = lpfc_sli_issue_iocb(phba, pring, piocb, 0); | 3507 | retval = lpfc_sli_issue_iocb(phba, pring, piocb, 0); |
3076 | if (retval == IOCB_SUCCESS) { | 3508 | if (retval == IOCB_SUCCESS) { |
3077 | timeout_req = timeout * HZ; | 3509 | timeout_req = timeout * HZ; |
3078 | spin_unlock_irq(&phba->hbalock); | ||
3079 | timeleft = wait_event_timeout(done_q, | 3510 | timeleft = wait_event_timeout(done_q, |
3080 | piocb->iocb_flag & LPFC_IO_WAKE, | 3511 | piocb->iocb_flag & LPFC_IO_WAKE, |
3081 | timeout_req); | 3512 | timeout_req); |
3082 | spin_lock_irq(&phba->hbalock); | ||
3083 | 3513 | ||
3084 | if (piocb->iocb_flag & LPFC_IO_WAKE) { | 3514 | if (piocb->iocb_flag & LPFC_IO_WAKE) { |
3085 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 3515 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
@@ -3164,13 +3594,25 @@ lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba) | |||
3164 | { | 3594 | { |
3165 | struct lpfc_vport *vport = phba->pport; | 3595 | struct lpfc_vport *vport = phba->pport; |
3166 | int i = 0; | 3596 | int i = 0; |
3597 | uint32_t ha_copy; | ||
3167 | 3598 | ||
3168 | while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE && !vport->stopped) { | 3599 | while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE && !vport->stopped) { |
3169 | if (i++ > LPFC_MBOX_TMO * 1000) | 3600 | if (i++ > LPFC_MBOX_TMO * 1000) |
3170 | return 1; | 3601 | return 1; |
3171 | 3602 | ||
3172 | if (lpfc_sli_handle_mb_event(phba) == 0) | 3603 | /* |
3173 | i = 0; | 3604 | * Call lpfc_sli_handle_mb_event only if a mailbox cmd |
3605 | * did finish. This way we won't get the misleading | ||
3606 | * "Stray Mailbox Interrupt" message. | ||
3607 | */ | ||
3608 | spin_lock_irq(&phba->hbalock); | ||
3609 | ha_copy = phba->work_ha; | ||
3610 | phba->work_ha &= ~HA_MBATT; | ||
3611 | spin_unlock_irq(&phba->hbalock); | ||
3612 | |||
3613 | if (ha_copy & HA_MBATT) | ||
3614 | if (lpfc_sli_handle_mb_event(phba) == 0) | ||
3615 | i = 0; | ||
3174 | 3616 | ||
3175 | msleep(1); | 3617 | msleep(1); |
3176 | } | 3618 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 0e857e51a2c4..190d55a69b2a 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h | |||
@@ -138,6 +138,8 @@ struct lpfc_sli_ring { | |||
138 | uint8_t ringno; /* ring number */ | 138 | uint8_t ringno; /* ring number */ |
139 | uint16_t numCiocb; /* number of command iocb's per ring */ | 139 | uint16_t numCiocb; /* number of command iocb's per ring */ |
140 | uint16_t numRiocb; /* number of rsp iocb's per ring */ | 140 | uint16_t numRiocb; /* number of rsp iocb's per ring */ |
141 | uint16_t sizeCiocb; /* Size of command iocb's in this ring */ | ||
142 | uint16_t sizeRiocb; /* Size of response iocb's in this ring */ | ||
141 | 143 | ||
142 | uint32_t fast_iotag; /* max fastlookup based iotag */ | 144 | uint32_t fast_iotag; /* max fastlookup based iotag */ |
143 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ | 145 | uint32_t iotag_ctr; /* keeps track of the next iotag to use */ |
@@ -168,6 +170,29 @@ struct lpfc_sli_ring { | |||
168 | struct lpfc_sli_ring *); | 170 | struct lpfc_sli_ring *); |
169 | }; | 171 | }; |
170 | 172 | ||
173 | /* Structure used for configuring rings to a specific profile or rctl / type */ | ||
174 | struct lpfc_hbq_init { | ||
175 | uint32_t rn; /* Receive buffer notification */ | ||
176 | uint32_t entry_count; /* # of entries in HBQ */ | ||
177 | uint32_t headerLen; /* 0 if not profile 4 or 5 */ | ||
178 | uint32_t logEntry; /* Set to 1 if this HBQ used for LogEntry */ | ||
179 | uint32_t profile; /* Selection profile 0=all, 7=logentry */ | ||
180 | uint32_t ring_mask; /* Binds HBQ to a ring e.g. Ring0=b0001, | ||
181 | * ring2=b0100 */ | ||
182 | uint32_t hbq_index; /* index of this hbq in ring .HBQs[] */ | ||
183 | |||
184 | uint32_t seqlenoff; | ||
185 | uint32_t maxlen; | ||
186 | uint32_t seqlenbcnt; | ||
187 | uint32_t cmdcodeoff; | ||
188 | uint32_t cmdmatch[8]; | ||
189 | uint32_t mask_count; /* number of mask entries in prt array */ | ||
190 | struct hbq_mask hbqMasks[6]; | ||
191 | } ; | ||
192 | |||
193 | #define LPFC_MAX_HBQ 16 | ||
194 | |||
195 | |||
171 | /* Structure used to hold SLI statistical counters and info */ | 196 | /* Structure used to hold SLI statistical counters and info */ |
172 | struct lpfc_sli_stat { | 197 | struct lpfc_sli_stat { |
173 | uint64_t mbox_stat_err; /* Mbox cmds completed status error */ | 198 | uint64_t mbox_stat_err; /* Mbox cmds completed status error */ |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 0a7937351448..fd10fa16980e 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.1.12_psplit" | 21 | #define LPFC_DRIVER_VERSION "8.1.12_sli3" |
22 | 22 | ||
23 | #define LPFC_DRIVER_NAME "lpfc" | 23 | #define LPFC_DRIVER_NAME "lpfc" |
24 | 24 | ||