DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Gujjar, Abhinandan S" <abhinandan.gujjar@intel.com>
To: "Kundapura, Ganapati" <ganapati.kundapura@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	"Naga Harish K, S V" <s.v.naga.harish.k@intel.com>
Cc: "Jayatheerthan, Jay" <jay.jayatheerthan@intel.com>
Subject: RE: [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
Date: Tue, 6 Dec 2022 16:25:45 +0000	[thread overview]
Message-ID: <PH0PR11MB58323D111925FE4CE8F87FA7E81B9@PH0PR11MB5832.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221201064652.1885734-4-ganapati.kundapura@intel.com>



> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 12:17 PM
> To: dev@dpdk.org; jerinj@marvell.com; Naga Harish K, S V
> <s.v.naga.harish.k@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
> 
> Crypto adapter checks CPM backpressure once in enq_run() This leads to
> buffer overflow if some ops failed to flush to cryptodev.
Adapter is agnostic to hardware, replace CPM with "crypto device"

Rephrase the commit message by adding:-
In case of crypto enqueue failures, even though backpressure flag is set to stop
further dequeue from eventdev the current logic does not stop dequeuing events
for max_nb events. This is fixed by checking backpressure just before dequeuing
events from event device.

> 
> Checked CPM backpressure for every iteration in enq_run()
> 
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
> 
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> v2:
> * Updated subject line in commit message
> 
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 72deedd..1d39c5b 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -573,14 +573,15 @@ eca_crypto_adapter_enq_run(struct
> event_crypto_adapter *adapter,
>  	if (adapter->mode == RTE_EVENT_CRYPTO_ADAPTER_OP_NEW)
>  		return 0;
> 
> -	if (unlikely(adapter->stop_enq_to_cryptodev)) {
> -		nb_enqueued += eca_crypto_enq_flush(adapter);
> +	for (nb_enq = 0; nb_enq < max_enq; nb_enq += n) {
> 
> -		if (unlikely(adapter->stop_enq_to_cryptodev))
> -			goto skip_event_dequeue_burst;
> -	}
> +		if (unlikely(adapter->stop_enq_to_cryptodev)) {
> +			nb_enqueued += eca_crypto_enq_flush(adapter);
> +
> +			if (unlikely(adapter->stop_enq_to_cryptodev))
> +				break;
> +		}
> 
> -	for (nb_enq = 0; nb_enq < max_enq; nb_enq += n) {
>  		stats->event_poll_count++;
>  		n = rte_event_dequeue_burst(event_dev_id,
>  					    event_port_id, ev, BATCH_SIZE, 0);
> @@ -591,8 +592,6 @@ eca_crypto_adapter_enq_run(struct
> event_crypto_adapter *adapter,
>  		nb_enqueued += eca_enq_to_cryptodev(adapter, ev, n);
>  	}
> 
> -skip_event_dequeue_burst:
> -
>  	if ((++adapter->transmit_loop_count &
>  		(CRYPTO_ENQ_FLUSH_THRESHOLD - 1)) == 0) {
>  		nb_enqueued += eca_crypto_enq_flush(adapter);
> --
> 2.6.4


  parent reply	other threads:[~2022-12-06 16:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 17:10 [PATCH v1 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
2022-11-30 17:10 ` [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count stats Ganapati Kundapura
2022-12-01  6:07   ` Naga Harish K, S V
2022-12-01  6:56     ` Kundapura, Ganapati
2022-11-30 17:10 ` [PATCH v1 3/5] eventdev/crypto: wrong offset used while flushing events Ganapati Kundapura
2022-11-30 17:10 ` [PATCH v1 4/5] eventdev/crypto: overflow in circular buffer Ganapati Kundapura
2022-11-30 17:10 ` [PATCH v1 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
2022-12-01  6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
2022-12-01  6:46   ` [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats Ganapati Kundapura
2022-12-05 11:34     ` [EXT] " Volodymyr Fialko
2022-12-07  5:40     ` Gujjar, Abhinandan S
2022-12-01  6:46   ` [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events Ganapati Kundapura
2022-12-05 11:35     ` [EXT] " Volodymyr Fialko
2022-12-06 16:17     ` Gujjar, Abhinandan S
2022-12-01  6:46   ` [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer Ganapati Kundapura
2022-12-05 11:37     ` [EXT] " Volodymyr Fialko
2022-12-06 16:25     ` Gujjar, Abhinandan S [this message]
2022-12-07  6:53       ` Kundapura, Ganapati
2022-12-01  6:46   ` [PATCH v2 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
2022-12-05 11:37     ` [EXT] " Volodymyr Fialko
2022-12-06 16:37     ` Gujjar, Abhinandan S
2022-12-01 13:20   ` [EXT] [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Volodymyr Fialko
2022-12-06 15:44   ` Gujjar, Abhinandan S
2022-12-07  6:53     ` Kundapura, Ganapati
2022-12-07  6:49   ` [PATCH v3 " Ganapati Kundapura
2022-12-07  6:49     ` [PATCH v3 2/5] eventdev/crypto: fix wrong crypto enqueue count stats Ganapati Kundapura
2022-12-07  6:55       ` Gujjar, Abhinandan S
2022-12-07  6:49     ` [PATCH v3 3/5] eventdev/crypto: fix wrong offset used while flushing events Ganapati Kundapura
2022-12-07  6:55       ` Gujjar, Abhinandan S
2022-12-07  6:49     ` [PATCH v3 4/5] eventdev/crypto: fix overflow in circular buffer Ganapati Kundapura
2022-12-07  7:04       ` Gujjar, Abhinandan S
2022-12-07  6:49     ` [PATCH v3 5/5] eventdev/crypto: fix failed events Ganapati Kundapura
2022-12-07  6:56       ` Gujjar, Abhinandan S
2023-01-12 12:59         ` Jerin Jacob
2022-12-07  6:54     ` [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel cap 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=PH0PR11MB58323D111925FE4CE8F87FA7E81B9@PH0PR11MB5832.namprd11.prod.outlook.com \
    --to=abhinandan.gujjar@intel.com \
    --cc=dev@dpdk.org \
    --cc=ganapati.kundapura@intel.com \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinj@marvell.com \
    --cc=s.v.naga.harish.k@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).