DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: Akhil Goyal <akhil.goyal@nxp.com>, <dev@dpdk.org>
Cc: <pablo.de.lara.guarch@intel.com>, <shreyansh.jain@nxp.com>,
	Nipun Gupta <nipun.gupta@nxp.com>
Subject: Re: [dpdk-dev] [PATCH 5/5] crypto/dpaa_sec: rewrite Rx/Tx path
Date: Tue, 19 Dec 2017 18:15:55 +0530	[thread overview]
Message-ID: <c1259a3f-b0b9-d9b6-63cc-606c4f247e06@nxp.com> (raw)
In-Reply-To: <20171213135659.32648-6-akhil.goyal@nxp.com>

Hi Akhil,

On 12/13/2017 7:26 PM, Akhil Goyal wrote:
> Rx and Tx patch are rewritten with improved internal APIs
> to improve performance.
>
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/crypto/dpaa_sec/dpaa_sec.c | 260 ++++++++++++++++++++++---------------
>  drivers/crypto/dpaa_sec/dpaa_sec.h |   2 +-
>  2 files changed, 153 insertions(+), 109 deletions(-)
>
> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
> index ea744e6..b650d5c 100644
> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c
> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
> @@ -563,46 +563,67 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)
>  	return 0;
>  }
>
..<snip>

> -
> +#define DPAA_MAX_DEQUEUE_NUM_FRAMES 32

It will be better, if you define it in dpaa_sec.h

>  /* qp is lockless, should be accessed by only one thread */
>  static int
>  dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops)
>  {
>  	struct qman_fq *fq;
> +	unsigned int pkts = 0;
> +	int ret;
> +	struct qm_dqrr_entry *dq;
>
>  	fq = &qp->outq;
> -	dpaa_sec_op_nb = 0;
> -	dpaa_sec_ops = ops;
> +	ret = qman_set_vdq(fq, (nb_ops > DPAA_MAX_DEQUEUE_NUM_FRAMES) ?
> +				DPAA_MAX_DEQUEUE_NUM_FRAMES : nb_ops);

Any particular reason for keeping the limit as 32 for SEC.
The dpaa eth PMD is using it as 63 i.e 6 bits

Also, you have a option to use '0'. NUM_FRAMES is zero—indicates that 
the volatile command is not terminate until the specified FQ becomes
empty.

>
.. <snip>
> -
>  static uint16_t
>  dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
>  		       uint16_t nb_ops)
>  {
>  	/* Function to transmit the frames to given device and queuepair */
>  	uint32_t loop;
> -	int32_t ret;
>  	struct dpaa_sec_qp *dpaa_qp = (struct dpaa_sec_qp *)qp;

you can avoid this explicit typecasting

>  	uint16_t num_tx = 0;
> +	struct qm_fd fds[DPAA_SEC_BURST], *fd;
> +	uint32_t frames_to_send;
> +	struct rte_crypto_op *op;
> +	struct dpaa_sec_job *cf;
> +	dpaa_sec_session *ses;
> +	struct dpaa_sec_op_ctx *ctx;
> +	uint32_t auth_only_len;
> +	struct qman_fq *inq[DPAA_SEC_BURST];
> +
> +	while (nb_ops) {
> +		frames_to_send = (nb_ops > DPAA_SEC_BURST) ?
> +				DPAA_SEC_BURST : nb_ops;
> +		for (loop = 0; loop < frames_to_send; loop++) {
> +			op = *(ops++);
> +			switch (op->sess_type) {
> +			case RTE_CRYPTO_OP_WITH_SESSION:
> +				ses = (dpaa_sec_session *)

here and other places as well

> +					get_session_private_data(
> +							op->sym->session,
> +							cryptodev_driver_id);
> +				break;
> +			case RTE_CRYPTO_OP_SECURITY_SESSION:
> +				ses = (dpaa_sec_session *)
> +					get_sec_session_private_data(
> +							op->sym->sec_session);
> +				break;
> +			default:
> +				PMD_TX_LOG(ERR,
> +					"sessionless crypto op not supported");
> +				frames_to_send = loop;
> +				nb_ops = loop;
> +				goto send_pkts;
> +			}
> +			if (unlikely(!ses->qp || ses->qp != qp)) {
> +				PMD_INIT_LOG(DEBUG, "sess->qp - %p qp %p",
> +						ses->qp, qp);
> +				if (dpaa_sec_attach_sess_q(qp, ses)) {
> +					frames_to_send = loop;
> +					nb_ops = loop;
> +					goto send_pkts;
> +				}
> +			}
>
> -	if (unlikely(nb_ops == 0))
> -		return 0;
> +			/*
> +			 * Segmented buffer is not supported.
> +			 */
> +			if (!rte_pktmbuf_is_contiguous(op->sym->m_src)) {
> +				op->status = RTE_CRYPTO_OP_STATUS_ERROR;
> +				frames_to_send = loop;
> +				nb_ops = loop;
> +				goto send_pkts;
> +			}
> +			auth_only_len = op->sym->auth.data.length -
> +						op->sym->cipher.data.length;
> +
> +			if (is_auth_only(ses)) {
> +				cf = build_auth_only(op, ses);
> +			} else if (is_cipher_only(ses)) {
> +				cf = build_cipher_only(op, ses);
> +			} else if (is_aead(ses)) {
> +				cf = build_cipher_auth_gcm(op, ses);
> +				auth_only_len = ses->auth_only_len;
> +			} else if (is_auth_cipher(ses)) {
> +				cf = build_cipher_auth(op, ses);
> +			} else if (is_proto_ipsec(ses)) {
> +				cf = build_proto(op, ses);
> +			} else {
> +				PMD_TX_LOG(ERR, "not supported sec op");
> +				frames_to_send = loop;
> +				nb_ops = loop;
> +				goto send_pkts;
> +			}

  reply	other threads:[~2017-12-19 12:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 13:56 [dpdk-dev] [PATCH 0/5] crypto/dpaa_sec: performance optimizations Akhil Goyal
2017-12-13 13:56 ` [dpdk-dev] [PATCH 1/5] crypto/dpaa_sec: optimize virt to phy conversion Akhil Goyal
2017-12-13 13:56 ` [dpdk-dev] [PATCH 2/5] crypto/dpaa_sec: support multiple sessions per qp Akhil Goyal
2017-12-13 13:56 ` [dpdk-dev] [PATCH 3/5] crypto/dpaa_sec: support ipsec protocol offload Akhil Goyal
2017-12-19 12:59   ` Hemant Agrawal
2017-12-13 13:56 ` [dpdk-dev] [PATCH 4/5] bus/dpaa: support for enqueue frames of multiple queues Akhil Goyal
2017-12-19 11:32   ` Hemant Agrawal
2017-12-13 13:56 ` [dpdk-dev] [PATCH 5/5] crypto/dpaa_sec: rewrite Rx/Tx path Akhil Goyal
2017-12-19 12:45   ` Hemant Agrawal [this message]
2018-01-08 11:13     ` De Lara Guarch, Pablo
2018-01-08 11:16       ` Akhil Goyal
2018-01-08 11:24         ` De Lara Guarch, Pablo
2018-01-11 11:44   ` [dpdk-dev] [PATCH v2] " Akhil Goyal
2018-01-17 16:54     ` De Lara Guarch, Pablo
2018-01-11 11:33 ` [dpdk-dev] [PATCH v2 0/3] crypto/dpaa_sec: performance optimizations Akhil Goyal
2018-01-11 11:33   ` [dpdk-dev] [PATCH v2 1/3] crypto/dpaa_sec: optimize virt to phy conversion Akhil Goyal
2018-01-11 11:33   ` [dpdk-dev] [PATCH v2 2/3] crypto/dpaa_sec: support multiple sessions per qp Akhil Goyal
2018-01-11 11:33   ` [dpdk-dev] [PATCH v2 3/3] crypto/dpaa_sec: support ipsec protocol offload Akhil Goyal
2018-01-11 14:13     ` De Lara Guarch, Pablo
2018-01-15  6:35   ` [dpdk-dev] [PATCH v3 0/3] crypto/dpaa_sec: performance optimizations Akhil Goyal
2018-01-15  6:35     ` [dpdk-dev] [PATCH v3 1/3] crypto/dpaa_sec: optimize virt to phy conversion Akhil Goyal
2018-01-15  6:35     ` [dpdk-dev] [PATCH v3 2/3] crypto/dpaa_sec: support multiple sessions per qp Akhil Goyal
2018-01-15  6:35     ` [dpdk-dev] [PATCH v3 3/3] crypto/dpaa_sec: support ipsec protocol offload Akhil Goyal
2018-01-15 14:46     ` [dpdk-dev] [PATCH v3 0/3] crypto/dpaa_sec: performance optimizations De Lara Guarch, Pablo

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=c1259a3f-b0b9-d9b6-63cc-606c4f247e06@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=nipun.gupta@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=shreyansh.jain@nxp.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).