Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH] shared/sec: replace inappropriate log labels
@ 2019-08-02  9:36 Yasufumi Ogawa
  0 siblings, 0 replies; only message in thread
From: Yasufumi Ogawa @ 2019-08-02  9:36 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

There are still remained log label `APP` which has no meaning. This
update is to replace it with other labels for identifying where the log
message is generated.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 .../secondary/spp_worker_th/cmd_utils.c       | 41 +++++++++++--------
 src/vf/spp_vf.c                               | 24 +++++------
 2 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index de472cc..2c50dcd 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -28,7 +28,7 @@
 
 
 /* TODO(yasufum) change log label after filename is revised. */
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
+#define RTE_LOGTYPE_WK_CMD_UTILS RTE_LOGTYPE_USER1
 
 /* A set of pointers of management data */
 /* TODO(yasufum) change names start with `p_change` because it wrong meanig. */
@@ -54,10 +54,11 @@ log_hexdumped(const char *obj_name, const void *obj_addr, const size_t size)
 	const uint32_t *buf = obj_addr;
 
 	if ((obj_name != NULL) && (obj_name[0] != '\0'))
-		RTE_LOG(DEBUG, APP, "Name of dumped buf: %s.\n", obj_name);
+		RTE_LOG(DEBUG, WK_CMD_UTILS, "Name of dumped buf: %s.\n",
+				obj_name);
 
 	for (cnt = 0; cnt < max_cnt; cnt += 16) {
-		RTE_LOG(DEBUG, APP, "[%p]"
+		RTE_LOG(DEBUG, WK_CMD_UTILS, "[%p]"
 			" %08x %08x %08x %08x %08x %08x %08x %08x"
 			" %08x %08x %08x %08x %08x %08x %08x %08x",
 			&buf[cnt],
@@ -106,7 +107,8 @@ check_core_status_wait(enum sppwk_lcore_status status)
 			return SPPWK_RET_OK;
 	}
 
-	RTE_LOG(ERR, APP, "Status check time out. (status = %d)\n", status);
+	RTE_LOG(ERR, WK_CMD_UTILS, "Status check time out. (status = %d)\n",
+			status);
 	return SPPWK_RET_NG;
 }
 
@@ -177,7 +179,8 @@ log_core_info(const struct core_mng_info *core_info)
 	unsigned int lcore_id = 0;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
 		info = &core_info[lcore_id];
-		RTE_LOG(DEBUG, APP, "core[%d] status=%d, ref=%d, upd=%d\n",
+		RTE_LOG(DEBUG, WK_CMD_UTILS,
+				"core[%d] status=%d, ref=%d, upd=%d\n",
 				lcore_id, info->status,
 				info->ref_index, info->upd_index);
 
@@ -203,7 +206,7 @@ log_component_info(const struct sppwk_comp_info *comp_info)
 		if (tmp_ci->wk_type == SPPWK_TYPE_NONE)
 			continue;
 
-		RTE_LOG(DEBUG, APP, "component[%d] name=%s, type=%d, "
+		RTE_LOG(DEBUG, WK_CMD_UTILS, "component[%d] name=%s, type=%d, "
 				"core=%u, index=%d\n",
 				cnt, tmp_ci->name, tmp_ci->wk_type,
 				tmp_ci->lcore_id, tmp_ci->comp_id);
@@ -231,7 +234,8 @@ log_interface_info(const struct iface_info *iface_info)
 		if (port->iface_type == UNDEF)
 			continue;
 
-		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
+		RTE_LOG(DEBUG, WK_CMD_UTILS,
+				"phy  [%d] type=%d, no=%d, port=%d, "
 				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->ethdev_port_id,
@@ -244,7 +248,8 @@ log_interface_info(const struct iface_info *iface_info)
 		if (port->iface_type == UNDEF)
 			continue;
 
-		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
+		RTE_LOG(DEBUG, WK_CMD_UTILS,
+				"vhost[%d] type=%d, no=%d, port=%d, "
 				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->ethdev_port_id,
@@ -257,7 +262,8 @@ log_interface_info(const struct iface_info *iface_info)
 		if (port->iface_type == UNDEF)
 			continue;
 
-		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
+		RTE_LOG(DEBUG, WK_CMD_UTILS,
+				"ring [%d] type=%d, no=%d, port=%d, "
 				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->ethdev_port_id,
@@ -417,7 +423,8 @@ init_host_port_info(void)
 		rte_eth_dev_get_name_by_port(i, dev_name);
 		ret = parse_dev_name(dev_name, &port_type, &port_id);
 		if (ret < 0)
-			RTE_LOG(ERR, APP, "Failed to parse dev_name.\n");
+			RTE_LOG(ERR, WK_CMD_UTILS,
+					"Failed to parse dev_name.\n");
 
 		if (port_type == PHY) {
 			port_id = nof_phys;
@@ -438,9 +445,10 @@ init_host_port_info(void)
 			p_iface_info->ring[port_id].ethdev_port_id = port_id;
 			break;
 		default:
-			RTE_LOG(ERR, APP, "Unsupported port on host, "
-				"type:%d, id:%d.\n",
-				port_type, port_id);
+			RTE_LOG(ERR, WK_CMD_UTILS,
+					"Unsupported port on host, "
+					"type:%d, id:%d.\n",
+					port_type, port_id);
 		}
 	}
 
@@ -750,7 +758,8 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 	char *saveptr = NULL;
 	char *endptr = NULL;
 
-	RTE_LOG(DEBUG, APP, "Try to convert MAC addr `%s`.\n", macaddr);
+	RTE_LOG(DEBUG, WK_CMD_UTILS, "Try to convert MAC addr `%s`.\n",
+			macaddr);
 
 	strcpy(tmp_mac, macaddr);
 	while (1) {
@@ -761,7 +770,7 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 
 		/* Check for mal-formatted address */
 		if (unlikely(token_cnt >= ETHER_ADDR_LEN)) {
-			RTE_LOG(ERR, APP,
+			RTE_LOG(ERR, WK_CMD_UTILS,
 					"Invalid MAC address `%s`.\n",
 					macaddr);
 			return SPPWK_RET_NG;
@@ -779,7 +788,7 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 		str = NULL;
 	}
 
-	RTE_LOG(DEBUG, APP,
+	RTE_LOG(DEBUG, WK_CMD_UTILS,
 			"Succeeded to convert MAC addr `%s` to `0x%08lx`.\n",
 			macaddr, ret_mac);
 	return ret_mac;
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index aabddd3..e7f08f4 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -16,7 +16,7 @@
 #include "shared/secondary/spp_worker_th/cmd_parser.h"
 #include "shared/secondary/spp_worker_th/port_capability.h"
 
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
+#define RTE_LOGTYPE_SPP_VF RTE_LOGTYPE_USER1
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 #include "shared/secondary/spp_worker_th/ringlatencystats.h"
@@ -54,7 +54,7 @@ static struct cancel_backup_info g_backup_info;
 static void
 usage(const char *progname)
 {
-	RTE_LOG(INFO, APP, "Usage: %s [EAL args] --"
+	RTE_LOG(INFO, SPP_VF, "Usage: %s [EAL args] --"
 			" --client-id CLIENT_ID"
 			" -s SERVER_IP:SERVER_PORT"
 			" [--vhost-client]\n"
@@ -140,7 +140,7 @@ parse_app_args(int argc, char *argv[])
 		usage(progname);
 		return SPPWK_RET_NG;
 	}
-	RTE_LOG(INFO, APP,
+	RTE_LOG(INFO, SPP_VF,
 			"Parsed app args (client_id=%d,server=%s:%d,"
 			"vhost_client=%d)\n",
 			cli_id, ctl_ip, ctl_port, get_vhost_cli_mode());
@@ -158,7 +158,7 @@ slave_main(void *arg __attribute__ ((unused)))
 	struct core_mng_info *info = &g_core_info[lcore_id];
 	struct core_info *core = get_core_info(lcore_id);
 
-	RTE_LOG(INFO, APP, "Slave started on lcore %d.\n", lcore_id);
+	RTE_LOG(INFO, SPP_VF, "Slave started on lcore %d.\n", lcore_id);
 	set_core_status(lcore_id, SPPWK_LCORE_IDLING);
 
 	while ((status = sppwk_get_lcore_status(lcore_id)) !=
@@ -189,7 +189,7 @@ slave_main(void *arg __attribute__ ((unused)))
 			}
 		}
 		if (unlikely(ret != 0)) {
-			RTE_LOG(ERR, APP, "Failed to forward on lcore %d. "
+			RTE_LOG(ERR, SPP_VF, "Failed to forward on lcore %d. "
 					"(id = %d).\n",
 					lcore_id, core->id[cnt]);
 			break;
@@ -197,7 +197,7 @@ slave_main(void *arg __attribute__ ((unused)))
 	}
 
 	set_core_status(lcore_id, SPPWK_LCORE_STOPPED);
-	RTE_LOG(INFO, APP, "Terminated slave on lcore %d.\n", lcore_id);
+	RTE_LOG(INFO, SPP_VF, "Terminated slave on lcore %d.\n", lcore_id);
 	return ret;
 }
 
@@ -219,7 +219,7 @@ main(int argc, char *argv[])
 	/* Daemonize process */
 	ret = daemon(0, 0);
 	if (unlikely(ret != 0)) {
-		RTE_LOG(ERR, APP, "daemonize is failed. (ret = %d)\n",
+		RTE_LOG(ERR, SPP_VF, "daemonize is failed. (ret = %d)\n",
 				ret);
 		return ret;
 	}
@@ -256,7 +256,7 @@ main(int argc, char *argv[])
 					g_core_info, g_change_core,
 					g_change_component,
 					&g_backup_info) < SPPWK_RET_OK) {
-			RTE_LOG(ERR, APP,
+			RTE_LOG(ERR, SPP_VF,
 				"Failed to set management data.\n");
 			break;
 		}
@@ -311,8 +311,8 @@ main(int argc, char *argv[])
 
 		/* Start forwarding */
 		set_all_core_status(SPPWK_LCORE_RUNNING);
-		RTE_LOG(INFO, APP, "My ID %d start handling message\n", 0);
-		RTE_LOG(INFO, APP, "[Press Ctrl-C to quit ...]\n");
+		RTE_LOG(INFO, SPP_VF, "My ID %d start handling message\n", 0);
+		RTE_LOG(INFO, SPP_VF, "[Press Ctrl-C to quit ...]\n");
 
 		/* Backup the management information after initialization */
 		backup_mng_info(&g_backup_info);
@@ -352,7 +352,7 @@ main(int argc, char *argv[])
 	g_core_info[master_lcore].status = SPPWK_LCORE_STOPPED;
 	ret = check_core_status_wait(SPPWK_LCORE_STOPPED);
 	if (unlikely(ret != SPPWK_RET_OK))
-		RTE_LOG(ERR, APP, "Failed to terminate master thread.\n");
+		RTE_LOG(ERR, SPP_VF, "Failed to terminate master thread.\n");
 
 	/*
 	 * Remove vhost sock file if it is not running
@@ -364,6 +364,6 @@ main(int argc, char *argv[])
 	spp_ringlatencystats_uninit();
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
 
-	RTE_LOG(INFO, APP, "Exit spp_vf.\n");
+	RTE_LOG(INFO, SPP_VF, "Exit spp_vf.\n");
 	return ret;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  9:36 [spp] [PATCH] shared/sec: replace inappropriate log labels Yasufumi Ogawa

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox