Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH 0/3] Rename global management data
@ 2019-05-31  3:35 ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 1/3] shared/sec: rename func for getting mng data ogawa.yasufumi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This series of patches is to revise variables of global management data
`g_mng_data_addr` and its members, functions for getting or setting the
data.

Yasufumi Ogawa (3):
  shared/sec: rename func for getting mng data
  shared/sec: rename func for management data
  shared/sec: revise name of vars of global mng data

 src/mirror/spp_mirror.c                       |  16 +-
 .../secondary/spp_worker_th/command_proc.c    |  14 +-
 src/shared/secondary/spp_worker_th/spp_proc.c | 186 +++++++++---------
 src/shared/secondary/spp_worker_th/spp_proc.h |  46 ++---
 src/vf/spp_vf.c                               |  17 +-
 5 files changed, 138 insertions(+), 141 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 1/3] shared/sec: rename func for getting mng data
  2019-05-31  3:35 [spp] [PATCH 0/3] Rename global management data ogawa.yasufumi
@ 2019-05-31  3:35 ` ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 2/3] shared/sec: rename func for management data ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 3/3] shared/sec: revise name of vars of global mng data ogawa.yasufumi
  2 siblings, 0 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to rename function for getting global management data
`spp_get_mng_data_addr()` to `sppwk_get_mng_data()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 .../secondary/spp_worker_th/command_proc.c    | 14 +++---
 src/shared/secondary/spp_worker_th/spp_proc.c | 45 ++++++++++---------
 src/shared/secondary/spp_worker_th/spp_proc.h | 16 +++----
 3 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index 151aaa6..94f4142 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -104,7 +104,7 @@ spp_get_client_id(void)
 {
 	struct startup_param *startup_param;
 
-	spp_get_mng_data_addr(&startup_param,
+	sppwk_get_mng_data(&startup_param,
 			NULL, NULL, NULL, NULL, NULL, NULL);
 	return startup_param->client_id;
 }
@@ -115,7 +115,7 @@ spp_get_process_type(void)
 {
 	struct startup_param *startup_param;
 
-	spp_get_mng_data_addr(&startup_param,
+	sppwk_get_mng_data(&startup_param,
 			NULL, NULL, NULL, NULL, NULL, NULL);
 	return startup_param->secondary_type;
 }
@@ -235,7 +235,7 @@ spp_update_component(
 	int *change_core = NULL;
 	int *change_component = NULL;
 
-	spp_get_mng_data_addr(NULL, NULL, &comp_info_base, &core_info,
+	sppwk_get_mng_data(NULL, NULL, &comp_info_base, &core_info,
 				&change_core, &change_component, NULL);
 
 	switch (wk_action) {
@@ -387,7 +387,7 @@ spp_update_port(enum sppwk_action wk_action,
 				"(component = %s)\n", name);
 		return SPP_RET_NG;
 	}
-	spp_get_mng_data_addr(NULL, NULL,
+	sppwk_get_mng_data(NULL, NULL,
 			&comp_info_base, NULL, NULL, &change_component, NULL);
 	comp_info = (comp_info_base + component_id);
 	port_info = get_sppwk_port(port->iface_type, port->iface_no);
@@ -491,7 +491,7 @@ spp_flush(void)
 	int ret = SPP_RET_NG;
 	struct cancel_backup_info *backup_info = NULL;
 
-	spp_get_mng_data_addr(NULL, NULL, NULL,
+	sppwk_get_mng_data(NULL, NULL, NULL,
 				NULL, NULL, NULL, &backup_info);
 
 	/* Initial setting of each interface. */
@@ -540,7 +540,7 @@ 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,
+			sppwk_get_mng_data(NULL, NULL, &comp_info_base,
 							NULL, NULL, NULL, NULL);
 			comp_info = (comp_info_base + core->id[cnt]);
 #ifdef SPP_VF_MODULE
@@ -602,7 +602,7 @@ sppwk_get_ethdev_port_id(enum port_type iface_type, int iface_no)
 {
 	struct iface_info *iface_info = NULL;
 
-	spp_get_mng_data_addr(NULL, &iface_info,
+	sppwk_get_mng_data(NULL, &iface_info,
 				NULL, NULL, NULL, NULL, NULL);
 	switch (iface_type) {
 	case PHY:
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.c b/src/shared/secondary/spp_worker_th/spp_proc.c
index 4105fb8..57b6321 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.c
+++ b/src/shared/secondary/spp_worker_th/spp_proc.c
@@ -1020,29 +1020,30 @@ int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
 	return SPP_RET_OK;
 }
 
-/* Get manage data address */
-void spp_get_mng_data_addr(struct startup_param **startup_param_addr,
-			   struct iface_info **iface_addr,
-			   struct spp_component_info **component_addr,
-			   struct core_mng_info **core_mng_addr,
-			   int **change_core_addr,
-			   int **change_component_addr,
-			   struct cancel_backup_info **backup_info_addr)
+/* Get manage data from global var for given non-NULL args. */
+void sppwk_get_mng_data(
+		struct startup_param **startup_param_p,
+		struct iface_info **iface_p,
+		struct spp_component_info **component_p,
+		struct core_mng_info **core_mng_p,
+		int **change_core_p,
+		int **change_component_p,
+		struct cancel_backup_info **backup_info_p)
 {
 
-	if (startup_param_addr != NULL)
-		*startup_param_addr = g_mng_data_addr.p_startup_param;
-	if (iface_addr != NULL)
-		*iface_addr = g_mng_data_addr.p_iface_info;
-	if (component_addr != NULL)
-		*component_addr = g_mng_data_addr.p_component_info;
-	if (core_mng_addr != NULL)
-		*core_mng_addr = g_mng_data_addr.p_core_info;
-	if (change_core_addr != NULL)
-		*change_core_addr = g_mng_data_addr.p_change_core;
-	if (change_component_addr != NULL)
-		*change_component_addr = g_mng_data_addr.p_change_component;
-	if (backup_info_addr != NULL)
-		*backup_info_addr = g_mng_data_addr.p_backup_info;
+	if (startup_param_p != NULL)
+		*startup_param_p = g_mng_data_addr.p_startup_param;
+	if (iface_p != NULL)
+		*iface_p = g_mng_data_addr.p_iface_info;
+	if (component_p != NULL)
+		*component_p = g_mng_data_addr.p_component_info;
+	if (core_mng_p != NULL)
+		*core_mng_p = g_mng_data_addr.p_core_info;
+	if (change_core_p != NULL)
+		*change_core_p = g_mng_data_addr.p_change_core;
+	if (change_component_p != NULL)
+		*change_component_p = g_mng_data_addr.p_change_component;
+	if (backup_info_p != NULL)
+		*backup_info_p = g_mng_data_addr.p_backup_info;
 
 }
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.h b/src/shared/secondary/spp_worker_th/spp_proc.h
index dffa6a5..921aead 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.h
+++ b/src/shared/secondary/spp_worker_th/spp_proc.h
@@ -689,7 +689,7 @@ int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
 /**
  * Get mange data address
  *
- * @param iface_addr
+ * @param startup_param_p
  *  g_startup_param write address
  * @param iface_addr
  *  g_iface_info write address
@@ -704,12 +704,12 @@ int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
  * @param backup_info_addr
  *  g_backup_info write address
  */
-void spp_get_mng_data_addr(struct startup_param **startup_param_addr,
-			   struct iface_info **iface_addr,
-			   struct spp_component_info **component_addr,
-			   struct core_mng_info **core_mng_addr,
-			   int **change_core_addr,
-			   int **change_component_addr,
-			   struct cancel_backup_info **backup_info_addr);
+void sppwk_get_mng_data(struct startup_param **startup_param_p,
+		struct iface_info **iface_p,
+		struct spp_component_info **component_p,
+		struct core_mng_info **core_mng_p,
+		int **change_core_p,
+		int **change_component_p,
+		struct cancel_backup_info **backup_info_p);
 
 #endif /* _SPP_PROC_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 2/3] shared/sec: rename func for management data
  2019-05-31  3:35 [spp] [PATCH 0/3] Rename global management data ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 1/3] shared/sec: rename func for getting mng data ogawa.yasufumi
@ 2019-05-31  3:35 ` ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 3/3] shared/sec: revise name of vars of global mng data ogawa.yasufumi
  2 siblings, 0 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to rename getting or setting maangement data of global
variable, from `spp_get_mng_data_addr()` to `sppwk_get_mng_data()` and
from `spp_set_mng_data_addr()` to `sppwk_set_mng_data()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/mirror/spp_mirror.c                       | 16 +++---
 src/shared/secondary/spp_worker_th/spp_proc.c | 49 ++++++++++---------
 src/shared/secondary/spp_worker_th/spp_proc.h | 30 ++++++------
 src/vf/spp_vf.c                               | 17 +++----
 4 files changed, 54 insertions(+), 58 deletions(-)

diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 29eac4e..2e6b58a 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -601,16 +601,12 @@ main(int argc, char *argv[])
 		/* Get lcore id of main thread to set its status after */
 		g_main_lcore_id = rte_lcore_id();
 
-		/* set manage address */
-		if (spp_set_mng_data_addr(&g_startup_param,
-					  &g_iface_info,
-					  g_component_info,
-					  g_core_info,
-					  g_change_core,
-					  g_change_component,
-					  &g_backup_info,
-					  g_main_lcore_id) < 0) {
-			RTE_LOG(ERR, MIRROR, "manage address set is failed.\n");
+		if (sppwk_set_mng_data(&g_startup_param, &g_iface_info,
+					g_component_info, g_core_info,
+					g_change_core, g_change_component,
+					&g_backup_info, g_main_lcore_id) < 0) {
+			RTE_LOG(ERR, MIRROR,
+				"Failed to set management data.\n");
 			break;
 		}
 
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.c b/src/shared/secondary/spp_worker_th/spp_proc.c
index 57b6321..ccefa5b 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.c
+++ b/src/shared/secondary/spp_worker_th/spp_proc.c
@@ -990,37 +990,40 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 	return ret_mac;
 }
 
-/* Set mange data address */
-int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
-			  struct iface_info *iface_addr,
-			  struct spp_component_info *component_addr,
-			  struct core_mng_info *core_mng_addr,
-			  int *change_core_addr,
-			  int *change_component_addr,
-			  struct cancel_backup_info *backup_info_addr,
-			  unsigned int main_lcore_id)
+/* Set management data of global var for given non-NULL args. */
+int sppwk_set_mng_data(
+		struct startup_param *startup_param_p,
+		struct iface_info *iface_p,
+		struct spp_component_info *component_p,
+		struct core_mng_info *core_mng_p,
+		int *change_core_p,
+		int *change_component_p,
+		struct cancel_backup_info *backup_info_p,
+		unsigned int main_lcore_id)
 {
-	if (startup_param_addr == NULL || iface_addr == NULL ||
-			component_addr == NULL || core_mng_addr == NULL ||
-			change_core_addr == NULL ||
-			change_component_addr == NULL ||
-			backup_info_addr == NULL ||
-			main_lcore_id == 0xffffffff)
+	/**
+	 * TODO(yasufum) confirm why the last `0xffffffff` is same as NULL,
+	 * although it is reserved for meaning as invalid.
+	 */
+	if (startup_param_p == NULL || iface_p == NULL ||
+			component_p == NULL || core_mng_p == NULL ||
+			change_core_p == NULL || change_component_p == NULL ||
+			backup_info_p == NULL || main_lcore_id == 0xffffffff)
 		return SPP_RET_NG;
 
-	g_mng_data_addr.p_startup_param = startup_param_addr;
-	g_mng_data_addr.p_iface_info = iface_addr;
-	g_mng_data_addr.p_component_info = component_addr;
-	g_mng_data_addr.p_core_info = core_mng_addr;
-	g_mng_data_addr.p_change_core = change_core_addr;
-	g_mng_data_addr.p_change_component = change_component_addr;
-	g_mng_data_addr.p_backup_info = backup_info_addr;
+	g_mng_data_addr.p_startup_param = startup_param_p;
+	g_mng_data_addr.p_iface_info = iface_p;
+	g_mng_data_addr.p_component_info = component_p;
+	g_mng_data_addr.p_core_info = core_mng_p;
+	g_mng_data_addr.p_change_core = change_core_p;
+	g_mng_data_addr.p_change_component = change_component_p;
+	g_mng_data_addr.p_backup_info = backup_info_p;
 	g_mng_data_addr.main_lcore_id = main_lcore_id;
 
 	return SPP_RET_OK;
 }
 
-/* Get manage data from global var for given non-NULL args. */
+/* Get management data from global var for given non-NULL args. */
 void sppwk_get_mng_data(
 		struct startup_param **startup_param_p,
 		struct iface_info **iface_p,
diff --git a/src/shared/secondary/spp_worker_th/spp_proc.h b/src/shared/secondary/spp_worker_th/spp_proc.h
index 921aead..30bd8be 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.h
+++ b/src/shared/secondary/spp_worker_th/spp_proc.h
@@ -657,19 +657,19 @@ int64_t sppwk_convert_mac_str_to_int64(const char *macaddr);
 /**
  * Set mange data address
  *
- * @param startup_param_addr
+ * @param startup_param_p
  *  g_startup_param address
- * @param iface_addr
+ * @param iface_p
  *  g_iface_info address
- * @param component_addr
+ * @param component_p
  *  g_component_info address
- * @param core_mng_addr
+ * @param core_mng_p
  *  g_core_info address
- * @param change_core_addr
+ * @param change_core_p
  *  g_change_core address
- * @param change_component_addr
+ * @param change_component_p
  *  g_change_component address
- * @param backup_info_addr
+ * @param backup_info_p
  *  g_backup_info address
  * @param main_lcore_id
  *  main_lcore_id mask
@@ -677,14 +677,14 @@ int64_t sppwk_convert_mac_str_to_int64(const char *macaddr);
  * @retval SPP_RET_OK succeeded.
  * @retval SPP_RET_NG failed.
  */
-int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
-			  struct iface_info *iface_addr,
-			  struct spp_component_info *component_addr,
-			  struct core_mng_info *core_mng_addr,
-			  int *change_core_addr,
-			  int *change_component_addr,
-			  struct cancel_backup_info *backup_info_addr,
-			  unsigned int main_lcore_id);
+int sppwk_set_mng_data(struct startup_param *startup_param_p,
+		struct iface_info *iface_p,
+		struct spp_component_info *component_p,
+		struct core_mng_info *core_mng_p,
+		int *change_core_p,
+		int *change_component_p,
+		struct cancel_backup_info *backup_info_p,
+		unsigned int main_lcore_id);
 
 /**
  * Get mange data address
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 9831058..8e6e187 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -277,16 +277,13 @@ main(int argc, char *argv[])
 		/* Get lcore id of main thread to set its status after */
 		g_main_lcore_id = rte_lcore_id();
 
-		/* set manage address */
-		if (spp_set_mng_data_addr(&g_startup_param,
-					  &g_iface_info,
-					  g_component_info,
-					  g_core_info,
-					  g_change_core,
-					  g_change_component,
-					  &g_backup_info,
-					  g_main_lcore_id) < SPP_RET_OK) {
-			RTE_LOG(ERR, APP, "manage address set is failed.\n");
+		if (sppwk_set_mng_data(&g_startup_param, &g_iface_info,
+					g_component_info, g_core_info,
+					g_change_core, g_change_component,
+					&g_backup_info,
+					g_main_lcore_id) < SPP_RET_OK) {
+			RTE_LOG(ERR, APP,
+				"Failed to set management data.\n");
 			break;
 		}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 3/3] shared/sec: revise name of vars of global mng data
  2019-05-31  3:35 [spp] [PATCH 0/3] Rename global management data ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 1/3] shared/sec: rename func for getting mng data ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 2/3] shared/sec: rename func for management data ogawa.yasufumi
@ 2019-05-31  3:35 ` ogawa.yasufumi
  2 siblings, 0 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

This update is to revise variables of global management data
`g_mng_data_addr` and its members because the term `addr` means
address is for pointer address but it has almost no meaning. It is
better to be simplified by removing the no meaning postfix.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/spp_proc.c | 122 +++++++++---------
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/spp_proc.c b/src/shared/secondary/spp_worker_th/spp_proc.c
index ccefa5b..2cd98c3 100644
--- a/src/shared/secondary/spp_worker_th/spp_proc.c
+++ b/src/shared/secondary/spp_worker_th/spp_proc.c
@@ -21,21 +21,21 @@
 
 #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
 
-/* Manage data to addoress */
-struct manage_data_addr_info {
-	struct startup_param	  *p_startup_param;
-	struct iface_info	  *p_iface_info;
+/* A set of pointers of management data */
+struct mng_data_info {
+	struct startup_param *p_startup_param;
+	struct iface_info *p_iface_info;
 	struct spp_component_info *p_component_info;
-	struct core_mng_info	  *p_core_info;
-	int			  *p_change_core;
-	int			  *p_change_component;
+	struct core_mng_info *p_core_info;
+	int *p_change_core;
+	int *p_change_component;
 	struct cancel_backup_info *p_backup_info;
-	unsigned int		  main_lcore_id;
+	unsigned int main_lcore_id;
 };
 
 /* Declare global variables */
 /* Logical core ID for main process */
-static struct manage_data_addr_info g_mng_data_addr;
+static struct mng_data_info g_mng_data;
 
 /**
  * Make a hexdump of an array data in every 4 byte.
@@ -191,7 +191,7 @@ spp_vf_add_vhost_pmd(int index, int client)
 enum spp_core_status
 spp_get_core_status(unsigned int lcore_id)
 {
-	return (g_mng_data_addr.p_core_info + lcore_id)->status;
+	return (g_mng_data.p_core_info + lcore_id)->status;
 }
 
 /**
@@ -205,7 +205,7 @@ check_core_status(enum spp_core_status status)
 {
 	unsigned int lcore_id = 0;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
-		if ((g_mng_data_addr.p_core_info + lcore_id)->status !=
+		if ((g_mng_data.p_core_info + lcore_id)->status !=
 								status) {
 			/* Status is mismatched */
 			return SPP_RET_NG;
@@ -234,7 +234,7 @@ void
 set_core_status(unsigned int lcore_id,
 		enum spp_core_status status)
 {
-	(g_mng_data_addr.p_core_info + lcore_id)->status = status;
+	(g_mng_data.p_core_info + lcore_id)->status = status;
 }
 
 /* Set all core to given status */
@@ -243,7 +243,7 @@ set_all_core_status(enum spp_core_status status)
 {
 	unsigned int lcore_id = 0;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
-		(g_mng_data_addr.p_core_info + lcore_id)->status = status;
+		(g_mng_data.p_core_info + lcore_id)->status = status;
 	}
 }
 
@@ -259,7 +259,7 @@ stop_process(int signal)
 		return;
 	}
 
-	(g_mng_data_addr.p_core_info + g_mng_data_addr.main_lcore_id)->status =
+	(g_mng_data.p_core_info + g_mng_data.main_lcore_id)->status =
 							SPP_CORE_STOP_REQUEST;
 	set_all_core_status(SPP_CORE_STOP_REQUEST);
 }
@@ -271,7 +271,7 @@ stop_process(int signal)
 struct sppwk_port_info *
 get_sppwk_port(enum port_type iface_type, int iface_no)
 {
-	struct iface_info *iface_info = g_mng_data_addr.p_iface_info;
+	struct iface_info *iface_info = g_mng_data.p_iface_info;
 
 	switch (iface_type) {
 	case PHY:
@@ -445,18 +445,18 @@ copy_mng_info(
 void
 backup_mng_info(struct cancel_backup_info *backup)
 {
-	dump_all_mng_info(g_mng_data_addr.p_core_info,
-			g_mng_data_addr.p_component_info,
-			g_mng_data_addr.p_iface_info);
+	dump_all_mng_info(g_mng_data.p_core_info,
+			g_mng_data.p_component_info,
+			g_mng_data.p_iface_info);
 	copy_mng_info(backup->core, backup->component, &backup->interface,
-			g_mng_data_addr.p_core_info,
-			g_mng_data_addr.p_component_info,
-			g_mng_data_addr.p_iface_info,
+			g_mng_data.p_core_info,
+			g_mng_data.p_component_info,
+			g_mng_data.p_iface_info,
 			COPY_MNG_FLG_ALLCOPY);
 	dump_all_mng_info(backup->core, backup->component, &backup->interface);
-	memset(g_mng_data_addr.p_change_core, 0x00,
+	memset(g_mng_data.p_change_core, 0x00,
 				sizeof(int)*RTE_MAX_LCORE);
-	memset(g_mng_data_addr.p_change_component, 0x00,
+	memset(g_mng_data.p_change_component, 0x00,
 				sizeof(int)*RTE_MAX_LCORE);
 }
 
@@ -469,7 +469,7 @@ static void
 init_iface_info(void)
 {
 	int port_cnt;  /* increment ether ports */
-	struct iface_info *p_iface_info = g_mng_data_addr.p_iface_info;
+	struct iface_info *p_iface_info = g_mng_data.p_iface_info;
 	memset(p_iface_info, 0x00, sizeof(struct iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
 		p_iface_info->nic[port_cnt].iface_type = UNDEF;
@@ -495,11 +495,11 @@ static void
 init_component_info(void)
 {
 	int cnt;
-	memset(g_mng_data_addr.p_component_info, 0x00,
+	memset(g_mng_data.p_component_info, 0x00,
 			sizeof(struct spp_component_info)*RTE_MAX_LCORE);
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++)
-		(g_mng_data_addr.p_component_info + cnt)->component_id = cnt;
-	memset(g_mng_data_addr.p_change_component, 0x00,
+		(g_mng_data.p_component_info + cnt)->component_id = cnt;
+	memset(g_mng_data.p_change_component, 0x00,
 			sizeof(int)*RTE_MAX_LCORE);
 }
 
@@ -508,7 +508,7 @@ static void
 init_core_info(void)
 {
 	int cnt = 0;
-	struct core_mng_info *p_core_info = g_mng_data_addr.p_core_info;
+	struct core_mng_info *p_core_info = g_mng_data.p_core_info;
 	memset(p_core_info, 0x00,
 			sizeof(struct core_mng_info)*RTE_MAX_LCORE);
 	set_all_core_status(SPP_CORE_STOP);
@@ -516,7 +516,7 @@ init_core_info(void)
 		(p_core_info + cnt)->ref_index = 0;
 		(p_core_info + cnt)->upd_index = 1;
 	}
-	memset(g_mng_data_addr.p_change_core, 0x00, sizeof(int)*RTE_MAX_LCORE);
+	memset(g_mng_data.p_change_core, 0x00, sizeof(int)*RTE_MAX_LCORE);
 }
 
 /* Setup port info of port on host */
@@ -524,7 +524,7 @@ static int
 set_nic_interface(void)
 {
 	int nic_cnt = 0;
-	struct iface_info *p_iface_info = g_mng_data_addr.p_iface_info;
+	struct iface_info *p_iface_info = g_mng_data.p_iface_info;
 
 	/* NIC Setting */
 	p_iface_info->num_nic = rte_eth_dev_count_avail();
@@ -602,7 +602,7 @@ del_vhost_sockfile(struct sppwk_port_info *vhost)
 	int cnt;
 
 	/* Do not remove for if it is running in vhost-client mode. */
-	if (g_mng_data_addr.p_startup_param->vhost_client != 0)
+	if (g_mng_data.p_startup_param->vhost_client != 0)
 		return;
 
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
@@ -620,7 +620,7 @@ enum spp_component_type
 spp_get_component_type(int id)
 {
 	struct spp_component_info *component_info =
-				(g_mng_data_addr.p_component_info + id);
+				(g_mng_data.p_component_info + id);
 	return component_info->type;
 }
 
@@ -629,7 +629,7 @@ unsigned int
 spp_get_component_core(int component_id)
 {
 	struct spp_component_info *info =
-			(g_mng_data_addr.p_component_info + component_id);
+			(g_mng_data.p_component_info + component_id);
 	return info->lcore_id;
 }
 
@@ -637,7 +637,7 @@ spp_get_component_core(int component_id)
 struct core_info *
 get_core_info(unsigned int lcore_id)
 {
-	struct core_mng_info *info = (g_mng_data_addr.p_core_info + lcore_id);
+	struct core_mng_info *info = (g_mng_data.p_core_info + lcore_id);
 	return &(info->core[info->ref_index]);
 }
 
@@ -645,7 +645,7 @@ get_core_info(unsigned int lcore_id)
 int
 spp_check_core_update(unsigned int lcore_id)
 {
-	struct core_mng_info *info = (g_mng_data_addr.p_core_info + lcore_id);
+	struct core_mng_info *info = (g_mng_data.p_core_info + lcore_id);
 	if (info->ref_index == info->upd_index)
 		return SPP_RET_OK;
 	else
@@ -664,7 +664,7 @@ spp_check_used_port(
 	struct sppwk_port_info **port_array = NULL;
 	struct sppwk_port_info *port = get_sppwk_port(iface_type, iface_no);
 	struct spp_component_info *component_info =
-					g_mng_data_addr.p_component_info;
+					g_mng_data.p_component_info;
 
 	if (port == NULL)
 		return SPP_RET_NG;
@@ -699,14 +699,14 @@ set_component_change_port(struct sppwk_port_info *port, enum spp_port_rxtx rxtx)
 		ret = spp_check_used_port(port->iface_type, port->iface_no,
 				SPP_PORT_RXTX_RX);
 		if (ret >= 0)
-			*(g_mng_data_addr.p_change_component + ret) = 1;
+			*(g_mng_data.p_change_component + ret) = 1;
 	}
 
 	if ((rxtx == SPP_PORT_RXTX_TX) || (rxtx == SPP_PORT_RXTX_ALL)) {
 		ret = spp_check_used_port(port->iface_type, port->iface_no,
 				SPP_PORT_RXTX_TX);
 		if (ret >= 0)
-			*(g_mng_data_addr.p_change_component + ret) = 1;
+			*(g_mng_data.p_change_component + ret) = 1;
 	}
 }
 
@@ -715,7 +715,7 @@ int
 get_free_component(void)
 {
 	struct spp_component_info *component_info =
-					g_mng_data_addr.p_component_info;
+					g_mng_data.p_component_info;
 
 	int cnt = 0;
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
@@ -731,7 +731,7 @@ int
 spp_get_component_id(const char *name)
 {
 	struct spp_component_info *component_info =
-		g_mng_data_addr.p_component_info;
+		g_mng_data.p_component_info;
 
 	int cnt = 0;
 	if (name[0] == '\0')
@@ -820,14 +820,14 @@ flush_port(void)
 	int ret = 0;
 	int cnt = 0;
 	struct sppwk_port_info *port = NULL;
-	struct iface_info *p_iface_info = g_mng_data_addr.p_iface_info;
+	struct iface_info *p_iface_info = g_mng_data.p_iface_info;
 
 	/* Initialize added vhost. */
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &p_iface_info->vhost[cnt];
 		if ((port->iface_type != UNDEF) && (port->ethdev_port_id < 0)) {
 			ret = spp_vf_add_vhost_pmd(port->iface_no,
-				g_mng_data_addr.p_startup_param->vhost_client);
+				g_mng_data.p_startup_param->vhost_client);
 			if (ret < 0)
 				return SPP_RET_NG;
 			port->ethdev_port_id = ret;
@@ -853,8 +853,8 @@ flush_core(void)
 {
 	int cnt = 0;
 	struct core_mng_info *info = NULL;
-	struct core_mng_info *p_core_info = g_mng_data_addr.p_core_info;
-	int *p_change_core = g_mng_data_addr.p_change_core;
+	struct core_mng_info *p_core_info = g_mng_data.p_core_info;
+	int *p_change_core = g_mng_data.p_change_core;
 
 	/* Changed core has changed index. */
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
@@ -885,9 +885,9 @@ flush_component(void)
 	int ret = 0;
 	int cnt = 0;
 	struct spp_component_info *component_info = NULL;
-	int *p_change_component = g_mng_data_addr.p_change_component;
+	int *p_change_component = g_mng_data.p_change_component;
 	struct spp_component_info *p_component_info =
-					g_mng_data_addr.p_component_info;
+					g_mng_data.p_component_info;
 
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		if (*(p_change_component + cnt) == 0)
@@ -1011,14 +1011,14 @@ int sppwk_set_mng_data(
 			backup_info_p == NULL || main_lcore_id == 0xffffffff)
 		return SPP_RET_NG;
 
-	g_mng_data_addr.p_startup_param = startup_param_p;
-	g_mng_data_addr.p_iface_info = iface_p;
-	g_mng_data_addr.p_component_info = component_p;
-	g_mng_data_addr.p_core_info = core_mng_p;
-	g_mng_data_addr.p_change_core = change_core_p;
-	g_mng_data_addr.p_change_component = change_component_p;
-	g_mng_data_addr.p_backup_info = backup_info_p;
-	g_mng_data_addr.main_lcore_id = main_lcore_id;
+	g_mng_data.p_startup_param = startup_param_p;
+	g_mng_data.p_iface_info = iface_p;
+	g_mng_data.p_component_info = component_p;
+	g_mng_data.p_core_info = core_mng_p;
+	g_mng_data.p_change_core = change_core_p;
+	g_mng_data.p_change_component = change_component_p;
+	g_mng_data.p_backup_info = backup_info_p;
+	g_mng_data.main_lcore_id = main_lcore_id;
 
 	return SPP_RET_OK;
 }
@@ -1035,18 +1035,18 @@ void sppwk_get_mng_data(
 {
 
 	if (startup_param_p != NULL)
-		*startup_param_p = g_mng_data_addr.p_startup_param;
+		*startup_param_p = g_mng_data.p_startup_param;
 	if (iface_p != NULL)
-		*iface_p = g_mng_data_addr.p_iface_info;
+		*iface_p = g_mng_data.p_iface_info;
 	if (component_p != NULL)
-		*component_p = g_mng_data_addr.p_component_info;
+		*component_p = g_mng_data.p_component_info;
 	if (core_mng_p != NULL)
-		*core_mng_p = g_mng_data_addr.p_core_info;
+		*core_mng_p = g_mng_data.p_core_info;
 	if (change_core_p != NULL)
-		*change_core_p = g_mng_data_addr.p_change_core;
+		*change_core_p = g_mng_data.p_change_core;
 	if (change_component_p != NULL)
-		*change_component_p = g_mng_data_addr.p_change_component;
+		*change_component_p = g_mng_data.p_change_component;
 	if (backup_info_p != NULL)
-		*backup_info_p = g_mng_data_addr.p_backup_info;
+		*backup_info_p = g_mng_data.p_backup_info;
 
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  3:35 [spp] [PATCH 0/3] Rename global management data ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 1/3] shared/sec: rename func for getting mng data ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 2/3] shared/sec: rename func for management data ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 3/3] shared/sec: revise name of vars of global mng data ogawa.yasufumi

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