[PATCH 20.11] crypto/snow3g: fix snow3g enqueue stat increment

Saoirse O'Donovan saoirse.odonovan at intel.com
Mon Apr 17 18:08:47 CEST 2023


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 at redhat.com

Signed-off-by: Saoirse O'Donovan <saoirse.odonovan at 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



More information about the stable mailing list