From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 06/11] shared/sec: rename util functions in cmd_runner
Date: Fri, 31 May 2019 12:36:00 +0900 [thread overview]
Message-ID: <1559273765-26130-7-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559273765-26130-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
This update is to rename utility functions.
* `spp_get_client_id()` for getting client ID from global variable is
renamed to `sppwk_get_client_id()`.
* `spp_get_process_type()` for getting process type from global variable
is renamed to `sppwk_get_process_type()`.
* `spp_check_flush_port()` is simply renamed to `is_port_flushed()`.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
.../secondary/spp_worker_th/cmd_runner.c | 34 ++++++++-----------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index 2a82edd..3d07a28 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -92,31 +92,27 @@ const char *CLS_TYPE_A_LIST[] = {
"", /* termination */
};
-/* get client id */
+/* Get client ID from global command params. */
static int
-spp_get_client_id(void)
+sppwk_get_client_id(void)
{
- struct startup_param *startup_param;
-
- sppwk_get_mng_data(&startup_param,
- NULL, NULL, NULL, NULL, NULL, NULL);
- return startup_param->client_id;
+ struct startup_param *params;
+ sppwk_get_mng_data(¶ms, NULL, NULL, NULL, NULL, NULL, NULL);
+ return params->client_id;
}
-/* get process type */
+/* Get proc type from global command params. */
static int
-spp_get_process_type(void)
+sppwk_get_proc_type(void)
{
- struct startup_param *startup_param;
-
- sppwk_get_mng_data(&startup_param,
- NULL, NULL, NULL, NULL, NULL, NULL);
- return startup_param->secondary_type;
+ struct startup_param *params;
+ sppwk_get_mng_data(¶ms, NULL, NULL, NULL, NULL, NULL, NULL);
+ return params->secondary_type;
}
-/* Check if port has been flushed. */
+/* Check if port is already flushed. */
static int
-spp_check_flush_port(enum port_type iface_type, int iface_no)
+is_port_flushed(enum port_type iface_type, int iface_no)
{
struct sppwk_port_info *port = get_sppwk_port(iface_type, iface_no);
return port->ethdev_port_id >= 0;
@@ -926,7 +922,7 @@ static int
append_client_id_value(const char *name, char **output,
void *tmp __attribute__ ((unused)))
{
- return append_json_int_value(name, output, spp_get_client_id());
+ return append_json_int_value(name, output, sppwk_get_client_id());
}
/* append a list of interface numbers */
@@ -937,7 +933,7 @@ append_interface_array(char **output, const enum port_type type)
char tmp_str[CMD_TAG_APPEND_SIZE];
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
- if (!spp_check_flush_port(type, i))
+ if (!is_port_flushed(type, i))
continue;
sprintf(tmp_str, "%s%d", JSON_APPEND_COMMA(port_cnt), i);
@@ -962,7 +958,7 @@ append_process_type_value(const char *name, char **output,
void *tmp __attribute__ ((unused)))
{
return append_json_str_value(name, output,
- SPPWK_PROC_TYPE_LIST[spp_get_process_type()]);
+ SPPWK_PROC_TYPE_LIST[sppwk_get_proc_type()]);
}
/* append a list of interface numbers for JSON format */
--
2.17.1
next prev parent reply other threads:[~2019-05-31 3:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 3:35 [spp] [PATCH 00/11] Refactor functions for handling commands ogawa.yasufumi
2019-05-31 3:35 ` [spp] [PATCH 01/11] shared/sec: rename functions of sppwk_cmd_runner ogawa.yasufumi
2019-05-31 3:35 ` [spp] [PATCH 02/11] shared/sec: revise enum for cmd response ogawa.yasufumi
2019-05-31 3:35 ` [spp] [PATCH 03/11] shared/sec: refactor passing err in cmd_runner ogawa.yasufumi
2019-05-31 3:35 ` [spp] [PATCH 04/11] shared/sec: rename struct for command response ogawa.yasufumi
2019-05-31 3:35 ` [spp] [PATCH 05/11] shared/sec: refactor funcs for managing port info ogawa.yasufumi
2019-05-31 3:36 ` ogawa.yasufumi [this message]
2019-05-31 3:36 ` [spp] [PATCH 07/11] shared/sec: rename func for getting component ID ogawa.yasufumi
2019-05-31 3:36 ` [spp] [PATCH 08/11] shared/sec: refactor func for updating cls table ogawa.yasufumi
2019-05-31 3:36 ` [spp] [PATCH 09/11] shared/sec: rename func for executing command ogawa.yasufumi
2019-05-31 3:36 ` [spp] [PATCH 10/11] shared/sec: add helpers for logging cmd parser ogawa.yasufumi
2019-05-31 3:36 ` [spp] [PATCH 11/11] shared/sec: rename func for updating port 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=1559273765-26130-7-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).