Message ID | 20180913060846.29930-6-g.singh@nxp.com |
---|---|
State | Superseded |
Headers | show |
Series | [01/10] doc: add caam jr cryptodev details | expand |
Hi Gagan, On 9/13/2018 11:38 AM, Gagandeep Singh wrote: > From: Hemant Agrawal <hemant.agrawal@nxp.com> > > Signed-off-by: Gagandeep Singh <g.singh@nxp.com> > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> > --- > drivers/crypto/caam_jr/caam_jr.c | 64 ++++++++++++++++++++++++++++++++ > 1 file changed, 64 insertions(+) > > diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c > index 43fe5233b..f05e966b0 100644 > --- a/drivers/crypto/caam_jr/caam_jr.c > +++ b/drivers/crypto/caam_jr/caam_jr.c > @@ -104,6 +104,67 @@ static void hw_flush_job_ring(struct sec_job_ring_t *job_ring, > } > } > > +/* Release queue pair */ > +static int > +caam_jr_queue_pair_release(struct rte_cryptodev *dev, > + uint16_t qp_id) > +{ > + struct sec_job_ring_t *internals; > + struct caam_jr_qp *qp = NULL; > + > + PMD_INIT_FUNC_TRACE(); > + > + CAAM_JR_DEBUG("dev =%p, queue =%d", dev, qp_id); > + > + internals = dev->data->dev_private; > + if (qp_id >= internals->max_nb_queue_pairs) { > + CAAM_JR_ERR("Max supported qpid %d", > + internals->max_nb_queue_pairs); > + return -EINVAL; > + } > + > + qp = &internals->qps[qp_id]; > + qp->ring = NULL; > + dev->data->queue_pairs[qp_id] = NULL; > + > + return 0; > +} > + > +/* Setup a queue pair */ > +static int > +caam_jr_queue_pair_setup( > + struct rte_cryptodev *dev, uint16_t qp_id, > + __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, > + __rte_unused int socket_id, > + __rte_unused struct rte_mempool *session_pool) > +{ > + struct sec_job_ring_t *internals; > + struct caam_jr_qp *qp = NULL; > + PMD_INIT_FUNC_TRACE(); missing here and please check other ops as well > + CAAM_JR_DEBUG("dev =%p, queue =%d, conf =%p", dev, qp_id, qp_conf); > + > + internals = dev->data->dev_private; > + if (qp_id >= internals->max_nb_queue_pairs) { > + CAAM_JR_ERR("Max supported qpid %d", > + internals->max_nb_queue_pairs); > + return -EINVAL; > + } > + > + qp = &internals->qps[qp_id]; > + qp->ring = internals; > + dev->data->queue_pairs[qp_id] = qp; > + > + return 0; > +} > + > +/* Return the number of allocated queue pairs */ > +static uint32_t > +caam_jr_queue_pair_count(struct rte_cryptodev *dev) > +{ > + PMD_INIT_FUNC_TRACE(); > + > + return dev->data->nb_queue_pairs; > +} > > static int > caam_jr_dev_configure(struct rte_cryptodev *dev, > @@ -186,6 +247,9 @@ static struct rte_cryptodev_ops caam_jr_ops = { > .dev_stop = caam_jr_dev_stop, > .dev_close = caam_jr_dev_close, > .dev_infos_get = caam_jr_dev_infos_get, > + .queue_pair_setup = caam_jr_queue_pair_setup, > + .queue_pair_release = caam_jr_queue_pair_release, > + .queue_pair_count = caam_jr_queue_pair_count, > }; > >
Hi, > -----Original Message----- > From: Akhil Goyal > Sent: Tuesday, September 18, 2018 7:35 PM > To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org > Cc: Hemant Agrawal <hemant.agrawal@nxp.com> > Subject: Re: [dpdk-dev] [PATCH 05/10] crypto/caam_jr: add queue config > functions > > Hi Gagan, > > On 9/13/2018 11:38 AM, Gagandeep Singh wrote: > > From: Hemant Agrawal <hemant.agrawal@nxp.com> > > > > Signed-off-by: Gagandeep Singh <g.singh@nxp.com> > > Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> > > --- > > drivers/crypto/caam_jr/caam_jr.c | 64 > ++++++++++++++++++++++++++++++++ > > 1 file changed, 64 insertions(+) > > > > diff --git a/drivers/crypto/caam_jr/caam_jr.c > > b/drivers/crypto/caam_jr/caam_jr.c > > index 43fe5233b..f05e966b0 100644 > > --- a/drivers/crypto/caam_jr/caam_jr.c > > +++ b/drivers/crypto/caam_jr/caam_jr.c > > @@ -104,6 +104,67 @@ static void hw_flush_job_ring(struct sec_job_ring_t > *job_ring, > > } > > } > > > > +/* Release queue pair */ > > +static int > > +caam_jr_queue_pair_release(struct rte_cryptodev *dev, > > + uint16_t qp_id) > > +{ > > + struct sec_job_ring_t *internals; > > + struct caam_jr_qp *qp = NULL; > > + > > + PMD_INIT_FUNC_TRACE(); > > + > > + CAAM_JR_DEBUG("dev =%p, queue =%d", dev, qp_id); > > + > > + internals = dev->data->dev_private; > > + if (qp_id >= internals->max_nb_queue_pairs) { > > + CAAM_JR_ERR("Max supported qpid %d", > > + internals->max_nb_queue_pairs); > > + return -EINVAL; > > + } > > + > > + qp = &internals->qps[qp_id]; > > + qp->ring = NULL; > > + dev->data->queue_pairs[qp_id] = NULL; > > + > > + return 0; > > +} > > + > > +/* Setup a queue pair */ > > +static int > > +caam_jr_queue_pair_setup( > > + struct rte_cryptodev *dev, uint16_t qp_id, > > + __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, > > + __rte_unused int socket_id, > > + __rte_unused struct rte_mempool *session_pool) { > > + struct sec_job_ring_t *internals; > > + struct caam_jr_qp *qp = NULL; > > + > > PMD_INIT_FUNC_TRACE(); missing here and please check other ops as well ok > > > + CAAM_JR_DEBUG("dev =%p, queue =%d, conf =%p", dev, qp_id, > qp_conf); > > + > > + internals = dev->data->dev_private; > > + if (qp_id >= internals->max_nb_queue_pairs) { > > + CAAM_JR_ERR("Max supported qpid %d", > > + internals->max_nb_queue_pairs); > > + return -EINVAL; > > + } > > + > > + qp = &internals->qps[qp_id]; > > + qp->ring = internals; > > + dev->data->queue_pairs[qp_id] = qp; > > + > > + return 0; > > +} > > + > > +/* Return the number of allocated queue pairs */ static uint32_t > > +caam_jr_queue_pair_count(struct rte_cryptodev *dev) { > > + PMD_INIT_FUNC_TRACE(); > > + > > + return dev->data->nb_queue_pairs; > > +} > > > > static int > > caam_jr_dev_configure(struct rte_cryptodev *dev, @@ -186,6 +247,9 @@ > > static struct rte_cryptodev_ops caam_jr_ops = { > > .dev_stop = caam_jr_dev_stop, > > .dev_close = caam_jr_dev_close, > > .dev_infos_get = caam_jr_dev_infos_get, > > + .queue_pair_setup = caam_jr_queue_pair_setup, > > + .queue_pair_release = caam_jr_queue_pair_release, > > + .queue_pair_count = caam_jr_queue_pair_count, > > }; > > > >
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 43fe5233b..f05e966b0 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -104,6 +104,67 @@ static void hw_flush_job_ring(struct sec_job_ring_t *job_ring, } } +/* Release queue pair */ +static int +caam_jr_queue_pair_release(struct rte_cryptodev *dev, + uint16_t qp_id) +{ + struct sec_job_ring_t *internals; + struct caam_jr_qp *qp = NULL; + + PMD_INIT_FUNC_TRACE(); + + CAAM_JR_DEBUG("dev =%p, queue =%d", dev, qp_id); + + internals = dev->data->dev_private; + if (qp_id >= internals->max_nb_queue_pairs) { + CAAM_JR_ERR("Max supported qpid %d", + internals->max_nb_queue_pairs); + return -EINVAL; + } + + qp = &internals->qps[qp_id]; + qp->ring = NULL; + dev->data->queue_pairs[qp_id] = NULL; + + return 0; +} + +/* Setup a queue pair */ +static int +caam_jr_queue_pair_setup( + struct rte_cryptodev *dev, uint16_t qp_id, + __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, + __rte_unused int socket_id, + __rte_unused struct rte_mempool *session_pool) +{ + struct sec_job_ring_t *internals; + struct caam_jr_qp *qp = NULL; + + CAAM_JR_DEBUG("dev =%p, queue =%d, conf =%p", dev, qp_id, qp_conf); + + internals = dev->data->dev_private; + if (qp_id >= internals->max_nb_queue_pairs) { + CAAM_JR_ERR("Max supported qpid %d", + internals->max_nb_queue_pairs); + return -EINVAL; + } + + qp = &internals->qps[qp_id]; + qp->ring = internals; + dev->data->queue_pairs[qp_id] = qp; + + return 0; +} + +/* Return the number of allocated queue pairs */ +static uint32_t +caam_jr_queue_pair_count(struct rte_cryptodev *dev) +{ + PMD_INIT_FUNC_TRACE(); + + return dev->data->nb_queue_pairs; +} static int caam_jr_dev_configure(struct rte_cryptodev *dev, @@ -186,6 +247,9 @@ static struct rte_cryptodev_ops caam_jr_ops = { .dev_stop = caam_jr_dev_stop, .dev_close = caam_jr_dev_close, .dev_infos_get = caam_jr_dev_infos_get, + .queue_pair_setup = caam_jr_queue_pair_setup, + .queue_pair_release = caam_jr_queue_pair_release, + .queue_pair_count = caam_jr_queue_pair_count, };