Skip to content

Commit 4507025

Browse files
Krishna GudipatiJames Bottomley
authored andcommitted
[SCSI] bfa: DMA memory allocation enhancement.
- Modified the design such that each BFA sub-module will provide the amount of DMA and KVA memory needed by it and queues the same request to the global dma and kva info queues. - During the memory allocation we iterate over this queue to allocate the dma and kva memory requested by sub-modules. - The change is needed to avoid requesting the aggregate amount of memory needed by all the BFA sub-modules as one contiguous chunk. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 3fd4598 commit 4507025

13 files changed

Lines changed: 624 additions & 569 deletions

File tree

‎drivers/scsi/bfa/bfa.h‎

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -172,34 +172,6 @@ struct bfa_pciid_s {
172172

173173
extern char bfa_version[];
174174

175-
/*
176-
* BFA memory resources
177-
*/
178-
enum bfa_mem_type {
179-
BFA_MEM_TYPE_KVA = 1, /* Kernel Virtual Memory *(non-dma-able) */
180-
BFA_MEM_TYPE_DMA = 2, /* DMA-able memory */
181-
BFA_MEM_TYPE_MAX = BFA_MEM_TYPE_DMA,
182-
};
183-
184-
struct bfa_mem_elem_s {
185-
enum bfa_mem_type mem_type; /* see enum bfa_mem_type */
186-
u32 mem_len; /* Total Length in Bytes */
187-
u8 *kva; /* kernel virtual address */
188-
u64 dma; /* dma address if DMA memory */
189-
u8 *kva_curp; /* kva allocation cursor */
190-
u64 dma_curp; /* dma allocation cursor */
191-
};
192-
193-
struct bfa_meminfo_s {
194-
struct bfa_mem_elem_s meminfo[BFA_MEM_TYPE_MAX];
195-
};
196-
#define bfa_meminfo_kva(_m) \
197-
((_m)->meminfo[BFA_MEM_TYPE_KVA - 1].kva_curp)
198-
#define bfa_meminfo_dma_virt(_m) \
199-
((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].kva_curp)
200-
#define bfa_meminfo_dma_phys(_m) \
201-
((_m)->meminfo[BFA_MEM_TYPE_DMA - 1].dma_curp)
202-
203175
struct bfa_iocfc_regs_s {
204176
void __iomem *intr_status;
205177
void __iomem *intr_mask;
@@ -294,8 +266,19 @@ struct bfa_iocfc_s {
294266
void *updateq_cbarg; /* bios callback arg */
295267
u32 intr_mask;
296268
struct bfa_faa_args_s faa_args;
269+
struct bfa_mem_dma_s ioc_dma;
270+
struct bfa_mem_dma_s iocfc_dma;
271+
struct bfa_mem_dma_s reqq_dma[BFI_IOC_MAX_CQS];
272+
struct bfa_mem_dma_s rspq_dma[BFI_IOC_MAX_CQS];
273+
struct bfa_mem_kva_s kva_seg;
297274
};
298275

276+
#define BFA_MEM_IOC_DMA(_bfa) (&((_bfa)->iocfc.ioc_dma))
277+
#define BFA_MEM_IOCFC_DMA(_bfa) (&((_bfa)->iocfc.iocfc_dma))
278+
#define BFA_MEM_REQQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.reqq_dma[(_qno)]))
279+
#define BFA_MEM_RSPQ_DMA(_bfa, _qno) (&((_bfa)->iocfc.rspq_dma[(_qno)]))
280+
#define BFA_MEM_IOCFC_KVA(_bfa) (&((_bfa)->iocfc.kva_seg))
281+
299282
#define bfa_fn_lpu(__bfa) \
300283
bfi_fn_lpu(bfa_ioc_pcifn(&(__bfa)->ioc), bfa_ioc_portid(&(__bfa)->ioc))
301284
#define bfa_msix_init(__bfa, __nvecs) \
@@ -329,17 +312,17 @@ struct bfa_iocfc_s {
329312
/*
330313
* FC specific IOC functions.
331314
*/
332-
void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
333-
u32 *dm_len);
315+
void bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg,
316+
struct bfa_meminfo_s *meminfo,
317+
struct bfa_s *bfa);
334318
void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad,
335319
struct bfa_iocfc_cfg_s *cfg,
336-
struct bfa_meminfo_s *meminfo,
337320
struct bfa_pcidev_s *pcidev);
338321
void bfa_iocfc_init(struct bfa_s *bfa);
339322
void bfa_iocfc_start(struct bfa_s *bfa);
340323
void bfa_iocfc_stop(struct bfa_s *bfa);
341324
void bfa_iocfc_isr(void *bfa, struct bfi_mbmsg_s *msg);
342-
void bfa_iocfc_set_snsbase(struct bfa_s *bfa, u64 snsbase_pa);
325+
void bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa);
343326
bfa_boolean_t bfa_iocfc_is_operational(struct bfa_s *bfa);
344327
void bfa_iocfc_reset_queues(struct bfa_s *bfa);
345328

@@ -418,7 +401,8 @@ void bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids);
418401
void bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg);
419402
void bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg);
420403
void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg,
421-
struct bfa_meminfo_s *meminfo);
404+
struct bfa_meminfo_s *meminfo,
405+
struct bfa_s *bfa);
422406
void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
423407
struct bfa_meminfo_s *meminfo,
424408
struct bfa_pcidev_s *pcidev);

0 commit comments

Comments
 (0)