xref: /freebsd/sys/dev/qat/qat_api/include/cpa.h (revision 38a52bd3b5cac3da6f7f6eef3dd050e6aa08ebb3)
1 /***************************************************************************
2  *
3  *   BSD LICENSE
4  *
5  *   Copyright(c) 2007-2022 Intel Corporation. All rights reserved.
6  *   All rights reserved.
7  *
8  *   Redistribution and use in source and binary forms, with or without
9  *   modification, are permitted provided that the following conditions
10  *   are met:
11  *
12  *     * Redistributions of source code must retain the above copyright
13  *       notice, this list of conditions and the following disclaimer.
14  *     * Redistributions in binary form must reproduce the above copyright
15  *       notice, this list of conditions and the following disclaimer in
16  *       the documentation and/or other materials provided with the
17  *       distribution.
18  *     * Neither the name of Intel Corporation nor the names of its
19  *       contributors may be used to endorse or promote products derived
20  *       from this software without specific prior written permission.
21  *
22  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *
35  ***************************************************************************/
36 
37 /*
38  *****************************************************************************
39  * Doxygen group definitions
40  ****************************************************************************/
41 
42 /**
43  *****************************************************************************
44  * @file cpa.h
45  *
46  * @defgroup cpa CPA API
47  *
48  * @description
49  *      This is the top level API definition for Intel(R) QuickAssist Technology.
50  *		It contains structures, data types and definitions that are common
51  *		across the interface.
52  *
53  *****************************************************************************/
54 
55 /**
56  *****************************************************************************
57  * @defgroup cpa_BaseDataTypes Base Data Types
58  * @file cpa.h
59  *
60  * @ingroup cpa
61  *
62  * @description
63  *      The base data types for the Intel CPA API.
64  *
65  *****************************************************************************/
66 
67 #ifndef CPA_H
68 #define CPA_H
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 #include "cpa_types.h"
75 
76 /**
77  *****************************************************************************
78  * @ingroup cpa_BaseDataTypes
79  *      Instance handle type.
80  *
81  * @description
82  *      Handle used to uniquely identify an instance.
83  *
84  * @note
85  *      Where only a single instantiation exists this field may be set to
86  *      @ref CPA_INSTANCE_HANDLE_SINGLE.
87  *
88  *****************************************************************************/
89 typedef void * CpaInstanceHandle;
90 
91 /**
92  *****************************************************************************
93  * @ingroup cpa_BaseDataTypes
94  *      Default instantiation handle value where there is only a single instance
95  *
96  * @description
97  *      Used as an instance handle value where only one instance exists.
98  *
99  *****************************************************************************/
100 #define CPA_INSTANCE_HANDLE_SINGLE ((CpaInstanceHandle)0)
101 
102 /**
103  *****************************************************************************
104  * @ingroup cpa_BaseDataTypes
105  *      Physical memory address.
106  * @description
107  *      Type for physical memory addresses.
108  *****************************************************************************/
109 typedef Cpa64U CpaPhysicalAddr;
110 
111 /**
112  *****************************************************************************
113  * @ingroup cpa_BaseDataTypes
114  *      Virtual to physical address conversion routine.
115  *
116  * @description
117  *      This function is used to convert virtual addresses to physical
118  *      addresses.
119  *
120  * @context
121  *      The function shall not be called in an interrupt context.
122  * @assumptions
123  *      None
124  * @sideEffects
125  *      None
126  * @blocking
127  *      This function is synchronous and blocking.
128  * @reentrant
129  *      No
130  * @threadSafe
131  *      Yes
132  *
133  * @param[in] pVirtualAddr           Virtual address to be converted.
134  *
135  * @return
136  * 		Returns the corresponding physical address.
137  *      On error, the value NULL is returned.
138  *
139  * @post
140  *      None
141  * @see
142  *      None
143  *
144  *****************************************************************************/
145 typedef CpaPhysicalAddr (*CpaVirtualToPhysical)(void * pVirtualAddr);
146 
147 
148 /**
149  *****************************************************************************
150  * @ingroup cpa_BaseDataTypes
151  *      Flat buffer structure containing a pointer and length member.
152  *
153  * @description
154  *      A flat buffer structure. The data pointer, pData, is a virtual address.
155  *      An API instance may require the actual data to be in contiguous
156  *      physical memory as determined by @ref CpaInstanceInfo2.
157  *
158  *****************************************************************************/
159 typedef struct _CpaFlatBuffer {
160     Cpa32U dataLenInBytes;
161     /**< Data length specified in bytes.
162      * When used as an input parameter to a function, the length specifies
163      * the current length of the buffer.
164      * When used as an output parameter to a function, the length passed in
165      * specifies the maximum length of the buffer on return (i.e. the allocated
166      * length).  The implementation will not write past this length.  On return,
167      * the length is always unchanged. */
168   Cpa8U *pData;
169     /**< The data pointer is a virtual address, however the actual data pointed
170      * to is required to be in contiguous physical memory unless the field
171      requiresPhysicallyContiguousMemory in CpaInstanceInfo2 is false. */
172 } CpaFlatBuffer;
173 
174 /**
175  *****************************************************************************
176  * @ingroup cpa_BaseDataTypes
177  *      Scatter/Gather buffer list containing an array of flat buffers.
178  *
179  * @description
180  *      A scatter/gather buffer list structure.  This buffer structure is
181  *      typically used to represent a region of memory which is not
182  *      physically contiguous, by describing it as a collection of
183  *      buffers, each of which is physically contiguous.
184  *
185  * @note
186  *      The memory for the pPrivateMetaData member must be allocated
187  *      by the client as physically contiguous memory.  When allocating
188  *      memory for pPrivateMetaData, a call to the corresponding
189  *      BufferListGetMetaSize function (e.g. cpaCyBufferListGetMetaSize)
190  *      MUST be made to determine the size of the Meta Data Buffer.  The
191  *      returned size (in bytes) may then be passed in a memory allocation
192  *      routine to allocate the pPrivateMetaData memory.
193  *****************************************************************************/
194 typedef struct _CpaBufferList {
195     Cpa32U numBuffers;
196     /**< Number of buffers in the list */
197     CpaFlatBuffer *pBuffers;
198     /**< Pointer to an unbounded array containing the number of CpaFlatBuffers
199      * defined by numBuffers
200      */
201     void *pUserData;
202     /**< This is an opaque field that is not read or modified internally. */
203     void *pPrivateMetaData;
204     /**< Private representation of this buffer list.  The memory for this
205      * buffer needs to be allocated by the client as contiguous data.
206      * The amount of memory required is returned with a call to
207      * the corresponding BufferListGetMetaSize function. If that function
208      * returns a size of zero then no memory needs to be allocated, and this
209      * parameter can be NULL.
210      */
211 } CpaBufferList;
212 
213 /**
214  *****************************************************************************
215  * @ingroup cpa_BaseDataTypes
216  *      Flat buffer structure with physical address.
217  *
218  * @description
219  *      Functions taking this structure do not need to do any virtual to
220  *      physical address translation before writing the buffer to hardware.
221  *****************************************************************************/
222 typedef struct _CpaPhysFlatBuffer {
223     Cpa32U dataLenInBytes;
224     /**< Data length specified in bytes.
225      * When used as an input parameter to a function, the length specifies
226      * the current length of the buffer.
227      * When used as an output parameter to a function, the length passed in
228      * specifies the maximum length of the buffer on return (i.e. the allocated
229      * length).  The implementation will not write past this length.  On return,
230      * the length is always unchanged.
231      */
232     Cpa32U reserved;
233     /**< Reserved for alignment */
234     CpaPhysicalAddr bufferPhysAddr;
235     /**< The physical address at which the data resides.  The data pointed
236      * to is required to be in contiguous physical memory.
237      */
238 } CpaPhysFlatBuffer;
239 
240 /**
241  *****************************************************************************
242  * @ingroup cpa_BaseDataTypes
243  *      Scatter/gather list containing an array of flat buffers with
244  *      physical addresses.
245  *
246  * @description
247  *      Similar to @ref CpaBufferList, this buffer structure is typically
248  *      used to represent a region of memory which is not physically
249  *      contiguous, by describing it as a collection of buffers, each of
250  *      which is physically contiguous.  The difference is that, in this
251  *      case, the individual "flat" buffers are represented using
252  *      physical, rather than virtual, addresses.
253  *****************************************************************************/
254 typedef struct _CpaPhysBufferList {
255     Cpa64U reserved0;
256     /**< Reserved for internal usage */
257     Cpa32U numBuffers;
258     /**< Number of buffers in the list */
259     Cpa32U reserved1;
260     /**< Reserved for alignment */
261     CpaPhysFlatBuffer flatBuffers[];
262     /**< Array of flat buffer structures, of size numBuffers */
263 } CpaPhysBufferList;
264 
265 
266 /**
267  *****************************************************************************
268  * @ingroup cpa_BaseDataTypes
269  *      Special value which can be taken by length fields on some of the
270  *      "data plane" APIs to indicate that the buffer in question is of
271  *      type CpaPhysBufferList, rather than simply an array of bytes.
272  ****************************************************************************/
273 #define CPA_DP_BUFLIST ((Cpa32U)0xFFFFFFFF)
274 
275 
276 /**
277  *****************************************************************************
278  * @ingroup cpa_BaseDataTypes
279  *      API status value type definition
280  *
281  * @description
282  *      This type definition is used for the return values used in all the
283  *      API functions.  Common values are defined, for example see
284  *      @ref CPA_STATUS_SUCCESS, @ref CPA_STATUS_FAIL, etc.
285  *****************************************************************************/
286 typedef Cpa32S CpaStatus;
287 
288 #define CPA_STATUS_SUCCESS (0)
289 /**<
290  *  @ingroup cpa_BaseDataTypes
291  *   Success status value. */
292 #define CPA_STATUS_FAIL (-1)
293 /**<
294  *  @ingroup cpa_BaseDataTypes
295  *   Fail status value. */
296 #define CPA_STATUS_RETRY (-2)
297 /**<
298  *  @ingroup cpa_BaseDataTypes
299  *  Retry status value. */
300 #define CPA_STATUS_RESOURCE (-3)
301 /**<
302  *  @ingroup cpa_BaseDataTypes
303  *  The resource that has been requested is unavailable. Refer
304  *  to relevant sections of the API for specifics on what the suggested
305  *  course of action is. */
306 #define CPA_STATUS_INVALID_PARAM (-4)
307 /**<
308  *  @ingroup cpa_BaseDataTypes
309  *  Invalid parameter has been passed in. */
310 #define CPA_STATUS_FATAL (-5)
311 /**<
312  *  @ingroup cpa_BaseDataTypes
313  *  A serious error has occurred. Recommended course of action
314  *  is to shutdown and restart the component. */
315 #define CPA_STATUS_UNSUPPORTED (-6)
316 /**<
317  *  @ingroup cpa_BaseDataTypes
318  *  The function is not supported, at least not with the specific
319  *  parameters supplied.  This may be because a particular
320  *  capability is not supported by the current implementation. */
321 #define CPA_STATUS_RESTARTING (-7)
322 /**<
323  *  @ingroup cpa_BaseDataTypes
324  *  The API implementation is restarting. This may be reported if, for example,
325  *  a hardware implementation is undergoing a reset. Recommended course of
326  *  action is to retry the request. */
327 
328 /**
329  *****************************************************************************
330  * @ingroup cpa_BaseDataTypes
331  *      API status string type definition
332  * @description
333  *      This type definition is used for the generic status text strings
334  *      provided by cpaXxGetStatusText API functions.  Common values are
335  *      defined, for example see @ref CPA_STATUS_STR_SUCCESS,
336  *      @ref CPA_STATUS_FAIL, etc., as well as the maximum size
337  *      @ref CPA_STATUS_MAX_STR_LENGTH_IN_BYTES.
338  *****************************************************************************/
339 #define CPA_STATUS_MAX_STR_LENGTH_IN_BYTES (255)
340 /**<
341  *  @ingroup cpa_BaseDataTypes
342  *   Maximum length of the Overall Status String (including generic and specific
343  *   strings returned by calls to cpaXxGetStatusText) */
344 
345 #define CPA_STATUS_STR_SUCCESS       ("Operation was successful:")
346 /**<
347  *  @ingroup cpa_BaseDataTypes
348  *   Status string for @ref CPA_STATUS_SUCCESS. */
349 #define CPA_STATUS_STR_FAIL          ("General or unspecified error occurred:")
350 /**<
351  *  @ingroup cpa_BaseDataTypes
352  *   Status string for @ref CPA_STATUS_FAIL. */
353 #define CPA_STATUS_STR_RETRY         ("Recoverable error occurred:")
354 /**<
355  *  @ingroup cpa_BaseDataTypes
356  *   Status string for @ref CPA_STATUS_RETRY. */
357 #define CPA_STATUS_STR_RESOURCE      ("Required resource unavailable:")
358 /**<
359  *  @ingroup cpa_BaseDataTypes
360  *   Status string for @ref CPA_STATUS_RESOURCE. */
361 #define CPA_STATUS_STR_INVALID_PARAM ("Invalid parameter supplied:")
362 /**<
363  *  @ingroup cpa_BaseDataTypes
364  *   Status string for @ref CPA_STATUS_INVALID_PARAM. */
365 #define CPA_STATUS_STR_FATAL         ("Fatal error has occurred:")
366 /**<
367  *  @ingroup cpa_BaseDataTypes
368  *   Status string for @ref CPA_STATUS_FATAL. */
369 #define CPA_STATUS_STR_UNSUPPORTED   ("Operation not supported:")
370 /**<
371  *  @ingroup cpa_BaseDataTypes
372  *   Status string for @ref CPA_STATUS_UNSUPPORTED. */
373 
374 /**
375  *****************************************************************************
376  * @ingroup cpa_BaseDataTypes
377  *      Instance Types
378  *
379  * @deprecated
380  * 		As of v1.3 of the Crypto API, this enum has been deprecated,
381  * 		replaced by @ref CpaAccelerationServiceType.
382  *
383  * @description
384  *      Enumeration of the different instance types.
385  *
386  *****************************************************************************/
387 typedef enum _CpaInstanceType
388 {
389     CPA_INSTANCE_TYPE_CRYPTO = 0,
390     /**< Cryptographic instance type */
391     CPA_INSTANCE_TYPE_DATA_COMPRESSION,
392     /**< Data compression instance type */
393     CPA_INSTANCE_TYPE_RAID,
394     /**< RAID instance type */
395     CPA_INSTANCE_TYPE_XML,
396     /**< XML instance type */
397     CPA_INSTANCE_TYPE_REGEX
398     /**< Regular Expression instance type */
399 } CpaInstanceType CPA_DEPRECATED;
400 
401 /**
402  *****************************************************************************
403  * @ingroup cpa_BaseDataTypes
404  *      Service Type
405  * @description
406  *      Enumeration of the different service types.
407  *
408  *****************************************************************************/
409 typedef enum _CpaAccelerationServiceType
410 {
411     CPA_ACC_SVC_TYPE_CRYPTO = CPA_INSTANCE_TYPE_CRYPTO,
412     /**< Cryptography */
413     CPA_ACC_SVC_TYPE_DATA_COMPRESSION = CPA_INSTANCE_TYPE_DATA_COMPRESSION,
414     /**< Data Compression */
415     CPA_ACC_SVC_TYPE_PATTERN_MATCH = CPA_INSTANCE_TYPE_REGEX,
416     /**< Pattern Match */
417     CPA_ACC_SVC_TYPE_RAID = CPA_INSTANCE_TYPE_RAID,
418     /**< RAID */
419     CPA_ACC_SVC_TYPE_XML = CPA_INSTANCE_TYPE_XML,
420     /**< XML */
421     CPA_ACC_SVC_TYPE_VIDEO_ANALYTICS
422     /**< Video Analytics */
423 } CpaAccelerationServiceType;
424 
425 /**
426  *****************************************************************************
427  * @ingroup cpa_BaseDataTypes
428  *      Instance State
429  *
430  * @deprecated
431  *      As of v1.3 of the Crypto API, this enum has been deprecated,
432  *      replaced by @ref CpaOperationalState.
433  *
434  * @description
435  *      Enumeration of the different instance states that are possible.
436  *
437  *****************************************************************************/
438 typedef enum _CpaInstanceState
439 {
440     CPA_INSTANCE_STATE_INITIALISED = 0,
441     /**< Instance is in the initialized state and ready for use. */
442     CPA_INSTANCE_STATE_SHUTDOWN
443     /**< Instance is in the shutdown state and not available for use. */
444 } CpaInstanceState CPA_DEPRECATED;
445 
446 /**
447  *****************************************************************************
448  * @ingroup cpa_BaseDataTypes
449  *      Instance operational state
450  * @description
451  *      Enumeration of the different operational states that are possible.
452  *
453  *****************************************************************************/
454 typedef enum _CpaOperationalState
455 {
456     CPA_OPER_STATE_DOWN= 0,
457     /**< Instance is not available for use. May not yet be initialized,
458      * or stopped. */
459     CPA_OPER_STATE_UP
460     /**< Instance is available for use. Has been initialized and started. */
461 } CpaOperationalState;
462 
463 #define CPA_INSTANCE_MAX_NAME_SIZE_IN_BYTES 64
464 /**<
465  *  @ingroup cpa_BaseDataTypes
466  *  Maximum instance info name string length in bytes */
467 #define CPA_INSTANCE_MAX_ID_SIZE_IN_BYTES 128
468 /**<
469  *  @ingroup cpa_BaseDataTypes
470  *  Maximum instance info id string length in bytes */
471 #define CPA_INSTANCE_MAX_VERSION_SIZE_IN_BYTES 64
472 /**<
473  *  @ingroup cpa_BaseDataTypes
474  * Maximum instance info version string length in bytes */
475 
476 /**
477  *****************************************************************************
478  * @ingroup cpa_BaseDataTypes
479  *      Instance Info Structure
480  *
481  * @deprecated
482  * 		As of v1.3 of the Crypto API, this structure has been deprecated,
483  * 		replaced by CpaInstanceInfo2.
484  *
485  * @description
486  *      Structure that contains the information to describe the instance.
487  *
488  *****************************************************************************/
489 typedef struct _CpaInstanceInfo {
490     enum _CpaInstanceType type;
491     /**< Type definition for this instance. */
492     enum _CpaInstanceState state;
493     /**< Operational state of the instance. */
494     Cpa8U name[CPA_INSTANCE_MAX_NAME_SIZE_IN_BYTES];
495     /**< Simple text string identifier for the instance. */
496     Cpa8U version[CPA_INSTANCE_MAX_VERSION_SIZE_IN_BYTES];
497     /**< Version string. There may be multiple versions of the same type of
498      * instance accessible through a particular library. */
499 } CpaInstanceInfo CPA_DEPRECATED;
500 
501 /**
502  *****************************************************************************
503  * @ingroup cpa_BaseDataTypes
504  *      Physical Instance ID
505  * @description
506  *      Identifies the physical instance of an accelerator execution
507  *      engine.
508  *
509  *      Accelerators grouped into "packages".  Each accelerator can in
510  *      turn contain one or more execution engines.  Implementations of
511  *      this API will define the packageId, acceleratorId,
512  *      executionEngineId and busAddress as appropriate for the
513  *      implementation.  For example, for hardware-based accelerators,
514  *      the packageId might identify the chip, which might contain
515  *      multiple accelerators, each of which might contain multiple
516  *      execution engines. The combination of packageId, acceleratorId
517  *      and executionEngineId uniquely identifies the instance.
518  *
519  *      Hardware based accelerators implementing this API may also provide
520  *      information on the location of the accelerator in the busAddress
521  *      field. This field will be defined as appropriate for the
522  *      implementation. For example, for PCIe attached accelerators,
523  *      the busAddress may contain the PCIe bus, device and function
524  *      number of the accelerators.
525  *
526  *****************************************************************************/
527 typedef struct _CpaPhysicalInstanceId {
528     Cpa16U packageId;
529     /**< Identifies the package within which the accelerator is
530      * contained. */
531     Cpa16U acceleratorId;
532     /**< Identifies the specific accelerator within the package. */
533     Cpa16U executionEngineId;
534     /**< Identifies the specific execution engine within the
535      * accelerator. */
536     Cpa16U busAddress;
537     /**< Identifies the bus address associated with the accelerator
538      * execution engine. */
539     Cpa32U kptAcHandle;
540     /**< Identifies the achandle of the accelerator. */
541 } CpaPhysicalInstanceId;
542 
543 /**
544  *****************************************************************************
545  * @ingroup cpa_BaseDataTypes
546  *      Instance Info Structure, version 2
547  * @description
548  *      Structure that contains the information to describe the instance.
549  *
550  *****************************************************************************/
551 typedef struct _CpaInstanceInfo2 {
552     CpaAccelerationServiceType accelerationServiceType;
553     /**< Type of service provided by this instance. */
554 #define CPA_INST_VENDOR_NAME_SIZE CPA_INSTANCE_MAX_NAME_SIZE_IN_BYTES
555     /**< Maximum length of the vendor name. */
556     Cpa8U vendorName[CPA_INST_VENDOR_NAME_SIZE];
557     /**< String identifying the vendor of the accelerator. */
558 
559 #define CPA_INST_PART_NAME_SIZE CPA_INSTANCE_MAX_NAME_SIZE_IN_BYTES
560     /**< Maximum length of the part name. */
561     Cpa8U partName[CPA_INST_PART_NAME_SIZE];
562     /**< String identifying the part (name and/or number). */
563 
564 #define CPA_INST_SW_VERSION_SIZE CPA_INSTANCE_MAX_VERSION_SIZE_IN_BYTES
565     /**< Maximum length of the software version string. */
566     Cpa8U swVersion[CPA_INST_SW_VERSION_SIZE];
567     /**< String identifying the version of the software associated with
568      * the instance.  For hardware-based implementations of the API,
569      * this should be the driver version.  For software-based
570      * implementations of the API, this should be the version of the
571      * library.
572      *
573      * Note that this should NOT be used to store the version of the
574      * API, nor should it be used to report the hardware revision
575      * (which can be captured as part of the @ref partName, if required). */
576 
577 #define CPA_INST_NAME_SIZE CPA_INSTANCE_MAX_NAME_SIZE_IN_BYTES
578     /**< Maximum length of the instance name. */
579     Cpa8U instName[CPA_INST_NAME_SIZE];
580     /**< String identifying the name of the instance. */
581 
582 #define CPA_INST_ID_SIZE CPA_INSTANCE_MAX_ID_SIZE_IN_BYTES
583     Cpa8U instID[CPA_INST_ID_SIZE];
584     /**< String containing a unique identifier for the instance */
585 
586     CpaPhysicalInstanceId physInstId;
587     /**< Identifies the "physical instance" of the accelerator. */
588 
589 #define CPA_MAX_CORES 256
590     /**< Maximum number of cores to support in the coreAffinity bitmap. */
591     CPA_BITMAP(coreAffinity, CPA_MAX_CORES);
592     /**< A bitmap identifying the core or cores to which the instance
593      * is affinitized in an SMP operating system.
594      *
595      * The term core here is used to mean a "logical" core - for example,
596      * in a dual-processor, quad-core system with hyperthreading (two
597      * threads per core), there would be 16 such cores (2 processors x
598      * 4 cores/processor x 2 threads/core).  The numbering of these cores
599      * and the corresponding bit positions is OS-specific.  Note that Linux
600      * refers to this as "processor affinity" or "CPU affinity", and refers
601      * to the bitmap as a "cpumask".
602      *
603      * The term "affinity" is used to mean that this is the core on which
604      * the callback function will be invoked when using the asynchronous
605      * mode of the API.  In a hardware-based implementation of the API,
606      * this might be the core to which the interrupt is affinitized.
607      * In a software-based implementation, this might be the core to which
608      * the process running the algorithm is affinitized.  Where there is
609      * no affinity, the bitmap can be set to all zeroes.
610      *
611      * This bitmap should be manipulated using the macros @ref
612      * CPA_BITMAP_BIT_SET, @ref CPA_BITMAP_BIT_CLEAR and @ref
613      * CPA_BITMAP_BIT_TEST. */
614 
615     Cpa32U nodeAffinity;
616     /**< Identifies the processor complex, or node, to which the accelerator
617      * is physically connected, to help identify locality in NUMA systems.
618      *
619      * The values taken by this attribute will typically be in the range
620      * 0..n-1, where n is the number of nodes (processor complexes) in the
621      * system.  For example, in a dual-processor configuration, n=2.  The
622      * precise values and their interpretation are OS-specific. */
623 
624     CpaOperationalState operState;
625     /**< Operational state of the instance. */
626     CpaBoolean requiresPhysicallyContiguousMemory;
627     /**< Specifies whether the data pointed to by flat buffers
628      * (CpaFlatBuffer::pData) supplied to this instance must be in
629      * physically contiguous memory. */
630     CpaBoolean isPolled;
631     /**< Specifies whether the instance must be polled, or is event driven.
632      * For hardware accelerators, the alternative to polling would be
633      * interrupts. */
634     CpaBoolean isOffloaded;
635     /**< Identifies whether the instance uses hardware offload, or is a
636      * software-only implementation. */
637 } CpaInstanceInfo2;
638 
639 /**
640  *****************************************************************************
641  * @ingroup cpa_BaseDataTypes
642  *      Instance Events
643  * @description
644  *      Enumeration of the different events that will cause the registered
645  *  Instance notification callback function to be invoked.
646  *
647  *****************************************************************************/
648 typedef enum _CpaInstanceEvent
649 {
650     CPA_INSTANCE_EVENT_RESTARTING = 0,
651     /**< Event type that triggers the registered instance notification callback
652      * function when and instance is restarting. The reason why an instance is
653      * restarting is implementation specific. For example a hardware
654      * implementation may send this event if the hardware device is about to
655      * be reset.
656      */
657     CPA_INSTANCE_EVENT_RESTARTED,
658     /**< Event type that triggers the registered instance notification callback
659      * function when and instance has restarted. The reason why an instance has
660      * restarted is implementation specific. For example a hardware
661      * implementation may send this event after the hardware device has
662      * been reset.
663      */
664     CPA_INSTANCE_EVENT_FATAL_ERROR
665     /**< Event type that triggers the registered instance notification callback
666      * function when an error has been detected that requires the device
667      * to be reset.
668      * This event will be sent by all instances using the device, both on the
669      * host and guests.
670      */
671 } CpaInstanceEvent;
672 
673 #ifdef __cplusplus
674 } /* close the extern "C" { */
675 #endif
676 
677 #endif /* CPA_H */
678