X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=inline;f=drivers%2Fcrypto%2Focteontx%2Fotx_cryptodev_hw_access.c;h=20b288334a25ed60f08d91b4b8a297b097f8aaab;hb=144d222305407504c16433d5f997b2937c93af7e;hp=ce546c2ffe2f25cb2db3d4880e975c354f07e81f;hpb=fadc1ea15c61136fa11a0416b08b46e9e6d59274;p=dpdk.git diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c index ce546c2ffe..20b288334a 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -409,7 +409,7 @@ otx_cpt_deinit_device(void *dev) static int otx_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev, struct cpt_instance *instance, uint8_t qp_id, - int nb_elements) + unsigned int nb_elements) { char mempool_name[RTE_MEMPOOL_NAMESIZE]; struct cpt_qp_meta_info *meta_info; @@ -417,6 +417,7 @@ otx_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev, int max_mlen = 0; int sg_mlen = 0; int lb_mlen = 0; + int mb_pool_sz; int ret; /* @@ -453,7 +454,9 @@ otx_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev, snprintf(mempool_name, RTE_MEMPOOL_NAMESIZE, "otx_cpt_mb_%u:%u", dev->data->dev_id, qp_id); - pool = rte_mempool_create_empty(mempool_name, nb_elements, max_mlen, + mb_pool_sz = RTE_MAX(nb_elements, (METABUF_POOL_CACHE_SIZE * rte_lcore_count())); + + pool = rte_mempool_create_empty(mempool_name, mb_pool_sz, max_mlen, METABUF_POOL_CACHE_SIZE, 0, rte_socket_id(), 0); @@ -524,10 +527,10 @@ otx_cpt_get_resource(const struct rte_cryptodev *dev, uint8_t group, memset(&cptvf->pqueue, 0, sizeof(cptvf->pqueue)); /* Chunks are of fixed size buffers */ + + qlen = DEFAULT_CMD_QLEN; chunks = DEFAULT_CMD_QCHUNKS; chunk_len = DEFAULT_CMD_QCHUNK_SIZE; - - qlen = chunks * chunk_len; /* Chunk size includes 8 bytes of next chunk ptr */ chunk_size = chunk_len * CPT_INST_SIZE + CPT_NEXT_CHUNK_PTR_SIZE; @@ -535,7 +538,7 @@ otx_cpt_get_resource(const struct rte_cryptodev *dev, uint8_t group, len = chunks * RTE_ALIGN(sizeof(struct command_chunk), 8); /* For pending queue */ - len += qlen * RTE_ALIGN(sizeof(struct rid), 8); + len += qlen * RTE_ALIGN(sizeof(cptvf->pqueue.rid_queue[0]), 8); /* So that instruction queues start as pg size aligned */ len = RTE_ALIGN(len, pg_sz); @@ -556,7 +559,7 @@ otx_cpt_get_resource(const struct rte_cryptodev *dev, uint8_t group, } mem = rz->addr; - dma_addr = rz->phys_addr; + dma_addr = rz->iova; alloc_len = len; memset(mem, 0, len); @@ -570,14 +573,11 @@ otx_cpt_get_resource(const struct rte_cryptodev *dev, uint8_t group, } /* Pending queue setup */ - cptvf->pqueue.rid_queue = (struct rid *)mem; - cptvf->pqueue.enq_tail = 0; - cptvf->pqueue.deq_head = 0; - cptvf->pqueue.pending_count = 0; - - mem += qlen * RTE_ALIGN(sizeof(struct rid), 8); - len -= qlen * RTE_ALIGN(sizeof(struct rid), 8); - dma_addr += qlen * RTE_ALIGN(sizeof(struct rid), 8); + cptvf->pqueue.rid_queue = (void **)mem; + + mem += qlen * RTE_ALIGN(sizeof(cptvf->pqueue.rid_queue[0]), 8); + len -= qlen * RTE_ALIGN(sizeof(cptvf->pqueue.rid_queue[0]), 8); + dma_addr += qlen * RTE_ALIGN(sizeof(cptvf->pqueue.rid_queue[0]), 8); /* Alignment wastage */ used_len = alloc_len - len;