* [PATCH v1 1/5] eventdev/event_crypto: process event port's impl rel cap
@ 2022-11-30 17:10 Ganapati Kundapura
2022-11-30 17:10 ` [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count stats Ganapati Kundapura
` (4 more replies)
0 siblings, 5 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-11-30 17:10 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
In the current implementation adapter queries event device's capability for
implicit release support.
This information is used to decide whether events are enqueued back as
NEW or FWD events.
This patch updates the adapter to query the port caps for implicit release
to decide on events enqueuing back as NEW/FWD events.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 3c585d7..1c0a22b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -53,7 +53,7 @@ struct event_crypto_adapter {
uint8_t eventdev_id;
/* Event port identifier */
uint8_t event_port_id;
- /* Store event device's implicit release capability */
+ /* Store event port's implicit release capability */
uint8_t implicit_release_disabled;
/* Flag to indicate backpressure at cryptodev
* Stop further dequeuing events from eventdev
@@ -320,7 +320,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
{
struct event_crypto_adapter *adapter;
char mem_name[CRYPTO_ADAPTER_NAME_LEN];
- struct rte_event_dev_info dev_info;
int socket_id;
uint8_t i;
int ret;
@@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
return -ENOMEM;
}
- ret = rte_event_dev_info_get(dev_id, &dev_info);
- if (ret < 0) {
- RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d: %s!",
- dev_id, dev_info.driver_name);
- eca_circular_buffer_free(&adapter->ebuf);
- rte_free(adapter);
- return ret;
- }
-
- adapter->implicit_release_disabled = (dev_info.event_dev_cap &
- RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
adapter->eventdev_id = dev_id;
adapter->socket_id = socket_id;
adapter->conf_cb = conf_cb;
@@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
struct rte_event_crypto_adapter_conf adapter_conf;
struct rte_service_spec service;
int ret;
+ uint32_t impl_rel;
if (adapter->service_inited)
return 0;
@@ -866,6 +855,17 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
adapter->max_nb = adapter_conf.max_nb;
adapter->event_port_id = adapter_conf.event_port_id;
+
+ if (rte_event_port_attr_get(adapter->eventdev_id,
+ adapter->event_port_id,
+ RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
+ &impl_rel)) {
+ RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %" PRId32,
+ adapter->eventdev_id);
+ return -EINVAL;
+ }
+
+ adapter->implicit_release_disabled = (uint8_t)impl_rel;
adapter->service_inited = 1;
return ret;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count stats
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 ` Ganapati Kundapura
2022-12-01 6:07 ` Naga Harish K, S V
2022-11-30 17:10 ` [PATCH v1 3/5] eventdev/crypto: wrong offset used while flushing events Ganapati Kundapura
` (3 subsequent siblings)
4 siblings, 1 reply; 35+ messages in thread
From: Ganapati Kundapura @ 2022-11-30 17:10 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
crypto_enq_count is updated on failure to enqueue ops to cryptodev.
Updated crypto_enq_count on successful enqueue of ops to cryptodev.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 1c0a22b..ef3dbe9 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
cdev_id,
qp_id,
&nb_enqueued);
+ stats->crypto_enq_count += nb_enqueued;
+ n += nb_enqueued;
+
/**
* If some crypto ops failed to flush to cdev and
* space for another batch is not available, stop
@@ -495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
&qp_info->cbuf)))
adapter->stop_enq_to_cryptodev = true;
}
-
- stats->crypto_enq_count += nb_enqueued;
- n += nb_enqueued;
}
return n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v1 3/5] eventdev/crypto: wrong offset used while flushing events
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-11-30 17:10 ` Ganapati Kundapura
2022-11-30 17:10 ` [PATCH v1 4/5] eventdev/crypto: overflow in circular buffer Ganapati Kundapura
` (2 subsequent siblings)
4 siblings, 0 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-11-30 17:10 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
Events enqueued to eventdev from the beginning of the circular buffer.
This leads to invalid or already freed events getting enqueued to
circular buffer.
Fixed by enqueuing the events from the head pointer of circular buffer.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index ef3dbe9..72deedd 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -669,7 +669,7 @@ eca_circular_buffer_flush_to_evdev(struct event_crypto_adapter *adapter,
else
return 0; /* buffer empty */
- nb_ops_flushed = eca_ops_enqueue_burst(adapter, ops, n);
+ nb_ops_flushed = eca_ops_enqueue_burst(adapter, &ops[*headp], n);
bufp->count -= nb_ops_flushed;
if (!bufp->count) {
*headp = 0;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v1 4/5] eventdev/crypto: overflow in circular buffer
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-11-30 17:10 ` [PATCH v1 3/5] eventdev/crypto: wrong offset used while flushing events Ganapati Kundapura
@ 2022-11-30 17:10 ` 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
4 siblings, 0 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-11-30 17:10 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
Crypto adapter checks CPM backpressure once in enq_run()
This leads to buffer overflow if some ops failed to flush
to cryptodev.
Checked CPM backpressure for every iteration in enq_run()
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
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
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v1 5/5] eventdev/crypto: add all failed events to circular buffer
2022-11-30 17:10 [PATCH v1 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (2 preceding siblings ...)
2022-11-30 17:10 ` [PATCH v1 4/5] eventdev/crypto: overflow in circular buffer Ganapati Kundapura
@ 2022-11-30 17:10 ` Ganapati Kundapura
2022-12-01 6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
4 siblings, 0 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-11-30 17:10 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
When many ops are failed to enqueue to eventdev, crypto
adapter stores one event in buffer for later processing.
Add all failed ops to buffer for later processing.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 1d39c5b..1a18530 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct event_crypto_adapter *adapter,
for (i = nb_enqueued; i < n; i++)
eca_circular_buffer_add(
&adapter->ebuf,
- ops[nb_enqueued]);
+ ops[i]);
check:
nb_deq += n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count stats
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
0 siblings, 1 reply; 35+ messages in thread
From: Naga Harish K, S V @ 2022-12-01 6:07 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Gujjar, Abhinandan S; +Cc: Jayatheerthan, Jay
Hi Ganapti,
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, November 30, 2022 10:40 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 v1 2/5] eventdev/crypto: wrong crypto enqueue count stats
As per the DPDK contribute guidelines, the subject line should use the imperative of the verb (like instructions to the code base).
http://doc.dpdk.org/guides/contributing/patches.html
Please change the subject lines for all patches in the patch set wherever it is required.
Also is it optimizing the stats update or fixing wrong stats update?
>
> crypto_enq_count is updated on failure to enqueue ops to cryptodev.
>
> Updated crypto_enq_count on successful enqueue of ops to cryptodev.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 1c0a22b..ef3dbe9 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> cdev_id,
> qp_id,
>
> &nb_enqueued);
> + stats->crypto_enq_count += nb_enqueued;
> + n += nb_enqueued;
> +
> /**
> * If some crypto ops failed to flush to cdev and
> * space for another batch is not available, stop @@ -
> 495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> &qp_info->cbuf)))
> adapter->stop_enq_to_cryptodev = true;
> }
> -
> - stats->crypto_enq_count += nb_enqueued;
> - n += nb_enqueued;
> }
>
> return n;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-11-30 17:10 [PATCH v1 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (3 preceding siblings ...)
2022-11-30 17:10 ` [PATCH v1 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
@ 2022-12-01 6:46 ` Ganapati Kundapura
2022-12-01 6:46 ` [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats Ganapati Kundapura
` (6 more replies)
4 siblings, 7 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-01 6:46 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
In the current implementation adapter queries event device's capability for
implicit release support.
This information is used to decide whether events are enqueued back as
NEW or FWD events.
This patch updates the adapter to query the port caps for implicit release
to decide on events enqueuing back as NEW/FWD events.
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 3c585d7..1c0a22b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -53,7 +53,7 @@ struct event_crypto_adapter {
uint8_t eventdev_id;
/* Event port identifier */
uint8_t event_port_id;
- /* Store event device's implicit release capability */
+ /* Store event port's implicit release capability */
uint8_t implicit_release_disabled;
/* Flag to indicate backpressure at cryptodev
* Stop further dequeuing events from eventdev
@@ -320,7 +320,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
{
struct event_crypto_adapter *adapter;
char mem_name[CRYPTO_ADAPTER_NAME_LEN];
- struct rte_event_dev_info dev_info;
int socket_id;
uint8_t i;
int ret;
@@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
return -ENOMEM;
}
- ret = rte_event_dev_info_get(dev_id, &dev_info);
- if (ret < 0) {
- RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d: %s!",
- dev_id, dev_info.driver_name);
- eca_circular_buffer_free(&adapter->ebuf);
- rte_free(adapter);
- return ret;
- }
-
- adapter->implicit_release_disabled = (dev_info.event_dev_cap &
- RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
adapter->eventdev_id = dev_id;
adapter->socket_id = socket_id;
adapter->conf_cb = conf_cb;
@@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
struct rte_event_crypto_adapter_conf adapter_conf;
struct rte_service_spec service;
int ret;
+ uint32_t impl_rel;
if (adapter->service_inited)
return 0;
@@ -866,6 +855,17 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
adapter->max_nb = adapter_conf.max_nb;
adapter->event_port_id = adapter_conf.event_port_id;
+
+ if (rte_event_port_attr_get(adapter->eventdev_id,
+ adapter->event_port_id,
+ RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
+ &impl_rel)) {
+ RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %" PRId32,
+ adapter->eventdev_id);
+ return -EINVAL;
+ }
+
+ adapter->implicit_release_disabled = (uint8_t)impl_rel;
adapter->service_inited = 1;
return ret;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
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 ` 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
` (5 subsequent siblings)
6 siblings, 2 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-01 6:46 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
crypto_enq_count is updated on failure to enqueue ops to cryptodev.
Updated crypto_enq_count on successful enqueue of ops to cryptodev.
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 1c0a22b..ef3dbe9 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
cdev_id,
qp_id,
&nb_enqueued);
+ stats->crypto_enq_count += nb_enqueued;
+ n += nb_enqueued;
+
/**
* If some crypto ops failed to flush to cdev and
* space for another batch is not available, stop
@@ -495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
&qp_info->cbuf)))
adapter->stop_enq_to_cryptodev = true;
}
-
- stats->crypto_enq_count += nb_enqueued;
- n += nb_enqueued;
}
return n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events
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-01 6:46 ` 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
` (4 subsequent siblings)
6 siblings, 2 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-01 6:46 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
Events enqueued to eventdev from the beginning of the circular buffer.
This leads to invalid or already freed events getting enqueued to eventdev
from the circular buffer.
Fixed by enqueuing the events to eventdev from the head pointer of
circular buffer.
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 ef3dbe9..72deedd 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -669,7 +669,7 @@ eca_circular_buffer_flush_to_evdev(struct event_crypto_adapter *adapter,
else
return 0; /* buffer empty */
- nb_ops_flushed = eca_ops_enqueue_burst(adapter, ops, n);
+ nb_ops_flushed = eca_ops_enqueue_burst(adapter, &ops[*headp], n);
bufp->count -= nb_ops_flushed;
if (!bufp->count) {
*headp = 0;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
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-01 6:46 ` [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events Ganapati Kundapura
@ 2022-12-01 6:46 ` Ganapati Kundapura
2022-12-05 11:37 ` [EXT] " Volodymyr Fialko
2022-12-06 16:25 ` Gujjar, Abhinandan S
2022-12-01 6:46 ` [PATCH v2 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
` (3 subsequent siblings)
6 siblings, 2 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-01 6:46 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
Crypto adapter checks CPM backpressure once in enq_run()
This leads to buffer overflow if some ops failed to flush
to cryptodev.
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
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 5/5] eventdev/crypto: add all failed events to circular buffer
2022-12-01 6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (2 preceding siblings ...)
2022-12-01 6:46 ` [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer Ganapati Kundapura
@ 2022-12-01 6:46 ` 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
` (2 subsequent siblings)
6 siblings, 2 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-01 6:46 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar; +Cc: jay.jayatheerthan
When many ops are failed to enqueue to eventdev, crypto
adapter stores one event in buffer for later processing.
Add all failed ops to buffer for later processing.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v2:
* Updated subject line commit message
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 1d39c5b..1a18530 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct event_crypto_adapter *adapter,
for (i = nb_enqueued; i < n; i++)
eca_circular_buffer_add(
&adapter->ebuf,
- ops[nb_enqueued]);
+ ops[i]);
check:
nb_deq += n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count stats
2022-12-01 6:07 ` Naga Harish K, S V
@ 2022-12-01 6:56 ` Kundapura, Ganapati
0 siblings, 0 replies; 35+ messages in thread
From: Kundapura, Ganapati @ 2022-12-01 6:56 UTC (permalink / raw)
To: Naga Harish K, S V, dev, jerinj, Gujjar, Abhinandan S; +Cc: Jayatheerthan, Jay
Hi Harish,
> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Thursday, December 1, 2022 11:38 AM
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; dev@dpdk.org;
> jerinj@marvell.com; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: RE: [PATCH v1 2/5] eventdev/crypto: wrong crypto enqueue count
> stats
>
> Hi Ganapti,
>
> > -----Original Message-----
> > From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Sent: Wednesday, November 30, 2022 10:40 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 v1 2/5] eventdev/crypto: wrong crypto enqueue count
> > stats
>
> As per the DPDK contribute guidelines, the subject line should use the
> imperative of the verb (like instructions to the code base).
> http://doc.dpdk.org/guides/contributing/patches.html
> Please change the subject lines for all patches in the patch set wherever it is
> required.
>
Updated the subject line and reposted
> Also is it optimizing the stats update or fixing wrong stats update?
>
It's fixing of wrong stats
> >
> > crypto_enq_count is updated on failure to enqueue ops to cryptodev.
> >
> > Updated crypto_enq_count on successful enqueue of ops to cryptodev.
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> >
> > diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> > b/lib/eventdev/rte_event_crypto_adapter.c
> > index 1c0a22b..ef3dbe9 100644
> > --- a/lib/eventdev/rte_event_crypto_adapter.c
> > +++ b/lib/eventdev/rte_event_crypto_adapter.c
> > @@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct
> event_crypto_adapter
> > *adapter, struct rte_event *ev,
> > cdev_id,
> > qp_id,
> >
> > &nb_enqueued);
> > + stats->crypto_enq_count += nb_enqueued;
> > + n += nb_enqueued;
> > +
> > /**
> > * If some crypto ops failed to flush to cdev and
> > * space for another batch is not available, stop @@ -
> > 495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> > *adapter, struct rte_event *ev,
> > &qp_info->cbuf)))
> > adapter->stop_enq_to_cryptodev = true;
> > }
> > -
> > - stats->crypto_enq_count += nb_enqueued;
> > - n += nb_enqueued;
> > }
> >
> > return n;
> > --
> > 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [EXT] [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-12-01 6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (3 preceding siblings ...)
2022-12-01 6:46 ` [PATCH v2 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
@ 2022-12-01 13:20 ` Volodymyr Fialko
2022-12-06 15:44 ` Gujjar, Abhinandan S
2022-12-07 6:49 ` [PATCH v3 " Ganapati Kundapura
6 siblings, 0 replies; 35+ messages in thread
From: Volodymyr Fialko @ 2022-12-01 13:20 UTC (permalink / raw)
To: Ganapati Kundapura, dev, Jerin Jacob Kollanukkaran,
s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan
> -----Original Message-----
> From: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 7:47 AM
> To: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; s.v.naga.harish.k@intel.com;
> abhinandan.gujjar@intel.com
> Cc: jay.jayatheerthan@intel.com
> Subject: [EXT] [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap
>
> In the current implementation adapter queries event device's capability for implicit release support.
>
> This information is used to decide whether events are enqueued back as NEW or FWD events.
>
> This patch updates the adapter to query the port caps for implicit release to decide on events
> enqueuing back as NEW/FWD events.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [EXT] [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
2022-12-01 6:46 ` [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats Ganapati Kundapura
@ 2022-12-05 11:34 ` Volodymyr Fialko
2022-12-07 5:40 ` Gujjar, Abhinandan S
1 sibling, 0 replies; 35+ messages in thread
From: Volodymyr Fialko @ 2022-12-05 11:34 UTC (permalink / raw)
To: Ganapati Kundapura, dev, Jerin Jacob Kollanukkaran,
s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan
> -----Original Message-----
> From: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 7:47 AM
> To: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; s.v.naga.harish.k@intel.com;
> abhinandan.gujjar@intel.com
> Cc: jay.jayatheerthan@intel.com
> Subject: [EXT] [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
>
> External Email
>
> ----------------------------------------------------------------------
> crypto_enq_count is updated on failure to enqueue ops to cryptodev.
>
> Updated crypto_enq_count on successful enqueue of ops to cryptodev.
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [EXT] [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events
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 ` Volodymyr Fialko
2022-12-06 16:17 ` Gujjar, Abhinandan S
1 sibling, 0 replies; 35+ messages in thread
From: Volodymyr Fialko @ 2022-12-05 11:35 UTC (permalink / raw)
To: Ganapati Kundapura, dev, Jerin Jacob Kollanukkaran,
s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan
> -----Original Message-----
> From: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 7:47 AM
> To: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; s.v.naga.harish.k@intel.com;
> abhinandan.gujjar@intel.com
> Cc: jay.jayatheerthan@intel.com
> Subject: [EXT] [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events
>
> External Email
>
> ----------------------------------------------------------------------
> Events enqueued to eventdev from the beginning of the circular buffer.
> This leads to invalid or already freed events getting enqueued to eventdev from the circular buffer.
>
> Fixed by enqueuing the events to eventdev from the head pointer of circular buffer.
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [EXT] [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
2022-12-01 6:46 ` [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer Ganapati Kundapura
@ 2022-12-05 11:37 ` Volodymyr Fialko
2022-12-06 16:25 ` Gujjar, Abhinandan S
1 sibling, 0 replies; 35+ messages in thread
From: Volodymyr Fialko @ 2022-12-05 11:37 UTC (permalink / raw)
To: Ganapati Kundapura, dev, Jerin Jacob Kollanukkaran,
s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan
> -----Original Message-----
> From: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 7:47 AM
> To: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; s.v.naga.harish.k@intel.com;
> abhinandan.gujjar@intel.com
> Cc: jay.jayatheerthan@intel.com
> Subject: [EXT] [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
>
> External Email
>
> ----------------------------------------------------------------------
> Crypto adapter checks CPM backpressure once in enq_run() This leads to buffer overflow if some ops
> failed to flush to cryptodev.
>
> 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>
> ---
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [EXT] [PATCH v2 5/5] eventdev/crypto: add all failed events to circular buffer
2022-12-01 6:46 ` [PATCH v2 5/5] eventdev/crypto: add all failed events to " Ganapati Kundapura
@ 2022-12-05 11:37 ` Volodymyr Fialko
2022-12-06 16:37 ` Gujjar, Abhinandan S
1 sibling, 0 replies; 35+ messages in thread
From: Volodymyr Fialko @ 2022-12-05 11:37 UTC (permalink / raw)
To: Ganapati Kundapura, dev, Jerin Jacob Kollanukkaran,
s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan
> -----Original Message-----
> From: Ganapati Kundapura <ganapati.kundapura@intel.com>
> Sent: Thursday, December 1, 2022 7:47 AM
> To: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; s.v.naga.harish.k@intel.com;
> abhinandan.gujjar@intel.com
> Cc: jay.jayatheerthan@intel.com
> Subject: [EXT] [PATCH v2 5/5] eventdev/crypto: add all failed events to circular buffer
>
> External Email
>
> ----------------------------------------------------------------------
> When many ops are failed to enqueue to eventdev, crypto adapter stores one event in buffer for later
> processing.
>
> Add all failed ops to buffer for later processing.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
Acked-by: Volodymyr Fialko <vfialko@marvell.com>
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-12-01 6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (4 preceding siblings ...)
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
6 siblings, 1 reply; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-06 15:44 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
> -----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 1/5] eventdev/event_crypto: process event port's impl rel
> cap
>
> In the current implementation adapter queries event device's capability for
> implicit release support.
>
> This information is used to decide whether events are enqueued back as NEW
> or FWD events.
>
> This patch updates the adapter to query the port caps for implicit release to
> decide on events enqueuing back as NEW/FWD events.
>
> 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 3c585d7..1c0a22b 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -53,7 +53,7 @@ struct event_crypto_adapter {
> uint8_t eventdev_id;
> /* Event port identifier */
> uint8_t event_port_id;
> - /* Store event device's implicit release capability */
> + /* Store event port's implicit release capability */
> uint8_t implicit_release_disabled;
> /* Flag to indicate backpressure at cryptodev
> * Stop further dequeuing events from eventdev @@ -320,7 +320,6
> @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id, {
> struct event_crypto_adapter *adapter;
> char mem_name[CRYPTO_ADAPTER_NAME_LEN];
> - struct rte_event_dev_info dev_info;
> int socket_id;
> uint8_t i;
> int ret;
> @@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id,
> uint8_t dev_id,
> return -ENOMEM;
> }
>
> - ret = rte_event_dev_info_get(dev_id, &dev_info);
> - if (ret < 0) {
> - RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d:
> %s!",
> - dev_id, dev_info.driver_name);
> - eca_circular_buffer_free(&adapter->ebuf);
> - rte_free(adapter);
> - return ret;
> - }
> -
> - adapter->implicit_release_disabled = (dev_info.event_dev_cap &
> - RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
> adapter->eventdev_id = dev_id;
> adapter->socket_id = socket_id;
> adapter->conf_cb = conf_cb;
> @@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter
> *adapter, uint8_t id)
> struct rte_event_crypto_adapter_conf adapter_conf;
> struct rte_service_spec service;
> int ret;
> + uint32_t impl_rel;
>
> if (adapter->service_inited)
> return 0;
> @@ -866,6 +855,17 @@ eca_init_service(struct event_crypto_adapter
> *adapter, uint8_t id)
>
> adapter->max_nb = adapter_conf.max_nb;
> adapter->event_port_id = adapter_conf.event_port_id;
> +
> + if (rte_event_port_attr_get(adapter->eventdev_id,
> + adapter->event_port_id,
> +
> RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
> + &impl_rel)) {
> + RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %"
> PRId32,
> + adapter->eventdev_id);
You need to free memory allocated for adapter + adapter->ebuf before returning error
> + return -EINVAL;
> + }
> +
> + adapter->implicit_release_disabled = (uint8_t)impl_rel;
> adapter->service_inited = 1;
>
> return ret;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 3/5] eventdev/crypto: fix wrong offset used while flushing events
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
1 sibling, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-06 16:17 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@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 3/5] eventdev/crypto: fix wrong offset used while flushing
> events
>
> Events enqueued to eventdev from the beginning of the circular buffer.
> This leads to invalid or already freed events getting enqueued to eventdev
> from the circular buffer.
>
> Fixed by enqueuing the events to eventdev from the head pointer of circular
> buffer.
>
> 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 ef3dbe9..72deedd 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -669,7 +669,7 @@ eca_circular_buffer_flush_to_evdev(struct
> event_crypto_adapter *adapter,
> else
> return 0; /* buffer empty */
>
> - nb_ops_flushed = eca_ops_enqueue_burst(adapter, ops, n);
> + nb_ops_flushed = eca_ops_enqueue_burst(adapter, &ops[*headp],
> n);
> bufp->count -= nb_ops_flushed;
> if (!bufp->count) {
> *headp = 0;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
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
2022-12-07 6:53 ` Kundapura, Ganapati
1 sibling, 1 reply; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-06 16:25 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
> -----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
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 5/5] eventdev/crypto: add all failed events to circular buffer
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
1 sibling, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-06 16:37 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
> -----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 5/5] eventdev/crypto: add all failed events to circular
> buffer
Rephrase header with "Fix failed events" as the adding to circular buffer logic already exists
>
> When many ops are failed to enqueue to eventdev, crypto adapter stores one
> event in buffer for later processing.
Rephase -> Circular buffer stores those events failed to enqueue to eventdev for
retrying later. Current implementation adds the same crypto op to circular buffer
instead of pointing all the ops in a batch. This fix updates the pointer to pointing to
correct ops in the batch.
>
> Add all failed ops to buffer for later processing.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> v2:
> * Updated subject line commit message
>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 1d39c5b..1a18530 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct
> event_crypto_adapter *adapter,
> for (i = nb_enqueued; i < n; i++)
> eca_circular_buffer_add(
> &adapter->ebuf,
> - ops[nb_enqueued]);
> + ops[i]);
>
> check:
> nb_deq += n;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
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
1 sibling, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 5:40 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@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 2/5] eventdev/crypto: fix wrong crypto enqueue count
> stats
>
> crypto_enq_count is updated on failure to enqueue ops to cryptodev.
>
> Updated crypto_enq_count on successful enqueue of ops to cryptodev.
>
> 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 1c0a22b..ef3dbe9 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> cdev_id,
> qp_id,
>
> &nb_enqueued);
> + stats->crypto_enq_count += nb_enqueued;
> + n += nb_enqueued;
> +
> /**
> * If some crypto ops failed to flush to cdev and
> * space for another batch is not available, stop @@ -
> 495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> &qp_info->cbuf)))
> adapter->stop_enq_to_cryptodev = true;
> }
> -
> - stats->crypto_enq_count += nb_enqueued;
> - n += nb_enqueued;
> }
>
> return n;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-12-01 6:46 ` [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap Ganapati Kundapura
` (5 preceding siblings ...)
2022-12-06 15:44 ` Gujjar, Abhinandan S
@ 2022-12-07 6:49 ` Ganapati Kundapura
2022-12-07 6:49 ` [PATCH v3 2/5] eventdev/crypto: fix wrong crypto enqueue count stats Ganapati Kundapura
` (4 more replies)
6 siblings, 5 replies; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-07 6:49 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan, vfialko
In the current implementation adapter queries event device's capability for
implicit release support.
This information is used to decide whether events are enqueued back as
NEW or FWD events.
This patch updates the adapter to query the port caps for implicit release
to decide on events enqueuing back as NEW/FWD events.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v3:
* Freed adapter and adapter->ebuf after rte_event_port_attr_get() failure
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 3c585d7..134470b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -53,7 +53,7 @@ struct event_crypto_adapter {
uint8_t eventdev_id;
/* Event port identifier */
uint8_t event_port_id;
- /* Store event device's implicit release capability */
+ /* Store event port's implicit release capability */
uint8_t implicit_release_disabled;
/* Flag to indicate backpressure at cryptodev
* Stop further dequeuing events from eventdev
@@ -320,7 +320,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
{
struct event_crypto_adapter *adapter;
char mem_name[CRYPTO_ADAPTER_NAME_LEN];
- struct rte_event_dev_info dev_info;
int socket_id;
uint8_t i;
int ret;
@@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id,
return -ENOMEM;
}
- ret = rte_event_dev_info_get(dev_id, &dev_info);
- if (ret < 0) {
- RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d: %s!",
- dev_id, dev_info.driver_name);
- eca_circular_buffer_free(&adapter->ebuf);
- rte_free(adapter);
- return ret;
- }
-
- adapter->implicit_release_disabled = (dev_info.event_dev_cap &
- RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
adapter->eventdev_id = dev_id;
adapter->socket_id = socket_id;
adapter->conf_cb = conf_cb;
@@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
struct rte_event_crypto_adapter_conf adapter_conf;
struct rte_service_spec service;
int ret;
+ uint32_t impl_rel;
if (adapter->service_inited)
return 0;
@@ -866,6 +855,19 @@ eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
adapter->max_nb = adapter_conf.max_nb;
adapter->event_port_id = adapter_conf.event_port_id;
+
+ if (rte_event_port_attr_get(adapter->eventdev_id,
+ adapter->event_port_id,
+ RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
+ &impl_rel)) {
+ RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %" PRId32,
+ adapter->eventdev_id);
+ eca_circular_buffer_free(&adapter->ebuf);
+ rte_free(adapter);
+ return -EINVAL;
+ }
+
+ adapter->implicit_release_disabled = (uint8_t)impl_rel;
adapter->service_inited = 1;
return ret;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
2022-12-07 6:49 ` [PATCH v3 " Ganapati Kundapura
@ 2022-12-07 6:49 ` 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
` (3 subsequent siblings)
4 siblings, 1 reply; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-07 6:49 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan, vfialko
crypto_enq_count is updated on failure to enqueue ops to cryptodev.
Updated crypto_enq_count on successful enqueue of ops to cryptodev.
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 134470b..eaff577 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
cdev_id,
qp_id,
&nb_enqueued);
+ stats->crypto_enq_count += nb_enqueued;
+ n += nb_enqueued;
+
/**
* If some crypto ops failed to flush to cdev and
* space for another batch is not available, stop
@@ -495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
&qp_info->cbuf)))
adapter->stop_enq_to_cryptodev = true;
}
-
- stats->crypto_enq_count += nb_enqueued;
- n += nb_enqueued;
}
return n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3 3/5] eventdev/crypto: fix wrong offset used while flushing events
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:49 ` 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
` (2 subsequent siblings)
4 siblings, 1 reply; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-07 6:49 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan, vfialko
Events enqueued to eventdev from the beginning of the circular buffer.
This leads to invalid or already freed events getting enqueued to eventdev
from the circular buffer.
Fixed by enqueuing the events to eventdev from the head pointer of
circular buffer.
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 eaff577..c08984b 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -669,7 +669,7 @@ eca_circular_buffer_flush_to_evdev(struct event_crypto_adapter *adapter,
else
return 0; /* buffer empty */
- nb_ops_flushed = eca_ops_enqueue_burst(adapter, ops, n);
+ nb_ops_flushed = eca_ops_enqueue_burst(adapter, &ops[*headp], n);
bufp->count -= nb_ops_flushed;
if (!bufp->count) {
*headp = 0;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3 4/5] eventdev/crypto: fix overflow in circular buffer
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:49 ` [PATCH v3 3/5] eventdev/crypto: fix wrong offset used while flushing events Ganapati Kundapura
@ 2022-12-07 6:49 ` 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:54 ` [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel cap Gujjar, Abhinandan S
4 siblings, 1 reply; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-07 6:49 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan, vfialko
In case of crypto enqueue failures, even though backpressure
flag is set to stop further dequeue from eventdev, the current
logic does not stop dequeueing events for max_nb events.
This is fixed by checking the backpressure just before
dequeuing events from event device.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v3:
* Updated commit message
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 c08984b..31b8255 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
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v3 5/5] eventdev/crypto: fix failed events
2022-12-07 6:49 ` [PATCH v3 " Ganapati Kundapura
` (2 preceding siblings ...)
2022-12-07 6:49 ` [PATCH v3 4/5] eventdev/crypto: fix overflow in circular buffer Ganapati Kundapura
@ 2022-12-07 6:49 ` Ganapati Kundapura
2022-12-07 6:56 ` Gujjar, Abhinandan S
2022-12-07 6:54 ` [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel cap Gujjar, Abhinandan S
4 siblings, 1 reply; 35+ messages in thread
From: Ganapati Kundapura @ 2022-12-07 6:49 UTC (permalink / raw)
To: dev, jerinj, s.v.naga.harish.k, abhinandan.gujjar
Cc: jay.jayatheerthan, vfialko
Circular buffer stores events failed to enqueue to eventdev for
retrying later. Current implementation adds the same crypto op
to circular buffer instead of pointing all the ops in a batch.
This fix updates the pointer to pointing to correct ops in the batch.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
---
v3:
* Updated commit message
v2:
* Updated subject line commit message
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index 31b8255..5d962a1 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct event_crypto_adapter *adapter,
for (i = nb_enqueued; i < n; i++)
eca_circular_buffer_add(
&adapter->ebuf,
- ops[nb_enqueued]);
+ ops[i]);
check:
nb_deq += n;
--
2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-12-06 15:44 ` Gujjar, Abhinandan S
@ 2022-12-07 6:53 ` Kundapura, Ganapati
0 siblings, 0 replies; 35+ messages in thread
From: Kundapura, Ganapati @ 2022-12-07 6:53 UTC (permalink / raw)
To: Gujjar, Abhinandan S, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
Hi Abhi,
> -----Original Message-----
> From: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Sent: Tuesday, December 6, 2022 9:14 PM
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; dev@dpdk.org;
> 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 1/5] eventdev/event_crypto: process event port's
> impl rel cap
>
>
>
> > -----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 1/5] eventdev/event_crypto: process event port's
> > impl rel cap
> >
> > In the current implementation adapter queries event device's
> > capability for implicit release support.
> >
> > This information is used to decide whether events are enqueued back as
> > NEW or FWD events.
> >
> > This patch updates the adapter to query the port caps for implicit
> > release to decide on events enqueuing back as NEW/FWD events.
> >
> > 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 3c585d7..1c0a22b 100644
> > --- a/lib/eventdev/rte_event_crypto_adapter.c
> > +++ b/lib/eventdev/rte_event_crypto_adapter.c
> > @@ -53,7 +53,7 @@ struct event_crypto_adapter {
> > uint8_t eventdev_id;
> > /* Event port identifier */
> > uint8_t event_port_id;
> > - /* Store event device's implicit release capability */
> > + /* Store event port's implicit release capability */
> > uint8_t implicit_release_disabled;
> > /* Flag to indicate backpressure at cryptodev
> > * Stop further dequeuing events from eventdev @@ -320,7 +320,6
> @@
> > rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id, {
> > struct event_crypto_adapter *adapter;
> > char mem_name[CRYPTO_ADAPTER_NAME_LEN];
> > - struct rte_event_dev_info dev_info;
> > int socket_id;
> > uint8_t i;
> > int ret;
> > @@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id,
> > uint8_t dev_id,
> > return -ENOMEM;
> > }
> >
> > - ret = rte_event_dev_info_get(dev_id, &dev_info);
> > - if (ret < 0) {
> > - RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d:
> > %s!",
> > - dev_id, dev_info.driver_name);
> > - eca_circular_buffer_free(&adapter->ebuf);
> > - rte_free(adapter);
> > - return ret;
> > - }
> > -
> > - adapter->implicit_release_disabled = (dev_info.event_dev_cap &
> > - RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
> > adapter->eventdev_id = dev_id;
> > adapter->socket_id = socket_id;
> > adapter->conf_cb = conf_cb;
> > @@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter
> > *adapter, uint8_t id)
> > struct rte_event_crypto_adapter_conf adapter_conf;
> > struct rte_service_spec service;
> > int ret;
> > + uint32_t impl_rel;
> >
> > if (adapter->service_inited)
> > return 0;
> > @@ -866,6 +855,17 @@ eca_init_service(struct event_crypto_adapter
> > *adapter, uint8_t id)
> >
> > adapter->max_nb = adapter_conf.max_nb;
> > adapter->event_port_id = adapter_conf.event_port_id;
> > +
> > + if (rte_event_port_attr_get(adapter->eventdev_id,
> > + adapter->event_port_id,
> > +
> > RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
> > + &impl_rel)) {
> > + RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %"
> > PRId32,
> > + adapter->eventdev_id);
> You need to free memory allocated for adapter + adapter->ebuf before
> returning error
Updated in V3
> > + return -EINVAL;
> > + }
> > +
> > + adapter->implicit_release_disabled = (uint8_t)impl_rel;
> > adapter->service_inited = 1;
> >
> > return ret;
> > --
> > 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v2 4/5] eventdev/crypto: fix overflow in circular buffer
2022-12-06 16:25 ` Gujjar, Abhinandan S
@ 2022-12-07 6:53 ` Kundapura, Ganapati
0 siblings, 0 replies; 35+ messages in thread
From: Kundapura, Ganapati @ 2022-12-07 6:53 UTC (permalink / raw)
To: Gujjar, Abhinandan S, dev, jerinj, Naga Harish K, S V; +Cc: Jayatheerthan, Jay
Hi Abhi,
> -----Original Message-----
> From: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>
> Sent: Tuesday, December 6, 2022 9:56 PM
> To: Kundapura, Ganapati <ganapati.kundapura@intel.com>; dev@dpdk.org;
> 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
>
>
>
> > -----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.
>
Updated in V3
> >
> > 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
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel cap
2022-12-07 6:49 ` [PATCH v3 " Ganapati Kundapura
` (3 preceding siblings ...)
2022-12-07 6:49 ` [PATCH v3 5/5] eventdev/crypto: fix failed events Ganapati Kundapura
@ 2022-12-07 6:54 ` Gujjar, Abhinandan S
4 siblings, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 6:54 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V
Cc: Jayatheerthan, Jay, vfialko
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> Subject: [PATCH v3 1/5] eventdev/event_crypto: process event port's impl rel
> cap
>
> In the current implementation adapter queries event device's capability for
> implicit release support.
>
> This information is used to decide whether events are enqueued back as NEW
> or FWD events.
>
> This patch updates the adapter to query the port caps for implicit release to
> decide on events enqueuing back as NEW/FWD events.
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> v3:
> * Freed adapter and adapter->ebuf after rte_event_port_attr_get() failure
>
> 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 3c585d7..134470b 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -53,7 +53,7 @@ struct event_crypto_adapter {
> uint8_t eventdev_id;
> /* Event port identifier */
> uint8_t event_port_id;
> - /* Store event device's implicit release capability */
> + /* Store event port's implicit release capability */
> uint8_t implicit_release_disabled;
> /* Flag to indicate backpressure at cryptodev
> * Stop further dequeuing events from eventdev @@ -320,7 +320,6
> @@ rte_event_crypto_adapter_create_ext(uint8_t id, uint8_t dev_id, {
> struct event_crypto_adapter *adapter;
> char mem_name[CRYPTO_ADAPTER_NAME_LEN];
> - struct rte_event_dev_info dev_info;
> int socket_id;
> uint8_t i;
> int ret;
> @@ -361,17 +360,6 @@ rte_event_crypto_adapter_create_ext(uint8_t id,
> uint8_t dev_id,
> return -ENOMEM;
> }
>
> - ret = rte_event_dev_info_get(dev_id, &dev_info);
> - if (ret < 0) {
> - RTE_EDEV_LOG_ERR("Failed to get info for eventdev %d:
> %s!",
> - dev_id, dev_info.driver_name);
> - eca_circular_buffer_free(&adapter->ebuf);
> - rte_free(adapter);
> - return ret;
> - }
> -
> - adapter->implicit_release_disabled = (dev_info.event_dev_cap &
> - RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
> adapter->eventdev_id = dev_id;
> adapter->socket_id = socket_id;
> adapter->conf_cb = conf_cb;
> @@ -837,6 +825,7 @@ eca_init_service(struct event_crypto_adapter
> *adapter, uint8_t id)
> struct rte_event_crypto_adapter_conf adapter_conf;
> struct rte_service_spec service;
> int ret;
> + uint32_t impl_rel;
>
> if (adapter->service_inited)
> return 0;
> @@ -866,6 +855,19 @@ eca_init_service(struct event_crypto_adapter
> *adapter, uint8_t id)
>
> adapter->max_nb = adapter_conf.max_nb;
> adapter->event_port_id = adapter_conf.event_port_id;
> +
> + if (rte_event_port_attr_get(adapter->eventdev_id,
> + adapter->event_port_id,
> +
> RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE,
> + &impl_rel)) {
> + RTE_EDEV_LOG_ERR("Failed to get port info for eventdev %"
> PRId32,
> + adapter->eventdev_id);
> + eca_circular_buffer_free(&adapter->ebuf);
> + rte_free(adapter);
> + return -EINVAL;
> + }
> +
> + adapter->implicit_release_disabled = (uint8_t)impl_rel;
> adapter->service_inited = 1;
>
> return ret;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v3 2/5] eventdev/crypto: fix wrong crypto enqueue count stats
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
0 siblings, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 6:55 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V
Cc: Jayatheerthan, Jay, vfialko
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> Subject: [PATCH v3 2/5] eventdev/crypto: fix wrong crypto enqueue count
> stats
>
> crypto_enq_count is updated on failure to enqueue ops to cryptodev.
>
> Updated crypto_enq_count on successful enqueue of ops to cryptodev.
>
> 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 134470b..eaff577 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -485,6 +485,9 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> cdev_id,
> qp_id,
>
> &nb_enqueued);
> + stats->crypto_enq_count += nb_enqueued;
> + n += nb_enqueued;
> +
> /**
> * If some crypto ops failed to flush to cdev and
> * space for another batch is not available, stop @@ -
> 495,9 +498,6 @@ eca_enq_to_cryptodev(struct event_crypto_adapter
> *adapter, struct rte_event *ev,
> &qp_info->cbuf)))
> adapter->stop_enq_to_cryptodev = true;
> }
> -
> - stats->crypto_enq_count += nb_enqueued;
> - n += nb_enqueued;
> }
>
> return n;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v3 3/5] eventdev/crypto: fix wrong offset used while flushing events
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
0 siblings, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 6:55 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V
Cc: Jayatheerthan, Jay, vfialko
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> Subject: [PATCH v3 3/5] eventdev/crypto: fix wrong offset used while flushing
> events
>
> Events enqueued to eventdev from the beginning of the circular buffer.
> This leads to invalid or already freed events getting enqueued to eventdev
> from the circular buffer.
>
> Fixed by enqueuing the events to eventdev from the head pointer of circular
> buffer.
>
> 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 eaff577..c08984b 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -669,7 +669,7 @@ eca_circular_buffer_flush_to_evdev(struct
> event_crypto_adapter *adapter,
> else
> return 0; /* buffer empty */
>
> - nb_ops_flushed = eca_ops_enqueue_burst(adapter, ops, n);
> + nb_ops_flushed = eca_ops_enqueue_burst(adapter, &ops[*headp],
> n);
> bufp->count -= nb_ops_flushed;
> if (!bufp->count) {
> *headp = 0;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v3 5/5] eventdev/crypto: fix failed events
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
0 siblings, 1 reply; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 6:56 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V
Cc: Jayatheerthan, Jay, vfialko
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> Subject: [PATCH v3 5/5] eventdev/crypto: fix failed events
>
> Circular buffer stores events failed to enqueue to eventdev for retrying later.
> Current implementation adds the same crypto op to circular buffer instead of
> pointing all the ops in a batch.
>
> This fix updates the pointer to pointing to correct ops in the batch.
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> v3:
> * Updated commit message
>
> v2:
> * Updated subject line commit message
>
> diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> b/lib/eventdev/rte_event_crypto_adapter.c
> index 31b8255..5d962a1 100644
> --- a/lib/eventdev/rte_event_crypto_adapter.c
> +++ b/lib/eventdev/rte_event_crypto_adapter.c
> @@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct
> event_crypto_adapter *adapter,
> for (i = nb_enqueued; i < n; i++)
> eca_circular_buffer_add(
> &adapter->ebuf,
> - ops[nb_enqueued]);
> + ops[i]);
>
> check:
> nb_deq += n;
> --
> 2.6.4
^ permalink raw reply [flat|nested] 35+ messages in thread
* RE: [PATCH v3 4/5] eventdev/crypto: fix overflow in circular buffer
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
0 siblings, 0 replies; 35+ messages in thread
From: Gujjar, Abhinandan S @ 2022-12-07 7:04 UTC (permalink / raw)
To: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V
Cc: Jayatheerthan, Jay, vfialko
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> -----Original Message-----
> From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> Subject: [PATCH v3 4/5] eventdev/crypto: fix overflow in circular buffer
>
> In case of crypto enqueue failures, even though backpressure flag is set to
> stop further dequeue from eventdev, the current logic does not stop
> dequeueing events for max_nb events.
>
> This is fixed by checking the backpressure just before dequeuing events from
> event device.
>
> Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
>
> Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
> ---
> v3:
> * Updated commit message
>
> 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 c08984b..31b8255 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
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v3 5/5] eventdev/crypto: fix failed events
2022-12-07 6:56 ` Gujjar, Abhinandan S
@ 2023-01-12 12:59 ` Jerin Jacob
0 siblings, 0 replies; 35+ messages in thread
From: Jerin Jacob @ 2023-01-12 12:59 UTC (permalink / raw)
To: Gujjar, Abhinandan S
Cc: Kundapura, Ganapati, dev, jerinj, Naga Harish K, S V,
Jayatheerthan, Jay, vfialko
On Wed, Dec 7, 2022 at 12:26 PM Gujjar, Abhinandan S
<abhinandan.gujjar@intel.com> wrote:
>
> Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
>
> > -----Original Message-----
> > From: Kundapura, Ganapati <ganapati.kundapura@intel.com>
> > Sent: Wednesday, December 7, 2022 12:20 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>; vfialko@marvell.com
> > Subject: [PATCH v3 5/5] eventdev/crypto: fix failed events
> >
> > Circular buffer stores events failed to enqueue to eventdev for retrying later.
> > Current implementation adds the same crypto op to circular buffer instead of
> > pointing all the ops in a batch.
> >
> > This fix updates the pointer to pointing to correct ops in the batch.
> >
> > Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
> >
> > Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Updated the git commit as follows and series applied to
dpdk-next-net-eventdev/for-main. Thanks
ommit 948973d20dbd465f8fcc502f9e3af3b0de3db1e6 (HEAD -> for-main)
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Wed Dec 7 00:49:45 2022 -0600
eventdev/crypto: fix failed events
Circular buffer stores events failed to enqueue to eventdev for
retrying later. Current implementation adds the same crypto op
to circular buffer instead of pointing all the ops in a batch.
This fix updates the pointer to pointing to correct ops in the batch.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
commit 32fb46e8e37e4cd6f965c9e577243693b99c02d4
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Wed Dec 7 00:49:44 2022 -0600
eventdev/crypto: fix overflow in circular buffer
In case of crypto enqueue failures, even though back pressure
flag is set to stop further dequeue from eventdev, the current
logic does not stop dequeueing events for max_nb events.
This is fixed by checking the back pressure just before
dequeuing events from event device.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
commit 74bf35c7b2510e9d3da409607a13b5887ceeb590
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Wed Dec 7 00:49:43 2022 -0600
eventdev/crypto: fix wrong offset used while flushing events
Events enqueued to eventdev from the beginning of the circular buffer.
This leads to invalid or already freed events getting enqueued to eventdev
from the circular buffer.
Fixed by enqueuing the events to eventdev from the head pointer of
circular buffer.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
commit 1597b6602c3d90887c2ec65031377c2dba0aacf1
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Wed Dec 7 00:49:42 2022 -0600
eventdev/crypto: fix wrong crypto enqueue count stats
crypto_enq_count is updated on failure to enqueue ops to cryptodev.
Updated crypto_enq_count on successful enqueue of ops to cryptodev.
Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
commit 2b3049e5e61cff02488e402358854ae5e9b0279d
Author: Ganapati Kundapura <ganapati.kundapura@intel.com>
Date: Wed Dec 7 00:49:41 2022 -0600
eventdev/crypto: select enqueue mode based on implicit release capability
In the current implementation adapter queries event device's capability for
implicit release support.
This information is used to decide whether events are enqueued back as
NEW or FWD events.
This patch updates the adapter to query the port caps for implicit release
to decide on events enqueuing back as NEW/FWD events.
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> > ---
> > v3:
> > * Updated commit message
> >
> > v2:
> > * Updated subject line commit message
> >
> > diff --git a/lib/eventdev/rte_event_crypto_adapter.c
> > b/lib/eventdev/rte_event_crypto_adapter.c
> > index 31b8255..5d962a1 100644
> > --- a/lib/eventdev/rte_event_crypto_adapter.c
> > +++ b/lib/eventdev/rte_event_crypto_adapter.c
> > @@ -753,7 +753,7 @@ eca_crypto_adapter_deq_run(struct
> > event_crypto_adapter *adapter,
> > for (i = nb_enqueued; i < n; i++)
> > eca_circular_buffer_add(
> > &adapter->ebuf,
> > - ops[nb_enqueued]);
> > + ops[i]);
> >
> > check:
> > nb_deq += n;
> > --
> > 2.6.4
>
^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2023-01-12 13:00 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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).