patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment
@ 2023-04-17 16:08 Saoirse O'Donovan
  2023-04-17 16:14 ` Power, Ciara
  0 siblings, 1 reply; 2+ messages in thread
From: Saoirse O'Donovan @ 2023-04-17 16:08 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: stable, Saoirse O'Donovan, david.marchand

The two functions rte_ring_enqueue and rte_ring_enqueue_burst have
different return values which weren't accounted for when updating
enqueue stats. This meant that on success, the enqueued count and
accumulated_enqueued_ops were being incremented by 0.

Fixes: 49abc602fa65 ("crypto/ipsec_mb: fix build with GCC 12")
Cc: david.marchand@redhat.com

Signed-off-by: Saoirse O'Donovan <saoirse.odonovan@intel.com>

---
Upstream commit:
Fixes: 468f31eb71c4 ("crypto/ipsec_mb: fix build with GCC 12")
---
 drivers/crypto/snow3g/rte_snow3g_pmd.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 2e2c8412ae..8dfc8b3945 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -371,7 +371,8 @@ static int
 process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
 		struct snow3g_qp *qp, uint16_t *accumulated_enqueued_ops)
 {
-	unsigned enqueued_op, processed_op;
+	unsigned int processed_op;
+	int ret;
 
 	switch (session->op) {
 	case SNOW3G_OP_ONLY_CIPHER:
@@ -412,9 +413,13 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
 
 	if (unlikely(processed_op != 1))
 		return 0;
-	enqueued_op = rte_ring_enqueue(qp->processed_ops, op);
-	qp->qp_stats.enqueued_count += enqueued_op;
-	*accumulated_enqueued_ops += enqueued_op;
+
+	ret = rte_ring_enqueue(qp->processed_ops, op);
+	if (ret != 0)
+		return ret;
+
+	qp->qp_stats.enqueued_count += 1;
+	*accumulated_enqueued_ops += 1;
 
 	return 1;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment
  2023-04-17 16:08 [PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment Saoirse O'Donovan
@ 2023-04-17 16:14 ` Power, Ciara
  0 siblings, 0 replies; 2+ messages in thread
From: Power, Ciara @ 2023-04-17 16:14 UTC (permalink / raw)
  To: O'Donovan, Saoirse, De Lara Guarch, Pablo
  Cc: stable, O'Donovan, Saoirse, david.marchand



> -----Original Message-----
> From: Saoirse O'Donovan <saoirse.odonovan@intel.com>
> Sent: Monday 17 April 2023 17:09
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: stable@dpdk.org; O'Donovan, Saoirse <saoirse.odonovan@intel.com>;
> david.marchand@redhat.com
> Subject: [PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment
> 
> The two functions rte_ring_enqueue and rte_ring_enqueue_burst have different
> return values which weren't accounted for when updating enqueue stats. This
> meant that on success, the enqueued count and accumulated_enqueued_ops
> were being incremented by 0.
> 
> Fixes: 49abc602fa65 ("crypto/ipsec_mb: fix build with GCC 12")
> Cc: david.marchand@redhat.com
> 
> Signed-off-by: Saoirse O'Donovan <saoirse.odonovan@intel.com>
> 
> ---
> Upstream commit:
> Fixes: 468f31eb71c4 ("crypto/ipsec_mb: fix build with GCC 12")
> ---
>  drivers/crypto/snow3g/rte_snow3g_pmd.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c
> b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> index 2e2c8412ae..8dfc8b3945 100644
> --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
> +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
> @@ -371,7 +371,8 @@ static int
>  process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
>  		struct snow3g_qp *qp, uint16_t *accumulated_enqueued_ops)
> {
> -	unsigned enqueued_op, processed_op;
> +	unsigned int processed_op;
> +	int ret;
> 
>  	switch (session->op) {
>  	case SNOW3G_OP_ONLY_CIPHER:
> @@ -412,9 +413,13 @@ process_op_bit(struct rte_crypto_op *op, struct
> snow3g_session *session,
> 
>  	if (unlikely(processed_op != 1))
>  		return 0;
> -	enqueued_op = rte_ring_enqueue(qp->processed_ops, op);
> -	qp->qp_stats.enqueued_count += enqueued_op;
> -	*accumulated_enqueued_ops += enqueued_op;
> +
> +	ret = rte_ring_enqueue(qp->processed_ops, op);
> +	if (ret != 0)
> +		return ret;
> +
> +	qp->qp_stats.enqueued_count += 1;
> +	*accumulated_enqueued_ops += 1;
> 
>  	return 1;
>  }
> --
> 2.25.1

Acked-by: Ciara Power <ciara.power@intel.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-17 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 16:08 [PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment Saoirse O'Donovan
2023-04-17 16:14 ` Power, Ciara

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).