From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 7/8] shared/sec: rename func for parsing MAC addr
Date: Tue, 21 May 2019 11:32:23 +0900 [thread overview]
Message-ID: <1558405944-8355-8-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1558405944-8355-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
This update is to rename `decode_mac_addr_str_value()` to
`parse_mac_addr()` and refactor the function.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
.../secondary/spp_worker_th/cmd_parser.c | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index fc30463..064b18f 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -597,22 +597,23 @@ parse_port_pcp(void *output, const char *arg_val,
return SPP_RET_OK;
}
-/* decoding procedure of mac address string */
+/* Parse mac address string. */
static int
-decode_mac_addr_str_value(void *output, const char *arg_val,
- int allow_override __attribute__ ((unused)))
+parse_mac_addr(void *output, const char *arg_val,
+ int allow_override __attribute__ ((unused)))
{
- int64_t ret = SPP_RET_OK;
+ int64_t res;
const char *str_val = arg_val;
- /* if default specification, convert to internal dummy address */
+ /* If given value is the default, use dummy address instead. */
if (unlikely(strcmp(str_val, SPP_DEFAULT_CLASSIFIED_SPEC_STR) == 0))
str_val = SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR;
- ret = spp_change_mac_str_to_int64(str_val);
- if (unlikely(ret < SPP_RET_OK)) {
+ /* Check if the given value is valid. */
+ res = spp_change_mac_str_to_int64(str_val);
+ if (unlikely(res < SPP_RET_OK)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
- "Bad mac address string. val=%s\n", str_val);
+ "Invalid MAC address `%s`.\n", str_val);
return SPP_RET_NG;
}
@@ -759,7 +760,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
.name = "mac address",
.offset = offsetof(struct spp_command,
spec.cls_table.mac),
- .func = decode_mac_addr_str_value
+ .func = parse_mac_addr
},
{
.name = "port",
@@ -792,7 +793,7 @@ cmd_ops_list[][SPPWK_MAX_PARAMS] = {
.name = "mac address",
.offset = offsetof(struct spp_command,
spec.cls_table.mac),
- .func = decode_mac_addr_str_value
+ .func = parse_mac_addr
},
{
.name = "port",
--
2.17.1
next prev parent reply other threads:[~2019-05-21 2:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 2:32 [spp] [PATCH 0/8] Refactor funcs for parsing port cmd ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 1/8] shared/sec: rename parsing port for " ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 2/8] shared/sec: rename parsing rx and tx ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 3/8] shared/sec: rename parsing comp for port cmd ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 4/8] shared/sec: rename parsing vlan operations ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 5/8] shared/sec: rename func for parsing VLAN ID ogawa.yasufumi
2019-05-21 2:32 ` [spp] [PATCH 6/8] shared/sec: rename func for parsing PCP ogawa.yasufumi
2019-05-21 2:32 ` ogawa.yasufumi [this message]
2019-05-21 2:32 ` [spp] [PATCH 8/8] shared/sec: rename func to convert MAC addr type 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=1558405944-8355-8-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).