Lines Matching refs:ndev
27 struct nitrox_device *ndev = cmdq->ndev; in nitrox_cmdq_init() local
29 cmdq->qsize = (ndev->qlen * cmdq->instr_size) + align_bytes; in nitrox_cmdq_init()
30 cmdq->unalign_base = dma_alloc_coherent(DEV(ndev), cmdq->qsize, in nitrox_cmdq_init()
62 struct nitrox_device *ndev; in nitrox_cmdq_cleanup() local
70 ndev = cmdq->ndev; in nitrox_cmdq_cleanup()
73 dma_free_coherent(DEV(ndev), cmdq->qsize, in nitrox_cmdq_cleanup()
87 static void nitrox_free_aqm_queues(struct nitrox_device *ndev) in nitrox_free_aqm_queues() argument
91 for (i = 0; i < ndev->nr_queues; i++) { in nitrox_free_aqm_queues()
92 nitrox_cmdq_cleanup(ndev->aqmq[i]); in nitrox_free_aqm_queues()
93 kfree_sensitive(ndev->aqmq[i]); in nitrox_free_aqm_queues()
94 ndev->aqmq[i] = NULL; in nitrox_free_aqm_queues()
98 static int nitrox_alloc_aqm_queues(struct nitrox_device *ndev) in nitrox_alloc_aqm_queues() argument
102 for (i = 0; i < ndev->nr_queues; i++) { in nitrox_alloc_aqm_queues()
106 cmdq = kzalloc_node(sizeof(*cmdq), GFP_KERNEL, ndev->node); in nitrox_alloc_aqm_queues()
112 cmdq->ndev = ndev; in nitrox_alloc_aqm_queues()
118 cmdq->dbell_csr_addr = NITROX_CSR_ADDR(ndev, offset); in nitrox_alloc_aqm_queues()
121 cmdq->compl_cnt_csr_addr = NITROX_CSR_ADDR(ndev, offset); in nitrox_alloc_aqm_queues()
128 ndev->aqmq[i] = cmdq; in nitrox_alloc_aqm_queues()
134 nitrox_free_aqm_queues(ndev); in nitrox_alloc_aqm_queues()
138 static void nitrox_free_pktin_queues(struct nitrox_device *ndev) in nitrox_free_pktin_queues() argument
142 for (i = 0; i < ndev->nr_queues; i++) { in nitrox_free_pktin_queues()
143 struct nitrox_cmdq *cmdq = &ndev->pkt_inq[i]; in nitrox_free_pktin_queues()
147 kfree(ndev->pkt_inq); in nitrox_free_pktin_queues()
148 ndev->pkt_inq = NULL; in nitrox_free_pktin_queues()
151 static int nitrox_alloc_pktin_queues(struct nitrox_device *ndev) in nitrox_alloc_pktin_queues() argument
155 ndev->pkt_inq = kcalloc_node(ndev->nr_queues, in nitrox_alloc_pktin_queues()
157 GFP_KERNEL, ndev->node); in nitrox_alloc_pktin_queues()
158 if (!ndev->pkt_inq) in nitrox_alloc_pktin_queues()
161 for (i = 0; i < ndev->nr_queues; i++) { in nitrox_alloc_pktin_queues()
165 cmdq = &ndev->pkt_inq[i]; in nitrox_alloc_pktin_queues()
166 cmdq->ndev = ndev; in nitrox_alloc_pktin_queues()
172 cmdq->dbell_csr_addr = NITROX_CSR_ADDR(ndev, offset); in nitrox_alloc_pktin_queues()
175 cmdq->compl_cnt_csr_addr = NITROX_CSR_ADDR(ndev, offset); in nitrox_alloc_pktin_queues()
184 nitrox_free_pktin_queues(ndev); in nitrox_alloc_pktin_queues()
188 static int create_crypto_dma_pool(struct nitrox_device *ndev) in create_crypto_dma_pool() argument
194 ndev->ctx_pool = dma_pool_create("nitrox-context", in create_crypto_dma_pool()
195 DEV(ndev), size, 16, 0); in create_crypto_dma_pool()
196 if (!ndev->ctx_pool) in create_crypto_dma_pool()
202 static void destroy_crypto_dma_pool(struct nitrox_device *ndev) in destroy_crypto_dma_pool() argument
204 if (!ndev->ctx_pool) in destroy_crypto_dma_pool()
207 dma_pool_destroy(ndev->ctx_pool); in destroy_crypto_dma_pool()
208 ndev->ctx_pool = NULL; in destroy_crypto_dma_pool()
215 void *crypto_alloc_context(struct nitrox_device *ndev) in crypto_alloc_context() argument
226 vaddr = dma_pool_zalloc(ndev->ctx_pool, GFP_KERNEL, &dma); in crypto_alloc_context()
234 ctx->pool = ndev->ctx_pool; in crypto_alloc_context()
238 chdr->pool = ndev->ctx_pool; in crypto_alloc_context()
269 int nitrox_common_sw_init(struct nitrox_device *ndev) in nitrox_common_sw_init() argument
274 err = create_crypto_dma_pool(ndev); in nitrox_common_sw_init()
278 err = nitrox_alloc_pktin_queues(ndev); in nitrox_common_sw_init()
280 destroy_crypto_dma_pool(ndev); in nitrox_common_sw_init()
282 err = nitrox_alloc_aqm_queues(ndev); in nitrox_common_sw_init()
284 nitrox_free_pktin_queues(ndev); in nitrox_common_sw_init()
285 destroy_crypto_dma_pool(ndev); in nitrox_common_sw_init()
295 void nitrox_common_sw_cleanup(struct nitrox_device *ndev) in nitrox_common_sw_cleanup() argument
297 nitrox_free_aqm_queues(ndev); in nitrox_common_sw_cleanup()
298 nitrox_free_pktin_queues(ndev); in nitrox_common_sw_cleanup()
299 destroy_crypto_dma_pool(ndev); in nitrox_common_sw_cleanup()