From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 2/4] shared/sec: rename struct of cmd operators
Date: Tue, 21 May 2019 11:31:41 +0900 [thread overview]
Message-ID: <1558405903-8252-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1558405903-8252-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
A set of operators and its names for parsing command is defined as
`decode_parameter_list`, but the name is inappropriate considering
the purpose. This update is to rename it to `sppwk_cmd_ops` instead.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
.../secondary/spp_worker_th/cmd_parser.c | 36 +++++++++----------
.../secondary/spp_worker_th/cmd_parser.h | 2 +-
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 6122cee..853b0ab 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -659,7 +659,7 @@ decode_classifier_vid_value(void *output, const char *arg_val,
return SPP_RET_OK;
}
-/* decoding procedure of port for classifier_table command */
+/* Parse port for classifier_table command */
static int
parse_cls_port(void *cls_cmd_attr, const char *arg_val,
int allow_override __attribute__ ((unused)))
@@ -710,20 +710,20 @@ parse_cls_port(void *cls_cmd_attr, const char *arg_val,
return SPP_RET_OK;
}
-/* parameter list for decoding */
-struct decode_parameter_list {
- const char *name; /* Parameter name */
- size_t offset; /* Offset value of struct spp_command */
+/* Attributes operator functions of command for parsing. */
+struct sppwk_cmd_ops {
+ const char *name;
+ size_t offset; /* Offset of struct spp_command */
+ /* Pointer to operator function */
int (*func)(void *output, const char *arg_val, int allow_override);
- /* Pointer to parameter handling function */
};
/* Used for command which takes no params, such as `status`. */
#define SPPWK_CMD_NO_PARAMS { NULL, 0, NULL }
-/* parameter list for each command */
-static struct decode_parameter_list
-parameter_list[][SPPWK_MAX_PARAMS] = {
+/* A set of operator functions for parsing command. */
+static struct sppwk_cmd_ops
+cmd_ops_list[][SPPWK_MAX_PARAMS] = {
{ /* classifier_table(mac) */
{
.name = "action",
@@ -863,11 +863,11 @@ decode_command_parameter_component(struct sppwk_cmd_req *request,
int ret = SPP_RET_OK;
int ci = request->commands[0].type;
int pi = 0;
- struct decode_parameter_list *list = NULL;
+ struct sppwk_cmd_ops *list = NULL;
for (pi = 1; pi < argc; pi++) {
- list = ¶meter_list[ci][pi-1];
+ list = &cmd_ops_list[ci][pi-1];
ret = (*list->func)((void *)
- ((char *)&request->commands[0]+list->offset),
+ ((char *)&request->commands[0] + list->offset),
argv[pi], 0);
if (unlikely(ret < 0)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -904,11 +904,11 @@ decode_command_parameter_cls_table_vlan(struct sppwk_cmd_req *request,
int ret = SPP_RET_OK;
int ci = request->commands[0].type;
int pi = 0;
- struct decode_parameter_list *list = NULL;
+ struct sppwk_cmd_ops *list = NULL;
for (pi = 1; pi < argc; pi++) {
- list = ¶meter_list[ci][pi-1];
+ list = &cmd_ops_list[ci][pi-1];
ret = (*list->func)((void *)
- ((char *)&request->commands[0]+list->offset),
+ ((char *)&request->commands[0] + list->offset),
argv[pi], 0);
if (unlikely(ret < SPP_RET_OK)) {
RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad value. "
@@ -931,7 +931,7 @@ decode_command_parameter_port(struct sppwk_cmd_req *request,
int ret = SPP_RET_OK;
int ci = request->commands[0].type;
int pi = 0;
- struct decode_parameter_list *list = NULL;
+ struct sppwk_cmd_ops *list = NULL;
int flag = 0;
/* check add vlatag */
@@ -939,9 +939,9 @@ decode_command_parameter_port(struct sppwk_cmd_req *request,
flag = 1;
for (pi = 1; pi < argc; pi++) {
- list = ¶meter_list[ci][pi-1];
+ list = &cmd_ops_list[ci][pi-1];
ret = (*list->func)((void *)
- ((char *)&request->commands[0]+list->offset),
+ ((char *)&request->commands[0] + list->offset),
argv[pi], flag);
if (unlikely(ret < SPP_RET_OK)) {
RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad value. "
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h
index 58e39a9..286fde0 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.h
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.h
@@ -112,7 +112,7 @@ struct spp_command {
struct sppwk_cmd_flush flush;
struct sppwk_cmd_comp comp;
struct sppwk_cmd_port port;
- } spec;
+ } spec; /* TODO(yasufum) rename no reasonable name */
};
/* Request parameters. */
--
2.17.1
next prev parent reply other threads:[~2019-05-21 2:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 2:31 [spp] [PATCH 0/4] Revise name of funcs and data for parsing ogawa.yasufumi
2019-05-21 2:31 ` [spp] [PATCH 1/4] shared/sec: rename define for empty params ogawa.yasufumi
2019-05-21 2:31 ` ogawa.yasufumi [this message]
2019-05-21 2:31 ` [spp] [PATCH 3/4] shared/sec: rename func for parsing given command ogawa.yasufumi
2019-05-21 2:31 ` [spp] [PATCH 4/4] shared/sec: rename operator func for parsing cmds 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=1558405903-8252-3-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).