From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] shared/sec: rename define SPP_INFO_AREA_MAX
Date: Mon, 24 Jun 2019 17:55:30 +0900 [thread overview]
Message-ID: <20190624085530.23982-1-yasufum.o@gmail.com> (raw)
From: Yasufumi Ogawa <yasufum.o@gmail.com>
Spp_vf or other worker processes has two configuration data for
two-phase updating as described in SPP's documentation. For the purpose,
the number of config data is defined as SPP_INFO_AREA_MAX, but the name
is not appropriate. This update is to rename it to TWO_SIDES simply.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/spp_mirror.c | 7 +++----
src/shared/secondary/spp_worker_th/cmd_utils.h | 5 +++--
src/shared/secondary/spp_worker_th/spp_port.c | 7 +++----
src/vf/forwarder.c | 8 ++++----
src/vf/spp_vf.c | 3 +--
5 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index cb76005..892a3a8 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -48,7 +48,7 @@ struct mirror_path {
struct mirror_info {
volatile int ref_index; /* index to reference area */
volatile int upd_index; /* index to update area */
- struct mirror_path path[SPP_INFO_AREA_MAX];
+ struct mirror_path path[TWO_SIDES];
/* Information of data path */
};
@@ -339,7 +339,7 @@ change_mirror_index(int id)
if (info->ref_index == info->upd_index) {
/* Change reference index of port ability. */
spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
- info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+ info->ref_index = (info->upd_index+1) % TWO_SIDES;
}
}
@@ -479,8 +479,7 @@ slave_main(void *arg __attribute__ ((unused)))
if (spp_check_core_update(lcore_id) == SPP_RET_OK) {
/* Setting with the flush command trigger. */
- info->ref_index = (info->upd_index+1) %
- SPP_INFO_AREA_MAX;
+ info->ref_index = (info->upd_index+1) % TWO_SIDES;
core = get_core_info(lcore_id);
}
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 4582a82..d90aff5 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -34,7 +34,8 @@
/** Update wait timer (micro sec) */
#define SPP_CHANGE_UPDATE_INTERVAL 10
-#define SPP_INFO_AREA_MAX 2 /* The max number of buffer for management */
+/* Used for index of arrary of management data which has two sides. */
+#define TWO_SIDES 2
#define STR_LEN_SHORT 32 /* Size of short string. */
#define STR_LEN_NAME 128 /* Size of string for names. */
@@ -224,7 +225,7 @@ struct core_mng_info {
volatile enum sppwk_lcore_status status;
volatile int ref_index; /* index for reference */
volatile int upd_index; /* index for update */
- struct core_info core[SPP_INFO_AREA_MAX]; /* info of each core */
+ struct core_info core[TWO_SIDES]; /* info of each core */
};
/* Manage data used for backup. */
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index b0a29f7..9f7ac5a 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -16,8 +16,7 @@
struct port_ability_mng_info {
volatile int ref_index; /* Index to reference area */
volatile int upd_index; /* Index to update area */
- struct spp_port_ability ability[SPP_INFO_AREA_MAX]
- [SPP_PORT_ABILITY_MAX];
+ struct spp_port_ability ability[TWO_SIDES][SPP_PORT_ABILITY_MAX];
/* Port ability information */
};
@@ -232,12 +231,12 @@ spp_port_ability_change_index(
for (cnt = 0; cnt < num_rx; cnt++) {
mng = &g_port_mng_info[rx_list[cnt]].rx;
- mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+ mng->ref_index = (mng->upd_index+1) % TWO_SIDES;
rx_list[cnt] = 0;
}
for (cnt = 0; cnt < num_tx; cnt++) {
mng = &g_port_mng_info[tx_list[cnt]].tx;
- mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+ mng->ref_index = (mng->upd_index+1) % TWO_SIDES;
tx_list[cnt] = 0;
}
diff --git a/src/vf/forwarder.c b/src/vf/forwarder.c
index 4d99bfb..e5cc963 100644
--- a/src/vf/forwarder.c
+++ b/src/vf/forwarder.c
@@ -31,7 +31,7 @@ struct forward_path {
struct forward_info {
volatile int ref_index; /* index to reference area */
volatile int upd_index; /* index to update area */
- struct forward_path path[SPP_INFO_AREA_MAX];
+ struct forward_path path[TWO_SIDES];
/* Information of data path */
};
@@ -169,10 +169,10 @@ change_forward_index(int id)
struct forward_info *info = &g_forward_info[id];
if (info->ref_index == info->upd_index) {
/* Change reference index of port ability. */
- spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF,
- 0, 0);
+ spp_port_ability_change_index(
+ PORT_ABILITY_CHG_INDEX_REF, 0, 0);
- info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+ info->ref_index = (info->upd_index+1) % TWO_SIDES;
}
}
/**
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 5bed735..bc8db5c 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -205,8 +205,7 @@ slave_main(void *arg __attribute__ ((unused)))
if (spp_check_core_update(lcore_id) == SPP_RET_OK) {
/* Setting with the flush command trigger. */
- info->ref_index = (info->upd_index+1) %
- SPP_INFO_AREA_MAX;
+ info->ref_index = (info->upd_index+1) % TWO_SIDES;
core = get_core_info(lcore_id);
}
--
2.17.1
reply other threads:[~2019-06-24 8:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190624085530.23982-1-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).