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 9E16641C58; Fri, 10 Feb 2023 02:08:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73C1A42BD9; Fri, 10 Feb 2023 02:08:08 +0100 (CET) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id 066BB410F9 for ; Fri, 10 Feb 2023 02:08:06 +0100 (CET) Received: by mail-pj1-f49.google.com with SMTP id gj9-20020a17090b108900b0023114156d36so7725129pjb.4 for ; Thu, 09 Feb 2023 17:08:05 -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=XC9Z/WZcbYJRMRfGGnRbWvLq8XyY7AHTqG0rf0Z88tw=; b=rRaHEcgKhr6f4ZEp/eogfoncJCoRyi1Nzc9ZoQvpvSPBzzkUbX8W7YhdYCxws8fuTS 9qgXHWqMt32GnihBE6fNgYtiuNTTSPm9FPQUGI92KwdumuG5I6/zgFgqEpjX6EmuxqtI r4xB/ay5FAhy9XM++g8ufuS6R4649Paf3EpUyJTRBI2jzcE94mVqFpnvEBvQ+1bvCel0 5KseLvwReHn4UVd6YsQqiUdROCP+QvB70YsxT2Ps0MiOzayMIAnwTTMvn/AnMcG41MNa VGP7mF1GRiHo5mbpZDeGJryglS9jbmv60xv2oyPdvVcXATBegvx/ih7zbTXs6W7fIf4+ oEyw== 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=XC9Z/WZcbYJRMRfGGnRbWvLq8XyY7AHTqG0rf0Z88tw=; b=dlrJ7CHwTS0DvadVWxWk7n0ZxPfnoDhlaKsENvASLylBoGyX2ihh9VMH4jMsHF61D+ P4GqwDnO379iypYa63WjTQLsN1W4KA2Y6yeAmcK78AIab5nreKeAVqZLTcakTP1ZyDh5 ryWWpZIK7qdJathhcUx2ku5Jl/AKcCZDZcgMafQ0PPsK5K6zAbga7IFi2gQRNiPCtog6 FM3DPmIIgn7Lo84DnNQdNGHRPt3HQvhWzesT+O1R5F2+/tcq2lIL4Ov1l523+rSILshj O6+Mk3vEvo2tYG3yYFWG0Gkp0QGLWDUx/WjTy8OW1W9YcUP8ZJ06intBLqGK5p7w9azs N2mw== X-Gm-Message-State: AO0yUKUjlF/QlNCfY/0b4YAdcr5KCDqew2OZoZdjyiMnvrb+8pYXihVG yzyo3WQ5/8aDxS62DNFTWV8DXyFNojgxfood7vY= X-Google-Smtp-Source: AK7set/NOibVje4H96h5pkeMyG8qVfCzbkinzlha2J6nYx+RYfGsXsGPrGXBM1MdaY4vRMrSsp6dIw== X-Received: by 2002:a17:903:1206:b0:196:15af:e6de with SMTP id l6-20020a170903120600b0019615afe6demr15519708plh.68.1675991284935; Thu, 09 Feb 2023 17:08:04 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id jd9-20020a170903260900b0019625428cefsm2103023plb.281.2023.02.09.17.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 17:08:04 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Byron Marohn , Yipeng Wang Subject: [PATCH v3 03/16] efd: replace RTE_LOGTYPE_EFD with local type Date: Thu, 9 Feb 2023 17:07:11 -0800 Message-Id: <20230210010724.890413-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230210010724.890413-1-stephen@networkplumber.org> References: <20230207204151.1503491-1-stephen@networkplumber.org> <20230210010724.890413-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 Replace all uses of global logtype with a local log type. Do not break message formats across source lines. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_log.c | 1 - lib/eal/include/rte_log.h | 2 +- lib/efd/rte_efd.c | 106 +++++++++++++++----------------- 3 files changed, 52 insertions(+), 57 deletions(-) diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c index e7ccde1c9ccd..675f3d07bbe3 100644 --- a/lib/eal/common/eal_common_log.c +++ b/lib/eal/common/eal_common_log.c @@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = { {RTE_LOGTYPE_PIPELINE, "lib.pipeline"}, {RTE_LOGTYPE_MBUF, "lib.mbuf"}, {RTE_LOGTYPE_CRYPTODEV, "lib.cryptodev"}, - {RTE_LOGTYPE_EFD, "lib.efd"}, {RTE_LOGTYPE_EVENTDEV, "lib.eventdev"}, {RTE_LOGTYPE_USER1, "user1"}, diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h index 361d1ad96299..a90fa629168d 100644 --- a/lib/eal/include/rte_log.h +++ b/lib/eal/include/rte_log.h @@ -44,7 +44,7 @@ extern "C" { #define RTE_LOGTYPE_PIPELINE 15 /**< Log related to pipeline. */ #define RTE_LOGTYPE_MBUF 16 /**< Log related to mbuf. */ #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */ -#define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */ + /* was RTE_LOGTYPE_EFD */ #define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */ /* these log types can be used in an application */ diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c index 686a13775742..23316ef7300f 100644 --- a/lib/efd/rte_efd.c +++ b/lib/efd/rte_efd.c @@ -87,6 +87,11 @@ static struct rte_tailq_elem rte_efd_tailq = { }; EAL_REGISTER_TAILQ(rte_efd_tailq); +RTE_LOG_REGISTER_DEFAULT(efd_logtype, INFO); + +#define EFD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, efd_logtype, "%s(): " fmt "\n", __func__, ##args) + /** Internal permutation array used to shuffle bins into pseudorandom groups */ const uint32_t efd_bin_to_group[EFD_CHUNK_NUM_BIN_TO_GROUP_SETS][EFD_CHUNK_NUM_BINS] = { { @@ -509,13 +514,12 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list); if (online_cpu_socket_bitmask == 0) { - RTE_LOG(ERR, EFD, "At least one CPU socket must be enabled " - "in the bitmask\n"); + EFD_LOG(ERR, "At least one CPU socket must be enabled in the bitmask"); return NULL; } if (max_num_rules == 0) { - RTE_LOG(ERR, EFD, "Max num rules must be higher than 0\n"); + EFD_LOG(ERR, "Max num rules must be higher than 0"); return NULL; } @@ -554,7 +558,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, te = rte_zmalloc("EFD_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { - RTE_LOG(ERR, EFD, "tailq entry allocation failed\n"); + EFD_LOG(ERR, "tailq entry allocation failed"); goto error_unlock_exit; } @@ -564,15 +568,15 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, RTE_CACHE_LINE_SIZE, offline_cpu_socket); if (table == NULL) { - RTE_LOG(ERR, EFD, "Allocating EFD table management structure" - " on socket %u failed\n", - offline_cpu_socket); + EFD_LOG(ERR, + "Allocating EFD table management structureon socket %u failed", + offline_cpu_socket); goto error_unlock_exit; } - RTE_LOG(DEBUG, EFD, "Allocated EFD table management structure " - "on socket %u\n", offline_cpu_socket); + EFD_LOG(DEBUG, "Allocated EFD table management structure on socket %u", + offline_cpu_socket); table->max_num_rules = num_chunks * EFD_TARGET_CHUNK_MAX_NUM_RULES; table->num_rules = 0; @@ -586,17 +590,17 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, RTE_CACHE_LINE_SIZE, offline_cpu_socket); if (key_array == NULL) { - RTE_LOG(ERR, EFD, "Allocating key array" - " on socket %u failed\n", - offline_cpu_socket); + EFD_LOG(ERR, + "Allocating key array on socket %u failed", + offline_cpu_socket); goto error_unlock_exit; } table->keys = key_array; strlcpy(table->name, name, sizeof(table->name)); - RTE_LOG(DEBUG, EFD, "Creating an EFD table with %u chunks," - " which potentially supports %u entries\n", - num_chunks, table->max_num_rules); + EFD_LOG(DEBUG, + "Creating an EFD table with %u chunks, which potentially supports %u entries", + num_chunks, table->max_num_rules); /* Make sure all the allocatable table pointers are NULL initially */ for (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES; socket_id++) @@ -623,19 +627,16 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, RTE_CACHE_LINE_SIZE, socket_id); if (table->chunks[socket_id] == NULL) { - RTE_LOG(ERR, EFD, - "Allocating EFD online table on " - "socket %u failed\n", - socket_id); + EFD_LOG(ERR, + "Allocating EFD online table on socket %u failed", + socket_id); goto error_unlock_exit; } - RTE_LOG(DEBUG, EFD, - "Allocated EFD online table of size " - "%"PRIu64" bytes (%.2f MB) on socket %u\n", - online_table_size, - (float) online_table_size / - (1024.0F * 1024.0F), - socket_id); + EFD_LOG(DEBUG, + "Allocated EFD online table of size %" PRIu64 " bytes (%.2f MB) on socket %u", + online_table_size, + (float) online_table_size / (1024.0F * 1024.0F), + socket_id); } } @@ -675,16 +676,17 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, RTE_CACHE_LINE_SIZE, offline_cpu_socket); if (table->offline_chunks == NULL) { - RTE_LOG(ERR, EFD, "Allocating EFD offline table on socket %u " - "failed\n", offline_cpu_socket); + EFD_LOG(ERR, + "Allocating EFD offline table on socket %u failed", + offline_cpu_socket); goto error_unlock_exit; } - RTE_LOG(DEBUG, EFD, - "Allocated EFD offline table of size %"PRIu64" bytes " - " (%.2f MB) on socket %u\n", offline_table_size, - (float) offline_table_size / (1024.0F * 1024.0F), - offline_cpu_socket); + EFD_LOG(DEBUG, + "Allocated EFD offline table of size %" PRIu64 " bytes (%.2f MB) on socket %u", + offline_table_size, + (float) offline_table_size / (1024.0F * 1024.0F), + offline_cpu_socket); te->data = (void *) table; TAILQ_INSERT_TAIL(efd_list, te, next); @@ -695,7 +697,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len, r = rte_ring_create(ring_name, rte_align32pow2(table->max_num_rules), offline_cpu_socket, 0); if (r == NULL) { - RTE_LOG(ERR, EFD, "memory allocation failed\n"); + EFD_LOG(ERR, "ring memory allocation failed"); rte_efd_free(table); return NULL; } @@ -1015,20 +1017,17 @@ efd_compute_update(struct rte_efd_table * const table, if (found == 0) { /* Key does not exist. Insert the rule into the bin/group */ if (unlikely(current_group->num_rules >= EFD_MAX_GROUP_NUM_RULES)) { - RTE_LOG(ERR, EFD, - "Fatal: No room remaining for insert into " - "chunk %u group %u bin %u\n", - *chunk_id, - current_group_id, *bin_id); + EFD_LOG(ERR, + "Fatal: No room remaining for insert into chunk %u group %u bin %u", + *chunk_id, current_group_id, *bin_id); return RTE_EFD_UPDATE_FAILED; } if (unlikely(current_group->num_rules == (EFD_MAX_GROUP_NUM_RULES - 1))) { - RTE_LOG(INFO, EFD, "Warn: Insert into last " - "available slot in chunk %u " - "group %u bin %u\n", *chunk_id, - current_group_id, *bin_id); + EFD_LOG(NOTICE, + "Insert into last available slot in chunk %u group %u bin %u", + *chunk_id, current_group_id, *bin_id); status = RTE_EFD_UPDATE_WARN_GROUP_FULL; } @@ -1112,14 +1111,11 @@ efd_compute_update(struct rte_efd_table * const table, uint8_t choice = 0; for (;;) { if (current_group != new_group && - new_group->num_rules + bin_size > - EFD_MAX_GROUP_NUM_RULES) { - RTE_LOG(DEBUG, EFD, - "Unable to move_groups to dest group " - "containing %u entries." - "bin_size:%u choice:%02x\n", - new_group->num_rules, bin_size, - choice - 1); + new_group->num_rules + bin_size > EFD_MAX_GROUP_NUM_RULES) { + EFD_LOG(DEBUG, + "Unable to move_groups to dest group containing %u entries. bin_size:%u choice:%02x", + new_group->num_rules, bin_size, + choice - 1); goto next_choice; } move_groups(*bin_id, bin_size, new_group, current_group); @@ -1132,10 +1128,10 @@ efd_compute_update(struct rte_efd_table * const table, if (!ret) return status; - RTE_LOG(DEBUG, EFD, - "Failed to find perfect hash for group " - "containing %u entries. bin_size:%u choice:%02x\n", - new_group->num_rules, bin_size, choice - 1); + EFD_LOG(DEBUG, + "Failed to find perfect hash for group containing %u entries. bin_size:%u choice:%02x", + new_group->num_rules, bin_size, choice - 1); + /* Restore groups modified to their previous state */ revert_groups(current_group, new_group, bin_size); -- 2.39.1