Skip to contentSkip to conversation

crypto/ipsec_mb: enqueue counter fix

PATCH Superseded Saoirse O'Donovan 4 participants 6 messages Apr 18, 2023 – May 24, 2023 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/ipsec_mb: enqueue counter fix

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")

---
A similar fix has been sent to 20.11 LTS stable, in the interest of time. In that fix, the enqueued stat is still in use, therefore only the fix to the count increment was necessary.

Here is the mail archive link:
https://mails.dpdk.org/archives/stable/2023-April/043550.html

---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +8 -8
index 8ed069f428..e64df1a462 100644
@@ -372,9 +372,10 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 /** Process a crypto op with length/offset in bits. */
 static int
 process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
-		struct ipsec_mb_qp *qp, uint16_t *accumulated_enqueued_ops)
+		struct ipsec_mb_qp *qp)
 {
-	uint32_t enqueued_op, processed_op;
+	unsigned int processed_op;
+	int ret;
 
 	switch (session->op) {
 	case IPSEC_MB_OP_ENCRYPT_ONLY:
@@ -421,9 +422,10 @@ 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->ingress_queue, op);
-	qp->stats.enqueued_count += enqueued_op;
-	*accumulated_enqueued_ops += enqueued_op;
+
+	ret = rte_ring_enqueue(qp->ingress_queue, op);
+	if (ret != 0)
+		return ret;
 
 	return 1;
 }
@@ -439,7 +441,6 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
 	struct snow3g_session *prev_sess = NULL, *curr_sess = NULL;
 	uint32_t i;
 	uint8_t burst_size = 0;
-	uint16_t enqueued_ops = 0;
 	uint8_t processed_ops;
 	uint32_t nb_dequeued;
 
@@ -479,8 +480,7 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
 				prev_sess = NULL;
 			}
 
-			processed_ops = process_op_bit(curr_c_op, curr_sess,
-							qp, &enqueued_ops);
+			processed_ops = process_op_bit(curr_c_op, curr_sess, qp);
 			if (processed_ops != 1)
 				break;
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 27 lines

-----Original Message-----
From: Saoirse O'Donovan <[email protected]>
Sent: Tuesday 18 April 2023 15:23
To: Ji, Kai <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Cc: [email protected]; [email protected]; O'Donovan, Saoirse <[email protected]>; Bronowski, PiotrX <[email protected]>
Subject: [PATCH] crypto/ipsec_mb: enqueue counter fix

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")

---
A similar fix has been sent to 20.11 LTS stable, in the interest of time. In that fix, the enqueued stat is still in use, therefore only the fix to the count increment was necessary.

Quoted 6 lines

Here is the mail archive link:
https://mails.dpdk.org/archives/stable/2023-April/043550.html

---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
#2 lore raw

PATCH v2 1/1 crypto/ipsec_mb: enqueue counter fix

In reply to Saoirse O'Donovan

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")

---
v2: Added cc stable for 21.11 and 22.11 backport.

A similar fix has been sent to 20.11 LTS stable, in the interest of time. In that fix, the enqueued stat is still in use, therefore only the fix to the count increment was necessary.

Here is the mail archive link:
https://mails.dpdk.org/archives/stable/2023-April/043550.html

---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +8 -8
index 8ed069f428..e64df1a462 100644
@@ -372,9 +372,10 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
 /** Process a crypto op with length/offset in bits. */
 static int
 process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
-		struct ipsec_mb_qp *qp, uint16_t *accumulated_enqueued_ops)
+		struct ipsec_mb_qp *qp)
 {
-	uint32_t enqueued_op, processed_op;
+	unsigned int processed_op;
+	int ret;
 
 	switch (session->op) {
 	case IPSEC_MB_OP_ENCRYPT_ONLY:
@@ -421,9 +422,10 @@ 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->ingress_queue, op);
-	qp->stats.enqueued_count += enqueued_op;
-	*accumulated_enqueued_ops += enqueued_op;
+
+	ret = rte_ring_enqueue(qp->ingress_queue, op);
+	if (ret != 0)
+		return ret;
 
 	return 1;
 }
@@ -439,7 +441,6 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
 	struct snow3g_session *prev_sess = NULL, *curr_sess = NULL;
 	uint32_t i;
 	uint8_t burst_size = 0;
-	uint16_t enqueued_ops = 0;
 	uint8_t processed_ops;
 	uint32_t nb_dequeued;
 
@@ -479,8 +480,7 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
 				prev_sess = NULL;
 			}
 
-			processed_ops = process_op_bit(curr_c_op, curr_sess,
-							qp, &enqueued_ops);
+			processed_ops = process_op_bit(curr_c_op, curr_sess, qp);
 			if (processed_ops != 1)
 				break;
 
Signature · 1 line
2.25.1
#3 lore raw
Quoted 9 lines · Saoirse O'Donovan

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")
Quoted 9 lines

---
v2: Added cc stable for 21.11 and 22.11 backport.

A similar fix has been sent to 20.11 LTS stable, in the interest of time. In that fix, the enqueued stat is still in use, therefore only the fix to the count increment was necessary.

Thanks for the explanation. As it has the correct tags, we will pick this up for 21.11 and 22.11 LTS releases in the normal workflow, which is after it has been released as part of a DPDK main branch release.

thanks,
Kevin.

Quoted 55 lines

Here is the mail archive link:
https://mails.dpdk.org/archives/stable/2023-April/043550.html

---
  drivers/crypto/ipsec_mb/pmd_snow3g.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +8 -8
index 8ed069f428..e64df1a462 100644
@@ -372,9 +372,10 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
  /** Process a crypto op with length/offset in bits. */
  static int
  process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session,
-		struct ipsec_mb_qp *qp, uint16_t *accumulated_enqueued_ops)
+		struct ipsec_mb_qp *qp)
  {
-	uint32_t enqueued_op, processed_op;
+	unsigned int processed_op;
+	int ret;
 
  	switch (session->op) {
  	case IPSEC_MB_OP_ENCRYPT_ONLY:
@@ -421,9 +422,10 @@ 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->ingress_queue, op);
-	qp->stats.enqueued_count += enqueued_op;
-	*accumulated_enqueued_ops += enqueued_op;
+
+	ret = rte_ring_enqueue(qp->ingress_queue, op);
+	if (ret != 0)
+		return ret;
 
  	return 1;
  }
@@ -439,7 +441,6 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
  	struct snow3g_session *prev_sess = NULL, *curr_sess = NULL;
  	uint32_t i;
  	uint8_t burst_size = 0;
-	uint16_t enqueued_ops = 0;
  	uint8_t processed_ops;
  	uint32_t nb_dequeued;
 
@@ -479,8 +480,7 @@ snow3g_pmd_dequeue_burst(void *queue_pair,
  				prev_sess = NULL;
  			}
 
-			processed_ops = process_op_bit(curr_c_op, curr_sess,
-							qp, &enqueued_ops);
+			processed_ops = process_op_bit(curr_c_op, curr_sess, qp);
  			if (processed_ops != 1)
  				break;
 
Acked-by on v2 1/1
#4 lore raw
In reply to Saoirse O'Donovan
Quoted 29 lines

-----Original Message-----
From: Saoirse O'Donovan <[email protected]>
Sent: Thursday 20 April 2023 11:32
To: Ji, Kai <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Cc: [email protected]; O'Donovan, Saoirse <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v2] crypto/ipsec_mb: enqueue counter fix

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")

---
v2: Added cc stable for 21.11 and 22.11 backport.

A similar fix has been sent to 20.11 LTS stable, in the interest of time. In that fix, the enqueued stat is still in use, therefore only the fix to the count increment was necessary.

Quoted 5 lines

Here is the mail archive link:
https://mails.dpdk.org/archives/stable/2023-April/043550.html

---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Applied
#5 lore raw
In reply to Saoirse O'Donovan
Quoted 5 lines

This patch removes enqueue op counter update from the process_op_bit function where the process is now done in dequeue stage. The original stats increment was incorrect as they shouldn't have been updated at all in this function.

Quoted 7 lines
Fixes 4f1cfda59ad3 ("crypto/ipsec_mb: move snow3g PMD")

---

Applied to dpdk-next-crypto

Thanks.