Skip to content

Commit b9d0128

Browse files
committed
Performance improvements for QuickAssist. Added new build option QAT_POLL_RESP_QUOTA to indicate maximum number of callbacks to service per poll. The default is 0 (all), was previously 8.
1 parent 3a31fef commit b9d0128

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

wolfcrypt/src/port/intel/quickassist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void* IntelQaPollingThread(void* context)
148148
printf("Polling Thread Start\n");
149149
#endif
150150
while (dev->qat.pollingCy) {
151-
icp_sal_CyPollInstance(dev->qat.handle, 8); /* max 8 callbacks */
151+
icp_sal_CyPollInstance(dev->qat.handle, QAT_POLL_RESP_QUOTA);
152152
wc_AsyncSleep(10);
153153
}
154154
#ifdef QAT_DEBUG
@@ -745,7 +745,7 @@ int IntelQaPoll(WC_ASYNC_DEV* dev)
745745
}
746746
#endif
747747

748-
status = icp_sal_CyPollInstance(dev->qat.handle, 8); /* max 8 callbacks */
748+
status = icp_sal_CyPollInstance(dev->qat.handle, QAT_POLL_RESP_QUOTA);
749749
if (status != CPA_STATUS_SUCCESS && status != CPA_STATUS_RETRY) {
750750
printf("IntelQa: Poll failure %d\n", status);
751751
ret = -1;

wolfssl/wolfcrypt/port/intel/quickassist.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,21 @@
8181
#define QAT_MAX_DEVICES (1) /* maximum number of QAT cards */
8282
#endif
8383
#ifndef QAT_MAX_PENDING
84-
#define QAT_MAX_PENDING (15) /* 120/num_threads = max num of concurrent ops */
84+
/* max num of concurrent ops */
85+
#ifdef WC_NO_ASYNC_THREADING
86+
#define QAT_MAX_PENDING (40)
87+
#elif defined(WC_ASYNC_BENCH_THREAD_COUNT)
88+
#define QAT_MAX_PENDING ((40/WC_ASYNC_BENCH_THREAD_COUNT)*2)
89+
#else
90+
#define QAT_MAX_PENDING (15)
91+
#endif
8592
#endif
8693
#ifndef QAT_RETRY_LIMIT
8794
#define QAT_RETRY_LIMIT (100)
8895
#endif
96+
#ifndef QAT_POLL_RESP_QUOTA
97+
#define QAT_POLL_RESP_QUOTA (0) /* all pending */
98+
#endif
8999

90100
/* TODO: Tune this value to get best performance */
91101
#ifndef WC_ASYNC_THRESH_AES_CBC

0 commit comments

Comments
 (0)