DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: Vipin Varghese <vipin.varghese@intel.com>,
	"keith.wiles@intel.com" <keith.wiles@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"pablo.de.lara.guarch@intel.com" <pablo.de.lara.guarch@intel.com>,
	"declan.doherty@intel.com" <declan.doherty@intel.com>
Cc: "sanjay.padubidri@intel.com" <sanjay.padubidri@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/2] lib/crypto: add callback handlers for crypto
Date: Thu, 27 Jun 2019 14:25:28 +0000	[thread overview]
Message-ID: <VE1PR04MB6639E2A56F16BB1974BEC330E6FD0@VE1PR04MB6639.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20190610063026.89020-1-vipin.varghese@intel.com>

Hi Vipin,

> 
> Add callback handlers for enqueue-dequeue operation on crypto
> device. The pre-enqueue and post-dequeue are selected on invoke
> user registered callback functions.
> 
> Use cases:
>  - allow user to investigate the contents pre-enqueue.
>  - allow user to investigate the contents post-dequeue.
>  - modify pre-enqueue and post-dequeue stage content.
>  - investigate PMD meta data.
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> ---

[..]

> @@ -907,6 +926,19 @@ rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t
> qp_id,
>  	nb_ops = (*dev->dequeue_burst)
>  			(dev->data->queue_pairs[qp_id], ops, nb_ops);
> 
> +#ifdef RTE_CRYPTODEV_ENQDEQ_CALLBACKS
> +	struct rte_cryptodev_enqdeq_callback *cb = NULL;
> +
> +	TAILQ_FOREACH(cb, &(dev->deq_cbs), next) {
> +		if (cb->cb_fn == NULL)
> +			continue;
> +
> +		cb->active = 1;
> +		nb_ops = cb->cb_fn(dev_id, qp_id, ops, nb_ops, cb->cb_arg);
> +		cb->active = 0;
> +	}

Shouldn't this cb->active be set atomically.

Will it be thread safe? There may be multiple threads enqueuing on the same device.
One may be executing while the other finished and set the active to 0, and may unregister
While the some other thread is still executing.

One more thing, it would be better to have a debug prints about how many nb_ops have been
Successfully passed through each of the callback.
And in the callback, it should be assumed that it will return back just after the first failed ops, so that
The application can free the remaining one. This should be documented in the callback API.

> +#endif
> +
>  	return nb_ops;
>  }
> 

  parent reply	other threads:[~2019-06-27 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  5:03 [dpdk-dev] [PATCH v1 " Vipin Varghese
2019-06-10  5:03 ` [dpdk-dev] [PATCH v1 2/2] examples/l2fwd-crypto: add callback handlers Vipin Varghese
2019-06-10  6:30 ` [dpdk-dev] [PATCH v2 1/2] lib/crypto: add callback handlers for crypto Vipin Varghese
2019-06-10  6:30   ` [dpdk-dev] [PATCH v2 2/2] examples/l2fwd-crypto: add callback handlers Vipin Varghese
2019-06-21  7:06     ` Ruifeng Wang (Arm Technology China)
2019-07-04  5:03       ` Varghese, Vipin
2019-06-27 14:25   ` Akhil Goyal [this message]
2019-07-04  5:03     ` [dpdk-dev] [PATCH v2 1/2] lib/crypto: add callback handlers for crypto Varghese, Vipin

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=VE1PR04MB6639E2A56F16BB1974BEC330E6FD0@VE1PR04MB6639.eurprd04.prod.outlook.com \
    --to=akhil.goyal@nxp.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=sanjay.padubidri@intel.com \
    --cc=vipin.varghese@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).