crypto/bcmfs: optimize crypto request processing
[dpdk.git] / drivers / crypto / bcmfs / bcmfs_logs.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Broadcom
3  * All rights reserved.
4  */
5
6 #include <rte_log.h>
7 #include <rte_hexdump.h>
8
9 #include "bcmfs_logs.h"
10
11 int bcmfs_conf_logtype;
12 int bcmfs_dp_logtype;
13
14 int
15 bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
16                 const void *buf, unsigned int len)
17 {
18         if (level > rte_log_get_global_level())
19                 return 0;
20         if (level > (uint32_t)(rte_log_get_level(logtype)))
21                 return 0;
22
23         rte_hexdump(rte_log_get_stream(), title, buf, len);
24         return 0;
25 }
26
27 RTE_INIT(bcmfs_device_init_log)
28 {
29         /* Configuration and general logs */
30         bcmfs_conf_logtype = rte_log_register("pmd.bcmfs_config");
31         if (bcmfs_conf_logtype >= 0)
32                 rte_log_set_level(bcmfs_conf_logtype, RTE_LOG_NOTICE);
33
34         /* data-path logs */
35         bcmfs_dp_logtype = rte_log_register("pmd.bcmfs_fp");
36         if (bcmfs_dp_logtype >= 0)
37                 rte_log_set_level(bcmfs_dp_logtype, RTE_LOG_NOTICE);
38 }