* [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings
@ 2019-05-08 1:59 ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 1/5] spp_vf/common: add lcore IDs in status message ogawa.yasufumi
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
This series of patches is to show lcore IDs in the response of status
command as spp_nfv.
Yasufumi Ogawa (5):
spp_vf/common: add lcore IDs in status message
controller: add paring lcore IDs for vf and mirror
spp-ctl: add master lcore entry for SPP CLI
spp_pcap: add lcore IDs in status message
controller: add parsing lcore IDs for spp_pcap
src/controller/commands/mirror.py | 14 +++++++++++
src/controller/commands/pcap.py | 19 +++++++++++++--
src/controller/commands/vf.py | 15 ++++++++++--
src/pcap/command_proc.c | 11 +++++++++
src/spp-ctl/spp_webapi.py | 1 +
src/vf/common/command_proc.c | 39 +++++++++++++++++++++++++++++++
6 files changed, 95 insertions(+), 4 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 1/5] spp_vf/common: add lcore IDs in status message
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
@ 2019-05-08 1:59 ` ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 2/5] controller: add paring lcore IDs for vf and mirror ogawa.yasufumi
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Add lcore IDs in response of status command to know which of lcores are
in use.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/vf/common/command_proc.c | 39 ++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index 415a638..813e95f 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -913,6 +913,7 @@ append_error_details_value(const char *name, char **output, void *tmp)
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -983,6 +984,7 @@ append_interface_value(const char *name, char **output,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1039,6 +1041,7 @@ append_vlan_block(const char *name, char **output,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1089,6 +1092,7 @@ append_port_block(char **output, const struct spp_port_index *port,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = port_block)\n");
return SPP_RET_NG;
}
@@ -1120,6 +1124,7 @@ append_port_array(const char *name, char **output, const int num,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1136,6 +1141,10 @@ append_port_array(const char *name, char **output, const int num,
return ret;
}
+/**
+ * TODO(yasufum) add usages called from `append_core_value` or refactor
+ * confusing function names.
+ */
/* append one element of core information for JSON format */
static int
append_core_element_value(
@@ -1151,6 +1160,7 @@ append_core_element_value(
buff = params->output;
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
+ /* TODO(yasufum) refactor no meaning err msg */
RTE_LOG(ERR, SPP_COMMAND_PROC,
"allocate error. (name = %s)\n",
name);
@@ -1160,6 +1170,10 @@ append_core_element_value(
/* there is unnecessary data when "unuse" by type */
unuse_flg = strcmp(type, SPP_TYPE_UNUSE_STR);
+ /**
+ * TODO(yasufum) change ambiguous "core" to more specific one such as
+ * "worker-lcores" or "slave-lcores".
+ */
ret = append_json_uint_value("core", &tmp_buff, lcore_id);
if (unlikely(ret < SPP_RET_OK))
return ret;
@@ -1192,6 +1206,16 @@ append_core_element_value(
return ret;
}
+/* append master lcore in JSON format */
+static int
+append_master_lcore_value(const char *name, char **output,
+ void *tmp __attribute__ ((unused)))
+{
+ int ret = SPP_RET_NG;
+ ret = append_json_int_value(name, output, rte_get_master_lcore());
+ return ret;
+}
+
/* append a list of core information for JSON format */
static int
append_core_value(const char *name, char **output,
@@ -1202,6 +1226,7 @@ append_core_value(const char *name, char **output,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1238,6 +1263,7 @@ append_classifier_element_value(
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = classifier_table)\n");
return ret;
}
@@ -1288,6 +1314,7 @@ append_classifier_table_value(const char *name, char **output,
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1319,6 +1346,7 @@ append_response_list_value(char **output,
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = response_list)\n");
return SPP_RET_NG;
}
@@ -1375,12 +1403,14 @@ struct command_response_list response_result_list[] = {
COMMAND_RESP_TAG_LIST_EMPTY
};
+/* TODO(yasufum) add desc why it is needed and how to be used */
/* command response status information string list */
struct command_response_list response_info_list[] = {
{ "client-id", append_client_id_value },
{ "phy", append_interface_value },
{ "vhost", append_interface_value },
{ "ring", append_interface_value },
+ { "master-lcore", append_master_lcore_value },
{ "core", append_core_value },
#ifdef SPP_VF_MODULE
{ "classifier_table", append_classifier_table_value },
@@ -1399,6 +1429,7 @@ append_command_results_value(const char *name, char **output,
tmp_buff1 = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff1 == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s, buff=1)\n",
name);
return SPP_RET_NG;
@@ -1408,6 +1439,7 @@ append_command_results_value(const char *name, char **output,
if (unlikely(tmp_buff2 == NULL)) {
spp_strbuf_free(tmp_buff1);
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s, buff=2)\n",
name);
return SPP_RET_NG;
@@ -1446,6 +1478,7 @@ append_info_value(const char *name, char **output)
char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = %s)\n",
name);
return SPP_RET_NG;
@@ -1473,6 +1506,7 @@ send_decode_error_response(int *sock,
char *msg, *tmp_buff;
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
+ /* TODO(yasufum) refactor no meaning err msg */
RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. "
"(name = decode_error_response)\n");
return;
@@ -1491,6 +1525,7 @@ send_decode_error_response(int *sock,
msg = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(msg == NULL)) {
spp_strbuf_free(tmp_buff);
+ /* TODO(yasufum) refactor no meaning err msg */
RTE_LOG(ERR, SPP_COMMAND_PROC, "allocate error. "
"(name = decode_error_response)\n");
return;
@@ -1500,6 +1535,7 @@ send_decode_error_response(int *sock,
if (unlikely(ret < SPP_RET_OK)) {
spp_strbuf_free(msg);
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = result_response)\n");
return;
}
@@ -1530,6 +1566,7 @@ send_command_result_response(int *sock,
tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
if (unlikely(tmp_buff == NULL)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = result_response)\n");
return;
}
@@ -1572,6 +1609,7 @@ send_command_result_response(int *sock,
if (unlikely(msg == NULL)) {
spp_strbuf_free(tmp_buff);
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = result_response)\n");
return;
}
@@ -1580,6 +1618,7 @@ send_command_result_response(int *sock,
if (unlikely(ret < SPP_RET_OK)) {
spp_strbuf_free(msg);
RTE_LOG(ERR, SPP_COMMAND_PROC,
+ /* TODO(yasufum) refactor no meaning err msg */
"allocate error. (name = result_response)\n");
return;
}
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 2/5] controller: add paring lcore IDs for vf and mirror
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 1/5] spp_vf/common: add lcore IDs in status message ogawa.yasufumi
@ 2019-05-08 1:59 ` ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 3/5] spp-ctl: add master lcore entry for SPP CLI ogawa.yasufumi
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To show lcore IDs of spp_vf and spp_mirror, add parsing lcore IDs in the
response from these processes.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/commands/mirror.py | 14 ++++++++++++++
src/controller/commands/vf.py | 15 +++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/controller/commands/mirror.py b/src/controller/commands/mirror.py
index b5b7a1b..d38812d 100644
--- a/src/controller/commands/mirror.py
+++ b/src/controller/commands/mirror.py
@@ -85,6 +85,9 @@ class SppMirror(object):
Basic Information:
- client-id: 3
- ports: [phy:0, phy:1]
+ - lcore_ids:
+ - master: 1
+ - slaves: [2, 3]
Components:
- core:1, "mr1" (type: mirror)
- rx: ring:0
@@ -96,10 +99,21 @@ class SppMirror(object):
"""
+ # Extract slave lcore IDs first
+ slave_lcore_ids = []
+ for worker in json_obj['components']:
+ slave_lcore_ids.append(str(worker['core']))
+
# Basic Information
print('Basic Information:')
print(' - client-id: %d' % json_obj['client-id'])
print(' - ports: [%s]' % ', '.join(json_obj['ports']))
+ print(' - lcore_ids:')
+ print(' - master: {}'.format(json_obj['master-lcore']))
+ if len(slave_lcore_ids) > 1:
+ print(' - slaves: [{}]'.format(', '.join(slave_lcore_ids)))
+ else:
+ print(' - slave: {}'.format(slave_lcore_ids[0]))
# Componennts
print('Components:')
diff --git a/src/controller/commands/vf.py b/src/controller/commands/vf.py
index ff08231..b673f0f 100644
--- a/src/controller/commands/vf.py
+++ b/src/controller/commands/vf.py
@@ -89,6 +89,9 @@ class SppVf(object):
Basic Information:
- client-id: 3
- ports: [phy:0, phy:1]
+ - lcore_ids:
+ - master: 1
+ - slaves: [2, 3]
Classifier Table:
- "FA:16:3E:7D:CC:35", ring:0
- "FA:17:3E:7D:CC:55", ring:1
@@ -103,10 +106,18 @@ class SppVf(object):
"""
+ # Extract slave lcore IDs first
+ slave_lcore_ids = []
+ for worker in json_obj['components']:
+ slave_lcore_ids.append(str(worker['core']))
+
# Basic Information
print('Basic Information:')
- print(' - client-id: %d' % json_obj['client-id'])
- print(' - ports: [%s]' % ', '.join(json_obj['ports']))
+ print(' - client-id: {}'.format(json_obj['client-id']))
+ print(' - ports: [{}]'.format(', '.join(json_obj['ports'])))
+ print(' - lcore_ids:')
+ print(' - master: {}'.format(json_obj['master-lcore']))
+ print(' - slaves: [{}]'.format(', '.join(slave_lcore_ids)))
# Classifier Table
print('Classifier Table:')
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 3/5] spp-ctl: add master lcore entry for SPP CLI
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 1/5] spp_vf/common: add lcore IDs in status message ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 2/5] controller: add paring lcore IDs for vf and mirror ogawa.yasufumi
@ 2019-05-08 1:59 ` ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 4/5] spp_pcap: add lcore IDs in status message ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 5/5] controller: add parsing lcore IDs for spp_pcap ogawa.yasufumi
4 siblings, 0 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To show master lcore ID in the result of status command, add
`master-lcore` entry in the message sent to SPP CLI.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/spp-ctl/spp_webapi.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/spp-ctl/spp_webapi.py b/src/spp-ctl/spp_webapi.py
index 39530dd..3ad34d0 100644
--- a/src/spp-ctl/spp_webapi.py
+++ b/src/spp-ctl/spp_webapi.py
@@ -173,6 +173,7 @@ class V1VFCommon(object):
for key in ["phy", "vhost", "ring"]:
for idx in info[key]:
vf["ports"].append(key + ":" + str(idx))
+ vf["master-lcore"] = info["master-lcore"]
vf["components"] = info["core"]
if "classifier_table" in info:
vf["classifier_table"] = info["classifier_table"]
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 4/5] spp_pcap: add lcore IDs in status message
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
` (2 preceding siblings ...)
2019-05-08 1:59 ` [spp] [PATCH 3/5] spp-ctl: add master lcore entry for SPP CLI ogawa.yasufumi
@ 2019-05-08 1:59 ` ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 5/5] controller: add parsing lcore IDs for spp_pcap ogawa.yasufumi
4 siblings, 0 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Add lcore IDs in response of status command to know which of lcores are
in use.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/pcap/command_proc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/pcap/command_proc.c b/src/pcap/command_proc.c
index 28c6b97..96218c0 100644
--- a/src/pcap/command_proc.c
+++ b/src/pcap/command_proc.c
@@ -523,6 +523,16 @@ append_pcap_core_element_value(
return ret;
}
+/* append master lcore in JSON format */
+static int
+append_master_lcore_value(const char *name, char **output,
+ void *tmp __attribute__ ((unused)))
+{
+ int ret = SPP_RET_NG;
+ ret = append_json_int_value(name, output, rte_get_master_lcore());
+ return ret;
+}
+
/* append a list of core information for JSON format */
static int
append_core_value(const char *name, char **output,
@@ -625,6 +635,7 @@ struct command_response_list response_result_list[] = {
struct command_response_list response_info_list[] = {
{ "client-id", append_client_id_value },
{ "status", append_capture_status_value },
+ { "master-lcore", append_master_lcore_value },
{ "core", append_core_value },
COMMAND_RESP_TAG_LIST_EMPTY
};
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [spp] [PATCH 5/5] controller: add parsing lcore IDs for spp_pcap
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
` (3 preceding siblings ...)
2019-05-08 1:59 ` [spp] [PATCH 4/5] spp_pcap: add lcore IDs in status message ogawa.yasufumi
@ 2019-05-08 1:59 ` ogawa.yasufumi
4 siblings, 0 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2019-05-08 1:59 UTC (permalink / raw)
To: spp, ferruh.yigit, ogawa.yasufumi
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To show lcore IDs, add parsing the response from spp_pcap.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/commands/pcap.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/controller/commands/pcap.py b/src/controller/commands/pcap.py
index d06327b..88dd5c8 100644
--- a/src/controller/commands/pcap.py
+++ b/src/controller/commands/pcap.py
@@ -115,8 +115,13 @@ class SppPcap(object):
Print status received from spp_pcap.
spp > pcap 1; status
+ Basic Information:
- client-id: 3
- satus: running
+ - lcore_ids:
+ - master: 1
+ - slaves: [2, 3, 3, 4, 5, 6]
+ Components:
- core:2, receive
- rx: phy:0
- core:3, write
@@ -129,11 +134,21 @@ class SppPcap(object):
"""
- # client id and status
+ # Extract slave lcore IDs first
+ slave_lcore_ids = []
+ for worker in json_obj['core']:
+ slave_lcore_ids.append(str(worker['core']))
+
+ # Basic Information
+ print('Basic Information:')
print(' - client-id: {}'.format(json_obj['client-id']))
print(' - status: {}'.format(json_obj['status']))
+ print(' - lcore_ids:')
+ print(' - master: {}'.format(json_obj['master-lcore']))
+ print(' - slaves: [{}]'.format(', '.join(slave_lcore_ids)))
- # Core
+ # Componennts
+ print('Components:')
for worker in json_obj['core']:
if 'role' in worker.keys():
print(" - core:{core_id} {role}".format(
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-08 2:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 1:59 [spp] [PATCH 0/5] Show lcores in status of spp_vf and siblings ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 1/5] spp_vf/common: add lcore IDs in status message ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 2/5] controller: add paring lcore IDs for vf and mirror ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 3/5] spp-ctl: add master lcore entry for SPP CLI ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 4/5] spp_pcap: add lcore IDs in status message ogawa.yasufumi
2019-05-08 1:59 ` [spp] [PATCH 5/5] controller: add parsing lcore IDs for spp_pcap ogawa.yasufumi
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).