1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5 ***************************************************************************
6 * @file lac_buffer_desc.h
7 *
8 * @defgroup LacBufferDesc Buffer Descriptors
9 *
10 * @ingroup LacCommon
11 *
12 * Functions which handle updating a user supplied buffer with the QAT
13 * descriptor representation.
14 *
15 ***************************************************************************/
16
17 /***************************************************************************/
18
19 #ifndef LAC_BUFFER_DESC_H
20 #define LAC_BUFFER_DESC_H
21
22 /***************************************************************************
23 * Include header files
24 ***************************************************************************/
25 #include "cpa.h"
26 #include "icp_buffer_desc.h"
27 #include "cpa_cy_sym.h"
28 #include "lac_common.h"
29
30 /**
31 *******************************************************************************
32 * @ingroup LacBufferDesc
33 * Write the buffer descriptor in QAT friendly format.
34 *
35 * @description
36 * Updates the Meta Data associated with the pUserBufferList CpaBufferList
37 * This function will also return the (aligned) physical address
38 * associated with this CpaBufferList.
39 *
40 * @param[in] pUserBufferList A pointer to the buffer list to
41 * create the meta data for the QAT.
42 * @param[out] pBufferListAlignedPhyAddr The pointer to the aligned physical
43 * address.
44 * @param[in] isPhysicalAddress Type of address
45 * @param[in] pService Pointer to generic service
46 *
47 *****************************************************************************/
48 CpaStatus LacBuffDesc_BufferListDescWrite(const CpaBufferList *pUserBufferList,
49 Cpa64U *pBufferListAlignedPhyAddr,
50 CpaBoolean isPhysicalAddress,
51 sal_service_t *pService);
52
53 /**
54 *******************************************************************************
55 * @ingroup LacBufferDesc
56 * Write the buffer descriptor in QAT friendly format.
57 *
58 * @description
59 * Updates the Meta Data associated with the pUserBufferList CpaBufferList
60 * This function will also return the (aligned) physical address
61 * associated with this CpaBufferList. Zero length buffers are allowed.
62 * Should be used for CHA-CHA-POLY and GCM algorithms.
63 *
64 * @param[in] pUserBufferList A pointer to the buffer list to
65 * create the meta data for the QAT.
66 * @param[out] pBufferListAlignedPhyAddr The pointer to the aligned physical
67 * address.
68 * @param[in] isPhysicalAddress Type of address
69 * @param[in] pService Pointer to generic service
70 *
71 *****************************************************************************/
72 CpaStatus LacBuffDesc_BufferListDescWriteAndAllowZeroBuffer(
73 const CpaBufferList *pUserBufferList,
74 Cpa64U *pBufferListAlignedPhyAddr,
75 CpaBoolean isPhysicalAddress,
76 sal_service_t *pService);
77
78 /**
79 *******************************************************************************
80 * @ingroup LacBufferDesc
81 * Write the buffer descriptor in QAT friendly format.
82 *
83 * @description
84 * Updates the Meta Data associated with the PClientList CpaBufferList
85 * This function will also return the (aligned) physical address
86 * associated with this CpaBufferList and the total data length of the
87 * buffer list.
88 *
89 * @param[in] pUserBufferList A pointer to the buffer list to
90 * create the meta data for the QAT.
91 * @param[out] pBufListAlignedPhyAddr The pointer to the aligned physical
92 * address.
93 * @param[in] isPhysicalAddress Type of address
94 * @param[out] totalDataLenInBytes The pointer to the total data length
95 * of the buffer list
96 * @param[in] pService Pointer to generic service
97 *
98 *****************************************************************************/
99 CpaStatus
100 LacBuffDesc_BufferListDescWriteAndGetSize(const CpaBufferList *pUserBufferList,
101 Cpa64U *pBufListAlignedPhyAddr,
102 CpaBoolean isPhysicalAddress,
103 Cpa64U *totalDataLenInBytes,
104 sal_service_t *pService);
105
106 /**
107 *******************************************************************************
108 * @ingroup LacBufferDesc
109 * Ensure the CpaFlatBuffer is correctly formatted.
110 *
111 * @description
112 * Ensures the CpaFlatBuffer is correctly formatted
113 * This function will also return the total size of the buffers
114 * in the scatter gather list.
115 *
116 * @param[in] pUserFlatBuffer A pointer to the flat buffer to
117 * validate.
118 * @param[out] pPktSize The total size of the packet.
119 * @param[in] alignmentShiftExpected The expected alignment shift of each
120 * of the elements of the scatter gather
121 *
122 * @retval CPA_STATUS_INVALID_PARAM BufferList failed checks
123 * @retval CPA_STATUS_SUCCESS Function executed successfully
124 *
125 *****************************************************************************/
126 CpaStatus
127 LacBuffDesc_FlatBufferVerify(const CpaFlatBuffer *pUserFlatBuffer,
128 Cpa64U *pPktSize,
129 lac_aligment_shift_t alignmentShiftExpected);
130
131 /**
132 *******************************************************************************
133 * @ingroup LacBufferDesc
134 * Ensure the CpaFlatBuffer is correctly formatted.
135 * This function will allow a size of zero bytes to any of the Flat
136 * buffers.
137 *
138 * @description
139 * Ensures the CpaFlatBuffer is correctly formatted
140 * This function will also return the total size of the buffers
141 * in the scatter gather list.
142 *
143 * @param[in] pUserFlatBuffer A pointer to the flat buffer to
144 * validate.
145 * @param[out] pPktSize The total size of the packet.
146 * @param[in] alignmentShiftExpected The expected alignment shift of each
147 * of the elements of the scatter gather
148 *
149 * @retval CPA_STATUS_INVALID_PARAM BufferList failed checks
150 * @retval CPA_STATUS_SUCCESS Function executed successfully
151 *
152 *****************************************************************************/
153 CpaStatus
154 LacBuffDesc_FlatBufferVerifyNull(const CpaFlatBuffer *pUserFlatBuffer,
155 Cpa64U *pPktSize,
156 lac_aligment_shift_t alignmentShiftExpected);
157
158 /**
159 *******************************************************************************
160 * @ingroup LacBufferDesc
161 * Ensure the CpaBufferList is correctly formatted.
162 *
163 * @description
164 * Ensures the CpaBufferList pUserBufferList is correctly formatted
165 * including the user supplied metaData.
166 * This function will also return the total size of the buffers
167 * in the scatter gather list.
168 *
169 * @param[in] pUserBufferList A pointer to the buffer list to
170 * validate.
171 * @param[out] pPktSize The total size of the buffers in the
172 * scatter gather list.
173 * @param[in] alignmentShiftExpected The expected alignment shift of each
174 * of the elements of the scatter gather
175 * list.
176 * @retval CPA_STATUS_INVALID_PARAM BufferList failed checks
177 * @retval CPA_STATUS_SUCCESS Function executed successfully
178 *
179 *****************************************************************************/
180 CpaStatus
181 LacBuffDesc_BufferListVerify(const CpaBufferList *pUserBufferList,
182 Cpa64U *pPktSize,
183 lac_aligment_shift_t alignmentShiftExpected);
184
185 /**
186 *******************************************************************************
187 * @ingroup LacBufferDesc
188 * Ensure the CpaBufferList is correctly formatted.
189 *
190 * @description
191 * Ensures the CpaBufferList pUserBufferList is correctly formatted
192 * including the user supplied metaData.
193 * This function will also return the total size of the buffers
194 * in the scatter gather list.
195 *
196 * @param[in] pUserBufferList A pointer to the buffer list to
197 * validate.
198 * @param[out] pPktSize The total size of the buffers in the
199 * scatter gather list.
200 * @param[in] alignmentShiftExpected The expected alignment shift of each
201 * of the elements of the scatter gather
202 * list.
203 * @retval CPA_STATUS_INVALID_PARAM BufferList failed checks
204 * @retval CPA_STATUS_SUCCESS Function executed successfully
205 *
206 *****************************************************************************/
207 CpaStatus
208 LacBuffDesc_BufferListVerifyNull(const CpaBufferList *pUserBufferList,
209 Cpa64U *pPktSize,
210 lac_aligment_shift_t alignmentShiftExpected);
211
212 /**
213 *******************************************************************************
214 * @ingroup LacBufferDesc
215 * Get the total size of a CpaBufferList.
216 *
217 * @description
218 * This function returns the total size of the buffers
219 * in the scatter gather list.
220 *
221 * @param[in] pUserBufferList A pointer to the buffer list to
222 * calculate the total size for.
223 * @param[out] pPktSize The total size of the buffers in the
224 * scatter gather list.
225 *
226 *****************************************************************************/
227 void LacBuffDesc_BufferListTotalSizeGet(const CpaBufferList *pUserBufferList,
228 Cpa64U *pPktSize);
229
230 /**
231 *******************************************************************************
232 * @ingroup LacBufferDesc
233 * Zero some of the CpaBufferList.
234 *
235 * @description
236 * Zero a section of data within the CpaBufferList from an offset for
237 * a specific length.
238 *
239 * @param[in] pBuffList A pointer to the buffer list to
240 * zero an area of.
241 * @param[in] offset Number of bytes from start of buffer to where
242 * to start zeroing.
243 *
244 * @param[in] lenToZero Number of bytes that will be set to zero
245 * after the call to this function.
246 *****************************************************************************/
247
248 void LacBuffDesc_BufferListZeroFromOffset(CpaBufferList *pBuffList,
249 Cpa32U offset,
250 Cpa32U lenToZero);
251
252 #endif /* LAC_BUFFER_DESC_H */
Cache object: 86d445f975ddfb2b9d5b9e48a96d11a8
|