Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH] shared/sec: rename define SPP_INFO_AREA_MAX
@ 2019-06-24  8:55 yasufum.o
  0 siblings, 0 replies; only message in thread
From: yasufum.o @ 2019-06-24  8:55 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24  8:55 [spp] [PATCH] shared/sec: rename define SPP_INFO_AREA_MAX yasufum.o

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox