From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 10/11] shared/sec: refactor getting classifier status
Date: Mon, 24 Jun 2019 11:25:03 +0900 [thread overview]
Message-ID: <20190624022504.18752-11-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624022504.18752-1-yasufum.o@gmail.com>
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to rename spp_classifier_get_component_status() to
get_classifier_status() to simplify, and revise vars and log messages
for refactoring.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
.../secondary/spp_worker_th/cmd_runner.c | 12 +++----
src/shared/secondary/spp_worker_th/vf_deps.h | 8 ++---
src/vf/classifier_mac.c | 22 ++++++------
src/vf/spp_forward.c | 35 +++++++++----------
4 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index a768575..856e79e 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -532,15 +532,11 @@ spp_iterate_core_info(struct spp_iterate_core_params *params)
comp_info = (comp_info_base + core->id[cnt]);
#ifdef SPP_VF_MODULE
if (comp_info->wk_type == SPPWK_TYPE_CLS) {
- ret = spp_classifier_get_component_status(
- lcore_id,
- core->id[cnt],
- params);
+ ret = get_classifier_status(lcore_id,
+ core->id[cnt], params);
} else {
- ret = spp_forward_get_component_status(
- lcore_id,
- core->id[cnt],
- params);
+ ret = get_forwarder_status(lcore_id,
+ core->id[cnt], params);
}
#endif /* SPP_VF_MODULE */
#ifdef SPP_MIRROR_MODULE
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index 3ae4fc9..fb34215 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -79,7 +79,7 @@ int spp_classifier_mac_iterate_table(
struct spp_iterate_classifier_table_params *params);
/**
- * classifier get component status.
+ * Get classifier status.
*
* @param[in] lcore_id Lcore ID for classifier.
* @param[in] id Unique component ID.
@@ -87,11 +87,11 @@ int spp_classifier_mac_iterate_table(
* @retval SPP_RET_OK If succeeded.
* @retval SPP_RET_NG If failed.
*/
-int spp_classifier_get_component_status(unsigned int lcore_id, int id,
+int get_classifier_status(unsigned int lcore_id, int id,
struct spp_iterate_core_params *params);
/**
- * Merge/Forward get component status
+ * Get forwarder status.
*
* @param lcore_id Lcore ID for forwarder and merger.
* @param id Unique component ID.
@@ -99,7 +99,7 @@ int spp_classifier_get_component_status(unsigned int lcore_id, int id,
* @retval SPP_RET_OK If succeeded.
* @retval SPP_RET_NG If failed.
*/
-int spp_forward_get_component_status(unsigned int lcore_id, int id,
+int get_forwarder_status(unsigned int lcore_id, int id,
struct spp_iterate_core_params *params);
#endif /* _SPPWK_TH_VF_DEPS_H_ */
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index f6074e4..9023a69 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -803,29 +803,29 @@ spp_classifier_mac_do(int id)
/* classifier iterate component information */
int
-spp_classifier_get_component_status(
- unsigned int lcore_id, int id,
+get_classifier_status(unsigned int lcore_id, int id,
struct spp_iterate_core_params *params)
{
int ret = SPP_RET_NG;
- int i, nof_tx, nof_rx = 0; /* Num of RX and TX ports. */
+ int i;
+ int nof_tx, nof_rx = 0; /* Num of RX and TX ports. */
struct management_info *mng_info;
struct cls_comp_info *cmp_info;
- struct cls_port_info *clsd_data;
+ struct cls_port_info *port_info;
struct sppwk_port_idx rx_ports[RTE_MAX_ETHPORTS];
struct sppwk_port_idx tx_ports[RTE_MAX_ETHPORTS];
mng_info = g_mng_infos + id;
if (!is_used_mng_info(mng_info)) {
RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
- "Component[%d] Not used. "
- "(status)(core = %d, type = %d)\n",
+ "Classifier is not used "
+ "(comp_id=%d, lcore_id=%d, type=%d).\n",
id, lcore_id, SPPWK_TYPE_CLS);
return SPP_RET_NG;
}
cmp_info = mng_info->cmp_infos + mng_info->ref_index;
- clsd_data = cmp_info->tx_ports_i;
+ port_info = cmp_info->tx_ports_i;
memset(rx_ports, 0x00, sizeof(rx_ports));
if (cmp_info->rx_port_i.iface_type != UNDEF) {
@@ -837,14 +837,14 @@ spp_classifier_get_component_status(
memset(tx_ports, 0x00, sizeof(tx_ports));
nof_tx = cmp_info->nof_tx_ports;
for (i = 0; i < nof_tx; i++) {
- tx_ports[i].iface_type = clsd_data[i].iface_type;
- tx_ports[i].iface_no = clsd_data[i].iface_no_global;
+ tx_ports[i].iface_type = port_info[i].iface_type;
+ tx_ports[i].iface_no = port_info[i].iface_no_global;
}
/* Set the information with the function specified by the command. */
+ /* TODO(yasufum) rename `element_proc` */
ret = (*params->element_proc)(
- params, lcore_id,
- cmp_info->name, SPPWK_TYPE_CLS_STR,
+ params, lcore_id, cmp_info->name, SPPWK_TYPE_CLS_STR,
nof_rx, rx_ports, nof_tx, tx_ports);
if (unlikely(ret != SPP_RET_OK))
return SPP_RET_NG;
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 7746d40..3d40951 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -182,50 +182,49 @@ spp_forward(int id)
return SPP_RET_OK;
}
-/* Merge/Forward get component status */
+/* Get forwarder status */
int
-spp_forward_get_component_status(
- unsigned int lcore_id, int id,
+get_forwarder_status(unsigned int lcore_id, int id,
struct spp_iterate_core_params *params)
{
int ret = SPP_RET_NG;
int cnt;
const char *component_type = NULL;
- struct forward_info *info = &g_forward_info[id];
- struct forward_path *path = &info->path[info->ref_index];
+ struct forward_info *fwd_info = &g_forward_info[id];
+ struct forward_path *fwd_path = &fwd_info->path[fwd_info->ref_index];
struct sppwk_port_idx rx_ports[RTE_MAX_ETHPORTS];
struct sppwk_port_idx tx_ports[RTE_MAX_ETHPORTS];
- if (unlikely(path->wk_type == SPPWK_TYPE_NONE)) {
+ if (unlikely(fwd_path->wk_type == SPPWK_TYPE_NONE)) {
RTE_LOG(ERR, FORWARD,
- "Component[%d] Not used. "
- "(status)(core = %d, type = %d)\n",
- id, lcore_id, path->wk_type);
+ "Forwarder is not used. "
+ "(id=%d, lcore=%d, type=%d).\n",
+ id, lcore_id, fwd_path->wk_type);
return SPP_RET_NG;
}
- if (path->wk_type == SPPWK_TYPE_MRG)
+ if (fwd_path->wk_type == SPPWK_TYPE_MRG)
component_type = SPPWK_TYPE_MRG_STR;
else
component_type = SPPWK_TYPE_FWD_STR;
memset(rx_ports, 0x00, sizeof(rx_ports));
- for (cnt = 0; cnt < path->num_rx; cnt++) {
- rx_ports[cnt].iface_type = path->ports[cnt].rx.iface_type;
- rx_ports[cnt].iface_no = path->ports[cnt].rx.iface_no;
+ for (cnt = 0; cnt < fwd_path->num_rx; cnt++) {
+ rx_ports[cnt].iface_type = fwd_path->ports[cnt].rx.iface_type;
+ rx_ports[cnt].iface_no = fwd_path->ports[cnt].rx.iface_no;
}
memset(tx_ports, 0x00, sizeof(tx_ports));
- for (cnt = 0; cnt < path->num_tx; cnt++) {
- tx_ports[cnt].iface_type = path->ports[cnt].tx.iface_type;
- tx_ports[cnt].iface_no = path->ports[cnt].tx.iface_no;
+ for (cnt = 0; cnt < fwd_path->num_tx; cnt++) {
+ tx_ports[cnt].iface_type = fwd_path->ports[cnt].tx.iface_type;
+ tx_ports[cnt].iface_no = fwd_path->ports[cnt].tx.iface_no;
}
/* Set the information with the function specified by the command. */
ret = (*params->element_proc)(
params, lcore_id,
- path->name, component_type,
- path->num_rx, rx_ports, path->num_tx, tx_ports);
+ fwd_path->name, component_type,
+ fwd_path->num_rx, rx_ports, fwd_path->num_tx, tx_ports);
if (unlikely(ret != SPP_RET_OK))
return SPP_RET_NG;
--
2.17.1
next prev parent reply other threads:[~2019-06-24 2:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 2:24 [spp] [PATCH 00/11] Refactor libs for classifier in spp_vf yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 01/11] shared/sec: refactor defines of VLAN " yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 02/11] shared/sec: rename struct mac_classification yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 03/11] shared/sec: refactor comments in vf_deps.h yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 04/11] shared/sec: rename struct classified_data yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 05/11] shared/sec: revise usage of term component_info yasufum.o
2019-06-24 2:24 ` [spp] [PATCH 06/11] shared/sec: revise members of struct cls_port_info yasufum.o
2019-06-24 2:25 ` [spp] [PATCH 07/11] shared/sec: rename func free_mac_classification yasufum.o
2019-06-24 2:25 ` [spp] [PATCH 08/11] shared/sec: refactor updating classifier info yasufum.o
2019-06-24 2:25 ` [spp] [PATCH 09/11] shared/sec: refactor updating forwarder yasufum.o
2019-06-24 2:25 ` yasufum.o [this message]
2019-06-24 2:25 ` [spp] [PATCH 11/11] shared/sec: refactor setup cls table stat in JSON yasufum.o
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=20190624022504.18752-11-yasufum.o@gmail.com \
--to=yasufum.o@gmail.com \
--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).