From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 02ECEA046B for ; Mon, 24 Jun 2019 04:23:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F0B1F1BF42; Mon, 24 Jun 2019 04:23:42 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 1DC7B1BF42 for ; Mon, 24 Jun 2019 04:23:42 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id y15so1954308pfn.5 for ; Sun, 23 Jun 2019 19:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=+YXqnNluOvmZ+Dagq6pkTuc01Fh73RfKppOA9PA9vUU=; b=cmt5TeZ+jMaL+r4omz0OJ6JTCA6wN7aK15o0uR7Z796x6GaudbGfgZa+YaPJqtIshA nOixDAdV4yX/9Z3UdTamC0ypPnR3wpTq/tjnQbwE8uauri4Zt91INOB4rocS4ICaqgWH LoKSAsMeod0cpbY7zdgMhe3HzXAMKuBpCVE3GEH4Mn0u0fAe/U4N6rxxu0t0m7C04ogQ S/ojZkZYCABAszaR+i1dWy88qaGHQgThXG3wrmFBNb135CGA9Un8O5z/uzSORZa+OHUL jGm+yEoHFcOVE8bZJrwkeljEgP83cBCuV0EgHLnP3Ok4I8oc5kpzUgp7shFbzZ2HitFt 9VEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+YXqnNluOvmZ+Dagq6pkTuc01Fh73RfKppOA9PA9vUU=; b=lMeYx38lSsZAkJ8nVYu9lKeQjd8ZWlqYQtQVgwMmCF2ufAAtartzUCoXThffMEB6TV D4gO1zZDAY+LfyG8iFMwYAJkFQoLZ/pncsZM1ZExhoq7KdNt5Vja+F9uhTosWan8qMHI sTLf7G+dvdGFKI4bCoJI8i6hLbE3SzahrYdpeVuDubzj3opuT/4OgU4QD9kp/9n3FlRs 1s1gnivasMPPm0RuEmO7hU9WJxz/lLmFJXLp0iRWBR+RP59zBzkm+m3qzDrRSt8wz16Z op3JvWDKJP21CM68FRq/lAImi/K9ySgC+0M0/1aQdG0/g//+MkfI7VdFo5jlWlSoflx0 7kuw== X-Gm-Message-State: APjAAAXUxT5/MObG6n27Wrd3vcupmDut8yegmWGFpYxi8UcG31r6XkEZ KS18TDKhba0SOyZloPadyMr3wmZ1 X-Google-Smtp-Source: APXvYqysdmFQfOLKCvlzXqKQW6m9fcz2sU34Oq+HpydCzjbf2nrUQl7dmbCDVG5aV+7//yPm0JaA4Q== X-Received: by 2002:a17:90a:24e4:: with SMTP id i91mr22826449pje.9.1561343021111; Sun, 23 Jun 2019 19:23:41 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y5sm9127726pgv.12.2019.06.23.19.23.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 19:23:40 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 24 Jun 2019 11:23:22 +0900 Message-Id: <20190624022325.18695-3-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624022325.18695-1-yasufum.o@gmail.com> References: <20190624022325.18695-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 2/5] shared/sec: rename funcs start with dump X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa Functions have prefix `dump_` do DEBUG logging actually, so the term of prefix is vague and not describing the feature exactly. This update is to change the prefix to `log_` to be explicitly doing just logging. Signed-off-by: Yasufumi Ogawa --- .../secondary/spp_worker_th/cmd_utils.c | 66 +++++++++---------- .../secondary/spp_worker_th/cmd_utils.h | 27 ++++---- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c index 07d6a2a..7f0a1ce 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.c +++ b/src/shared/secondary/spp_worker_th/cmd_utils.c @@ -34,38 +34,30 @@ struct mng_data_info { unsigned int main_lcore_id; }; -/* Declare global variables */ /* Logical core ID for main process */ static struct mng_data_info g_mng_data; -/** - * Make a hexdump of an array data in every 4 byte. - * This function is used to dump core_info or component info. - */ +/* Hexdump `addr` for logging, used for core_info or component info. */ void -dump_buff(const char *name, const void *addr, const size_t size) +log_hexdumped(const char *obj_name, const void *obj_addr, const size_t size) { - size_t cnt = 0; - size_t max = (size / sizeof(unsigned int)) + + size_t cnt; + size_t max_cnt = (size / sizeof(unsigned int)) + ((size % sizeof(unsigned int)) != 0); - const uint32_t *buff = addr; + const uint32_t *buf = obj_addr; - if ((name != NULL) && (name[0] != '\0')) - RTE_LOG(DEBUG, APP, "dump buff. (%s)\n", name); + if ((obj_name != NULL) && (obj_name[0] != '\0')) + RTE_LOG(DEBUG, APP, "Name of dumped buf: %s.\n", obj_name); - for (cnt = 0; cnt < max; cnt += 16) { + for (cnt = 0; cnt < max_cnt; cnt += 16) { RTE_LOG(DEBUG, APP, "[%p]" - " %08x %08x %08x %08x %08x %08x %08x %08x" - " %08x %08x %08x %08x %08x %08x %08x %08x", - &buff[cnt], - buff[cnt+0], buff[cnt+1], - buff[cnt+2], buff[cnt+3], - buff[cnt+4], buff[cnt+5], - buff[cnt+6], buff[cnt+7], - buff[cnt+8], buff[cnt+9], - buff[cnt+10], buff[cnt+11], - buff[cnt+12], buff[cnt+13], - buff[cnt+14], buff[cnt+15]); + " %08x %08x %08x %08x %08x %08x %08x %08x" + " %08x %08x %08x %08x %08x %08x %08x %08x", + &buf[cnt], + buf[cnt+0], buf[cnt+1], buf[cnt+2], buf[cnt+3], + buf[cnt+4], buf[cnt+5], buf[cnt+6], buf[cnt+7], + buf[cnt+8], buf[cnt+9], buf[cnt+10], buf[cnt+11], + buf[cnt+12], buf[cnt+13], buf[cnt+14], buf[cnt+15]); } } @@ -288,7 +280,7 @@ get_sppwk_port(enum port_type iface_type, int iface_no) /* Dump of core information */ void -dump_core_info(const struct core_mng_info *core_info) +log_core_info(const struct core_mng_info *core_info) { char str[SPP_NAME_STR_LEN]; const struct core_mng_info *info = NULL; @@ -300,16 +292,18 @@ dump_core_info(const struct core_mng_info *core_info) info->ref_index, info->upd_index); memset(str, 0x00, SPP_NAME_STR_LEN); - dump_buff(str, info->core[0].id, sizeof(int)*info->core[0].num); + log_hexdumped(str, info->core[0].id, + sizeof(int)*info->core[0].num); sprintf(str, "core[%d]-1 num=%d", lcore_id, info->core[1].num); - dump_buff(str, info->core[1].id, sizeof(int)*info->core[1].num); + log_hexdumped(str, info->core[1].id, + sizeof(int)*info->core[1].num); } } /* Dump of component information */ void -dump_component_info(const struct sppwk_comp_info *comp_info) +log_component_info(const struct sppwk_comp_info *comp_info) { char str[SPP_NAME_STR_LEN]; const struct sppwk_comp_info *tmp_ci = NULL; @@ -326,19 +320,19 @@ dump_component_info(const struct sppwk_comp_info *comp_info) sprintf(str, "component[%d] rx=%d", cnt, tmp_ci->nof_rx); - dump_buff(str, tmp_ci->rx_ports, + log_hexdumped(str, tmp_ci->rx_ports, sizeof(struct sppwk_port_info *)*tmp_ci->nof_rx); sprintf(str, "component[%d] tx=%d", cnt, tmp_ci->nof_tx); - dump_buff(str, tmp_ci->tx_ports, + log_hexdumped(str, tmp_ci->tx_ports, sizeof(struct sppwk_port_info *)*tmp_ci->nof_tx); } } /* Dump of interface information */ void -dump_interface_info(const struct iface_info *iface_info) +log_interface_info(const struct iface_info *iface_info) { const struct sppwk_port_info *port = NULL; int cnt = 0; @@ -389,7 +383,7 @@ dump_interface_info(const struct iface_info *iface_info) /* Dump of all management information */ void -dump_all_mng_info( +log_all_mng_info( const struct core_mng_info *core, const struct sppwk_comp_info *component, const struct iface_info *interface) @@ -397,9 +391,9 @@ dump_all_mng_info( if (rte_log_get_global_level() < RTE_LOG_DEBUG) return; - dump_core_info(core); - dump_component_info(component); - dump_interface_info(interface); + log_core_info(core); + log_component_info(component); + log_interface_info(interface); } /* Copy management information */ @@ -446,7 +440,7 @@ copy_mng_info( void backup_mng_info(struct cancel_backup_info *backup) { - dump_all_mng_info(g_mng_data.p_core_info, + log_all_mng_info(g_mng_data.p_core_info, g_mng_data.p_component_info, g_mng_data.p_iface_info); copy_mng_info(backup->core, backup->component, &backup->interface, @@ -454,7 +448,7 @@ backup_mng_info(struct cancel_backup_info *backup) g_mng_data.p_component_info, g_mng_data.p_iface_info, COPY_MNG_FLG_ALLCOPY); - dump_all_mng_info(backup->core, backup->component, &backup->interface); + log_all_mng_info(backup->core, backup->component, &backup->interface); memset(g_mng_data.p_change_core, 0x00, sizeof(int)*RTE_MAX_LCORE); memset(g_mng_data.p_change_component, 0x00, diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h index 4cecfdd..65a66b8 100644 --- a/src/shared/secondary/spp_worker_th/cmd_utils.h +++ b/src/shared/secondary/spp_worker_th/cmd_utils.h @@ -297,13 +297,14 @@ struct spp_iterate_classifier_table_params { }; /** - * Make a hexdump of an array data in every 4 byte + * Hexdump `addr` for logging, used for core_info or component info. * - * @param name Dumped name. - * @param addr Dumped address. - * @param size Dumped byte size. + * @param name Name of object to be dumped. + * @param addr Address of dumped value. + * @param size Size of dumped value. */ -void dump_buff(const char *name, const void *addr, const size_t size); +void log_hexdumped(const char *obj_name, const void *obj_addr, + const size_t size); /** * Add ring pmd for owned proccess or thread. @@ -376,17 +377,17 @@ void stop_process(int signal); struct sppwk_port_info * get_sppwk_port(enum port_type iface_type, int iface_no); -/* Dump of core information */ -void dump_core_info(const struct core_mng_info *core_info); +/* Output log message for core information */ +void log_core_info(const struct core_mng_info *core_info); -/* Dump of component information */ -void dump_component_info(const struct sppwk_comp_info *component_info); +/* Output log message for component information */ +void log_component_info(const struct sppwk_comp_info *component_info); -/* Dump of interface information */ -void dump_interface_info(const struct iface_info *iface_info); +/* Output log message for interface information */ +void log_interface_info(const struct iface_info *iface_info); -/* Dump of all management information */ -void dump_all_mng_info( +/* Output log message for all management information */ +void log_all_mng_info( const struct core_mng_info *core, const struct sppwk_comp_info *component, const struct iface_info *interface); -- 2.17.1