1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5 *****************************************************************************
6 * @file lac_sync.c Utility functions containing synchronous callback support
7 * functions
8 *
9 * @ingroup LacSync
10 *
11 *****************************************************************************/
12
13 /*
14 *******************************************************************************
15 * Include public/global header files
16 *******************************************************************************
17 */
18 #include "lac_sync.h"
19 #include "lac_common.h"
20
21 /*
22 *******************************************************************************
23 * Define public/global function definitions
24 *******************************************************************************
25 */
26
27 /**
28 *****************************************************************************
29 * @ingroup LacSync
30 *****************************************************************************/
31 void
32 LacSync_GenWakeupSyncCaller(void *pCallbackTag, CpaStatus status)
33 {
34 lac_sync_op_data_t *pSc = (lac_sync_op_data_t *)pCallbackTag;
35 if (pSc != NULL) {
36 if (pSc->canceled) {
37 QAT_UTILS_LOG("Synchronous operation cancelled.\n");
38 return;
39 }
40 pSc->status = status;
41 if (CPA_STATUS_SUCCESS != LAC_POST_SEMAPHORE(pSc->sid)) {
42 QAT_UTILS_LOG("Failed to post semaphore.\n");
43 }
44 }
45 }
46
47 /**
48 *****************************************************************************
49 * @ingroup LacSync
50 *****************************************************************************/
51 void
52 LacSync_GenVerifyWakeupSyncCaller(void *pCallbackTag,
53 CpaStatus status,
54 CpaBoolean opResult)
55 {
56 lac_sync_op_data_t *pSc = (lac_sync_op_data_t *)pCallbackTag;
57 if (pSc != NULL) {
58 if (pSc->canceled) {
59 QAT_UTILS_LOG("Synchronous operation cancelled.\n");
60 return;
61 }
62 pSc->status = status;
63 pSc->opResult = opResult;
64 if (CPA_STATUS_SUCCESS != LAC_POST_SEMAPHORE(pSc->sid)) {
65 QAT_UTILS_LOG("Failed to post semaphore.\n");
66 }
67 }
68 }
69
70 /**
71 *****************************************************************************
72 * @ingroup LacSync
73 *****************************************************************************/
74 void
75 LacSync_GenVerifyCb(void *pCallbackTag,
76 CpaStatus status,
77 void *pOpData,
78 CpaBoolean opResult)
79 {
80 LacSync_GenVerifyWakeupSyncCaller(pCallbackTag, status, opResult);
81 }
82
83 /**
84 *****************************************************************************
85 * @ingroup LacSync
86 *****************************************************************************/
87 void
88 LacSync_GenFlatBufCb(void *pCallbackTag,
89 CpaStatus status,
90 void *pOpData,
91 CpaFlatBuffer *pOut)
92 {
93 LacSync_GenWakeupSyncCaller(pCallbackTag, status);
94 }
95
96 /**
97 *****************************************************************************
98 * @ingroup LacSync
99 *****************************************************************************/
100 void
101 LacSync_GenFlatBufVerifyCb(void *pCallbackTag,
102 CpaStatus status,
103 void *pOpData,
104 CpaBoolean opResult,
105 CpaFlatBuffer *pOut)
106 {
107 LacSync_GenVerifyWakeupSyncCaller(pCallbackTag, status, opResult);
108 }
109
110 /**
111 *****************************************************************************
112 * @ingroup LacSync
113 *****************************************************************************/
114 void
115 LacSync_GenDualFlatBufVerifyCb(void *pCallbackTag,
116 CpaStatus status,
117 void *pOpdata,
118 CpaBoolean opResult,
119 CpaFlatBuffer *pOut0,
120 CpaFlatBuffer *pOut1)
121 {
122 LacSync_GenVerifyWakeupSyncCaller(pCallbackTag, status, opResult);
123 }
Cache object: fc8265c9ba7571f43c99c7affec7e86f
|