aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mem.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 812d0cd7c86d..b1db23c70781 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -38,10 +38,28 @@
38#include "lpfc_scsi.h" 38#include "lpfc_scsi.h"
39#include "lpfc.h" 39#include "lpfc.h"
40#include "lpfc_crtn.h" 40#include "lpfc_crtn.h"
41#include "lpfc_logmsg.h"
41 42
42#define LPFC_MBUF_POOL_SIZE 64 /* max elements in MBUF safety pool */ 43#define LPFC_MBUF_POOL_SIZE 64 /* max elements in MBUF safety pool */
43#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ 44#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */
44 45
46int
47lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) {
48 size_t bytes;
49 int max_xri = phba->sli4_hba.max_cfg_param.max_xri;
50
51 if (max_xri <= 0)
52 return -ENOMEM;
53 bytes = ((BITS_PER_LONG - 1 + max_xri) / BITS_PER_LONG) *
54 sizeof(unsigned long);
55 phba->cfg_rrq_xri_bitmap_sz = bytes;
56 phba->active_rrq_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE,
57 bytes);
58 if (!phba->active_rrq_pool)
59 return -ENOMEM;
60 else
61 return 0;
62}
45 63
46/** 64/**
47 * lpfc_mem_alloc - create and allocate all PCI and memory pools 65 * lpfc_mem_alloc - create and allocate all PCI and memory pools
@@ -209,6 +227,10 @@ lpfc_mem_free(struct lpfc_hba *phba)
209 /* Free NLP memory pool */ 227 /* Free NLP memory pool */
210 mempool_destroy(phba->nlp_mem_pool); 228 mempool_destroy(phba->nlp_mem_pool);
211 phba->nlp_mem_pool = NULL; 229 phba->nlp_mem_pool = NULL;
230 if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
231 mempool_destroy(phba->active_rrq_pool);
232 phba->active_rrq_pool = NULL;
233 }
212 234
213 /* Free mbox memory pool */ 235 /* Free mbox memory pool */
214 mempool_destroy(phba->mbox_mem_pool); 236 mempool_destroy(phba->mbox_mem_pool);