aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-06-07 15:28:24 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-06-12 00:09:44 +0300
commita01a7347c0092c733a1f2ef3b956c2a012b1d060 (patch)
treea52bf92620b3ea3e31d1c70f67821759755c7758
parent9533e1cd69e7f4c6aacd4683efc6810b415cf83d (diff)
linux-dpdk: crypto: add retry to rte_cryptodev_dequeue_burst()
There may be a delay until a DPDK crypto operation is completed. E.g. when using QAT PCIe cards. Retries max 100ms before failing. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--platform/linux-dpdk/odp_crypto.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c
index b8417dcb5..352a2e9dd 100644
--- a/platform/linux-dpdk/odp_crypto.c
+++ b/platform/linux-dpdk/odp_crypto.c
@@ -41,6 +41,10 @@
#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
sizeof(struct rte_crypto_sym_op))
+/* Max number of rte_cryptodev_dequeue_burst() retries (1 usec wait between
+ * retries). */
+#define MAX_DEQ_RETRIES 100000
+
typedef struct crypto_session_entry_s {
struct crypto_session_entry_s *next;
@@ -1720,6 +1724,7 @@ int odp_crypto_int(odp_packet_t pkt_in,
if (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE &&
rc_auth == ODP_CRYPTO_ALG_ERR_NONE) {
+ int retry_count = 0;
int queue_pair = odp_cpu_id();
int rc;
@@ -1734,8 +1739,18 @@ int odp_crypto_int(odp_packet_t pkt_in,
goto err_op_free;
}
- rc = rte_cryptodev_dequeue_burst(session->cdev_id,
- queue_pair, &op, 1);
+ /* There may be a delay until the crypto operation is
+ * completed. */
+ while (1) {
+ rc = rte_cryptodev_dequeue_burst(session->cdev_id,
+ queue_pair, &op, 1);
+ if (rc == 0 && retry_count < MAX_DEQ_RETRIES) {
+ odp_time_wait_ns(ODP_TIME_USEC_IN_NS);
+ retry_count++;
+ continue;
+ }
+ break;
+ }
if (rc == 0) {
ODP_ERR("Failed to dequeue packet");
goto err_op_free;