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_dev.h 45 * 46 * @defgroup cpaDev Device API 47 * 48 * @ingroup cpa 49 * 50 * @description 51 * These functions specify the API for device level operation. 52 * 53 * @remarks 54 * 55 * 56 *****************************************************************************/ 57 58 #ifndef CPA_DEV_H 59 #define CPA_DEV_H 60 61 #ifdef __cplusplus 62 extern"C" { 63 #endif 64 65 66 #ifndef CPA_H 67 #include "cpa.h" 68 #endif 69 70 71 /***************************************************************************** 72 * @ingroup cpaDev 73 * Returns device information 74 * 75 * @description 76 * This data structure contains the device information. The device 77 * information are available to both Physical and Virtual Functions. 78 * Depending on the resource partitioning configuration, the services 79 * available may changes. This configuration will impact the size of the 80 * Security Association Database (SADB). Other properties such device SKU 81 * and device ID are also reported. 82 * 83 *****************************************************************************/ 84 typedef struct _CpaDeviceInfo { 85 Cpa32U sku; 86 /**< Identifies the SKU of the device. */ 87 Cpa16U bdf; 88 /**< Identifies the Bus Device Function of the device. 89 * Format is reported as follow: 90 * - bits<2:0> represent the function number. 91 * - bits<7:3> represent the device 92 * - bits<15:8> represent the bus 93 */ 94 Cpa32U deviceId; 95 /**< Returns the device ID. */ 96 Cpa32U numaNode; 97 /**< Return the local NUMA node mapped to the device. */ 98 CpaBoolean isVf; 99 /**< Return whether the device is currently used in a virtual function 100 * or not. */ 101 CpaBoolean dcEnabled; 102 /**< Compression service enabled */ 103 CpaBoolean cySymEnabled; 104 /**< Symetric crypto service enabled */ 105 CpaBoolean cyAsymEnabled; 106 /**< Asymetric crypto service enabled */ 107 CpaBoolean inlineEnabled; 108 /**< Inline service enabled */ 109 Cpa32U deviceMemorySizeAvailable; 110 /**< Return the size of the device memory available. This device memory 111 * section could be used for the intermediate buffers in the 112 * compression service. 113 */ 114 } CpaDeviceInfo; 115 116 117 /***************************************************************************** 118 * @ingroup cpaDev 119 * Returns number devices. 120 * 121 * @description 122 * This API returns the number of devices available to the application. 123 * If used on the host, it will return the number of physical devices. 124 * If used on the guest, it will return the number of function mapped 125 * to the virtual machine. 126 * 127 *****************************************************************************/ 128 CpaStatus cpaGetNumDevices (Cpa16U *numDevices); 129 130 /***************************************************************************** 131 * @ingroup cpaDev 132 * Returns device information for a given device index. 133 * 134 * @description 135 * Returns device information for a given device index. This API must 136 * be used with cpaGetNumDevices(). 137 *****************************************************************************/ 138 CpaStatus cpaGetDeviceInfo (Cpa16U device, CpaDeviceInfo *deviceInfo); 139 140 #ifdef __cplusplus 141 } /* close the extern "C" { */ 142 #endif 143 144 #endif /* CPA_DEV_H */ 145