From 1acf14ca726d3441e5bfe2acfe82b1744e72e507 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 4 Dec 2023 18:09:56 -0800 Subject: [PATCH] hash: use dynamic logtypes Use dynamic type for hash and add subtypes for crc and gfni. Signed-off-by: Stephen Hemminger --- lib/hash/rte_cuckoo_hash.c | 5 +++++ lib/hash/rte_fbk_hash.c | 3 +++ lib/hash/rte_thash.c | 3 +++ lib/hash/rte_thash_gfni.c | 3 +++ lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c index ccdc3b98948..8e4364f060a 100644 --- a/lib/hash/rte_cuckoo_hash.c +++ b/lib/hash/rte_cuckoo_hash.c @@ -24,6 +24,11 @@ #include #include "rte_hash.h" + +/* needs to be before rte_cuckoo_hash.h */ +RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO); +#define RTE_LOGTYPE_HASH hash_logtype + #include "rte_cuckoo_hash.h" /* Mask of all flags supported by this version */ diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c index c46bf3f8b96..faeb50cd89f 100644 --- a/lib/hash/rte_fbk_hash.c +++ b/lib/hash/rte_fbk_hash.c @@ -19,6 +19,9 @@ #include "rte_fbk_hash.h" +RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO); +#define RTE_LOGTYPE_HASH fbk_hash_logtype + TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry); static struct rte_tailq_elem rte_fbk_hash_tailq = { diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 4ff567ee5ad..d819dddd84f 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -13,6 +13,9 @@ #include #include +RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO); +#define RTE_LOGTYPE_HASH thash_logtype + #define THASH_NAME_LEN 64 #define TOEPLITZ_HASH_LEN 32 diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c index e148fada622..c863789b515 100644 --- a/lib/hash/rte_thash_gfni.c +++ b/lib/hash/rte_thash_gfni.c @@ -9,6 +9,9 @@ #ifndef RTE_THASH_GFNI_DEFINED +RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO); +#define RTE_LOGTYPE_HASH hash_gfni_logtype + uint32_t rte_thash_gfni(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused) diff --git a/lib/log/log.c b/lib/log/log.c index 06486a00fa9..5404c790dd7 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -356,7 +356,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_MEMPOOL, "lib.mempool"}, {RTE_LOGTYPE_TIMER, "lib.timer"}, {RTE_LOGTYPE_PMD, "pmd"}, - {RTE_LOGTYPE_HASH, "lib.hash"}, {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_POWER, "lib.power"}, {RTE_LOGTYPE_METER, "lib.meter"}, diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h index 679fd2fd868..529ec729a8c 100644 --- a/lib/log/rte_log.h +++ b/lib/log/rte_log.h @@ -32,7 +32,7 @@ extern "C" { #define RTE_LOGTYPE_MEMPOOL 3 /**< Log related to mempool. */ #define RTE_LOGTYPE_TIMER 4 /**< Log related to timers. */ #define RTE_LOGTYPE_PMD 5 /**< Log related to poll mode driver. */ -#define RTE_LOGTYPE_HASH 6 /**< Log related to hash table. */ + /* was RTE_LOGTYPE_HASH */ #define RTE_LOGTYPE_LPM 7 /**< Log related to LPM. */ /* was RTE_LOGTYPE_KNI */ /* was RTE_LOGTYPE_ACL */