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 4AB09A046B for ; Mon, 24 Jun 2019 06:36:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 442F61BF40; Mon, 24 Jun 2019 06:36:43 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 465541BF5F for ; Mon, 24 Jun 2019 06:36:42 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id g4so6131544plb.5 for ; Sun, 23 Jun 2019 21:36: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=U513fdLmes0ACugfFNVqn5S38qxg4OdE7HgK2d/P+QA=; b=gMQjwenyF7Gf27MiV56DBo1et0pN0Yg9Fh5Y6tM9dwh4AZrwZRCrEFgkxQU1DbHW6l Y7vomZHk5PwGSGpOdxIs5OvW9SbyK8QCnCLSCY6I5GYmt3liCt9XkLo/beP9KXIFGP9V u7B24fh1Cgacyzd1Bv8e91GF8vALW89RqrkOhlTZuGY3MLi0PGJXN4/EG/SNX2hPVeEY +XX+Z7fviQBjf9pcpyHQNelHjtospWvl7tqbqETh2CnKdy6C9Qfd2inrFsURGPqOGF9M R2k7PHoA4ppnk5xWFrxVXK0oo2ZhglaDwFhYPC/JQlCThXCf4qsngY+D5iDHCMHD1rJK /QMQ== 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=U513fdLmes0ACugfFNVqn5S38qxg4OdE7HgK2d/P+QA=; b=BPgFZDiKw0JnWL0lRmB3xNwuufj4Ecm/MmpPsZ5oa3y9gZrZiOel7fEGejd1RgWXID wzGz0dd4JnXP4vvtpWK7uoo+AYcRusrYlPdg8VNEN8NTJsbntaJ3O1qdseGCltc1ZcwH f5qCnXoFy4bmarS9GNUiWfPAmzCMUdSR2+fhNJbvfOR7WlKibjlrSw/NyCkXu5y1xrAN HQTJ/G7DKCIk7ECRetTWW44FGd6Xv9WgN3YuYrklc9TCXzMfRC1OMtOf9DqCCk2xL4jW Dh5JHjrDA1zMx8qY7Vii02waPJSbmdz2Njyg65BYmY535iOHdayAObPGwjLayw2Nwcqj 10gg== X-Gm-Message-State: APjAAAWT9aV/zhfebC6yl70lpFqv2As8ioy6a+18opEbACKqEvVkJ/tT LEARbaxPWfYGzGSEkAju0uuEm03h X-Google-Smtp-Source: APXvYqx1OLx7iHzcTKNE85bdw3TOl5B9/cAZbtXWyDYHlT1nissya5SV8pxPUSxknhlc5kBKJJKZ5A== X-Received: by 2002:a17:902:1e9:: with SMTP id b96mr99722793plb.277.1561351001394; Sun, 23 Jun 2019 21:36:41 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id c10sm9005178pjq.14.2019.06.23.21.36.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 21:36:41 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 24 Jun 2019 13:36:05 +0900 Message-Id: <20190624043613.19271-6-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624043613.19271-1-yasufum.o@gmail.com> References: <20190624043613.19271-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 05/13] shared/sec: move JSON formatter to shard/secondary 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 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 --- 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 -#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 +#include +#include +#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 +#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 #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