On Wed, Dec 20, 2023 at 04:54:23PM +0800, Cheng Xu wrote: > Hardware response, such as the result of query statistics, may be too > long to be directly accommodated within the CQE structure. To address > this, we introduce a DMA pool to hold the hardware's responses of CMDQ > requests. > > Signed-off-by: Cheng Xu <chengyou@xxxxxxxxxxxxxxxxx> > --- > drivers/infiniband/hw/erdma/erdma.h | 2 ++ > drivers/infiniband/hw/erdma/erdma_main.c | 38 ++++++++++++++++++++++-- > 2 files changed, 38 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/hw/erdma/erdma.h b/drivers/infiniband/hw/erdma/erdma.h > index f190111840e9..5df401a30cb9 100644 > --- a/drivers/infiniband/hw/erdma/erdma.h > +++ b/drivers/infiniband/hw/erdma/erdma.h > @@ -212,6 +212,8 @@ struct erdma_dev { > > atomic_t num_ctx; > struct list_head cep_list; > + > + struct dma_pool *resp_pool; > }; > > static inline void *get_queue_entry(void *qbuf, u32 idx, u32 depth, u32 shift) > diff --git a/drivers/infiniband/hw/erdma/erdma_main.c b/drivers/infiniband/hw/erdma/erdma_main.c > index 0880c79a978c..541e77aea494 100644 > --- a/drivers/infiniband/hw/erdma/erdma_main.c > +++ b/drivers/infiniband/hw/erdma/erdma_main.c > @@ -168,18 +168,48 @@ static void erdma_comm_irq_uninit(struct erdma_dev *dev) > free_irq(dev->comm_irq.msix_vector, dev); > } > > +static int erdma_dma_pools_init(struct erdma_dev *dev) > +{ > + dev->resp_pool = dma_pool_create("erdma_resp_pool", &dev->pdev->dev, > + ERDMA_HW_RESP_SIZE, ERDMA_HW_RESP_SIZE, > + 0); > + if (!dev->resp_pool) > + return -ENOMEM; > + > + return 0; > +} > + > +static void erdma_dma_pools_destroy(struct erdma_dev *dev) > +{ > + dma_pool_destroy(dev->resp_pool); > +} Please don't add extra layer of functions which will be called in same file anyway. Call directly to dma_pool_destroy(), same goes for dma_pool_create(). Thanks