Lines Matching defs:ndev

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