eeded2044a
Let's try to enforce the convention where most drivers use a pmd. logtype with their class reflected in it, and libraries use a lib. logtype. Introduce two new macros: - RTE_LOG_REGISTER_DEFAULT can be used when a single logtype is used in a component. It is associated to the default name provided by the build system, - RTE_LOG_REGISTER_SUFFIX can be used when multiple logtypes are used, and then the passed name is appended to the default name, RTE_LOG_REGISTER is left untouched for existing external users and for components that do not comply with the convention. There is a new Meson variable log_prefix to adapt the default name for baseband (pmd.bb.), bus (no pmd.) and mempool (no pmd.) classes. Note: achieved with below commands + reverted change on net/bonding + edits on crypto/virtio, compress/mlx5, regex/mlx5 $ git grep -l RTE_LOG_REGISTER drivers/ | while read file; do pattern=${file##drivers/}; class=${pattern%%/*}; pattern=${pattern#$class/}; drv=${pattern%%/*}; case "$class" in baseband) pattern=pmd.bb.$drv;; bus) pattern=bus.$drv;; mempool) pattern=mempool.$drv;; *) pattern=pmd.$class.$drv;; esac sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file; sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file; done $ git grep -l RTE_LOG_REGISTER lib/ | while read file; do pattern=${file##lib/}; pattern=lib.${pattern%%/*}; sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file; sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file; done Signed-off-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
26 lines
586 B
C
26 lines
586 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2020 Broadcom
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include <rte_log.h>
|
|
#include <rte_hexdump.h>
|
|
|
|
#include "bcmfs_logs.h"
|
|
|
|
int
|
|
bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
|
|
const void *buf, unsigned int len)
|
|
{
|
|
if (level > rte_log_get_global_level())
|
|
return 0;
|
|
if (level > (uint32_t)(rte_log_get_level(logtype)))
|
|
return 0;
|
|
|
|
rte_hexdump(rte_log_get_stream(), title, buf, len);
|
|
return 0;
|
|
}
|
|
|
|
RTE_LOG_REGISTER_SUFFIX(bcmfs_conf_logtype, config, NOTICE)
|
|
RTE_LOG_REGISTER_SUFFIX(bcmfs_dp_logtype, fp, NOTICE)
|