From: x-fn-spp@sl.ntt-tx.co.jp
To: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Cc: spp@dpdk.org
Subject: [spp] [PATCH 5/5] spp_vf: change retrieve component type
Date: Tue, 5 Feb 2019 20:47:42 +0900 [thread overview]
Message-ID: <201902051147.x15BlhN0014237@imss03.silk.ntt-tx.co.jp> (raw)
In-Reply-To: <20190205114742.24502-1-x-fn-spp@sl.ntt-tx.co.jp>
From: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
So far, component which is assigned for a core is retrieved from
member type of core_info. However member type is removed from
core_info. So such information can be retrieved from referring
spp_component_info.
Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@po.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
src/vf/common/command_dec.c | 17 +++---------
src/vf/common/command_proc.c | 52 +++++++++++++++++++-----------------
src/vf/common/spp_proc.c | 9 ++++---
src/vf/common/spp_proc.h | 22 ++++-----------
4 files changed, 42 insertions(+), 58 deletions(-)
diff --git a/src/vf/common/command_dec.c b/src/vf/common/command_dec.c
index 4c3e62a..9523ab9 100644
--- a/src/vf/common/command_dec.c
+++ b/src/vf/common/command_dec.c
@@ -408,31 +408,22 @@ static int
decode_component_type_value(void *output, const char *arg_val,
int allow_override __attribute__ ((unused)))
{
- enum spp_component_type org_type, set_type;
+ enum spp_component_type comp_type;
struct spp_command_component *component = output;
/* "stop" has no type parameter. */
if (component->action != SPP_CMD_ACTION_START)
return SPP_RET_OK;
- set_type = spp_convert_component_type(arg_val);
- if (unlikely(set_type <= 0)) {
+ comp_type = spp_convert_component_type(arg_val);
+ if (unlikely(comp_type <= 0)) {
RTE_LOG(ERR, SPP_COMMAND_PROC,
"Unknown component type. val=%s\n",
arg_val);
return SPP_RET_NG;
}
- org_type = spp_get_component_type_update(component->core);
- if ((org_type != SPP_COMPONENT_UNUSE) && (org_type != set_type)) {
- RTE_LOG(ERR, SPP_COMMAND_PROC,
- "Component type does not match. "
- "val=%s (org=%d, new=%d)\n",
- arg_val, org_type, set_type);
- return SPP_RET_NG;
- }
-
- component->type = set_type;
+ component->type = comp_type;
return SPP_RET_OK;
}
diff --git a/src/vf/common/command_proc.c b/src/vf/common/command_proc.c
index 06e50e6..0f99827 100644
--- a/src/vf/common/command_proc.c
+++ b/src/vf/common/command_proc.c
@@ -235,15 +235,15 @@ spp_update_component(
int ret_del = -1;
int component_id = 0;
unsigned int tmp_lcore_id = 0;
- struct spp_component_info *component = NULL;
+ struct spp_component_info *comp_info = NULL;
struct core_info *core = NULL;
struct core_mng_info *info = NULL;
- struct spp_component_info *component_info = NULL;
+ struct spp_component_info *comp_info_base = NULL;
struct core_mng_info *core_info = NULL;
int *change_core = NULL;
int *change_component = NULL;
- spp_get_mng_data_addr(NULL, NULL, &component_info, &core_info,
+ spp_get_mng_data_addr(NULL, NULL, &comp_info_base, &core_info,
&change_core, &change_component, NULL);
switch (action) {
@@ -271,12 +271,12 @@ spp_update_component(
core = &info->core[info->upd_index];
- component = (component_info + component_id);
- memset(component, 0x00, sizeof(struct spp_component_info));
- strcpy(component->name, name);
- component->type = type;
- component->lcore_id = lcore_id;
- component->component_id = component_id;
+ comp_info = (comp_info_base + component_id);
+ memset(comp_info, 0x00, sizeof(struct spp_component_info));
+ strcpy(comp_info->name, name);
+ comp_info->type = type;
+ comp_info->lcore_id = lcore_id;
+ comp_info->component_id = component_id;
core->id[core->num] = component_id;
core->num++;
@@ -290,16 +290,16 @@ spp_update_component(
if (component_id < 0)
return SPP_RET_OK;
- component = (component_info + component_id);
- tmp_lcore_id = component->lcore_id;
- memset(component, 0x00, sizeof(struct spp_component_info));
+ comp_info = (comp_info_base + component_id);
+ tmp_lcore_id = comp_info->lcore_id;
+ memset(comp_info, 0x00, sizeof(struct spp_component_info));
info = (core_info + tmp_lcore_id);
core = &info->core[info->upd_index];
#ifdef SPP_VF_MODULE
/* initialize classifier information */
- if (component->type == SPP_COMPONENT_CLASSIFIER_MAC)
+ if (comp_info->type == SPP_COMPONENT_CLASSIFIER_MAC)
init_classifier_info(component_id);
#endif /* SPP_VF_MODULE */
@@ -334,11 +334,11 @@ spp_update_port(enum spp_command_action action,
int ret_del = -1;
int component_id = 0;
int cnt = 0;
- struct spp_component_info *component = NULL;
+ struct spp_component_info *comp_info = NULL;
struct spp_port_info *port_info = NULL;
int *num = NULL;
struct spp_port_info **ports = NULL;
- struct spp_component_info *component_info = NULL;
+ struct spp_component_info *comp_info_base = NULL;
int *change_component = NULL;
component_id = spp_get_component_id(name);
@@ -347,17 +347,16 @@ spp_update_port(enum spp_command_action action,
"(component = %s)\n", name);
return SPP_RET_NG;
}
-
spp_get_mng_data_addr(NULL, NULL,
- &component_info, NULL, NULL, &change_component, NULL);
- component = (component_info + component_id);
+ &comp_info_base, NULL, NULL, &change_component, NULL);
+ comp_info = (comp_info_base + component_id);
port_info = get_iface_info(port->iface_type, port->iface_no);
if (rxtx == SPP_PORT_RXTX_RX) {
- num = &component->num_rx_port;
- ports = component->rx_ports;
+ num = &comp_info->num_rx_port;
+ ports = comp_info->rx_ports;
} else {
- num = &component->num_tx_port;
- ports = component->tx_ports;
+ num = &comp_info->num_tx_port;
+ ports = comp_info->tx_ports;
}
switch (action) {
@@ -471,6 +470,8 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
int ret;
int lcore_id, cnt;
struct core_info *core = NULL;
+ struct spp_component_info *comp_info_base = NULL;
+ struct spp_component_info *comp_info = NULL;
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
if (spp_get_core_status(lcore_id) == SPP_CORE_UNUSE)
@@ -493,8 +494,11 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
}
for (cnt = 0; cnt < core->num; cnt++) {
+ spp_get_mng_data_addr(NULL, NULL, &comp_info_base,
+ NULL, NULL, NULL, NULL);
+ comp_info = (comp_info_base + core->id[cnt]);
#ifdef SPP_VF_MODULE
- if (core->type == SPP_COMPONENT_CLASSIFIER_MAC) {
+ if (comp_info->type == SPP_COMPONENT_CLASSIFIER_MAC) {
ret = spp_classifier_get_component_status(
lcore_id,
core->id[cnt],
@@ -516,7 +520,7 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
RTE_LOG(ERR, APP, "Cannot iterate core "
"information. "
"(core = %d, type = %d)\n",
- lcore_id, core->type);
+ lcore_id, comp_info->type);
return SPP_RET_NG;
}
}
diff --git a/src/vf/common/spp_proc.c b/src/vf/common/spp_proc.c
index cf0d760..803e498 100644
--- a/src/vf/common/spp_proc.c
+++ b/src/vf/common/spp_proc.c
@@ -607,12 +607,13 @@ del_vhost_sockfile(struct spp_port_info *vhost)
}
}
-/* Get component type of target core */
+/* Get component type of target component_info */
enum spp_component_type
-spp_get_component_type(unsigned int lcore_id)
+spp_get_component_type(int id)
{
- struct core_mng_info *info = (g_mng_data_addr.p_core_info + lcore_id);
- return info->core[info->ref_index].type;
+ struct spp_component_info *component_info =
+ (g_mng_data_addr.p_component_info + id);
+ return component_info->type;
}
/* Get core ID of target component */
diff --git a/src/vf/common/spp_proc.h b/src/vf/common/spp_proc.h
index 8112af3..734c604 100644
--- a/src/vf/common/spp_proc.h
+++ b/src/vf/common/spp_proc.h
@@ -380,15 +380,15 @@ int spp_vf_add_vhost_pmd(int index, int client);
enum spp_core_status spp_get_core_status(unsigned int lcore_id);
/**
- * Get component type of target core
+ * Get component type of target component_info
*
- * @param lcore_id
- * Logical core ID.
+ * @param id
+ * component ID.
*
* @return
- * Type of component executed on specified logical core
+ * Type of component executed
*/
-enum spp_component_type spp_get_component_type(unsigned int lcore_id);
+enum spp_component_type spp_get_component_type(int id);
/**
* Run check_core_status() for SPP_CORE_STATUS_CHECK_MAX times with
@@ -489,18 +489,6 @@ void print_ring_latency_stats(void);
/* Remove sock file if spp is not running */
void del_vhost_sockfile(struct spp_port_info *vhost);
-/**
- * Get component type of target core
- *
- * @param lcore_id
- * Logical core ID.
- *
- * @return
- * Type of component executed on specified logical core
- */
-enum spp_component_type
-spp_get_component_type(unsigned int lcore_id);
-
/**
* Get core ID of target component
*
--
2.17.1
prev parent reply other threads:[~2019-02-05 11:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190205114742.24502-1-x-fn-spp@sl.ntt-tx.co.jp>
2019-02-05 11:47 ` [spp] [PATCH 1/5] spp_vf: remove while loop in classifier_mac x-fn-spp
2019-02-06 3:46 ` Yasufumi Ogawa
2019-02-05 11:47 ` [spp] [PATCH 2/5] spp_vf: change to handle multiples component x-fn-spp
2019-02-06 3:58 ` Yasufumi Ogawa
2019-02-05 11:47 ` [spp] [PATCH 3/5] spp_vf: move classifier component init x-fn-spp
2019-02-05 11:47 ` [spp] [PATCH 4/5] spp_vf: remove to check unused cores no needed x-fn-spp
2019-02-05 11:47 ` x-fn-spp [this message]
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=201902051147.x15BlhN0014237@imss03.silk.ntt-tx.co.jp \
--to=x-fn-spp@sl.ntt-tx.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=ogawa.yasufumi@lab.ntt.co.jp \
--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).