From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 116A341C33; Tue, 7 Feb 2023 21:45:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C774142D42; Tue, 7 Feb 2023 21:44:48 +0100 (CET) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id E6D7F42D35 for ; Tue, 7 Feb 2023 21:44:45 +0100 (CET) Received: by mail-pl1-f170.google.com with SMTP id r8so16988988pls.2 for ; Tue, 07 Feb 2023 12:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t1IX1AWs9jckdbexKA5I/in49+KMfAncUTudfy17AAA=; b=v5qxEY4jvulXbumgbuEQ/n80G0KUFumw0SX8KagfGWttGdxQuSD9JlFf8bumH8FpyS hbwnWQ+qvY9nxzD8HQuEdzVObUyEafl5CXTDfOoTIkqD6APksugoRDirHK5WDs752pWS a5IGr8/2I3u4hFJfyiamXooum+RMEMksIUzf2g4Kn6ykhFx8l7Jn6zriNcOD8c81nNqR PnKrG9LLkzUNb6jyDw7pSTYTc1Gx2TlGg1RGfOhRghhUxCROzGya1zJYSYj88zEW0Hbb jReAV5qO4MuvoVKu8ccNgsWkjzHtOstWNVTnhlKGsiUV9r6AyAz0AekVewH/rGkm3vac JLNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t1IX1AWs9jckdbexKA5I/in49+KMfAncUTudfy17AAA=; b=F6CeGmk/K4zID64xMF87PgV+z4RckL8XTQx9k75HPD0G+bRt6wTnS9IxSohxx0f4RB wdMo5meKl3qS6xDQG2yMJcuCYk2fYEzNNn5osQdZI9BSyVvL9gl3pXRTWaNO7wAJptzi 1UUopXckw/Xmpm2hzrHAzqx9kbKV4LRVLTt3H+BGqjEK8D0SNBvqQxYwitjkxgOzE7t5 LZfhl06fr73E1EbdYeWcVP58bcjH1QoDOLW88lmZ8sr/uXyCRYS/e6QfHblqF5SFvASX rrEMYG9eNYwj3yGry+LLz2HhhXXCit50DFzFpGQxN0WbKvtmJRFx2rgoODtAaJYfcHLD 010w== X-Gm-Message-State: AO0yUKVNut1KnTBqDCfaPGxhx8M8UtuV61XmO48kkiR0r4IMvy2Cncnu EahP052SOK1+nu9QKRf0KZePza6l9K742PPnoU0= X-Google-Smtp-Source: AK7set+tQHIK4W42kEVaSjHuYkxkpMPFwkjnesmBT1VpOsV9h3fAKR8H04BYTltz5qAor4z8g6iCyg== X-Received: by 2002:a17:903:283:b0:198:df29:53bc with SMTP id j3-20020a170903028300b00198df2953bcmr5034233plr.69.1675802684642; Tue, 07 Feb 2023 12:44:44 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id jk24-20020a170903331800b00194ab9a4febsm4725562plb.74.2023.02.07.12.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 12:44:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Vladimir Medvedkin , Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [RFC 10/13] lpm: replace RTE_LOGTYPE_LPM with dynamic types Date: Tue, 7 Feb 2023 12:41:48 -0800 Message-Id: <20230207204151.1503491-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207204151.1503491-1-stephen@networkplumber.org> References: <20230207204151.1503491-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Split lpm and lpm6 into seperate log types since they are in different files and user may want to change log levels for IPv4 vs IPv6. For rib and fib libraries give them own types as well. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/fib/rte_fib.c | 23 +++++++----- lib/fib/rte_fib6.c | 21 +++++++---- lib/hash/rte_hash_crc.c | 63 +++++++++++++++++++++++++++++++++ lib/lpm/rte_lpm.c | 18 ++++++---- lib/lpm/rte_lpm6.c | 25 ++++++++----- lib/rib/rte_rib.c | 14 +++++--- lib/rib/rte_rib6.c | 16 ++++++--- 9 files changed, 142 insertions(+), 41 deletions(-) create mode 100644 lib/hash/rte_hash_crc.c diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c index 90d388192712..ff250b9a6d56 100644 --- a/lib/eal/common/eal_common_log.c +++ b/lib/eal/common/eal_common_log.c @@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_EAL, "lib.eal"}, {RTE_LOGTYPE_PMD, "pmd"}, {RTE_LOGTYPE_HASH, "lib.hash"}, - {RTE_LOGTYPE_LPM, "lib.lpm"}, {RTE_LOGTYPE_KNI, "lib.kni"}, {RTE_LOGTYPE_METER, "lib.meter"}, {RTE_LOGTYPE_SCHED, "lib.sched"}, diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h index f583352ec1ea..55067efb0a84 100644 --- a/lib/eal/include/rte_log.h +++ b/lib/eal/include/rte_log.h @@ -33,7 +33,7 @@ extern "C" { /* was RTE_LOGTYPE_TIMER */ #define RTE_LOGTYPE_PMD 5 /**< Log related to poll mode driver. */ #define RTE_LOGTYPE_HASH 6 /**< Log related to hash table. */ -#define RTE_LOGTYPE_LPM 7 /**< Log related to LPM. */ + /* was RTE_LOGTYPE_LPM */ #define RTE_LOGTYPE_KNI 8 /**< Log related to KNI. */ /* was RTE_LOGTYPE_ACL */ /* was RTE_LOGTYPE_POWER */ diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c index 8af4c4091908..7fda4263f841 100644 --- a/lib/fib/rte_fib.c +++ b/lib/fib/rte_fib.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -17,6 +18,12 @@ #include "dir24_8.h" +RTE_LOG_REGISTER_DEFAULT(fib_logtype, INFO); + +#define FIB_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, fib_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + TAILQ_HEAD(rte_fib_list, rte_tailq_entry); static struct rte_tailq_elem rte_fib_tailq = { .name = "RTE_FIB", @@ -167,8 +174,8 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf) rib = rte_rib_create(name, socket_id, &rib_conf); if (rib == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate RIB %s\n", name); + FIB_LOG(ERR, + "Can not allocate RIB %s", name); return NULL; } @@ -192,8 +199,8 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf) /* allocate tailq entry */ te = rte_zmalloc("FIB_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate tailq entry for FIB %s\n", name); + FIB_LOG(ERR, + "Can not allocate tailq entry for FIB %s", name); rte_errno = ENOMEM; goto exit; } @@ -202,7 +209,7 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf) fib = rte_zmalloc_socket(mem_name, sizeof(struct rte_fib), RTE_CACHE_LINE_SIZE, socket_id); if (fib == NULL) { - RTE_LOG(ERR, LPM, "FIB %s memory allocation failed\n", name); + FIB_LOG(ERR, "FIB %s memory allocation failed", name); rte_errno = ENOMEM; goto free_te; } @@ -213,9 +220,9 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf) fib->def_nh = conf->default_nh; ret = init_dataplane(fib, socket_id, conf); if (ret < 0) { - RTE_LOG(ERR, LPM, - "FIB dataplane struct %s memory allocation failed " - "with err %d\n", name, ret); + FIB_LOG(ERR, + "FIB dataplane struct %s memory allocation failed with err %d", + name, ret); rte_errno = -ret; goto free_fib; } diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c index 4b8e22b142b9..d735fe81fc41 100644 --- a/lib/fib/rte_fib6.c +++ b/lib/fib/rte_fib6.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,12 @@ #include "trie.h" +RTE_LOG_REGISTER_SUFFIX(fib6_logtype, "fib6", INFO); + +#define FIB_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, fib6_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + TAILQ_HEAD(rte_fib6_list, rte_tailq_entry); static struct rte_tailq_elem rte_fib6_tailq = { .name = "RTE_FIB6", @@ -168,8 +175,8 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf) rib = rte_rib6_create(name, socket_id, &rib_conf); if (rib == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate RIB %s\n", name); + FIB_LOG(ERR, + "Can not allocate RIB %s", name); return NULL; } @@ -193,8 +200,8 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf) /* allocate tailq entry */ te = rte_zmalloc("FIB_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate tailq entry for FIB %s\n", name); + FIB_LOG(ERR, + "Can not allocate tailq entry for FIB %s", name); rte_errno = ENOMEM; goto exit; } @@ -203,7 +210,7 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf) fib = rte_zmalloc_socket(mem_name, sizeof(struct rte_fib6), RTE_CACHE_LINE_SIZE, socket_id); if (fib == NULL) { - RTE_LOG(ERR, LPM, "FIB %s memory allocation failed\n", name); + FIB_LOG(ERR,"FIB %s memory allocation failed", name); rte_errno = ENOMEM; goto free_te; } @@ -214,8 +221,8 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf) fib->def_nh = conf->default_nh; ret = init_dataplane(fib, socket_id, conf); if (ret < 0) { - RTE_LOG(ERR, LPM, - "FIB dataplane struct %s memory allocation failed\n", + FIB_LOG(ERR, + "FIB dataplane struct %s memory allocation failed", name); rte_errno = -ret; goto free_fib; diff --git a/lib/hash/rte_hash_crc.c b/lib/hash/rte_hash_crc.c new file mode 100644 index 000000000000..c6d0c25c0709 --- /dev/null +++ b/lib/hash/rte_hash_crc.c @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ + +RTE_LOG_REGISTER_SUFFIX(crc_hash_logtype, "hash.crc", INFO); + +#define HASH_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, crc_hash_logtype, \ + "%s(): " fmt "\n", __func__, ##args) +/** + * Allow or disallow use of SSE4.2/ARMv8 intrinsics for CRC32 hash + * calculation. + * + * @param alg + * An OR of following flags: + * - (CRC32_SW) Don't use SSE4.2/ARMv8 intrinsics (default non-[x86/ARMv8]) + * - (CRC32_SSE42) Use SSE4.2 intrinsics if available + * - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86) + * - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8) + * + */ +static inline void +rte_hash_crc_set_alg(uint8_t alg) +{ + crc32_alg = CRC32_SW; + + if (alg == CRC32_SW) + return; + +#if defined RTE_ARCH_X86 + if (!(alg & CRC32_SSE42_x64)) + HASH_LOG(WARNING, + "Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42"); + if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42) + crc32_alg = CRC32_SSE42; + else + crc32_alg = CRC32_SSE42_x64; +#endif + +#if defined RTE_ARCH_ARM64 + if (!(alg & CRC32_ARM64)) + HASH_LOG(WARNING, + "Unsupported CRC32 algorithm requested using CRC32_ARM64"); + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32)) + crc32_alg = CRC32_ARM64; +#endif + + if (crc32_alg == CRC32_SW) + HASH_LOG(WARNING, + "Unsupported CRC32 algorithm requested using CRC32_SW"); +} + +/* Setting the best available algorithm */ +RTE_INIT(rte_hash_crc_init_alg) +{ +#if defined(RTE_ARCH_X86) + rte_hash_crc_set_alg(CRC32_SSE42_x64); +#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32) + rte_hash_crc_set_alg(CRC32_ARM64); +#else + rte_hash_crc_set_alg(CRC32_SW); +#endif +} diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c index cdcd1b7f9e47..ba3912a775a3 100644 --- a/lib/lpm/rte_lpm.c +++ b/lib/lpm/rte_lpm.c @@ -19,6 +19,12 @@ #include "rte_lpm.h" +RTE_LOG_REGISTER_DEFAULT(lpm_logtype, INFO); + +#define LPM_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, lpm_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + TAILQ_HEAD(rte_lpm_list, rte_tailq_entry); static struct rte_tailq_elem rte_lpm_tailq = { @@ -189,7 +195,7 @@ rte_lpm_create(const char *name, int socket_id, /* allocate tailq entry */ te = rte_zmalloc("LPM_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, LPM, "Failed to allocate tailq entry\n"); + LPM_LOG(ERR, "Failed to allocate tailq entry"); rte_errno = ENOMEM; goto exit; } @@ -198,7 +204,7 @@ rte_lpm_create(const char *name, int socket_id, i_lpm = rte_zmalloc_socket(mem_name, mem_size, RTE_CACHE_LINE_SIZE, socket_id); if (i_lpm == NULL) { - RTE_LOG(ERR, LPM, "LPM memory allocation failed\n"); + LPM_LOG(ERR, "LPM memory allocation failed"); rte_free(te); rte_errno = ENOMEM; goto exit; @@ -208,7 +214,7 @@ rte_lpm_create(const char *name, int socket_id, (size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id); if (i_lpm->rules_tbl == NULL) { - RTE_LOG(ERR, LPM, "LPM rules_tbl memory allocation failed\n"); + LPM_LOG(ERR, "LPM rules_tbl memory allocation failed"); rte_free(i_lpm); i_lpm = NULL; rte_free(te); @@ -220,7 +226,7 @@ rte_lpm_create(const char *name, int socket_id, (size_t)tbl8s_size, RTE_CACHE_LINE_SIZE, socket_id); if (i_lpm->lpm.tbl8 == NULL) { - RTE_LOG(ERR, LPM, "LPM tbl8 memory allocation failed\n"); + LPM_LOG(ERR, "LPM tbl8 memory allocation failed"); rte_free(i_lpm->rules_tbl); rte_free(i_lpm); i_lpm = NULL; @@ -335,7 +341,7 @@ rte_lpm_rcu_qsbr_add(struct rte_lpm *lpm, struct rte_lpm_rcu_config *cfg) params.v = cfg->v; i_lpm->dq = rte_rcu_qsbr_dq_create(¶ms); if (i_lpm->dq == NULL) { - RTE_LOG(ERR, LPM, "LPM defer queue creation failed\n"); + LPM_LOG(ERR, "LPM defer queue creation failed"); return 1; } } else { @@ -562,7 +568,7 @@ tbl8_free(struct __rte_lpm *i_lpm, uint32_t tbl8_group_start) status = rte_rcu_qsbr_dq_enqueue(i_lpm->dq, (void *)&tbl8_group_start); if (status == 1) { - RTE_LOG(ERR, LPM, "Failed to push QSBR FIFO\n"); + LPM_LOG(ERR, "Failed to push QSBR FIFO"); return -rte_errno; } } diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c index 8d21aeddb83c..7701e8112ed2 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -45,6 +45,12 @@ enum valid_flag { VALID }; +RTE_LOG_REGISTER_SUFFIX(lpm6_logtype, "lpm6", INFO); + +#define LPM_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, lpm6_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + TAILQ_HEAD(rte_lpm6_list, rte_tailq_entry); static struct rte_tailq_elem rte_lpm6_tailq = { @@ -279,8 +285,9 @@ rte_lpm6_create(const char *name, int socket_id, rules_tbl = rte_hash_create(&rule_hash_tbl_params); if (rules_tbl == NULL) { - RTE_LOG(ERR, LPM, "LPM rules hash table allocation failed: %s (%d)", - rte_strerror(rte_errno), rte_errno); + LPM_LOG(ERR, + "LPM rules hash table allocation failed: %s (%d)", + rte_strerror(rte_errno), rte_errno); goto fail_wo_unlock; } @@ -289,8 +296,9 @@ rte_lpm6_create(const char *name, int socket_id, sizeof(uint32_t) * config->number_tbl8s, RTE_CACHE_LINE_SIZE); if (tbl8_pool == NULL) { - RTE_LOG(ERR, LPM, "LPM tbl8 pool allocation failed: %s (%d)", - rte_strerror(rte_errno), rte_errno); + LPM_LOG(ERR, + "LPM tbl8 pool allocation failed: %s (%d)", + rte_strerror(rte_errno), rte_errno); rte_errno = ENOMEM; goto fail_wo_unlock; } @@ -300,8 +308,9 @@ rte_lpm6_create(const char *name, int socket_id, sizeof(struct rte_lpm_tbl8_hdr) * config->number_tbl8s, RTE_CACHE_LINE_SIZE); if (tbl8_hdrs == NULL) { - RTE_LOG(ERR, LPM, "LPM tbl8 headers allocation failed: %s (%d)", - rte_strerror(rte_errno), rte_errno); + LPM_LOG(ERR, + "LPM tbl8 headers allocation failed: %s (%d)", + rte_strerror(rte_errno), rte_errno); rte_errno = ENOMEM; goto fail_wo_unlock; } @@ -329,7 +338,7 @@ rte_lpm6_create(const char *name, int socket_id, /* allocate tailq entry */ te = rte_zmalloc("LPM6_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, LPM, "Failed to allocate tailq entry!\n"); + LPM_LOG(ERR, "Failed to allocate tailq entry!"); rte_errno = ENOMEM; goto fail; } @@ -339,7 +348,7 @@ rte_lpm6_create(const char *name, int socket_id, RTE_CACHE_LINE_SIZE, socket_id); if (lpm == NULL) { - RTE_LOG(ERR, LPM, "LPM memory allocation failed\n"); + LPM_LOG(ERR, "LPM memory allocation failed"); rte_free(te); rte_errno = ENOMEM; goto fail; diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c index b0794edf66f5..a81b4ed1cc04 100644 --- a/lib/rib/rte_rib.c +++ b/lib/rib/rte_rib.c @@ -15,6 +15,12 @@ #include +RTE_LOG_REGISTER_DEFAULT(rib_logtype, INFO); + +#define RIB_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, rib_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + TAILQ_HEAD(rte_rib_list, rte_tailq_entry); static struct rte_tailq_elem rte_rib_tailq = { .name = "RTE_RIB", @@ -412,8 +418,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) NULL, NULL, NULL, NULL, socket_id, 0); if (node_pool == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate mempool for RIB %s\n", name); + RIB_LOG(ERR, "Can not allocate mempool for RIB %s", name); return NULL; } @@ -437,8 +442,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) /* allocate tailq entry */ te = rte_zmalloc("RIB_TAILQ_ENTRY", sizeof(*te), 0); if (unlikely(te == NULL)) { - RTE_LOG(ERR, LPM, - "Can not allocate tailq entry for RIB %s\n", name); + RIB_LOG(ERR, "Can not allocate tailq entry for RIB %s", name); rte_errno = ENOMEM; goto exit; } @@ -447,7 +451,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) rib = rte_zmalloc_socket(mem_name, sizeof(struct rte_rib), RTE_CACHE_LINE_SIZE, socket_id); if (unlikely(rib == NULL)) { - RTE_LOG(ERR, LPM, "RIB %s memory allocation failed\n", name); + RIB_LOG(ERR, "RIB %s memory allocation failed", name); rte_errno = ENOMEM; goto free_te; } diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c index 19e4ff97c479..39eba4d7032b 100644 --- a/lib/rib/rte_rib6.c +++ b/lib/rib/rte_rib6.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -15,6 +16,12 @@ #include +RTE_LOG_REGISTER_SUFFIX(rib6_logtype, "rib6", INFO); + +#define RIB_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, rib6_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + #define RTE_RIB_VALID_NODE 1 #define RIB6_MAXDEPTH 128 /* Maximum length of a RIB6 name. */ @@ -481,8 +488,7 @@ rte_rib6_create(const char *name, int socket_id, NULL, NULL, NULL, NULL, socket_id, 0); if (node_pool == NULL) { - RTE_LOG(ERR, LPM, - "Can not allocate mempool for RIB6 %s\n", name); + RIB_LOG(ERR, "Can not allocate mempool for RIB6 %s", name); return NULL; } @@ -506,8 +512,8 @@ rte_rib6_create(const char *name, int socket_id, /* allocate tailq entry */ te = rte_zmalloc("RIB6_TAILQ_ENTRY", sizeof(*te), 0); if (unlikely(te == NULL)) { - RTE_LOG(ERR, LPM, - "Can not allocate tailq entry for RIB6 %s\n", name); + RIB_LOG(ERR, + "Can not allocate tailq entry for RIB6 %s", name); rte_errno = ENOMEM; goto exit; } @@ -516,7 +522,7 @@ rte_rib6_create(const char *name, int socket_id, rib = rte_zmalloc_socket(mem_name, sizeof(struct rte_rib6), RTE_CACHE_LINE_SIZE, socket_id); if (unlikely(rib == NULL)) { - RTE_LOG(ERR, LPM, "RIB6 %s memory allocation failed\n", name); + RIB_LOG(ERR, "RIB6 %s memory allocation failed", name); rte_errno = ENOMEM; goto free_te; } -- 2.39.1