The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/qat/qat_api/common/ctrl/sal_create_services.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* SPDX-License-Identifier: BSD-3-Clause */
    2 /* Copyright(c) 2007-2022 Intel Corporation */
    3 /* $FreeBSD$ */
    4 /**
    5  *****************************************************************************
    6  * @file sal_create_services.c
    7  *
    8  * @defgroup SalCtrl Service Access Layer Controller
    9  *
   10  * @ingroup SalCtrl
   11  *
   12  * @description
   13  *      This file contains the main function to create a specific service.
   14  *
   15  *****************************************************************************/
   16 
   17 #include "cpa.h"
   18 #include "lac_mem.h"
   19 #include "lac_mem_pools.h"
   20 #include "qat_utils.h"
   21 #include "lac_list.h"
   22 #include "icp_adf_transport.h"
   23 #include "icp_accel_devices.h"
   24 #include "icp_adf_debug.h"
   25 
   26 #include "icp_qat_fw_la.h"
   27 #include "lac_sym_qat.h"
   28 #include "sal_types_compression.h"
   29 #include "lac_sal_types_crypto.h"
   30 
   31 #include "icp_adf_init.h"
   32 
   33 #include "lac_sal.h"
   34 #include "lac_sal_ctrl.h"
   35 
   36 CpaStatus
   37 SalCtrl_ServiceCreate(sal_service_type_t serviceType,
   38                       Cpa32U instance,
   39                       sal_service_t **ppInst)
   40 {
   41         sal_crypto_service_t *pCrypto_service = NULL;
   42         sal_compression_service_t *pCompression_service = NULL;
   43 
   44         switch ((sal_service_type_t)serviceType) {
   45         case SAL_SERVICE_TYPE_CRYPTO_ASYM:
   46         case SAL_SERVICE_TYPE_CRYPTO_SYM:
   47         case SAL_SERVICE_TYPE_CRYPTO: {
   48                 pCrypto_service =
   49                     malloc(sizeof(sal_crypto_service_t), M_QAT, M_WAITOK);
   50 
   51                 /* Zero memory */
   52                 memset(pCrypto_service, 0, sizeof(sal_crypto_service_t));
   53 
   54                 pCrypto_service->generic_service_info.type =
   55                     (sal_service_type_t)serviceType;
   56                 pCrypto_service->generic_service_info.state =
   57                     SAL_SERVICE_STATE_UNINITIALIZED;
   58                 pCrypto_service->generic_service_info.instance = instance;
   59 
   60                 pCrypto_service->generic_service_info.init = SalCtrl_CryptoInit;
   61                 pCrypto_service->generic_service_info.start =
   62                     SalCtrl_CryptoStart;
   63                 pCrypto_service->generic_service_info.stop = SalCtrl_CryptoStop;
   64                 pCrypto_service->generic_service_info.shutdown =
   65                     SalCtrl_CryptoShutdown;
   66 
   67                 /* Force HW MAC validation for GCM and CCM */
   68                 pCrypto_service->forceAEADMacVerify = CPA_TRUE;
   69 
   70                 *(ppInst) = &(pCrypto_service->generic_service_info);
   71 
   72                 return CPA_STATUS_SUCCESS;
   73         }
   74         case SAL_SERVICE_TYPE_COMPRESSION: {
   75                 pCompression_service =
   76                     malloc(sizeof(sal_compression_service_t), M_QAT, M_WAITOK);
   77 
   78                 /* Zero memory */
   79                 memset(pCompression_service,
   80                        0,
   81                        sizeof(sal_compression_service_t));
   82 
   83                 pCompression_service->generic_service_info.type =
   84                     (sal_service_type_t)serviceType;
   85                 pCompression_service->generic_service_info.state =
   86                     SAL_SERVICE_STATE_UNINITIALIZED;
   87                 pCompression_service->generic_service_info.instance = instance;
   88 
   89                 pCompression_service->generic_service_info.init =
   90                     SalCtrl_CompressionInit;
   91                 pCompression_service->generic_service_info.start =
   92                     SalCtrl_CompressionStart;
   93                 pCompression_service->generic_service_info.stop =
   94                     SalCtrl_CompressionStop;
   95                 pCompression_service->generic_service_info.shutdown =
   96                     SalCtrl_CompressionShutdown;
   97 
   98                 *(ppInst) = &(pCompression_service->generic_service_info);
   99                 return CPA_STATUS_SUCCESS;
  100         }
  101 
  102         default: {
  103                 QAT_UTILS_LOG("Not a valid service type\n");
  104                 (*ppInst) = NULL;
  105                 return CPA_STATUS_FAIL;
  106         }
  107         }
  108 }

Cache object: b2279c95d5cf0efac8db17abcfb5b6db


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.