crypto/qat: re-organise build file content
[dpdk.git] / drivers / crypto / qat / qat_logs.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4
5 #include <rte_log.h>
6 #include <rte_hexdump.h>
7
8 #include "qat_logs.h"
9
10 int qat_gen_logtype;
11 int qat_dp_logtype;
12
13 int
14 qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
15                 const void *buf, unsigned int len)
16 {
17         if (level > rte_log_get_global_level())
18                 return 0;
19         if (level > (uint32_t)(rte_log_get_level(logtype)))
20                 return 0;
21
22         rte_hexdump(rte_logs.file == NULL ? stderr : rte_logs.file,
23                                 title, buf, len);
24         return 0;
25 }
26
27 RTE_INIT(qat_pci_init_log);
28 static void
29 qat_pci_init_log(void)
30 {
31         /* Non-data-path logging for pci device and all services */
32         qat_gen_logtype = rte_log_register("pmd.qat_general");
33         if (qat_gen_logtype >= 0)
34                 rte_log_set_level(qat_gen_logtype, RTE_LOG_NOTICE);
35
36         /* data-path logging for all services */
37         qat_dp_logtype = rte_log_register("pmd.qat_dp");
38         if (qat_dp_logtype >= 0)
39                 rte_log_set_level(qat_dp_logtype, RTE_LOG_NOTICE);
40 }