From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Cc: hemant.agrawal@nxp.com, akhil.goyal@nxp.com, dev@dpdk.org,
narender.vangati@intel.com, nikhil.rao@intel.com,
gage.eads@intel.com
Subject: Re: [dpdk-dev] [v2, 3/6] eventdev: add crypto adapter implementation
Date: Sun, 29 Apr 2018 21:52:53 +0530 [thread overview]
Message-ID: <20180429162251.GC11546@jerin> (raw)
In-Reply-To: <1524573807-168522-4-git-send-email-abhinandan.gujjar@intel.com>
-----Original Message-----
> Date: Tue, 24 Apr 2018 18:13:24 +0530
> From: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> To: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com,
> akhil.goyal@nxp.com, dev@dpdk.org
> CC: narender.vangati@intel.com, abhinandan.gujjar@intel.com,
> nikhil.rao@intel.com, gage.eads@intel.com
> Subject: [v2,3/6] eventdev: add crypto adapter implementation
> X-Mailer: git-send-email 1.9.1
>
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> ---
> +
> +/* Per crypto device information */
> +struct crypto_device_info {
> + /* Pointer to cryptodev */
> + struct rte_cryptodev *dev;
> + /* Pointer to queue pair info */
> + struct crypto_queue_pair_info *qpairs;
> + /* Next queue pair to be processed */
> + uint16_t next_queue_pair_id;
> + /* Set to indicate cryptodev->eventdev packet
> + * transfer uses a hardware mechanism
> + */
> + uint8_t internal_event_port;
> + /* Set to indicate processing has been started */
> + uint8_t dev_started;
> + /* If num_qpairs > 0, the start callback will
> + * be invoked if not already invoked
> + */
> + uint16_t num_qpairs;
> +};
Looks like it is used in fastpath, if so add the cache alignment.
> +
> +/* Per queue pair information */
> +struct crypto_queue_pair_info {
> + /* Set to indicate queue pair is enabled */
> + bool qp_enabled;
> + /* Pointer to hold rte_crypto_ops for batching */
> + struct rte_crypto_op **op_buffer;
> + /* No of crypto ops accumulated */
> + uint8_t len;
> +};
> +
> +static struct rte_event_crypto_adapter **event_crypto_adapter;
> +
> +eca_enq_to_cryptodev(struct rte_event_crypto_adapter *adapter,
> + struct rte_event *ev, unsigned int cnt)
> +{
> + struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
> + union rte_event_crypto_metadata *m_data = NULL;
> + struct crypto_queue_pair_info *qp_info = NULL;
> + struct rte_crypto_op *crypto_op;
> + unsigned int i, n = 0;
> + uint16_t qp_id = 0, len = 0, ret = 0;
Please review the explicit '0' assignment.
> + uint8_t cdev_id = 0;
> +
> + stats->event_dequeue_count += cnt;
> +
> + for (i = 0; i < cnt; i++) {
> + crypto_op = ev[i].event_ptr;
> + if (crypto_op == NULL)
> + continue;
> + if (crypto_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
> + m_data = rte_cryptodev_sym_session_get_private_data(
> + crypto_op->sym->session);
> + if (m_data == NULL) {
> + rte_pktmbuf_free(crypto_op->sym->m_src);
> + rte_crypto_op_free(crypto_op);
> + continue;
> + }
> +
> + cdev_id = m_data->request_info.cdev_id;
> + qp_id = m_data->request_info.queue_pair_id;
> + qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
> + if (qp_info == NULL) {
> + rte_pktmbuf_free(crypto_op->sym->m_src);
> + rte_crypto_op_free(crypto_op);
> + continue;
> + }
> + len = qp_info->len;
> + qp_info->op_buffer[len] = crypto_op;
> + len++;
> +
> +int __rte_experimental
> +rte_event_crypto_adapter_queue_pair_add(uint8_t id,
> + uint8_t cdev_id,
> + int32_t queue_pair_id,
> + const struct rte_event_crypto_queue_pair_conf *conf)
> +{
> + struct rte_event_crypto_adapter *adapter;
> + struct rte_eventdev *dev;
> + struct crypto_device_info *dev_info;
> + uint32_t cap;
> + int ret;
> +
> + RTE_EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
> +
> + if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) {
> + RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id);
> + return -EINVAL;
> + }
> +
> + adapter = eca_id_to_adapter(id);
> + if (adapter == NULL)
> + return -EINVAL;
> +
> + dev = &rte_eventdevs[adapter->eventdev_id];
> + ret = rte_event_crypto_adapter_caps_get(adapter->eventdev_id,
> + cdev_id,
> + &cap);
> + if (ret) {
> + if ((cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&
> + adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ) || cap) {
> + rte_spinlock_lock(&adapter->lock);
> + ret = eca_init_service(adapter, id);
> + if (ret == 0)
> + ret = eca_add_queue_pair(adapter, cdev_id,
> + queue_pair_id);
> + rte_spinlock_unlock(&adapter->lock);
> + }
> +
> + if (ret)
> + return ret;
> +
> + rte_service_component_runstate_set(adapter->service_id, 1);
I guess, it will be called in HW case, if so, please move to appropriate
place.
> +
> + return 0;
> +}
> +
> +int __rte_experimental
> +rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
> + int32_t queue_pair_id)
> +{
> + struct rte_event_crypto_adapter *adapter;
> + struct crypto_device_info *dev_info;
> + struct rte_eventdev *dev;
> + int ret = 0;
No need for explicit '0' assignment
next prev parent reply other threads:[~2018-04-29 16:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 12:43 [dpdk-dev] [v2,0/6] eventdev: cover letter - crypto adapter Abhinandan Gujjar
2018-04-24 12:43 ` [dpdk-dev] [v2,1/6] eventdev: introduce event " Abhinandan Gujjar
2018-04-25 12:42 ` Akhil Goyal
2018-04-26 6:07 ` Gujjar, Abhinandan S
2018-04-26 7:16 ` Akhil Goyal
2018-05-03 6:10 ` Gujjar, Abhinandan S
2018-04-29 16:08 ` Jerin Jacob
2018-05-03 6:03 ` Gujjar, Abhinandan S
2018-05-03 9:02 ` Jerin Jacob
2018-04-24 12:43 ` [dpdk-dev] [v2, 2/6] eventdev: add APIs and PMD callbacks for " Abhinandan Gujjar
2018-04-29 16:14 ` Jerin Jacob
2018-04-30 11:15 ` Gujjar, Abhinandan S
2018-04-24 12:43 ` [dpdk-dev] [v2,3/6] eventdev: add crypto adapter implementation Abhinandan Gujjar
2018-04-25 14:14 ` [dpdk-dev] [v2, 3/6] " Akhil Goyal
2018-04-26 6:20 ` Gujjar, Abhinandan S
2018-04-29 16:22 ` Jerin Jacob [this message]
2018-04-30 11:18 ` Gujjar, Abhinandan S
2018-04-24 12:43 ` [dpdk-dev] [v2,4/6] test: add event crypto adapter auto-test Abhinandan Gujjar
2018-04-25 14:40 ` Akhil Goyal
2018-04-26 4:58 ` Gujjar, Abhinandan S
2018-04-24 12:43 ` [dpdk-dev] [v2, 5/6] eventdev: add event crypto adapter to meson build system Abhinandan Gujjar
2018-04-29 16:25 ` Jerin Jacob
2018-04-30 11:21 ` Gujjar, Abhinandan S
2018-04-30 11:27 ` Jerin Jacob
2018-04-24 12:43 ` [dpdk-dev] [v2,6/6] doc: add event crypto adapter documentation Abhinandan Gujjar
2018-04-25 10:31 ` [dpdk-dev] [v2, 6/6] " Kovacevic, Marko
2018-04-25 12:15 ` Gujjar, Abhinandan S
2018-04-29 16:30 ` Jerin Jacob
2018-04-30 11:33 ` Gujjar, Abhinandan S
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180429162251.GC11546@jerin \
--to=jerin.jacob@caviumnetworks.com \
--cc=abhinandan.gujjar@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=gage.eads@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=narender.vangati@intel.com \
--cc=nikhil.rao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).