Skip to contentSkip to conversation

crypto: qat - ring returning retry even though ring has BW

PATCH In review Tadeusz Struk 2 participants 2 messages Dec 9, 2015 – Dec 12, 2015 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: qat - ring returning retry even though ring has BW

From: Harvijay Saini <[email protected]>

When many threads submit multiple requests they get blocked until all responses are processed, which prevents them from submitting more requests even though there is space on the rings.
To fix this we need to decrement the inflight counter early to in the callback.

---
 drivers/crypto/qat/qat_common/adf_transport.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/adf_transport.c +2 -3
index eff00cd..a6f3766 100644
@@ -141,6 +141,7 @@ static int adf_handle_response(struct adf_etr_ring_data *ring)
 
 	while (*msg != ADF_RING_EMPTY_SIG) {
 		ring->callback((uint32_t *)msg);
+		atomic_dec(ring->inflights);
 		*msg = ADF_RING_EMPTY_SIG;
 		ring->head = adf_modulo(ring->head +
 					ADF_MSG_SIZE_TO_BYTES(ring->msg_size),
@@ -148,12 +149,10 @@ static int adf_handle_response(struct adf_etr_ring_data *ring)
 		msg_counter++;
 		msg = (uint32_t *)((uintptr_t)ring->base_addr + ring->head);
 	}
-	if (msg_counter > 0) {
+	if (msg_counter > 0)
 		WRITE_CSR_RING_HEAD(ring->bank->csr_addr,
 				    ring->bank->bank_number,
 				    ring->ring_number, ring->head);
-		atomic_sub(msg_counter, ring->inflights);
-	}
 	return 0;
 }
 
maintainer
#1 lore raw
Quoted 9 lines · Tadeusz Struk

From: Harvijay Saini <[email protected]>

When many threads submit multiple requests they get blocked until all responses are processed, which prevents them from submitting more requests even though there is space on the rings.
To fix this we need to decrement the inflight counter early to in the callback.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt