aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mem.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2009-07-19 10:01:16 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:51:57 -0400
commit8568a4d2495ebcf5da38a2141c7633399143b1a5 (patch)
treeca36764ce8d8703339e408b93ccfd06ec165eefd /drivers/scsi/lpfc/lpfc_mem.c
parenta0c87cbdb52467a16343b31251f2722643db603c (diff)
[SCSI] lpfc 8.3.4: Various SLI3 fixes
Various SLI3 fixes - Fix for firmware dump failure - Fix inband remote management Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mem.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index e198c917c13e..a1b6db6016da 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -110,17 +110,28 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
110 sizeof(struct lpfc_nodelist)); 110 sizeof(struct lpfc_nodelist));
111 if (!phba->nlp_mem_pool) 111 if (!phba->nlp_mem_pool)
112 goto fail_free_mbox_pool; 112 goto fail_free_mbox_pool;
113 phba->lpfc_hrb_pool = pci_pool_create("lpfc_hrb_pool", 113
114 if (phba->sli_rev == LPFC_SLI_REV4) {
115 phba->lpfc_hrb_pool = pci_pool_create("lpfc_hrb_pool",
114 phba->pcidev, 116 phba->pcidev,
115 LPFC_HDR_BUF_SIZE, align, 0); 117 LPFC_HDR_BUF_SIZE, align, 0);
116 if (!phba->lpfc_hrb_pool) 118 if (!phba->lpfc_hrb_pool)
117 goto fail_free_nlp_mem_pool; 119 goto fail_free_nlp_mem_pool;
118 phba->lpfc_drb_pool = pci_pool_create("lpfc_drb_pool", 120
121 phba->lpfc_drb_pool = pci_pool_create("lpfc_drb_pool",
119 phba->pcidev, 122 phba->pcidev,
120 LPFC_DATA_BUF_SIZE, align, 0); 123 LPFC_DATA_BUF_SIZE, align, 0);
121 if (!phba->lpfc_drb_pool) 124 if (!phba->lpfc_drb_pool)
122 goto fail_free_hbq_pool; 125 goto fail_free_hrb_pool;
123 126 phba->lpfc_hbq_pool = NULL;
127 } else {
128 phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool",
129 phba->pcidev, LPFC_BPL_SIZE, align, 0);
130 if (!phba->lpfc_hbq_pool)
131 goto fail_free_nlp_mem_pool;
132 phba->lpfc_hrb_pool = NULL;
133 phba->lpfc_drb_pool = NULL;
134 }
124 /* vpi zero is reserved for the physical port so add 1 to max */ 135 /* vpi zero is reserved for the physical port so add 1 to max */
125 longs = ((phba->max_vpi + 1) + BITS_PER_LONG - 1) / BITS_PER_LONG; 136 longs = ((phba->max_vpi + 1) + BITS_PER_LONG - 1) / BITS_PER_LONG;
126 phba->vpi_bmask = kzalloc(longs * sizeof(unsigned long), GFP_KERNEL); 137 phba->vpi_bmask = kzalloc(longs * sizeof(unsigned long), GFP_KERNEL);
@@ -132,7 +143,7 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align)
132 fail_free_dbq_pool: 143 fail_free_dbq_pool:
133 pci_pool_destroy(phba->lpfc_drb_pool); 144 pci_pool_destroy(phba->lpfc_drb_pool);
134 phba->lpfc_drb_pool = NULL; 145 phba->lpfc_drb_pool = NULL;
135 fail_free_hbq_pool: 146 fail_free_hrb_pool:
136 pci_pool_destroy(phba->lpfc_hrb_pool); 147 pci_pool_destroy(phba->lpfc_hrb_pool);
137 phba->lpfc_hrb_pool = NULL; 148 phba->lpfc_hrb_pool = NULL;
138 fail_free_nlp_mem_pool: 149 fail_free_nlp_mem_pool:
@@ -176,11 +187,17 @@ lpfc_mem_free(struct lpfc_hba *phba)
176 187
177 /* Free HBQ pools */ 188 /* Free HBQ pools */
178 lpfc_sli_hbqbuf_free_all(phba); 189 lpfc_sli_hbqbuf_free_all(phba);
179 pci_pool_destroy(phba->lpfc_drb_pool); 190 if (phba->lpfc_drb_pool)
191 pci_pool_destroy(phba->lpfc_drb_pool);
180 phba->lpfc_drb_pool = NULL; 192 phba->lpfc_drb_pool = NULL;
181 pci_pool_destroy(phba->lpfc_hrb_pool); 193 if (phba->lpfc_hrb_pool)
194 pci_pool_destroy(phba->lpfc_hrb_pool);
182 phba->lpfc_hrb_pool = NULL; 195 phba->lpfc_hrb_pool = NULL;
183 196
197 if (phba->lpfc_hbq_pool)
198 pci_pool_destroy(phba->lpfc_hbq_pool);
199 phba->lpfc_hbq_pool = NULL;
200
184 /* Free NLP memory pool */ 201 /* Free NLP memory pool */
185 mempool_destroy(phba->nlp_mem_pool); 202 mempool_destroy(phba->nlp_mem_pool);
186 phba->nlp_mem_pool = NULL; 203 phba->nlp_mem_pool = NULL;
@@ -380,7 +397,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
380 if (!hbqbp) 397 if (!hbqbp)
381 return NULL; 398 return NULL;
382 399
383 hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL, 400 hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
384 &hbqbp->dbuf.phys); 401 &hbqbp->dbuf.phys);
385 if (!hbqbp->dbuf.virt) { 402 if (!hbqbp->dbuf.virt) {
386 kfree(hbqbp); 403 kfree(hbqbp);
@@ -405,7 +422,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
405void 422void
406lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) 423lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
407{ 424{
408 pci_pool_free(phba->lpfc_hrb_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); 425 pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
409 kfree(hbqbp); 426 kfree(hbqbp);
410 return; 427 return;
411} 428}