[dpdk-dev,2/5] crypto/qat: move to dynamic logging for non-dp trace
Checks
Commit Message
From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
For all trace not on the data-path move to dynamic logging.
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
config/common_base | 1 -
drivers/crypto/qat/Makefile | 1 +
drivers/crypto/qat/meson.build | 1 +
drivers/crypto/qat/qat_logs.c | 18 ++++++++++++++++++
drivers/crypto/qat/qat_logs.h | 12 ++++--------
5 files changed, 24 insertions(+), 9 deletions(-)
create mode 100644 drivers/crypto/qat/qat_logs.c
Comments
Hi,
> -----Original Message-----
> From: Trahe, Fiona
> Sent: Friday, May 11, 2018 12:32 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Jozwiak, TomaszX <tomaszx.jozwiak@intel.com>
> Subject: [PATCH 2/5] crypto/qat: move to dynamic logging for non-dp trace
>
> From: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
>
> For all trace not on the data-path move to dynamic logging.
>
> Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
...
> +++ b/drivers/crypto/qat/qat_logs.c
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018 Intel Corporation
> + */
> +
> +#include <rte_log.h>
> +
> +int qat_gen_logtype;
> +
> +static void
> +qat_pci_init_log(void)
> +{
> + /* Non-data-path logging for pci device and all services */
> + qat_gen_logtype = rte_log_register("pmd.qat_general");
> + if (qat_gen_logtype >= 0)
> + rte_log_set_level(qat_gen_logtype, RTE_LOG_NOTICE); }
> +
> +RTE_INIT(qat_pci_init_log);
I am seeing a compilation error on clang:
drivers/crypto/qat/qat_logs.c:18:1: error:
attribute declaration must precede definition [-Werror,-Wignored-attributes]
RTE_INIT(qat_pci_init_log);
^
Thanks,
Pablo
@@ -484,7 +484,6 @@ CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048
CONFIG_RTE_LIBRTE_PMD_QAT=n
CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_TX=n
CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_RX=n
-CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
#
# Max. number of QuickAssist devices, which can be detected and attached
#
@@ -26,6 +26,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_device.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_qp.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_session.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_common.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_logs.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_sym_pmd.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_asym_pmd.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_comp_pmd.c
@@ -8,6 +8,7 @@ endif
sources = files('qat_common.c',
'qat_qp.c',
'qat_device.c',
+ 'qat_logs.c',
'qat_sym_pmd.c', 'qat_sym.c', 'qat_sym_session.c',
'qat_asym_pmd.c',
'qat_comp_pmd.c')
new file mode 100644
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include <rte_log.h>
+
+int qat_gen_logtype;
+
+static void
+qat_pci_init_log(void)
+{
+ /* Non-data-path logging for pci device and all services */
+ qat_gen_logtype = rte_log_register("pmd.qat_general");
+ if (qat_gen_logtype >= 0)
+ rte_log_set_level(qat_gen_logtype, RTE_LOG_NOTICE);
+}
+
+RTE_INIT(qat_pci_init_log);
@@ -5,14 +5,10 @@
#ifndef _QAT_LOGS_H_
#define _QAT_LOGS_H_
-#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER
-#define PMD_DRV_LOG_RAW(level, fmt, args...) \
- RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
-#else
-#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0)
-#endif
+extern int qat_gen_logtype;
-#define PMD_DRV_LOG(level, fmt, args...) \
- PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+#define PMD_DRV_LOG(level, fmt, args...) \
+ rte_log(RTE_LOG_ ## level, qat_gen_logtype, \
+ "%s(): " fmt "\n", __func__, ## args)
#endif /* _QAT_LOGS_H_ */