xref: /freebsd/sys/dev/qat/qat_api/include/cpa_dev.h (revision 2542189532b3025577fa4e782904494f3587008b)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2025 Intel Corporation */
3 
4 /*
5  *****************************************************************************
6  * Doxygen group definitions
7  ****************************************************************************/
8 
9 /**
10  *****************************************************************************
11  * @file cpa_dev.h
12  *
13  * @defgroup cpaDev Device API
14  *
15  * @ingroup cpa
16  *
17  * @description
18  *      These functions specify the API for device level operation.
19  *
20  * @remarks
21  *
22  *
23  *****************************************************************************/
24 
25 #ifndef CPA_DEV_H
26 #define CPA_DEV_H
27 
28 #ifdef __cplusplus
29 extern"C" {
30 #endif
31 
32 
33 #ifndef CPA_H
34 #include "cpa.h"
35 #endif
36 
37 
38  /*****************************************************************************
39  * @ingroup cpaDev
40  *      Returns device information
41  *
42  * @description
43  *      This data structure contains the device information. The device
44  *      information are available to both Physical and Virtual Functions.
45  *      Depending on the resource partitioning configuration, the services
46  *      available may changes. This configuration will impact the size of the
47  *      Security Association Database (SADB). Other properties such device SKU
48  *      and device ID are also reported.
49  *
50  *****************************************************************************/
51 typedef struct _CpaDeviceInfo {
52 	Cpa32U sku;
53 	/**< Identifies the SKU of the device. */
54 	Cpa16U bdf;
55 	/**< Identifies the Bus Device Function of the device.
56 	 *   Format is reported as follow:
57 	 *   - bits<2:0> represent the function number.
58 	 *   - bits<7:3> represent the device
59 	 *   - bits<15:8> represent the bus
60 	 */
61 	Cpa32U deviceId;
62 	/**< Returns the device ID. */
63 	Cpa32U numaNode;
64 	/**< Return the local NUMA node mapped to the device. */
65 	CpaBoolean isVf;
66 	/**< Return whether the device is currently used in a virtual function
67 	 *   or not. */
68 	CpaBoolean dcEnabled;
69     /**< Compression service enabled */
70 	CpaBoolean cySymEnabled;
71     /**< Symmetric crypto service enabled */
72 	CpaBoolean cyAsymEnabled;
73     /**< Asymmetric crypto service enabled */
74 	CpaBoolean inlineEnabled;
75     /**< Inline service enabled */
76 	Cpa32U deviceMemorySizeAvailable;
77 	/**< Return the size of the device memory available. This device memory
78 	 *   section could be used for the intermediate buffers in the
79 	 *   compression service.
80 	 */
81 } CpaDeviceInfo;
82 
83 
84 /*****************************************************************************
85 * @ingroup cpaDev
86 *      Returns number devices.
87 *
88 * @description
89 *      This API returns the number of devices available to the application.
90 *      If used on the host, it will return the number of physical devices.
91 *      If used on the guest, it will return the number of function mapped
92 *      to the virtual machine.
93 *
94 *****************************************************************************/
95 CpaStatus cpaGetNumDevices (Cpa16U *numDevices);
96 
97 /*****************************************************************************
98 * @ingroup cpaDev
99 *      Returns device information for a given device index.
100 *
101 * @description
102 *      Returns device information for a given device index. This API must
103 *      be used with cpaGetNumDevices().
104 *****************************************************************************/
105 CpaStatus cpaGetDeviceInfo (Cpa16U device, CpaDeviceInfo *deviceInfo);
106 
107 #ifdef __cplusplus
108 } /* close the extern "C" { */
109 #endif
110 
111 #endif /* CPA_DEV_H */
112