From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 05/13] shared/sec: move JSON formatter to shard/secondary
Date: Mon, 24 Jun 2019 13:36:05 +0900 [thread overview]
Message-ID: <20190624043613.19271-6-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624043613.19271-1-yasufum.o@gmail.com>
From: Yasufumi Ogawa <yasufum.o@gmail.com>
Principle JSON formatters, such as append_json_int_value(), can be used
from all of SPP secondary processes. This update is to move files
`json_helper.*` and `string_buffer.*` to the parent directory
`shared/secondary`. Definition of return codes of `SPP_RET_OK` and
`SPP_RET_NG` is also moved to the directory for the change.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/Makefile | 7 ++++---
src/pcap/Makefile | 3 ++-
src/pcap/cmd_runner.c | 2 +-
.../secondary/{spp_worker_th => }/json_helper.c | 0
.../secondary/{spp_worker_th => }/json_helper.h | 6 +++++-
src/shared/secondary/return_codes.h | 13 +++++++++++++
src/shared/secondary/spp_worker_th/cmd_runner.c | 4 ++--
src/shared/secondary/spp_worker_th/cmd_utils.h | 6 +-----
src/shared/secondary/spp_worker_th/conn_spp_ctl.c | 2 +-
.../secondary/{spp_worker_th => }/string_buffer.c | 0
.../secondary/{spp_worker_th => }/string_buffer.h | 0
src/vf/Makefile | 7 ++++---
12 files changed, 33 insertions(+), 17 deletions(-)
rename src/shared/secondary/{spp_worker_th => }/json_helper.c (100%)
rename src/shared/secondary/{spp_worker_th => }/json_helper.h (95%)
create mode 100644 src/shared/secondary/return_codes.h
rename src/shared/secondary/{spp_worker_th => }/string_buffer.c (100%)
rename src/shared/secondary/{spp_worker_th => }/string_buffer.h (100%)
diff --git a/src/mirror/Makefile b/src/mirror/Makefile
index 6b6b9b9..b31e116 100644
--- a/src/mirror/Makefile
+++ b/src/mirror/Makefile
@@ -11,19 +11,20 @@ include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = spp_mirror
+SPP_SEC_DIR = ../shared/secondary
SPP_WKT_DIR = ../shared/secondary/spp_worker_th
# all source are stored in SRCS-y
SRCS-y := spp_mirror.c
SRCS-y += ../shared/common.c
-SRCS-y += ../shared/secondary/utils.c ../shared/secondary/add_port.c
+SRCS-y += $(SPP_SEC_DIR)/utils.c $(SPP_SEC_DIR)/add_port.c
+SRCS-y += $(SPP_SEC_DIR)/json_helper.c
+SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_WKT_DIR)/cmd_utils.c
SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
SRCS-y += $(SPP_WKT_DIR)/cmd_parser.c
SRCS-y += $(SPP_WKT_DIR)/cmd_runner.c
-SRCS-y += $(SPP_WKT_DIR)/json_helper.c
-SRCS-y += $(SPP_WKT_DIR)/string_buffer.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/src/pcap/Makefile b/src/pcap/Makefile
index c3d5ae4..852d036 100644
--- a/src/pcap/Makefile
+++ b/src/pcap/Makefile
@@ -11,6 +11,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = spp_pcap
+SPP_SEC_DIR = ../shared/secondary
SPP_WKT_DIR = ../shared/secondary/spp_worker_th
# all source are stored in SRCS-y
@@ -18,10 +19,10 @@ SRCS-y := spp_pcap.c
SRCS-y += cmd_utils.c
SRCS-y += cmd_runner.c cmd_parser.c
SRCS-y += ../shared/common.c
+SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
-SRCS-y += $(SPP_WKT_DIR)/string_buffer.c
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3 -MMD
diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c
index 8a1fb87..55f15bf 100644
--- a/src/pcap/cmd_runner.c
+++ b/src/pcap/cmd_runner.c
@@ -7,7 +7,7 @@
#include <rte_log.h>
-#include "shared/secondary/spp_worker_th/string_buffer.h"
+#include "shared/secondary/string_buffer.h"
#include "spp_pcap.h"
#include "shared/secondary/spp_worker_th/conn_spp_ctl.h"
#include "cmd_parser.h"
diff --git a/src/shared/secondary/spp_worker_th/json_helper.c b/src/shared/secondary/json_helper.c
similarity index 100%
rename from src/shared/secondary/spp_worker_th/json_helper.c
rename to src/shared/secondary/json_helper.c
diff --git a/src/shared/secondary/spp_worker_th/json_helper.h b/src/shared/secondary/json_helper.h
similarity index 95%
rename from src/shared/secondary/spp_worker_th/json_helper.h
rename to src/shared/secondary/json_helper.h
index 0bfe0bf..b004428 100644
--- a/src/shared/secondary/spp_worker_th/json_helper.h
+++ b/src/shared/secondary/json_helper.h
@@ -5,7 +5,11 @@
#ifndef _SPPWK_JSON_HELPER_H_
#define _SPPWK_JSON_HELPER_H_
-#include "cmd_utils.h"
+#include <string.h>
+#include <rte_branch_prediction.h>
+#include <rte_log.h>
+#include "return_codes.h"
+#include "string_buffer.h"
/* TODO(yasufum) revise name considering the usage. */
#define JSON_APPEND_LEN 16
diff --git a/src/shared/secondary/return_codes.h b/src/shared/secondary/return_codes.h
new file mode 100644
index 0000000..18b4711
--- /dev/null
+++ b/src/shared/secondary/return_codes.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _SPP_SEC_RETURN_CODES_H_
+#define _SPP_SEC_RETURN_CODES_H_
+
+enum spp_return_val {
+ SPP_RET_OK = 0, /**< succeeded */
+ SPP_RET_NG = -1, /**< failed */
+};
+
+#endif
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index e41fd85..b1718fa 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -11,9 +11,9 @@
#include "vf_deps.h"
#include "mirror_deps.h"
#include "spp_port.h"
-#include "string_buffer.h"
+#include "shared/secondary/string_buffer.h"
-#include "json_helper.h"
+#include "shared/secondary/json_helper.h"
#include "conn_spp_ctl.h"
#include "cmd_parser.h"
#include "cmd_runner.h"
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index b8ab10c..3ee3142 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -12,6 +12,7 @@
*/
#include <netinet/in.h>
+#include "shared/secondary/return_codes.h"
#include "shared/common.h"
/**
@@ -94,11 +95,6 @@ enum spp_classifier_type {
SPP_CLASSIFIER_TYPE_VLAN /**< VLAN ID */
};
-enum sppwk_return_val {
- SPP_RET_OK = 0, /**< succeeded */
- SPP_RET_NG = -1, /**< failed */
-};
-
/**
* Port type (rx or tx) to indicate which direction packet goes
* (e.g. receiving or transmitting)
diff --git a/src/shared/secondary/spp_worker_th/conn_spp_ctl.c b/src/shared/secondary/spp_worker_th/conn_spp_ctl.c
index 030da92..70e06f9 100644
--- a/src/shared/secondary/spp_worker_th/conn_spp_ctl.c
+++ b/src/shared/secondary/spp_worker_th/conn_spp_ctl.c
@@ -13,7 +13,7 @@
#include <rte_branch_prediction.h>
#include "shared/common.h"
-#include "string_buffer.h"
+#include "shared/secondary/string_buffer.h"
#include "conn_spp_ctl.h"
#define RTE_LOGTYPE_SPP_COMMAND_PROC RTE_LOGTYPE_USER1
diff --git a/src/shared/secondary/spp_worker_th/string_buffer.c b/src/shared/secondary/string_buffer.c
similarity index 100%
rename from src/shared/secondary/spp_worker_th/string_buffer.c
rename to src/shared/secondary/string_buffer.c
diff --git a/src/shared/secondary/spp_worker_th/string_buffer.h b/src/shared/secondary/string_buffer.h
similarity index 100%
rename from src/shared/secondary/spp_worker_th/string_buffer.h
rename to src/shared/secondary/string_buffer.h
diff --git a/src/vf/Makefile b/src/vf/Makefile
index ca8d2b3..3cbdb01 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -11,20 +11,21 @@ include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = spp_vf
+SPP_SEC_DIR = ../shared/secondary
SPP_WKT_DIR = ../shared/secondary/spp_worker_th
# all source are stored in SRCS-y
SRCS-y := spp_vf.c classifier_mac.c spp_forward.c
-SRCS-y += $(SPP_WKT_DIR)/string_buffer.c
+SRCS-y += $(SPP_SEC_DIR)/string_buffer.c
+SRCS-y += $(SPP_SEC_DIR)/json_helper.c
+SRCS-y += $(SPP_SEC_DIR)/utils.c $(SPP_SEC_DIR)/add_port.c
SRCS-y += $(SPP_WKT_DIR)/ringlatencystats.c
SRCS-y += $(SPP_WKT_DIR)/spp_port.c
SRCS-y += $(SPP_WKT_DIR)/conn_spp_ctl.c
SRCS-y += $(SPP_WKT_DIR)/cmd_parser.c
SRCS-y += $(SPP_WKT_DIR)/cmd_runner.c
SRCS-y += $(SPP_WKT_DIR)/cmd_utils.c
-SRCS-y += $(SPP_WKT_DIR)/json_helper.c
SRCS-y += ../shared/common.c
-SRCS-y += ../shared/secondary/utils.c ../shared/secondary/add_port.c
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -O3 -MMD
--
2.17.1
next prev parent reply other threads:[~2019-06-24 4:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 4:36 [spp] [PATCH 00/13] Move JSON utils from libs for running cmds yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 01/13] shared/sec: rename ops for setup cmd response yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 02/13] shared/sec: rename functions for spp_mirror yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 03/13] shared/sec: move principle JSON formatter funcs yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 04/13] shared/sec: change order of args of JSON fmtters yasufum.o
2019-06-24 4:36 ` yasufum.o [this message]
2019-06-24 4:36 ` [spp] [PATCH 06/13] shared/sec: revise including headers yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 07/13] shared/sec: move JSON formatters from cmd_runner yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 08/13] shared/sec: move rest of JSON formatters yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 09/13] shared/sec: move lcore funcs in response_info_list yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 10/13] shared/sec: move ope cli-id " yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 11/13] shared/sec: move rest of ops " yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 12/13] shared/sec: remove local funcs from header yasufum.o
2019-06-24 4:36 ` [spp] [PATCH 13/13] shared/sec: refactor comments for JSON formatter yasufum.o
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=20190624043613.19271-6-yasufum.o@gmail.com \
--to=yasufum.o@gmail.com \
--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).