Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 4/9] spp_pcap: rename define starts from SPP_CMD_MAX
Date: Fri, 31 May 2019 17:51:34 +0900	[thread overview]
Message-ID: <1559292699-26940-5-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559292699-26940-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

For refactoring, rename SPP_CMD_MAX_COMMANDS and SPP_CMD_MAX_PARAMETERS
to SPPWK_MAX_CMDS and SPPWK_MAX_PARAMS to be more simple and specific.
This update is also revise log labels.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/pcap/cmd_parser.c | 18 ++++-----
 src/pcap/cmd_parser.h | 12 +++---
 src/pcap/cmd_runner.c | 92 +++++++++++++++++++++----------------------
 src/pcap/cmd_runner.h |  6 +--
 src/pcap/cmd_utils.c  | 10 ++---
 src/pcap/cmd_utils.h  |  8 +++-
 6 files changed, 76 insertions(+), 70 deletions(-)

diff --git a/src/pcap/cmd_parser.c b/src/pcap/cmd_parser.c
index e7ad50e..b91b39c 100644
--- a/src/pcap/cmd_parser.c
+++ b/src/pcap/cmd_parser.c
@@ -11,7 +11,7 @@
 
 #include "cmd_parser.h"
 
-#define RTE_LOGTYPE_SPP_COMMAND_DEC RTE_LOGTYPE_USER2
+#define RTE_LOGTYPE_PCAP_PARSER RTE_LOGTYPE_USER2
 
 /* set parse error */
 static inline int
@@ -91,20 +91,20 @@ parse_command_in_list(struct spp_command_request *request,
 	struct parse_command_list *list = NULL;
 	int i = 0;
 	int argc = 0;
-	char *argv[SPP_CMD_MAX_PARAMETERS];
-	char tmp_str[SPP_CMD_MAX_PARAMETERS*SPP_CMD_VALUE_BUFSZ];
+	char *argv[SPPWK_MAX_PARAMS];
+	char tmp_str[SPPWK_MAX_PARAMS * SPP_CMD_VALUE_BUFSZ];
 	memset(argv, 0x00, sizeof(argv));
 	memset(tmp_str, 0x00, sizeof(tmp_str));
 
 	strcpy(tmp_str, request_str);
-	ret = parse_parameter_value(tmp_str, SPP_CMD_MAX_PARAMETERS,
+	ret = parse_parameter_value(tmp_str, SPPWK_MAX_PARAMS,
 			&argc, argv);
 	if (ret < SPP_RET_OK) {
-		RTE_LOG(ERR, SPP_COMMAND_DEC, "Parameter number over limit."
+		RTE_LOG(ERR, PCAP_PARSER, "Parameter number over limit."
 				"request_str=%s\n", request_str);
 		return set_parse_error(error, SPPWK_PARSE_WRONG_FORMAT, NULL);
 	}
-	RTE_LOG(DEBUG, SPP_COMMAND_DEC, "Decode array. num=%d\n", argc);
+	RTE_LOG(DEBUG, PCAP_PARSER, "Decode array. num=%d\n", argc);
 
 	for (i = 0; command_list_pcap[i].name[0] != '\0'; i++) {
 		list = &command_list_pcap[i];
@@ -126,12 +126,12 @@ parse_command_in_list(struct spp_command_request *request,
 	}
 
 	if (command_name_check != 0) {
-		RTE_LOG(ERR, SPP_COMMAND_DEC, "Parameter number out of range."
+		RTE_LOG(ERR, PCAP_PARSER, "Parameter number out of range."
 				"request_str=%s\n", request_str);
 		return set_parse_error(error, SPPWK_PARSE_WRONG_FORMAT, NULL);
 	}
 
-	RTE_LOG(ERR, SPP_COMMAND_DEC,
+	RTE_LOG(ERR, PCAP_PARSER,
 			"Unknown command. command=%s, request_str=%s\n",
 			argv[0], request_str);
 	return set_string_value_parse_error(error, argv[0], "command");
@@ -151,7 +151,7 @@ spp_command_parse_request(
 	request->num_command = 1;
 	ret = parse_command_in_list(request, request_str, error);
 	if (unlikely(ret != SPP_RET_OK)) {
-		RTE_LOG(ERR, SPP_COMMAND_DEC,
+		RTE_LOG(ERR, PCAP_PARSER,
 				"Cannot parse command request. "
 				"ret=%d, request_str=%.*s\n",
 				ret, (int)request_str_len, request_str);
diff --git a/src/pcap/cmd_parser.h b/src/pcap/cmd_parser.h
index 3893214..109b649 100644
--- a/src/pcap/cmd_parser.h
+++ b/src/pcap/cmd_parser.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
  */
 
-#ifndef _SPP_PCAP_COMMAND_DEC_H_
-#define _SPP_PCAP_COMMAND_DEC_H_
+#ifndef _SPP_PCAP_CMD_PARSER_H_
+#define _SPP_PCAP_CMD_PARSER_H_
 
 /**
  * @file
@@ -15,10 +15,10 @@
 #include "cmd_utils.h"
 
 /** max number of command per request */
-#define SPP_CMD_MAX_COMMANDS 32
+#define SPPWK_MAX_CMDS 32
 
 /** maximum number of parameters per command */
-#define SPP_CMD_MAX_PARAMETERS 8
+#define SPPWK_MAX_PARAMS 8
 
 /** command name string buffer size (include null char) */
 #define SPP_CMD_NAME_BUFSZ  32
@@ -69,7 +69,7 @@ struct spp_command {
 struct spp_command_request {
 	int num_command;                /**< Number of accepted commands */
 	int num_valid_command;          /**< Number of executed commands */
-	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
+	struct spp_command commands[SPPWK_MAX_CMDS];
 					/**<Information of executed commands */
 
 	int is_requested_client_id;     /**< Id for get_client_id command */
@@ -107,4 +107,4 @@ int spp_command_parse_request(struct spp_command_request *request,
 		const char *request_str, size_t request_str_len,
 		struct spp_command_parse_error *error);
 
-#endif /* _COMMAND_DEC_H_ */
+#endif /* _SPP_PCAP_CMD_PARSER_H_ */
diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c
index 44d00ae..0ce5d49 100644
--- a/src/pcap/cmd_runner.c
+++ b/src/pcap/cmd_runner.c
@@ -13,7 +13,7 @@
 #include "cmd_parser.h"
 #include "cmd_runner.h"
 
-#define RTE_LOGTYPE_SPP_COMMAND_PROC RTE_LOGTYPE_USER2
+#define RTE_LOGTYPE_PCAP_RUNNER RTE_LOGTYPE_USER2
 
 /* request message initial size */
 #define CMD_RES_ERR_MSG_SIZE  128
@@ -90,7 +90,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
 
 		ret = spp_pcap_get_core_status(lcore_id, params);
 		if (unlikely(ret != 0)) {
-			RTE_LOG(ERR, SPP_COMMAND_PROC,
+			RTE_LOG(ERR, PCAP_RUNNER,
 					"Cannot iterate core information. "
 						"(core = %d)\n", lcore_id);
 			return SPP_RET_NG;
@@ -106,7 +106,7 @@ append_json_comma(char **output)
 {
 	*output = spp_strbuf_append(*output, ", ", strlen(", "));
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's comma failed to add.\n");
 		return SPP_RET_NG;
 	}
@@ -126,7 +126,7 @@ append_json_uint_value(const char *name, char **output, unsigned int value)
 	*output = spp_strbuf_append(*output, "",
 			strlen(name) + CMD_TAG_APPEND_SIZE*2);
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's numeric format failed to add. "
 				"(name = %s, uint = %u)\n", name, value);
 		return SPP_RET_NG;
@@ -150,7 +150,7 @@ append_json_int_value(const char *name, char **output, int value)
 	*output = spp_strbuf_append(*output, "",
 			strlen(name) + CMD_TAG_APPEND_SIZE*2);
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's numeric format failed to add. "
 				"(name = %s, int = %d)\n", name, value);
 		return SPP_RET_NG;
@@ -174,7 +174,7 @@ append_json_str_value(const char *name, char **output, const char *str)
 	*output = spp_strbuf_append(*output, "",
 			strlen(name) + strlen(str) + CMD_TAG_APPEND_SIZE);
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's string format failed to add. "
 				"(name = %s, str = %s)\n", name, str);
 		return SPP_RET_NG;
@@ -198,7 +198,7 @@ append_json_array_brackets(const char *name, char **output, const char *str)
 	*output = spp_strbuf_append(*output, "",
 			strlen(name) + strlen(str) + CMD_TAG_APPEND_SIZE);
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's square bracket failed to add. "
 				"(name = %s, str = %s)\n", name, str);
 		return SPP_RET_NG;
@@ -218,7 +218,7 @@ append_json_block_brackets(const char *name, char **output, const char *str)
 	*output = spp_strbuf_append(*output, "",
 			strlen(name) + strlen(str) + CMD_TAG_APPEND_SIZE);
 	if (unlikely(*output == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"JSON's curly bracket failed to add. "
 				"(name = %s, str = %s)\n", name, str);
 		return SPP_RET_NG;
@@ -241,27 +241,27 @@ execute_command(const struct spp_command *command)
 
 	switch (command->type) {
 	case CMD_CLIENT_ID:
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Execute get_client_id command.\n");
 		break;
 
 	case CMD_STATUS:
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Execute status command.\n");
 		break;
 
 	case CMD_EXIT:
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Execute exit command.\n");
 		break;
 
 	case CMD_START:
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Execute start command.\n");
 		break;
 
 	case CMD_STOP:
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Execute stop command.\n");
 		break;
 	}
@@ -376,7 +376,7 @@ append_error_details_value(const char *name, char **output, void *tmp)
 
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s)\n",
 				name);
 		return SPP_RET_NG;
@@ -424,7 +424,7 @@ append_port_entry(char **output, const struct spp_port_index *port,
 	char port_str[CMD_TAG_APPEND_SIZE];
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = port_block)\n");
 		return SPP_RET_NG;
 	}
@@ -449,7 +449,7 @@ append_port_array(const char *name, char **output, const int num,
 	int i = 0;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s)\n",
 				name);
 		return SPP_RET_NG;
@@ -496,7 +496,7 @@ append_pcap_core_element_value(
 
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (lcore_id = %d, type = %s)\n",
 				lcore_id, type);
 		return ret;
@@ -544,7 +544,7 @@ append_core_value(const char *name, char **output,
 
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s)\n",
 				name);
 		return SPP_RET_NG;
@@ -575,7 +575,7 @@ append_response_list_value(char **output,
 	char *tmp_buff;
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = response_list)\n");
 		return SPP_RET_NG;
 	}
@@ -585,7 +585,7 @@ append_response_list_value(char **output,
 		ret = list[i].func(list[i].tag_name, &tmp_buff, tmp);
 		if (unlikely(ret < SPP_RET_OK)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC,
+			RTE_LOG(ERR, PCAP_RUNNER,
 					"Failed to get reply string. "
 					"(tag = %s)\n", list[i].tag_name);
 			return SPP_RET_NG;
@@ -598,7 +598,7 @@ append_response_list_value(char **output,
 			ret = append_json_comma(output);
 			if (unlikely(ret < SPP_RET_OK)) {
 				spp_strbuf_free(tmp_buff);
-				RTE_LOG(ERR, SPP_COMMAND_PROC,
+				RTE_LOG(ERR, PCAP_RUNNER,
 						"Failed to add commas. "
 						"(tag = %s)\n",
 						list[i].tag_name);
@@ -610,7 +610,7 @@ append_response_list_value(char **output,
 				strlen(tmp_buff));
 		if (unlikely(*output == NULL)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC,
+			RTE_LOG(ERR, PCAP_RUNNER,
 					"Failed to add reply string. "
 					"(tag = %s)\n",
 					list[i].tag_name);
@@ -651,7 +651,7 @@ append_command_results_value(const char *name, char **output,
 	char *tmp_buff1, *tmp_buff2;
 	tmp_buff1 = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff1 == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s, buff=1)\n",
 				name);
 		return SPP_RET_NG;
@@ -660,7 +660,7 @@ append_command_results_value(const char *name, char **output,
 	tmp_buff2 = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff2 == NULL)) {
 		spp_strbuf_free(tmp_buff1);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s, buff=2)\n",
 				name);
 		return SPP_RET_NG;
@@ -698,7 +698,7 @@ append_info_value(const char *name, char **output)
 	int ret = SPP_RET_NG;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = %s)\n",
 				name);
 		return SPP_RET_NG;
@@ -726,7 +726,7 @@ send_parse_error_response(int *sock,
 	char *msg, *tmp_buff;
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. "
+		RTE_LOG(ERR, PCAP_RUNNER, "allocate error. "
 				"(name = parse_error_response)\n");
 		return;
 	}
@@ -736,7 +736,7 @@ send_parse_error_response(int *sock,
 			request->num_command, command_results);
 	if (unlikely(ret < SPP_RET_OK)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"Failed to make command result response.\n");
 		return;
 	}
@@ -744,7 +744,7 @@ send_parse_error_response(int *sock,
 	msg = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(msg == NULL)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. "
+		RTE_LOG(ERR, PCAP_RUNNER, "allocate error. "
 				"(name = parse_error_response)\n");
 		return;
 	}
@@ -752,19 +752,19 @@ send_parse_error_response(int *sock,
 	spp_strbuf_free(tmp_buff);
 	if (unlikely(ret < SPP_RET_OK)) {
 		spp_strbuf_free(msg);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = result_response)\n");
 		return;
 	}
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+	RTE_LOG(DEBUG, PCAP_RUNNER,
 			"Make command response (parse error). "
 			"response_str=\n%s\n", msg);
 
 	/* send response to requester */
 	ret = spp_send_message(sock, msg, strlen(msg));
 	if (unlikely(ret != SPP_RET_OK)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"Failed to send parse error response.\n");
 		/* not return */
 	}
@@ -784,7 +784,7 @@ send_command_result_response(int *sock,
 
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = result_response)\n");
 		return;
 	}
@@ -794,7 +794,7 @@ send_command_result_response(int *sock,
 			request->num_command, command_results);
 	if (unlikely(ret < SPP_RET_OK)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"Failed to make command result response.\n");
 		return;
 	}
@@ -804,7 +804,7 @@ send_command_result_response(int *sock,
 		ret = append_client_id_value("client_id", &tmp_buff, NULL);
 		if (unlikely(ret < SPP_RET_OK)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make "
+			RTE_LOG(ERR, PCAP_RUNNER, "Failed to make "
 					"client id response.\n");
 			return;
 		}
@@ -817,7 +817,7 @@ send_command_result_response(int *sock,
 		ret = append_info_value("info", &tmp_buff);
 		if (unlikely(ret < SPP_RET_OK)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC,
+			RTE_LOG(ERR, PCAP_RUNNER,
 					"Failed to make status response.\n");
 			return;
 		}
@@ -840,7 +840,7 @@ send_command_result_response(int *sock,
 	msg = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(msg == NULL)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = result_response)\n");
 		return;
 	}
@@ -848,19 +848,19 @@ send_command_result_response(int *sock,
 	spp_strbuf_free(tmp_buff);
 	if (unlikely(ret < SPP_RET_OK)) {
 		spp_strbuf_free(msg);
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 				"allocate error. (name = result_response)\n");
 		return;
 	}
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+	RTE_LOG(DEBUG, PCAP_RUNNER,
 			"Make command response (command result). "
 			"response_str=\n%s\n", msg);
 
 	/* send response to requester */
 	ret = spp_send_message(sock, msg, strlen(msg));
 	if (unlikely(ret != SPP_RET_OK)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC,
+		RTE_LOG(ERR, PCAP_RUNNER,
 			"Failed to send command result response.\n");
 		/* not return */
 	}
@@ -877,13 +877,13 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 
 	struct spp_command_request request;
 	struct spp_command_parse_error parse_error;
-	struct command_result command_results[SPP_CMD_MAX_COMMANDS];
+	struct command_result command_results[SPPWK_MAX_CMDS];
 
 	memset(&request, 0, sizeof(struct spp_command_request));
 	memset(&parse_error, 0, sizeof(struct spp_command_parse_error));
 	memset(command_results, 0, sizeof(command_results));
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "Start command request processing. "
+	RTE_LOG(DEBUG, PCAP_RUNNER, "Start command request processing. "
 			"request_str=\n%.*s\n",
 			(int)request_str_len, request_str);
 
@@ -895,12 +895,12 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 		set_parse_error_to_results(command_results, &request,
 				&parse_error);
 		send_parse_error_response(sock, &request, command_results);
-		RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+		RTE_LOG(DEBUG, PCAP_RUNNER,
 				"End command request processing.\n");
 		return SPP_RET_OK;
 	}
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "Command request is valid. "
+	RTE_LOG(DEBUG, PCAP_RUNNER, "Command request is valid. "
 			"num_command=%d, num_valid_command=%d\n",
 			request.num_command, request.num_valid_command);
 
@@ -927,7 +927,7 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 		/* Other route is normal end because it responds to command. */
 		set_command_results(&command_results[0], CMD_SUCCESS, "");
 		send_command_result_response(sock, &request, command_results);
-		RTE_LOG(INFO, SPP_COMMAND_PROC,
+		RTE_LOG(INFO, PCAP_RUNNER,
 				"Terminate process for exit.\n");
 		return SPP_RET_NG;
 	}
@@ -935,7 +935,7 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 	/* send response */
 	send_command_result_response(sock, &request, command_results);
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "End command request processing.\n");
+	RTE_LOG(DEBUG, PCAP_RUNNER, "End command request processing.\n");
 
 	return SPP_RET_OK;
 }
@@ -960,7 +960,7 @@ spp_command_proc_do(void)
 	if (unlikely(msgbuf == NULL)) {
 		msgbuf = spp_strbuf_allocate(CMD_REQ_BUF_INIT_SIZE);
 		if (unlikely(msgbuf == NULL)) {
-			RTE_LOG(ERR, SPP_COMMAND_PROC,
+			RTE_LOG(ERR, PCAP_RUNNER,
 					"Cannot allocate memory "
 					"for receive data(init).\n");
 			return SPP_RET_NG;
diff --git a/src/pcap/cmd_runner.h b/src/pcap/cmd_runner.h
index cbaf6a2..ccae164 100644
--- a/src/pcap/cmd_runner.h
+++ b/src/pcap/cmd_runner.h
@@ -2,8 +2,8 @@
  * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
  */
 
-#ifndef _SPP_PCAP_COMMAND_PROC_H_
-#define _SPP_PCAP_COMMAND_PROC_H_
+#ifndef _SPP_PCAP_CMD_RUNNER_H_
+#define _SPP_PCAP_CMD_RUNNER_H_
 
 /**
  * @file
@@ -39,4 +39,4 @@ spp_command_proc_init(const char *controller_ip, int controller_port);
 int
 spp_command_proc_do(void);
 
-#endif /* _SPP_PCAP_COMMAND_PROC_H_ */
+#endif /* _SPP_PCAP_CMD_RUNNER_H_ */
diff --git a/src/pcap/cmd_utils.c b/src/pcap/cmd_utils.c
index f8f5e46..f425ed0 100644
--- a/src/pcap/cmd_utils.c
+++ b/src/pcap/cmd_utils.c
@@ -10,7 +10,7 @@
 
 #include "cmd_utils.h"
 
-#define RTE_LOGTYPE_SPP_PROC RTE_LOGTYPE_USER2
+#define RTE_LOGTYPE_PCAP_UTILS RTE_LOGTYPE_USER2
 
 /* Manage data to addoress */
 struct manage_data_addr_info {
@@ -38,7 +38,7 @@ add_ring_pmd(int ring_id)
 	/* Lookup ring of given id */
 	ring = rte_ring_lookup(get_rx_queue_name(ring_id));
 	if (unlikely(ring == NULL)) {
-		RTE_LOG(ERR, SPP_PROC,
+		RTE_LOG(ERR, PCAP_UTILS,
 			"Cannot get RX ring - is server process running?\n");
 		return SPP_RET_NG;
 	}
@@ -50,7 +50,7 @@ add_ring_pmd(int ring_id)
 	if (port_id == PORT_RESET) {
 		ring_port_id = rte_eth_from_ring(ring);
 		if (ring_port_id < 0) {
-			RTE_LOG(ERR, SPP_PROC, "Cannot create eth dev with "
+			RTE_LOG(ERR, PCAP_UTILS, "Cannot create eth dev with "
 						"rte_eth_from_ring()\n");
 			return SPP_RET_NG;
 		}
@@ -58,7 +58,7 @@ add_ring_pmd(int ring_id)
 		ring_port_id = port_id;
 		rte_eth_dev_start(ring_port_id);
 	}
-	RTE_LOG(INFO, SPP_PROC, "ring port add. (no = %d / port = %d)\n",
+	RTE_LOG(INFO, PCAP_UTILS, "ring port add. (no = %d / port = %d)\n",
 			ring_id, ring_port_id);
 	return ring_port_id;
 }
@@ -101,7 +101,7 @@ check_core_status_wait(enum sppwk_lcore_status status)
 			return SPP_RET_OK;
 	}
 
-	RTE_LOG(ERR, SPP_PROC,
+	RTE_LOG(ERR, PCAP_UTILS,
 			"Status check time out. (status = %d)\n", status);
 	return SPP_RET_NG;
 }
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index c7684c9..8cebf2d 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -2,6 +2,12 @@
  * Copyright(c) 2018 Nippon Telegraph and Telephone Corporation
  */
 
+/**
+ * TODO(yasufum) change this define tag because it is the same as
+ * shared/.../cmd_utils.h. However, it should be the same to avoid both of
+ * this and shared headers are included which are incompabtible and causes
+ * an compile error. After fixing the incompatibility, change the tag name.
+ */
 #ifndef _SPPWK_CMD_UTILS_H_
 #define _SPPWK_CMD_UTILS_H_
 
@@ -387,4 +393,4 @@ void spp_get_mng_data_addr(struct startup_param **startup_param_addr,
 			   int **capture_request_addr,
 			   int **capture_status_addr);
 
-#endif /* _SPPWK_CMD_UTILS_H_ */
+#endif
-- 
2.17.1


  parent reply	other threads:[~2019-05-31  8:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:51 [spp] [PATCH 0/9] Refactor func and struct for spp_pcap resources ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 1/9] spp_pcap: rename enum spp_core_status ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 2/9] spp_pcap: rename file of util libs ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 3/9] spp_pcap: refactor parse error code ogawa.yasufumi
2019-05-31  8:51 ` ogawa.yasufumi [this message]
2019-05-31  8:51 ` [spp] [PATCH 5/9] spp_pcap: rename define of buffer size for cmds ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 6/9] spp_pcap: revise name of error message object ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 7/9] spp_pcap: revise return codes ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 8/9] spp_pcap: rename struct spp_port_info ogawa.yasufumi
2019-05-31  8:51 ` [spp] [PATCH 9/9] spp_pcap: rename struct spp_port_index ogawa.yasufumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559292699-26940-5-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).