git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crypto/cnxk: support lookaside IPsec HMAC-SHA384/512
[dpdk.git]
/
drivers
/
crypto
/
cnxk
/
cnxk_cryptodev_ops.c
diff --git
a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index
41d8fe4
..
21ee09f
100644
(file)
--- a/
drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/
drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@
-100,8
+100,13
@@
cnxk_cpt_dev_start(struct rte_cryptodev *dev)
uint16_t nb_lf = roc_cpt->nb_lf;
uint16_t qp_id;
uint16_t nb_lf = roc_cpt->nb_lf;
uint16_t qp_id;
- for (qp_id = 0; qp_id < nb_lf; qp_id++)
+ for (qp_id = 0; qp_id < nb_lf; qp_id++) {
+ /* Application may not setup all queue pair */
+ if (roc_cpt->lf[qp_id] == NULL)
+ continue;
+
roc_cpt_iq_enable(roc_cpt->lf[qp_id]);
roc_cpt_iq_enable(roc_cpt->lf[qp_id]);
+ }
return 0;
}
return 0;
}
@@
-114,8
+119,12
@@
cnxk_cpt_dev_stop(struct rte_cryptodev *dev)
uint16_t nb_lf = roc_cpt->nb_lf;
uint16_t qp_id;
uint16_t nb_lf = roc_cpt->nb_lf;
uint16_t qp_id;
- for (qp_id = 0; qp_id < nb_lf; qp_id++)
+ for (qp_id = 0; qp_id < nb_lf; qp_id++) {
+ if (roc_cpt->lf[qp_id] == NULL)
+ continue;
+
roc_cpt_iq_disable(roc_cpt->lf[qp_id]);
roc_cpt_iq_disable(roc_cpt->lf[qp_id]);
+ }
}
int
}
int
@@
-150,7
+159,10
@@
cnxk_cpt_dev_info_get(struct rte_cryptodev *dev,
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
struct cnxk_cpt_vf *vf = dev->data->dev_private;
struct roc_cpt *roc_cpt = &vf->cpt;
- info->max_nb_queue_pairs = roc_cpt->nb_lf_avail;
+ info->max_nb_queue_pairs =
+ RTE_MIN(roc_cpt->nb_lf_avail, vf->max_qps_limit);
+ plt_cpt_dbg("max_nb_queue_pairs %u", info->max_nb_queue_pairs);
+
info->feature_flags = cnxk_cpt_default_ff_get();
info->capabilities = cnxk_crypto_capabilities_get(vf);
info->sym.max_nb_sessions = 0;
info->feature_flags = cnxk_cpt_default_ff_get();
info->capabilities = cnxk_crypto_capabilities_get(vf);
info->sym.max_nb_sessions = 0;
@@
-171,9
+183,10
@@
cnxk_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev,
{
char mempool_name[RTE_MEMPOOL_NAMESIZE];
struct cpt_qp_meta_info *meta_info;
{
char mempool_name[RTE_MEMPOOL_NAMESIZE];
struct cpt_qp_meta_info *meta_info;
+ int lcore_cnt = rte_lcore_count();
struct rte_mempool *pool;
struct rte_mempool *pool;
+ int mb_pool_sz, mlen = 8;
uint32_t cache_sz;
uint32_t cache_sz;
- int mlen = 8;
if (dev->feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) {
/* Get meta len */
if (dev->feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) {
/* Get meta len */
@@
-186,14
+199,22
@@
cnxk_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev,
mlen = RTE_MAX(mlen, cnxk_cpt_asym_get_mlen());
}
mlen = RTE_MAX(mlen, cnxk_cpt_asym_get_mlen());
}
+ mb_pool_sz = nb_elements;
cache_sz = RTE_MIN(RTE_MEMPOOL_CACHE_MAX_SIZE, nb_elements / 1.5);
cache_sz = RTE_MIN(RTE_MEMPOOL_CACHE_MAX_SIZE, nb_elements / 1.5);
+ /* For poll mode, core that enqueues and core that dequeues can be
+ * different. For event mode, all cores are allowed to use same crypto
+ * queue pair.
+ */
+
+ mb_pool_sz += (RTE_MAX(2, lcore_cnt) * cache_sz);
+
/* Allocate mempool */
snprintf(mempool_name, RTE_MEMPOOL_NAMESIZE, "cnxk_cpt_mb_%u:%u",
dev->data->dev_id, qp_id);
/* Allocate mempool */
snprintf(mempool_name, RTE_MEMPOOL_NAMESIZE, "cnxk_cpt_mb_%u:%u",
dev->data->dev_id, qp_id);
- pool = rte_mempool_create(mempool_name,
nb_elements
, mlen, cache_sz, 0,
+ pool = rte_mempool_create(mempool_name,
mb_pool_sz
, mlen, cache_sz, 0,
NULL, NULL, NULL, NULL, rte_socket_id(), 0);
if (pool == NULL) {
NULL, NULL, NULL, NULL, rte_socket_id(), 0);
if (pool == NULL) {
@@
-266,9
+287,8
@@
cnxk_cpt_qp_create(const struct rte_cryptodev *dev, uint16_t qp_id,
/* Initialize pending queue */
qp->pend_q.req_queue = pq_mem->addr;
/* Initialize pending queue */
qp->pend_q.req_queue = pq_mem->addr;
- qp->pend_q.enq_tail = 0;
- qp->pend_q.deq_head = 0;
- qp->pend_q.pending_count = 0;
+ qp->pend_q.head = 0;
+ qp->pend_q.tail = 0;
return qp;
return qp;
@@
-369,6
+389,8
@@
cnxk_cpt_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
goto exit;
}
goto exit;
}
+ qp->pend_q.pq_mask = qp->lf.nb_desc - 1;
+
roc_cpt->lf[qp_id] = &qp->lf;
ret = roc_cpt_lmtline_init(roc_cpt, &qp->lmtline, qp_id);
roc_cpt->lf[qp_id] = &qp->lf;
ret = roc_cpt_lmtline_init(roc_cpt, &qp->lmtline, qp_id);