2021-10-18 08:21:42

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH] PCI: Remove the unused pci wrappers pci_pool_xxx()

The wrappers around dma_pool_xxx should go away, so
remove the unused pci wrappers.
Prefer using dma_pool_xxx() instead of the pci wrappers
pci_pool_xxx(), and the use of pci_pool_xxx was already
removed.

Signed-off-by: Cai Huoqing <[email protected]>
---
include/linux/pci.h | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7e0ce3a4d5a1..98fc67ceb582 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1498,19 +1498,6 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
#define PCI_IRQ_ALL_TYPES \
(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)

-/* kmem_cache style wrapper around pci_alloc_consistent() */
-
-#include <linux/dmapool.h>
-
-#define pci_pool dma_pool
-#define pci_pool_create(name, pdev, size, align, allocation) \
- dma_pool_create(name, &pdev->dev, size, align, allocation)
-#define pci_pool_destroy(pool) dma_pool_destroy(pool)
-#define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
-#define pci_pool_zalloc(pool, flags, handle) \
- dma_pool_zalloc(pool, flags, handle)
-#define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
-
struct msix_entry {
u32 vector; /* Kernel uses to write allocated vector */
u16 entry; /* Driver uses to specify entry, OS writes */
--
2.25.1


2021-10-18 10:33:11

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] PCI: Remove the unused pci wrappers pci_pool_xxx()

On Mon, Oct 18, 2021 at 04:16:28PM +0800, Cai Huoqing wrote:
> The wrappers around dma_pool_xxx should go away, so
> remove the unused pci wrappers.
> Prefer using dma_pool_xxx() instead of the pci wrappers
> pci_pool_xxx(), and the use of pci_pool_xxx was already
> removed.
>
> Signed-off-by: Cai Huoqing <[email protected]>

This looks good.

But did this survive a few rounds of buildbot randomconfig build on
various architectures? I'd be somewhat surprised if no file at all
dependended on this implicit inclusion of dmapool.h.

2021-10-18 12:20:47

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] PCI: Remove the unused pci wrappers pci_pool_xxx()

Hi Cai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on v5.15-rc6 next-20211018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Cai-Huoqing/PCI-Remove-the-unused-pci-wrappers-pci_pool_xxx/20211018-161828
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-a014-20211018 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d245f2e8597bfb52c34810a328d42b990e4af1a4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/35cdbe7c76652cc75a170ef91c4dafac9773e8c0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cai-Huoqing/PCI-Remove-the-unused-pci-wrappers-pci_pool_xxx/20211018-161828
git checkout 35cdbe7c76652cc75a170ef91c4dafac9773e8c0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

>> drivers/misc/habanalabs/goya/goya.c:919:19: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
^
drivers/misc/habanalabs/goya/goya.c:919:19: note: did you mean 'gen_pool_create'?
include/linux/genalloc.h:96:25: note: 'gen_pool_create' declared here
extern struct gen_pool *gen_pool_create(int, int);
^
>> drivers/misc/habanalabs/goya/goya.c:919:17: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/habanalabs/goya/goya.c:977:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(hdev->dma_pool);
^
drivers/misc/habanalabs/goya/goya.c:977:2: note: did you mean 'gen_pool_destroy'?
include/linux/genalloc.h:124:13: note: 'gen_pool_destroy' declared here
extern void gen_pool_destroy(struct gen_pool *);
^
drivers/misc/habanalabs/goya/goya.c:1001:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(hdev->dma_pool);
^
>> drivers/misc/habanalabs/goya/goya.c:3184:17: error: implicit declaration of function 'dma_pool_zalloc' [-Werror,-Wimplicit-function-declaration]
kernel_addr = dma_pool_zalloc(hdev->dma_pool, mem_flags, dma_handle);
^
drivers/misc/habanalabs/goya/goya.c:3184:17: note: did you mean 'gen_pool_alloc'?
include/linux/genalloc.h:151:29: note: 'gen_pool_alloc' declared here
static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
^
>> drivers/misc/habanalabs/goya/goya.c:3184:14: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
kernel_addr = dma_pool_zalloc(hdev->dma_pool, mem_flags, dma_handle);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/habanalabs/goya/goya.c:3199:2: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(hdev->dma_pool, vaddr, fixed_dma_addr);
^
drivers/misc/habanalabs/goya/goya.c:3199:2: note: did you mean 'gen_pool_free'?
include/linux/genalloc.h:169:20: note: 'gen_pool_free' declared here
static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr,
^
2 warnings and 5 errors generated.
--
>> drivers/misc/habanalabs/gaudi/gaudi.c:1845:19: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
^
drivers/misc/habanalabs/gaudi/gaudi.c:1845:19: note: did you mean 'gen_pool_create'?
include/linux/genalloc.h:96:25: note: 'gen_pool_create' declared here
extern struct gen_pool *gen_pool_create(int, int);
^
>> drivers/misc/habanalabs/gaudi/gaudi.c:1845:17: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/habanalabs/gaudi/gaudi.c:1905:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(hdev->dma_pool);
^
drivers/misc/habanalabs/gaudi/gaudi.c:1905:2: note: did you mean 'gen_pool_destroy'?
include/linux/genalloc.h:124:13: note: 'gen_pool_destroy' declared here
extern void gen_pool_destroy(struct gen_pool *);
^
drivers/misc/habanalabs/gaudi/gaudi.c:1928:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(hdev->dma_pool);
^
>> drivers/misc/habanalabs/gaudi/gaudi.c:5057:16: error: implicit declaration of function 'dma_pool_zalloc' [-Werror,-Wimplicit-function-declaration]
kernel_addr = dma_pool_zalloc(hdev->dma_pool, mem_flags, dma_handle);
^
drivers/misc/habanalabs/gaudi/gaudi.c:5057:16: note: did you mean 'gen_pool_alloc'?
include/linux/genalloc.h:151:29: note: 'gen_pool_alloc' declared here
static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
^
>> drivers/misc/habanalabs/gaudi/gaudi.c:5057:14: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
kernel_addr = dma_pool_zalloc(hdev->dma_pool, mem_flags, dma_handle);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/habanalabs/gaudi/gaudi.c:5072:2: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(hdev->dma_pool, vaddr, fixed_dma_addr);
^
drivers/misc/habanalabs/gaudi/gaudi.c:5072:2: note: did you mean 'gen_pool_free'?
include/linux/genalloc.h:169:20: note: 'gen_pool_free' declared here
static inline void gen_pool_free(struct gen_pool *pool, unsigned long addr,
^
2 warnings and 5 errors generated.


vim +/dma_pool_create +919 drivers/misc/habanalabs/goya/goya.c

c592c270fe1f24 Ohad Sharabi 2021-04-21 892
99b9d7b4970cf1 Oded Gabbay 2019-02-16 893 /*
99b9d7b4970cf1 Oded Gabbay 2019-02-16 894 * goya_sw_init - Goya software initialization code
99b9d7b4970cf1 Oded Gabbay 2019-02-16 895 *
99b9d7b4970cf1 Oded Gabbay 2019-02-16 896 * @hdev: pointer to hl_device structure
99b9d7b4970cf1 Oded Gabbay 2019-02-16 897 *
99b9d7b4970cf1 Oded Gabbay 2019-02-16 898 */
99b9d7b4970cf1 Oded Gabbay 2019-02-16 899 static int goya_sw_init(struct hl_device *hdev)
99b9d7b4970cf1 Oded Gabbay 2019-02-16 900 {
99b9d7b4970cf1 Oded Gabbay 2019-02-16 901 struct goya_device *goya;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 902 int rc;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 903
99b9d7b4970cf1 Oded Gabbay 2019-02-16 904 /* Allocate device structure */
99b9d7b4970cf1 Oded Gabbay 2019-02-16 905 goya = kzalloc(sizeof(*goya), GFP_KERNEL);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 906 if (!goya)
99b9d7b4970cf1 Oded Gabbay 2019-02-16 907 return -ENOMEM;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 908
99b9d7b4970cf1 Oded Gabbay 2019-02-16 909 /* according to goya_init_iatu */
99b9d7b4970cf1 Oded Gabbay 2019-02-16 910 goya->ddr_bar_cur_addr = DRAM_PHYS_BASE;
d91389bc839d72 Oded Gabbay 2019-02-16 911
d91389bc839d72 Oded Gabbay 2019-02-16 912 goya->mme_clk = GOYA_PLL_FREQ_LOW;
d91389bc839d72 Oded Gabbay 2019-02-16 913 goya->tpc_clk = GOYA_PLL_FREQ_LOW;
d91389bc839d72 Oded Gabbay 2019-02-16 914 goya->ic_clk = GOYA_PLL_FREQ_LOW;
d91389bc839d72 Oded Gabbay 2019-02-16 915
99b9d7b4970cf1 Oded Gabbay 2019-02-16 916 hdev->asic_specific = goya;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 917
99b9d7b4970cf1 Oded Gabbay 2019-02-16 918 /* Create DMA pool for small allocations */
99b9d7b4970cf1 Oded Gabbay 2019-02-16 @919 hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
99b9d7b4970cf1 Oded Gabbay 2019-02-16 920 &hdev->pdev->dev, GOYA_DMA_POOL_BLK_SIZE, 8, 0);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 921 if (!hdev->dma_pool) {
99b9d7b4970cf1 Oded Gabbay 2019-02-16 922 dev_err(hdev->dev, "failed to create DMA pool\n");
99b9d7b4970cf1 Oded Gabbay 2019-02-16 923 rc = -ENOMEM;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 924 goto free_goya_device;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 925 }
99b9d7b4970cf1 Oded Gabbay 2019-02-16 926
99b9d7b4970cf1 Oded Gabbay 2019-02-16 927 hdev->cpu_accessible_dma_mem =
d9c3aa8038c391 Oded Gabbay 2019-05-01 928 hdev->asic_funcs->asic_dma_alloc_coherent(hdev,
3110c60fdc7a5a Tomer Tayar 2019-03-04 929 HL_CPU_ACCESSIBLE_MEM_SIZE,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 930 &hdev->cpu_accessible_dma_address,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 931 GFP_KERNEL | __GFP_ZERO);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 932
99b9d7b4970cf1 Oded Gabbay 2019-02-16 933 if (!hdev->cpu_accessible_dma_mem) {
99b9d7b4970cf1 Oded Gabbay 2019-02-16 934 rc = -ENOMEM;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 935 goto free_dma_pool;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 936 }
99b9d7b4970cf1 Oded Gabbay 2019-02-16 937
f62fa0ced46afc Arnd Bergmann 2019-07-08 938 dev_dbg(hdev->dev, "cpu accessible memory at bus address %pad\n",
f62fa0ced46afc Arnd Bergmann 2019-07-08 939 &hdev->cpu_accessible_dma_address);
2a51558c8c7f82 Oded Gabbay 2019-05-29 940
cbb10f1e4a7225 Oded Gabbay 2019-05-17 941 hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 942 if (!hdev->cpu_accessible_dma_pool) {
99b9d7b4970cf1 Oded Gabbay 2019-02-16 943 dev_err(hdev->dev,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 944 "Failed to create CPU accessible DMA pool\n");
99b9d7b4970cf1 Oded Gabbay 2019-02-16 945 rc = -ENOMEM;
9f832fda79eb6e Tomer Tayar 2019-05-02 946 goto free_cpu_dma_mem;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 947 }
99b9d7b4970cf1 Oded Gabbay 2019-02-16 948
99b9d7b4970cf1 Oded Gabbay 2019-02-16 949 rc = gen_pool_add(hdev->cpu_accessible_dma_pool,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 950 (uintptr_t) hdev->cpu_accessible_dma_mem,
3110c60fdc7a5a Tomer Tayar 2019-03-04 951 HL_CPU_ACCESSIBLE_MEM_SIZE, -1);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 952 if (rc) {
99b9d7b4970cf1 Oded Gabbay 2019-02-16 953 dev_err(hdev->dev,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 954 "Failed to add memory to CPU accessible DMA pool\n");
99b9d7b4970cf1 Oded Gabbay 2019-02-16 955 rc = -EFAULT;
ba209e1587227f Tomer Tayar 2019-05-02 956 goto free_cpu_accessible_dma_pool;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 957 }
99b9d7b4970cf1 Oded Gabbay 2019-02-16 958
99b9d7b4970cf1 Oded Gabbay 2019-02-16 959 spin_lock_init(&goya->hw_queues_lock);
9e5e49cd5b90cf Omer Shpigelman 2020-05-10 960 hdev->supports_coresight = true;
66446820df1864 Oded Gabbay 2020-05-18 961 hdev->supports_soft_reset = true;
23bace677a3d92 Ofir Bitton 2021-06-08 962 hdev->allow_external_soft_reset = true;
215f0c1775d550 Ohad Sharabi 2021-06-14 963 hdev->supports_wait_for_multi_cs = false;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 964
b9317d513098d0 Ohad Sharabi 2021-07-15 965 hdev->asic_funcs->set_pci_memory_regions(hdev);
c592c270fe1f24 Ohad Sharabi 2021-04-21 966
99b9d7b4970cf1 Oded Gabbay 2019-02-16 967 return 0;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 968
ba209e1587227f Tomer Tayar 2019-05-02 969 free_cpu_accessible_dma_pool:
99b9d7b4970cf1 Oded Gabbay 2019-02-16 970 gen_pool_destroy(hdev->cpu_accessible_dma_pool);
9f832fda79eb6e Tomer Tayar 2019-05-02 971 free_cpu_dma_mem:
d9c3aa8038c391 Oded Gabbay 2019-05-01 972 hdev->asic_funcs->asic_dma_free_coherent(hdev,
d9c3aa8038c391 Oded Gabbay 2019-05-01 973 HL_CPU_ACCESSIBLE_MEM_SIZE,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 974 hdev->cpu_accessible_dma_mem,
99b9d7b4970cf1 Oded Gabbay 2019-02-16 975 hdev->cpu_accessible_dma_address);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 976 free_dma_pool:
99b9d7b4970cf1 Oded Gabbay 2019-02-16 @977 dma_pool_destroy(hdev->dma_pool);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 978 free_goya_device:
99b9d7b4970cf1 Oded Gabbay 2019-02-16 979 kfree(goya);
99b9d7b4970cf1 Oded Gabbay 2019-02-16 980
99b9d7b4970cf1 Oded Gabbay 2019-02-16 981 return rc;
99b9d7b4970cf1 Oded Gabbay 2019-02-16 982 }
99b9d7b4970cf1 Oded Gabbay 2019-02-16 983

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (13.85 kB)
.config.gz (31.13 kB)
Download all attachments

2021-10-18 12:48:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] PCI: Remove the unused pci wrappers pci_pool_xxx()

Hi Cai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on v5.15-rc6 next-20211018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Cai-Huoqing/PCI-Remove-the-unused-pci-wrappers-pci_pool_xxx/20211018-161828
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-a015-20211018 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d245f2e8597bfb52c34810a328d42b990e4af1a4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/35cdbe7c76652cc75a170ef91c4dafac9773e8c0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cai-Huoqing/PCI-Remove-the-unused-pci-wrappers-pci_pool_xxx/20211018-161828
git checkout 35cdbe7c76652cc75a170ef91c4dafac9773e8c0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

>> drivers/scsi/lpfc/lpfc_mem.c:92:25: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", &phba->pcidev->dev,
^
drivers/scsi/lpfc/lpfc_mem.c:92:25: note: did you mean 'mempool_create'?
include/linux/mempool.h:40:19: note: 'mempool_create' declared here
extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
^
>> drivers/scsi/lpfc/lpfc_mem.c:92:23: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", &phba->pcidev->dev,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/lpfc/lpfc_mem.c:107:28: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
^
drivers/scsi/lpfc/lpfc_mem.c:107:28: note: did you mean 'mempool_alloc'?
include/linux/mempool.h:48:14: note: 'mempool_alloc' declared here
extern void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask) __malloc;
^
>> drivers/scsi/lpfc/lpfc_mem.c:107:26: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:131:23: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:137:23: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:144:23: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool",
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/lpfc/lpfc_mem.c:164:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(phba->lpfc_drb_pool);
^
drivers/scsi/lpfc/lpfc_mem.c:164:2: note: did you mean 'mempool_destroy'?
include/linux/mempool.h:47:13: note: 'mempool_destroy' declared here
extern void mempool_destroy(mempool_t *pool);
^
>> drivers/scsi/lpfc/lpfc_mem.c:180:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
^
drivers/scsi/lpfc/lpfc_mem.c:194:3: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
dma_pool_create("lpfc_nvmet_drb_pool",
^
drivers/scsi/lpfc/lpfc_mem.c:193:28: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_nvmet_drb_pool =
^
drivers/scsi/lpfc/lpfc_mem.c:223:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(phba->lpfc_nvmet_drb_pool);
^
drivers/scsi/lpfc/lpfc_mem.c:252:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
^
drivers/scsi/lpfc/lpfc_mem.c:332:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
^
drivers/scsi/lpfc/lpfc_mem.c:383:8: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
^
drivers/scsi/lpfc/lpfc_mem.c:383:6: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:419:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_mbuf_pool, virt, dma);
^
drivers/scsi/lpfc/lpfc_mem.c:467:8: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
^
drivers/scsi/lpfc/lpfc_mem.c:467:6: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:483:2: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
^
drivers/scsi/lpfc/lpfc_mem.c:508:21: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
^
drivers/scsi/lpfc/lpfc_mem.c:508:19: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:533:2: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
^
drivers/scsi/lpfc/lpfc_mem.c:560:23: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
^
drivers/scsi/lpfc/lpfc_mem.c:560:21: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:566:21: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:569:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
^
drivers/scsi/lpfc/lpfc_mem.c:593:2: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
^
drivers/scsi/lpfc/lpfc_mem.c:618:23: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
^
drivers/scsi/lpfc/lpfc_mem.c:618:21: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:624:21: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_nvmet_drb_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_mem.c:627:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
13 warnings and 20 errors generated.
--
drivers/scsi/lpfc/lpfc_sli.c:15629:6: warning: variable 'i' set but not used [-Wunused-but-set-variable]
int i = 0;
^
>> drivers/scsi/lpfc/lpfc_sli.c:19245:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
^
drivers/scsi/lpfc/lpfc_sli.c:19245:3: note: did you mean 'mempool_free'?
include/linux/mempool.h:49:13: note: 'mempool_free' declared here
extern void mempool_free(void *element, mempool_t *pool);
^
>> drivers/scsi/lpfc/lpfc_sli.c:19283:16: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
pcmd->virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
^
drivers/scsi/lpfc/lpfc_sli.c:19283:16: note: did you mean 'mempool_alloc'?
include/linux/mempool.h:48:14: note: 'mempool_alloc' declared here
extern void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask) __malloc;
^
>> drivers/scsi/lpfc/lpfc_sli.c:19283:14: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
pcmd->virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_sli.c:19332:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
^
drivers/scsi/lpfc/lpfc_sli.c:22226:18: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
tmp->dma_sgl = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
^
>> drivers/scsi/lpfc/lpfc_sli.c:22226:16: warning: incompatible integer to pointer conversion assigning to 'struct sli4_sge *' from 'int' [-Wint-conversion]
tmp->dma_sgl = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_sli.c:22312:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_sli.c:22369:19: error: implicit declaration of function 'dma_pool_alloc' [-Werror,-Wimplicit-function-declaration]
tmp->fcp_cmnd = dma_pool_alloc(phba->lpfc_cmd_rsp_buf_pool,
^
>> drivers/scsi/lpfc/lpfc_sli.c:22369:17: warning: incompatible integer to pointer conversion assigning to 'struct fcp_cmnd *' from 'int' [-Wint-conversion]
tmp->fcp_cmnd = dma_pool_alloc(phba->lpfc_cmd_rsp_buf_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_sli.c:22462:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_cmd_rsp_buf_pool,
^
4 warnings and 7 errors generated.
--
>> drivers/scsi/lpfc/lpfc_init.c:3804:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
^
drivers/scsi/lpfc/lpfc_init.c:3804:3: note: did you mean 'mempool_free'?
include/linux/mempool.h:49:13: note: 'mempool_free' declared here
extern void mempool_free(void *element, mempool_t *pool);
^
drivers/scsi/lpfc/lpfc_init.c:3815:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
^
drivers/scsi/lpfc/lpfc_init.c:3848:4: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_init.c:3864:4: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_init.c:4260:5: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
>> drivers/scsi/lpfc/lpfc_init.c:4330:21: error: implicit declaration of function 'dma_pool_zalloc' [-Werror,-Wimplicit-function-declaration]
lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_init.c:4330:21: note: did you mean 'mempool_alloc'?
include/linux/mempool.h:48:14: note: 'mempool_alloc' declared here
extern void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask) __malloc;
^
>> drivers/scsi/lpfc/lpfc_init.c:4330:19: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_init.c:4353:5: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_init.c:4365:4: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_init.c:4375:4: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
>> drivers/scsi/lpfc/lpfc_init.c:7686:3: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
dma_pool_create("lpfc_sg_dma_buf_pool",
^
drivers/scsi/lpfc/lpfc_init.c:7686:3: note: did you mean 'mempool_create'?
include/linux/mempool.h:40:19: note: 'mempool_create' declared here
extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
^
>> drivers/scsi/lpfc/lpfc_init.c:7685:29: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_sg_dma_buf_pool =
^
drivers/scsi/lpfc/lpfc_init.c:7693:30: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_cmd_rsp_buf_pool =
^
>> drivers/scsi/lpfc/lpfc_init.c:7723:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
^
drivers/scsi/lpfc/lpfc_init.c:7723:2: note: did you mean 'mempool_destroy'?
include/linux/mempool.h:47:13: note: 'mempool_destroy' declared here
extern void mempool_destroy(mempool_t *pool);
^
drivers/scsi/lpfc/lpfc_init.c:8139:4: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
dma_pool_create("lpfc_sg_dma_buf_pool",
^
drivers/scsi/lpfc/lpfc_init.c:8138:29: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_sg_dma_buf_pool =
^
drivers/scsi/lpfc/lpfc_init.c:8146:30: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
phba->lpfc_cmd_rsp_buf_pool =
^
drivers/scsi/lpfc/lpfc_init.c:8300:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool);
^
5 warnings and 13 errors generated.
--
>> drivers/scsi/lpfc/lpfc_scsi.c:349:15: error: implicit declaration of function 'dma_pool_zalloc' [-Werror,-Wimplicit-function-declaration]
psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_scsi.c:349:15: note: did you mean 'mempool_alloc'?
include/linux/mempool.h:48:14: note: 'mempool_alloc' declared here
extern void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask) __malloc;
^
>> drivers/scsi/lpfc/lpfc_scsi.c:349:13: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/lpfc/lpfc_scsi.c:360:4: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
^
drivers/scsi/lpfc/lpfc_scsi.c:360:4: note: did you mean 'mempool_free'?
include/linux/mempool.h:49:13: note: 'mempool_free' declared here
extern void mempool_free(void *element, mempool_t *pool);
^
1 warning and 2 errors generated.
--
>> drivers/net/ethernet/alacritech/slicoss.c:852:18: error: implicit declaration of function 'dma_pool_create' [-Werror,-Wimplicit-function-declaration]
txq->dma_pool = dma_pool_create("slic_pool", &sdev->pdev->dev,
^
drivers/net/ethernet/alacritech/slicoss.c:852:18: note: did you mean 'page_pool_create'?
include/net/page_pool.h:169:19: note: 'page_pool_create' declared here
struct page_pool *page_pool_create(const struct page_pool_params *params);
^
>> drivers/net/ethernet/alacritech/slicoss.c:852:16: warning: incompatible integer to pointer conversion assigning to 'struct dma_pool *' from 'int' [-Wint-conversion]
txq->dma_pool = dma_pool_create("slic_pool", &sdev->pdev->dev,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/alacritech/slicoss.c:863:10: error: implicit declaration of function 'dma_pool_zalloc' [-Werror,-Wimplicit-function-declaration]
desc = dma_pool_zalloc(txq->dma_pool, GFP_KERNEL,
^
>> drivers/net/ethernet/alacritech/slicoss.c:863:8: warning: incompatible integer to pointer conversion assigning to 'struct slic_tx_desc *' from 'int' [-Wint-conversion]
desc = dma_pool_zalloc(txq->dma_pool, GFP_KERNEL,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/alacritech/slicoss.c:884:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(txq->dma_pool, buff->desc, buff->desc_paddr);
^
drivers/net/ethernet/alacritech/slicoss.c:884:3: note: did you mean 'dma_pool_create'?
drivers/net/ethernet/alacritech/slicoss.c:852:18: note: 'dma_pool_create' declared here
txq->dma_pool = dma_pool_create("slic_pool", &sdev->pdev->dev,
^
>> drivers/net/ethernet/alacritech/slicoss.c:886:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(txq->dma_pool);
^
drivers/net/ethernet/alacritech/slicoss.c:886:2: note: did you mean 'page_pool_destroy'?
include/net/page_pool.h:172:6: note: 'page_pool_destroy' declared here
void page_pool_destroy(struct page_pool *pool);
^
drivers/net/ethernet/alacritech/slicoss.c:902:3: error: implicit declaration of function 'dma_pool_free' [-Werror,-Wimplicit-function-declaration]
dma_pool_free(txq->dma_pool, buff->desc, buff->desc_paddr);
^
drivers/net/ethernet/alacritech/slicoss.c:911:2: error: implicit declaration of function 'dma_pool_destroy' [-Werror,-Wimplicit-function-declaration]
dma_pool_destroy(txq->dma_pool);
^
2 warnings and 6 errors generated.


vim +/dma_pool_create +92 drivers/scsi/lpfc/lpfc_mem.c

2e0fef85e098f6 James Smart 2007-06-17 68
e59058c44025d7 James Smart 2008-08-24 69 /**
3621a710a7dbb2 James Smart 2009-04-06 70 * lpfc_mem_alloc - create and allocate all PCI and memory pools
e59058c44025d7 James Smart 2008-08-24 71 * @phba: HBA to allocate pools for
c734de98a7bc3d Lee Jones 2020-07-21 72 * @align: alignment requirement for blocks; must be a power of two
e59058c44025d7 James Smart 2008-08-24 73 *
d79c9e9d4b3d93 James Smart 2019-08-14 74 * Description: Creates and allocates PCI pools lpfc_mbuf_pool,
d79c9e9d4b3d93 James Smart 2019-08-14 75 * lpfc_hrb_pool. Creates and allocates kmalloc-backed mempools
e59058c44025d7 James Smart 2008-08-24 76 * for LPFC_MBOXQ_t and lpfc_nodelist. Also allocates the VPI bitmask.
e59058c44025d7 James Smart 2008-08-24 77 *
e59058c44025d7 James Smart 2008-08-24 78 * Notes: Not interrupt-safe. Must be called with no locks held. If any
e59058c44025d7 James Smart 2008-08-24 79 * allocation fails, frees all successfully allocated memory before returning.
e59058c44025d7 James Smart 2008-08-24 80 *
e59058c44025d7 James Smart 2008-08-24 81 * Returns:
e59058c44025d7 James Smart 2008-08-24 82 * 0 on success
e59058c44025d7 James Smart 2008-08-24 83 * -ENOMEM on failure (if any memory allocations fail)
e59058c44025d7 James Smart 2008-08-24 84 **/
dea3101e0a5c89 James Bottomley 2005-04-17 85 int
da0436e915a5c1 James Smart 2009-05-22 86 lpfc_mem_alloc(struct lpfc_hba *phba, int align)
dea3101e0a5c89 James Bottomley 2005-04-17 87 {
dea3101e0a5c89 James Bottomley 2005-04-17 88 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool;
dea3101e0a5c89 James Bottomley 2005-04-17 89 int i;
dea3101e0a5c89 James Bottomley 2005-04-17 90
dea3101e0a5c89 James Bottomley 2005-04-17 91
771db5c0e3f5da Romain Perier 2017-07-06 @92 phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", &phba->pcidev->dev,
da0436e915a5c1 James Smart 2009-05-22 93 LPFC_BPL_SIZE,
da0436e915a5c1 James Smart 2009-05-22 94 align, 0);
dea3101e0a5c89 James Bottomley 2005-04-17 95 if (!phba->lpfc_mbuf_pool)
d79c9e9d4b3d93 James Smart 2019-08-14 96 goto fail;
dea3101e0a5c89 James Bottomley 2005-04-17 97
6da2ec56059c3c Kees Cook 2018-06-12 98 pool->elements = kmalloc_array(LPFC_MBUF_POOL_SIZE,
6da2ec56059c3c Kees Cook 2018-06-12 99 sizeof(struct lpfc_dmabuf),
6da2ec56059c3c Kees Cook 2018-06-12 100 GFP_KERNEL);
a96e0c7798057d Mariusz Kozlowski 2007-01-02 101 if (!pool->elements)
a96e0c7798057d Mariusz Kozlowski 2007-01-02 102 goto fail_free_lpfc_mbuf_pool;
a96e0c7798057d Mariusz Kozlowski 2007-01-02 103
dea3101e0a5c89 James Bottomley 2005-04-17 104 pool->max_count = 0;
dea3101e0a5c89 James Bottomley 2005-04-17 105 pool->current_count = 0;
dea3101e0a5c89 James Bottomley 2005-04-17 106 for ( i = 0; i < LPFC_MBUF_POOL_SIZE; i++) {
771db5c0e3f5da Romain Perier 2017-07-06 @107 pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
dea3101e0a5c89 James Bottomley 2005-04-17 108 GFP_KERNEL, &pool->elements[i].phys);
dea3101e0a5c89 James Bottomley 2005-04-17 109 if (!pool->elements[i].virt)
dea3101e0a5c89 James Bottomley 2005-04-17 110 goto fail_free_mbuf_pool;
dea3101e0a5c89 James Bottomley 2005-04-17 111 pool->max_count++;
dea3101e0a5c89 James Bottomley 2005-04-17 112 pool->current_count++;
dea3101e0a5c89 James Bottomley 2005-04-17 113 }
dea3101e0a5c89 James Bottomley 2005-04-17 114
e7dab164a9aa45 James Smart 2020-10-20 115 phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MBX_POOL_SIZE,
0eaae62abaa1ad Matthew Dobson 2006-03-26 116 sizeof(LPFC_MBOXQ_t));
dea3101e0a5c89 James Bottomley 2005-04-17 117 if (!phba->mbox_mem_pool)
dea3101e0a5c89 James Bottomley 2005-04-17 118 goto fail_free_mbuf_pool;
dea3101e0a5c89 James Bottomley 2005-04-17 119
0eaae62abaa1ad Matthew Dobson 2006-03-26 120 phba->nlp_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE,
0eaae62abaa1ad Matthew Dobson 2006-03-26 121 sizeof(struct lpfc_nodelist));
dea3101e0a5c89 James Bottomley 2005-04-17 122 if (!phba->nlp_mem_pool)
dea3101e0a5c89 James Bottomley 2005-04-17 123 goto fail_free_mbox_pool;
8568a4d2495ebc James Smart 2009-07-19 124
8568a4d2495ebc James Smart 2009-07-19 125 if (phba->sli_rev == LPFC_SLI_REV4) {
19ca760979e4be James Smart 2010-11-20 126 phba->rrq_pool =
9dace1fa91ca41 Dick Kennedy 2020-06-30 127 mempool_create_kmalloc_pool(LPFC_RRQ_POOL_SIZE,
19ca760979e4be James Smart 2010-11-20 128 sizeof(struct lpfc_node_rrq));
19ca760979e4be James Smart 2010-11-20 129 if (!phba->rrq_pool)
19ca760979e4be James Smart 2010-11-20 130 goto fail_free_nlp_mem_pool;
771db5c0e3f5da Romain Perier 2017-07-06 131 phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool",
771db5c0e3f5da Romain Perier 2017-07-06 132 &phba->pcidev->dev,
da0436e915a5c1 James Smart 2009-05-22 133 LPFC_HDR_BUF_SIZE, align, 0);
da0436e915a5c1 James Smart 2009-05-22 134 if (!phba->lpfc_hrb_pool)
19ca760979e4be James Smart 2010-11-20 135 goto fail_free_rrq_mem_pool;
8568a4d2495ebc James Smart 2009-07-19 136
771db5c0e3f5da Romain Perier 2017-07-06 137 phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool",
771db5c0e3f5da Romain Perier 2017-07-06 138 &phba->pcidev->dev,
da0436e915a5c1 James Smart 2009-05-22 139 LPFC_DATA_BUF_SIZE, align, 0);
da0436e915a5c1 James Smart 2009-05-22 140 if (!phba->lpfc_drb_pool)
8568a4d2495ebc James Smart 2009-07-19 141 goto fail_free_hrb_pool;
8568a4d2495ebc James Smart 2009-07-19 142 phba->lpfc_hbq_pool = NULL;
8568a4d2495ebc James Smart 2009-07-19 143 } else {
771db5c0e3f5da Romain Perier 2017-07-06 144 phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool",
771db5c0e3f5da Romain Perier 2017-07-06 145 &phba->pcidev->dev, LPFC_BPL_SIZE, align, 0);
8568a4d2495ebc James Smart 2009-07-19 146 if (!phba->lpfc_hbq_pool)
8568a4d2495ebc James Smart 2009-07-19 147 goto fail_free_nlp_mem_pool;
8568a4d2495ebc James Smart 2009-07-19 148 phba->lpfc_hrb_pool = NULL;
8568a4d2495ebc James Smart 2009-07-19 149 phba->lpfc_drb_pool = NULL;
8568a4d2495ebc James Smart 2009-07-19 150 }
92d7f7b0cde3ad James Smart 2007-06-17 151
1ba981fd3ad1f9 James Smart 2014-02-20 152 if (phba->cfg_EnableXLane) {
1ba981fd3ad1f9 James Smart 2014-02-20 153 phba->device_data_mem_pool = mempool_create_kmalloc_pool(
1ba981fd3ad1f9 James Smart 2014-02-20 154 LPFC_DEVICE_DATA_POOL_SIZE,
1ba981fd3ad1f9 James Smart 2014-02-20 155 sizeof(struct lpfc_device_data));
1ba981fd3ad1f9 James Smart 2014-02-20 156 if (!phba->device_data_mem_pool)
895427bd012ce5 James Smart 2017-02-12 157 goto fail_free_drb_pool;
1ba981fd3ad1f9 James Smart 2014-02-20 158 } else {
1ba981fd3ad1f9 James Smart 2014-02-20 159 phba->device_data_mem_pool = NULL;
1ba981fd3ad1f9 James Smart 2014-02-20 160 }
1ba981fd3ad1f9 James Smart 2014-02-20 161
dea3101e0a5c89 James Bottomley 2005-04-17 162 return 0;
895427bd012ce5 James Smart 2017-02-12 163 fail_free_drb_pool:
771db5c0e3f5da Romain Perier 2017-07-06 @164 dma_pool_destroy(phba->lpfc_drb_pool);
895427bd012ce5 James Smart 2017-02-12 165 phba->lpfc_drb_pool = NULL;
8568a4d2495ebc James Smart 2009-07-19 166 fail_free_hrb_pool:
771db5c0e3f5da Romain Perier 2017-07-06 167 dma_pool_destroy(phba->lpfc_hrb_pool);
da0436e915a5c1 James Smart 2009-05-22 168 phba->lpfc_hrb_pool = NULL;
19ca760979e4be James Smart 2010-11-20 169 fail_free_rrq_mem_pool:
19ca760979e4be James Smart 2010-11-20 170 mempool_destroy(phba->rrq_pool);
19ca760979e4be James Smart 2010-11-20 171 phba->rrq_pool = NULL;
ed957684294618 James Smart 2007-06-17 172 fail_free_nlp_mem_pool:
ed957684294618 James Smart 2007-06-17 173 mempool_destroy(phba->nlp_mem_pool);
ed957684294618 James Smart 2007-06-17 174 phba->nlp_mem_pool = NULL;
dea3101e0a5c89 James Bottomley 2005-04-17 175 fail_free_mbox_pool:
dea3101e0a5c89 James Bottomley 2005-04-17 176 mempool_destroy(phba->mbox_mem_pool);
2e0fef85e098f6 James Smart 2007-06-17 177 phba->mbox_mem_pool = NULL;
dea3101e0a5c89 James Bottomley 2005-04-17 178 fail_free_mbuf_pool:
a96e0c7798057d Mariusz Kozlowski 2007-01-02 179 while (i--)
771db5c0e3f5da Romain Perier 2017-07-06 @180 dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
dea3101e0a5c89 James Bottomley 2005-04-17 181 pool->elements[i].phys);
dea3101e0a5c89 James Bottomley 2005-04-17 182 kfree(pool->elements);
a96e0c7798057d Mariusz Kozlowski 2007-01-02 183 fail_free_lpfc_mbuf_pool:
771db5c0e3f5da Romain Perier 2017-07-06 184 dma_pool_destroy(phba->lpfc_mbuf_pool);
2e0fef85e098f6 James Smart 2007-06-17 185 phba->lpfc_mbuf_pool = NULL;
dea3101e0a5c89 James Bottomley 2005-04-17 186 fail:
dea3101e0a5c89 James Bottomley 2005-04-17 187 return -ENOMEM;
dea3101e0a5c89 James Bottomley 2005-04-17 188 }
dea3101e0a5c89 James Bottomley 2005-04-17 189

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (32.86 kB)
.config.gz (32.74 kB)
Download all attachments