Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH 0/2] Rename struct of component
@ 2019-05-31  3:37 ogawa.yasufumi
  2019-05-31  3:37 ` [spp] [PATCH 1/2] shared/sec: rename struct spp_component_info ogawa.yasufumi
  2019-05-31  3:37 ` [spp] [PATCH 2/2] shared/sec: rename enum spp_core_status ogawa.yasufumi
  0 siblings, 2 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:37 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename structs of component info.

Yasufumi Ogawa (2):
  shared/sec: rename struct spp_component_info
  shared/sec: rename enum spp_core_status

 src/mirror/spp_mirror.c                       | 25 ++++----
 src/pcap/cmd_utils.h                          | 38 ++++++------
 .../secondary/spp_worker_th/cmd_runner.c      | 28 ++++-----
 .../secondary/spp_worker_th/cmd_utils.c       | 62 +++++++++----------
 .../secondary/spp_worker_th/cmd_utils.h       | 48 +++++++-------
 .../secondary/spp_worker_th/mirror_deps.h     |  4 +-
 src/shared/secondary/spp_worker_th/spp_port.c |  6 +-
 src/shared/secondary/spp_worker_th/spp_port.h |  4 +-
 src/shared/secondary/spp_worker_th/vf_deps.h  |  8 +--
 src/vf/classifier_mac.c                       | 12 ++--
 src/vf/spp_forward.c                          | 30 ++++-----
 src/vf/spp_vf.c                               |  4 +-
 12 files changed, 133 insertions(+), 136 deletions(-)

-- 
2.17.1


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

* [spp] [PATCH 1/2] shared/sec: rename struct spp_component_info
  2019-05-31  3:37 [spp] [PATCH 0/2] Rename struct of component ogawa.yasufumi
@ 2019-05-31  3:37 ` ogawa.yasufumi
  2019-05-31  3:37 ` [spp] [PATCH 2/2] shared/sec: rename enum spp_core_status ogawa.yasufumi
  1 sibling, 0 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:37 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename struct `spp_component_info` to
`sppwk_comp_info` to be more specific.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/mirror/spp_mirror.c                       | 23 ++++----
 src/pcap/cmd_utils.h                          | 38 +++++++-------
 .../secondary/spp_worker_th/cmd_runner.c      | 28 +++++-----
 .../secondary/spp_worker_th/cmd_utils.c       | 52 +++++++++----------
 .../secondary/spp_worker_th/cmd_utils.h       | 36 ++++++-------
 .../secondary/spp_worker_th/mirror_deps.h     |  4 +-
 src/shared/secondary/spp_worker_th/spp_port.c |  6 +--
 src/shared/secondary/spp_worker_th/spp_port.h |  4 +-
 src/shared/secondary/spp_worker_th/vf_deps.h  |  8 +--
 src/vf/classifier_mac.c                       | 12 ++---
 src/vf/spp_forward.c                          | 30 +++++------
 src/vf/spp_vf.c                               |  2 +-
 12 files changed, 120 insertions(+), 123 deletions(-)

diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 501b214..5c82e2b 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -63,7 +63,7 @@ static struct startup_param g_startup_param;
 static struct iface_info g_iface_info;
 
 /* Component management information */
-static struct spp_component_info g_component_info[RTE_MAX_LCORE];
+static struct sppwk_comp_info g_component_info[RTE_MAX_LCORE];
 
 /* Core management information */
 static struct core_mng_info g_core_info[RTE_MAX_LCORE];
@@ -277,19 +277,19 @@ mirror_proc_init(void)
 
 /* Update mirror info */
 int
-spp_mirror_update(struct spp_component_info *component)
+spp_mirror_update(struct sppwk_comp_info *component)
 {
 	int cnt = 0;
-	int num_rx = component->num_rx_port;
-	int num_tx = component->num_tx_port;
-	struct mirror_info *info = &g_mirror_info[component->component_id];
+	int num_rx = component->nof_rx;
+	int num_tx = component->nof_tx;
+	struct mirror_info *info = &g_mirror_info[component->comp_id];
 	struct mirror_path *path = &info->path[info->upd_index];
 
 	/* mirror component allows only one receiving port. */
 	if (unlikely(num_rx > 1)) {
 		RTE_LOG(ERR, MIRROR,
 			"Component[%d] Setting error. (type = %d, rx = %d)\n",
-			component->component_id, component->wk_type, num_rx);
+			component->comp_id, component->wk_type, num_rx);
 		return SPP_RET_NG;
 	}
 
@@ -297,7 +297,7 @@ spp_mirror_update(struct spp_component_info *component)
 	if (unlikely(num_tx > 2)) {
 		RTE_LOG(ERR, MIRROR,
 			"Component[%d] Setting error. (type = %d, tx = %d)\n",
-			component->component_id, component->wk_type, num_tx);
+			component->comp_id, component->wk_type, num_tx);
 		return SPP_RET_NG;
 	}
 
@@ -306,14 +306,14 @@ spp_mirror_update(struct spp_component_info *component)
 	RTE_LOG(INFO, MIRROR,
 			"Component[%d] Start update component. "
 			"(name = %s, type = %d)\n",
-			component->component_id,
+			component->comp_id,
 			component->name,
 			component->wk_type);
 
 	memcpy(&path->name, component->name, SPP_NAME_STR_LEN);
 	path->wk_type = component->wk_type;
-	path->nof_rx = component->num_rx_port;
-	path->nof_tx = component->num_tx_port;
+	path->nof_rx = component->nof_rx;
+	path->nof_tx = component->nof_tx;
 	for (cnt = 0; cnt < num_rx; cnt++)
 		memcpy(&path->ports[cnt].rx, component->rx_ports[cnt],
 				sizeof(struct sppwk_port_info));
@@ -330,8 +330,7 @@ spp_mirror_update(struct spp_component_info *component)
 	RTE_LOG(INFO, MIRROR,
 			"Component[%d] Complete update component. "
 			"(name = %s, type = %d)\n",
-			component->component_id,
-			component->name,
+			component->comp_id, component->name,
 			component->wk_type);
 
 	return SPP_RET_OK;
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index 61b6da5..1b028fa 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -63,13 +63,14 @@ enum spp_port_rxtx {
 	SPP_PORT_RXTX_ALL,  /**< rx/tx port */
 };
 
-/* Process type for each component */
-enum spp_component_type {
-	SPP_COMPONENT_UNUSE,          /**< Not used */
-	SPP_COMPONENT_CLASSIFIER_MAC, /**< Classifier_mac */
-	SPP_COMPONENT_MERGE,          /**< Merger */
-	SPP_COMPONENT_FORWARD,        /**< Forwarder */
-	SPP_COMPONENT_MIRROR,         /**< Mirror */
+/* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
+/* Type of SPP worker thread. */
+enum sppwk_worker_type {
+	SPPWK_TYPE_NONE,  /**< Not used */
+	SPPWK_TYPE_CLS,  /**< Classifier_mac */
+	SPPWK_TYPE_MRG,  /**< Merger */
+	SPPWK_TYPE_FWD,  /**< Forwarder */
+	SPPWK_TYPE_MIR,  /**< Mirror */
 };
 
 /**
@@ -142,18 +143,17 @@ struct spp_port_info {
 					/**< Port ability */
 };
 
-/* Component info */
-struct spp_component_info {
-	char name[SPP_NAME_STR_LEN];    /**< Component name */
-	enum spp_component_type type;   /**< Component type */
-	unsigned int lcore_id;          /**< Logical core ID for component */
-	int component_id;               /**< Component ID */
-	int num_rx_port;                /**< The number of rx ports */
-	int num_tx_port;                /**< The number of tx ports */
-	struct spp_port_info *rx_ports[RTE_MAX_ETHPORTS];
-					/**< Array of pointers to rx ports */
-	struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
-					/**< Array of pointers to tx ports */
+/* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
+/* Attributes of SPP worker thread named as `component`. */
+struct sppwk_comp_info {
+	char name[SPP_NAME_STR_LEN];  /**< Component name */
+	enum sppwk_worker_type wk_type;  /**< Type of worker thread */
+	unsigned int lcore_id;
+	int comp_id;  /**< Component ID */
+	int nof_rx;  /**< The number of rx ports */
+	int nof_tx;  /**< The number of tx ports */
+	struct sppwk_port_info *rx_ports[RTE_MAX_ETHPORTS]; /**< rx ports */
+	struct sppwk_port_info *tx_ports[RTE_MAX_ETHPORTS]; /**< tx ports */
 };
 
 /* Manage given options as global variable */
diff --git a/src/shared/secondary/spp_worker_th/cmd_runner.c b/src/shared/secondary/spp_worker_th/cmd_runner.c
index c3e1c9c..8672a25 100644
--- a/src/shared/secondary/spp_worker_th/cmd_runner.c
+++ b/src/shared/secondary/spp_worker_th/cmd_runner.c
@@ -216,11 +216,11 @@ update_comp(enum sppwk_action wk_action, const char *name,
 	int ret_del;
 	int comp_lcore_id = 0;
 	unsigned int tmp_lcore_id = 0;
-	struct spp_component_info *comp_info = NULL;
+	struct sppwk_comp_info *comp_info = NULL;
 	/* TODO(yasufum) revise `core` to be more specific. */
 	struct core_info *core = NULL;
 	struct core_mng_info *info = NULL;
-	struct spp_component_info *comp_info_base = NULL;
+	struct sppwk_comp_info *comp_info_base = NULL;
 	/* TODO(yasufum) revise `core_info` which is same as struct name. */
 	struct core_mng_info *core_info = NULL;
 	int *change_core = NULL;
@@ -255,11 +255,11 @@ update_comp(enum sppwk_action wk_action, const char *name,
 		core = &info->core[info->upd_index];
 
 		comp_info = (comp_info_base + comp_lcore_id);
-		memset(comp_info, 0x00, sizeof(struct spp_component_info));
+		memset(comp_info, 0x00, sizeof(struct sppwk_comp_info));
 		strcpy(comp_info->name, name);
 		comp_info->wk_type = wk_type;
-		comp_info->lcore_id	= lcore_id;
-		comp_info->component_id	= comp_lcore_id;
+		comp_info->lcore_id = lcore_id;
+		comp_info->comp_id = comp_lcore_id;
 
 		core->id[core->num] = comp_lcore_id;
 		core->num++;
@@ -275,7 +275,7 @@ update_comp(enum sppwk_action wk_action, const char *name,
 
 		comp_info = (comp_info_base + comp_lcore_id);
 		tmp_lcore_id = comp_info->lcore_id;
-		memset(comp_info, 0x00, sizeof(struct spp_component_info));
+		memset(comp_info, 0x00, sizeof(struct sppwk_comp_info));
 
 		info = (core_info + tmp_lcore_id);
 		core = &info->core[info->upd_index];
@@ -365,11 +365,11 @@ update_port(enum sppwk_action wk_action,
 	int ret_del = -1;
 	int comp_lcore_id = 0;
 	int cnt = 0;
-	struct spp_component_info *comp_info = NULL;
+	struct sppwk_comp_info *comp_info = NULL;
 	struct sppwk_port_info *port_info = NULL;
 	int *nof_ports = NULL;
 	struct sppwk_port_info **ports = NULL;
-	struct spp_component_info *comp_info_base = NULL;
+	struct sppwk_comp_info *comp_info_base = NULL;
 	int *change_component = NULL;
 
 	comp_lcore_id = sppwk_get_lcore_id(name);
@@ -383,10 +383,10 @@ update_port(enum sppwk_action wk_action,
 	comp_info = (comp_info_base + comp_lcore_id);
 	port_info = get_sppwk_port(port->iface_type, port->iface_no);
 	if (rxtx == SPP_PORT_RXTX_RX) {
-		nof_ports = &comp_info->num_rx_port;
+		nof_ports = &comp_info->nof_rx;
 		ports = comp_info->rx_ports;
 	} else {
-		nof_ports = &comp_info->num_tx_port;
+		nof_ports = &comp_info->nof_tx;
 		ports = comp_info->tx_ports;
 	}
 
@@ -394,8 +394,8 @@ update_port(enum sppwk_action wk_action,
 	case SPPWK_ACT_ADD:
 		/* Check if over the maximum num of ports of component. */
 		if (check_port_count(comp_info->wk_type, rxtx,
-				comp_info->num_rx_port,
-				comp_info->num_tx_port) != SPP_RET_OK)
+				comp_info->nof_rx,
+				comp_info->nof_tx) != SPP_RET_OK)
 			return SPP_RET_NG;
 
 		/* Check if the port_info is included in array `ports`. */
@@ -506,8 +506,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;
+	struct sppwk_comp_info *comp_info_base = NULL;
+	struct sppwk_comp_info *comp_info = NULL;
 
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
 		if (spp_get_core_status(lcore_id) == SPP_CORE_UNUSE)
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index 46aa118..cacb565 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -26,7 +26,7 @@
 struct mng_data_info {
 	struct startup_param *p_startup_param;
 	struct iface_info *p_iface_info;
-	struct spp_component_info *p_component_info;
+	struct sppwk_comp_info *p_component_info;
 	struct core_mng_info *p_core_info;
 	int *p_change_core;
 	int *p_change_component;
@@ -309,10 +309,10 @@ dump_core_info(const struct core_mng_info *core_info)
 
 /* Dump of component information */
 void
-dump_component_info(const struct spp_component_info *comp_info)
+dump_component_info(const struct sppwk_comp_info *comp_info)
 {
 	char str[SPP_NAME_STR_LEN];
-	const struct spp_component_info *tmp_ci = NULL;
+	const struct sppwk_comp_info *tmp_ci = NULL;
 	int cnt = 0;
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		tmp_ci = &comp_info[cnt];
@@ -322,17 +322,17 @@ dump_component_info(const struct spp_component_info *comp_info)
 		RTE_LOG(DEBUG, APP, "component[%d] name=%s, type=%d, "
 				"core=%u, index=%d\n",
 				cnt, tmp_ci->name, tmp_ci->wk_type,
-				tmp_ci->lcore_id, tmp_ci->component_id);
+				tmp_ci->lcore_id, tmp_ci->comp_id);
 
 		sprintf(str, "component[%d] rx=%d", cnt,
-				tmp_ci->num_rx_port);
+				tmp_ci->nof_rx);
 		dump_buff(str, tmp_ci->rx_ports,
-			sizeof(struct sppwk_port_info *)*tmp_ci->num_rx_port);
+			sizeof(struct sppwk_port_info *)*tmp_ci->nof_rx);
 
 		sprintf(str, "component[%d] tx=%d", cnt,
-				tmp_ci->num_tx_port);
+				tmp_ci->nof_tx);
 		dump_buff(str, tmp_ci->tx_ports,
-			sizeof(struct sppwk_port_info *)*tmp_ci->num_tx_port);
+			sizeof(struct sppwk_port_info *)*tmp_ci->nof_tx);
 	}
 }
 
@@ -391,7 +391,7 @@ dump_interface_info(const struct iface_info *iface_info)
 void
 dump_all_mng_info(
 		const struct core_mng_info *core,
-		const struct spp_component_info *component,
+		const struct sppwk_comp_info *component,
 		const struct iface_info *interface)
 {
 	if (rte_log_get_global_level() < RTE_LOG_DEBUG)
@@ -406,10 +406,10 @@ dump_all_mng_info(
 void
 copy_mng_info(
 		struct core_mng_info *dst_core,
-		struct spp_component_info *dst_component,
+		struct sppwk_comp_info *dst_component,
 		struct iface_info *dst_interface,
 		const struct core_mng_info *src_core,
-		const struct spp_component_info *src_component,
+		const struct sppwk_comp_info *src_component,
 		const struct iface_info *src_interface,
 		enum copy_mng_flg flg)
 {
@@ -437,7 +437,7 @@ copy_mng_info(
 	}
 
 	memcpy(dst_component, src_component,
-			sizeof(struct spp_component_info)*RTE_MAX_LCORE);
+			sizeof(struct sppwk_comp_info)*RTE_MAX_LCORE);
 	memcpy(dst_interface, src_interface,
 			sizeof(struct iface_info));
 }
@@ -497,9 +497,9 @@ init_component_info(void)
 {
 	int cnt;
 	memset(g_mng_data.p_component_info, 0x00,
-			sizeof(struct spp_component_info)*RTE_MAX_LCORE);
+			sizeof(struct sppwk_comp_info)*RTE_MAX_LCORE);
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++)
-		(g_mng_data.p_component_info + cnt)->component_id = cnt;
+		(g_mng_data.p_component_info + cnt)->comp_id = cnt;
 	memset(g_mng_data.p_change_component, 0x00,
 			sizeof(int)*RTE_MAX_LCORE);
 }
@@ -620,7 +620,7 @@ del_vhost_sockfile(struct sppwk_port_info *vhost)
 enum sppwk_worker_type
 spp_get_component_type(int id)
 {
-	struct spp_component_info *component_info =
+	struct sppwk_comp_info *component_info =
 				(g_mng_data.p_component_info + id);
 	return component_info->wk_type;
 }
@@ -629,7 +629,7 @@ spp_get_component_type(int id)
 unsigned int
 spp_get_component_core(int component_id)
 {
-	struct spp_component_info *info =
+	struct sppwk_comp_info *info =
 			(g_mng_data.p_component_info + component_id);
 	return info->lcore_id;
 }
@@ -661,10 +661,10 @@ spp_check_used_port(
 		enum spp_port_rxtx rxtx)
 {
 	int cnt, port_cnt, max = 0;
-	struct spp_component_info *component = NULL;
+	struct sppwk_comp_info *component = NULL;
 	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 =
+	struct sppwk_comp_info *component_info =
 					g_mng_data.p_component_info;
 
 	if (port == NULL)
@@ -676,10 +676,10 @@ spp_check_used_port(
 			continue;
 
 		if (rxtx == SPP_PORT_RXTX_RX) {
-			max = component->num_rx_port;
+			max = component->nof_rx;
 			port_array = component->rx_ports;
 		} else if (rxtx == SPP_PORT_RXTX_TX) {
-			max = component->num_tx_port;
+			max = component->nof_tx;
 			port_array = component->tx_ports;
 		}
 		for (port_cnt = 0; port_cnt < max; port_cnt++) {
@@ -715,7 +715,7 @@ set_component_change_port(struct sppwk_port_info *port, enum spp_port_rxtx rxtx)
 int
 get_free_lcore_id(void)
 {
-	struct spp_component_info *comp_info = g_mng_data.p_component_info;
+	struct sppwk_comp_info *comp_info = g_mng_data.p_component_info;
 
 	int cnt = 0;
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
@@ -729,7 +729,7 @@ get_free_lcore_id(void)
 int
 sppwk_get_lcore_id(const char *comp_name)
 {
-	struct spp_component_info *comp_info = g_mng_data.p_component_info;
+	struct sppwk_comp_info *comp_info = g_mng_data.p_component_info;
 
 	int cnt = 0;
 	if (comp_name[0] == '\0')
@@ -884,9 +884,9 @@ update_comp_info(void)
 {
 	int ret = 0;
 	int cnt = 0;
-	struct spp_component_info *comp_info = NULL;
+	struct sppwk_comp_info *comp_info = NULL;
 	int *p_change_comp = g_mng_data.p_change_component;
-	struct spp_component_info *p_comp_info = g_mng_data.p_component_info;
+	struct sppwk_comp_info *p_comp_info = g_mng_data.p_component_info;
 
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		if (*(p_change_comp + cnt) == 0)
@@ -995,7 +995,7 @@ sppwk_convert_mac_str_to_int64(const char *macaddr)
 int sppwk_set_mng_data(
 		struct startup_param *startup_param_p,
 		struct iface_info *iface_p,
-		struct spp_component_info *component_p,
+		struct sppwk_comp_info *component_p,
 		struct core_mng_info *core_mng_p,
 		int *change_core_p,
 		int *change_component_p,
@@ -1028,7 +1028,7 @@ int sppwk_set_mng_data(
 void sppwk_get_mng_data(
 		struct startup_param **startup_param_p,
 		struct iface_info **iface_p,
-		struct spp_component_info **component_p,
+		struct sppwk_comp_info **component_p,
 		struct core_mng_info **core_mng_p,
 		int **change_core_p,
 		int **change_component_p,
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 7f15ea6..9b01ff9 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -203,18 +203,16 @@ struct sppwk_port_info {
 	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
 };
 
-/* Component info */
-struct spp_component_info {
-	char name[SPP_NAME_STR_LEN];	/**< Component name */
-	enum sppwk_worker_type wk_type;	/**< Component type */
-	unsigned int lcore_id;		/**< Logical core ID for component */
-	int component_id;		/**< Component ID */
-	int num_rx_port;		/**< The number of rx ports */
-	int num_tx_port;		/**< The number of tx ports */
-	struct sppwk_port_info *rx_ports[RTE_MAX_ETHPORTS];
-					/**< Array of pointers to rx ports */
-	struct sppwk_port_info *tx_ports[RTE_MAX_ETHPORTS];
-					/**< Array of pointers to tx ports */
+/* Attributes of SPP worker thread named as `component`. */
+struct sppwk_comp_info {
+	char name[SPP_NAME_STR_LEN];  /**< Component name */
+	enum sppwk_worker_type wk_type;  /**< Type of worker thread */
+	unsigned int lcore_id;
+	int comp_id;  /**< Component ID */
+	int nof_rx;  /**< The number of rx ports */
+	int nof_tx;  /**< The number of tx ports */
+	struct sppwk_port_info *rx_ports[RTE_MAX_ETHPORTS]; /**< rx ports */
+	struct sppwk_port_info *tx_ports[RTE_MAX_ETHPORTS]; /**< tx ports */
 };
 
 /* Manage given options as global variable */
@@ -268,7 +266,7 @@ struct cancel_backup_info {
 	struct core_mng_info core[RTE_MAX_LCORE];
 
 	/* Backup data of component information */
-	struct spp_component_info component[RTE_MAX_LCORE];
+	struct sppwk_comp_info component[RTE_MAX_LCORE];
 
 	/* Backup data of interface information */
 	struct iface_info interface;
@@ -438,7 +436,7 @@ get_sppwk_port(enum port_type iface_type, int iface_no);
 void dump_core_info(const struct core_mng_info *core_info);
 
 /* Dump of component information */
-void dump_component_info(const struct spp_component_info *component_info);
+void dump_component_info(const struct sppwk_comp_info *component_info);
 
 /* Dump of interface information */
 void dump_interface_info(const struct iface_info *iface_info);
@@ -446,16 +444,16 @@ void dump_interface_info(const struct iface_info *iface_info);
 /* Dump of all management information */
 void dump_all_mng_info(
 		const struct core_mng_info *core,
-		const struct spp_component_info *component,
+		const struct sppwk_comp_info *component,
 		const struct iface_info *interface);
 
 /* Copy management information */
 void copy_mng_info(
 		struct core_mng_info *dst_core,
-		struct spp_component_info *dst_component,
+		struct sppwk_comp_info *dst_component,
 		struct iface_info *dst_interface,
 		const struct core_mng_info *src_core,
-		const struct spp_component_info *src_component,
+		const struct sppwk_comp_info *src_component,
 		const struct iface_info *src_interface,
 		enum copy_mng_flg flg);
 
@@ -664,7 +662,7 @@ int64_t sppwk_convert_mac_str_to_int64(const char *macaddr);
  */
 int sppwk_set_mng_data(struct startup_param *startup_param_p,
 		struct iface_info *iface_p,
-		struct spp_component_info *component_p,
+		struct sppwk_comp_info *component_p,
 		struct core_mng_info *core_mng_p,
 		int *change_core_p,
 		int *change_component_p,
@@ -691,7 +689,7 @@ int sppwk_set_mng_data(struct startup_param *startup_param_p,
  */
 void sppwk_get_mng_data(struct startup_param **startup_param_p,
 		struct iface_info **iface_p,
-		struct spp_component_info **component_p,
+		struct sppwk_comp_info **component_p,
 		struct core_mng_info **core_mng_p,
 		int **change_core_p,
 		int **change_component_p,
diff --git a/src/shared/secondary/spp_worker_th/mirror_deps.h b/src/shared/secondary/spp_worker_th/mirror_deps.h
index 02e64d9..83edc1f 100644
--- a/src/shared/secondary/spp_worker_th/mirror_deps.h
+++ b/src/shared/secondary/spp_worker_th/mirror_deps.h
@@ -11,13 +11,13 @@
  * Update Mirror info
  *
  * @param component
- *  The pointer to struct spp_component_info.@n
+ *  The pointer to struct sppwk_comp_info.@n
  *  The data for updating the internal data of mirror.
  *
  * @retval SPP_RET_OK succeeded.
  * @retval SPP_RET_NG failed.
  */
-int spp_mirror_update(struct spp_component_info *component);
+int spp_mirror_update(struct sppwk_comp_info *component);
 
 /**
  * Mirror get component status
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index 5b02d90..7a8a088 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -305,16 +305,16 @@ port_ability_set_ability(
 
 /* Update port capability. */
 void
-spp_port_ability_update(const struct spp_component_info *component)
+spp_port_ability_update(const struct sppwk_comp_info *component)
 {
 	int cnt;
 	struct sppwk_port_info *port = NULL;
-	for (cnt = 0; cnt < component->num_rx_port; cnt++) {
+	for (cnt = 0; cnt < component->nof_rx; cnt++) {
 		port = component->rx_ports[cnt];
 		port_ability_set_ability(port, SPP_PORT_RXTX_RX);
 	}
 
-	for (cnt = 0; cnt < component->num_tx_port; cnt++) {
+	for (cnt = 0; cnt < component->nof_tx; cnt++) {
 		port = component->tx_ports[cnt];
 		port_ability_set_ability(port, SPP_PORT_RXTX_TX);
 	}
diff --git a/src/shared/secondary/spp_worker_th/spp_port.h b/src/shared/secondary/spp_worker_th/spp_port.h
index 1f8161a..274b24b 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.h
+++ b/src/shared/secondary/spp_worker_th/spp_port.h
@@ -61,10 +61,10 @@ void spp_port_ability_change_index(
  * Update port capability.
  *
  * @param component_info
- *  The pointer to struct spp_component_info.@n
+ *  The pointer to struct sppwk_comp_info.@n
  *  The data for updating the internal data of port ability.
  */
-void spp_port_ability_update(const struct spp_component_info *component);
+void spp_port_ability_update(const struct sppwk_comp_info *component);
 
 /**
  * Wrapper function for rte_eth_rx_burst().
diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index 4b9cecf..6d857d2 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -86,25 +86,25 @@ free_mac_classification(struct mac_classification *mac_cls)
  * classifier(mac address) update component info.
  *
  * @param component_info
- *  The pointer to struct spp_component_info.@n
+ *  The pointer to struct sppwk_comp_info.@n
  *  The data for updating the internal data of classifier.
  *
  * @retval SPP_RET_OK succeeded.
  * @retval SPP_RET_NG failed.
  */
-int spp_classifier_mac_update(struct spp_component_info *component_info);
+int spp_classifier_mac_update(struct sppwk_comp_info *component_info);
 
 /**
  * Update forward info
  *
  * @param component
- *  The pointer to struct spp_component_info.@n
+ *  The pointer to struct sppwk_comp_info.@n
  *  The data for updating the internal data of forwarder and merger.
  *
  * @retval SPP_RET_OK succeeded.
  * @retval SPP_RET_NG failed.
  */
-int spp_forward_update(struct spp_component_info *component);
+int spp_forward_update(struct sppwk_comp_info *component);
 
 void init_classifier_info(int component_id);
 
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 0eb8234..c8cc7df 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -321,7 +321,7 @@ create_mac_classification(void)
 /* initialize classifier information. */
 static int
 init_component_info(struct component_info *cmp_info,
-		const struct spp_component_info *component_info)
+		const struct sppwk_comp_info *component_info)
 {
 	int ret = SPP_RET_NG;
 	int i;
@@ -334,7 +334,7 @@ init_component_info(struct component_info *cmp_info,
 	uint16_t vid;
 
 	/* set rx */
-	if (component_info->num_rx_port == 0) {
+	if (component_info->nof_rx == 0) {
 		clsd_data_rx->iface_type = UNDEF;
 		clsd_data_rx->iface_no = 0;
 		clsd_data_rx->iface_no_global = 0;
@@ -352,9 +352,9 @@ init_component_info(struct component_info *cmp_info,
 	}
 
 	/* set tx */
-	cmp_info->n_classified_data_tx = component_info->num_tx_port;
+	cmp_info->n_classified_data_tx = component_info->nof_tx;
 	cmp_info->mac_addr_entry = 0;
-	for (i = 0; i < component_info->num_tx_port; i++) {
+	for (i = 0; i < component_info->nof_tx; i++) {
 		tx_port = component_info->tx_ports[i];
 		vid = tx_port->cls_attrs.vlantag.vid;
 
@@ -701,10 +701,10 @@ spp_classifier_mac_init(void)
 
 /* classifier(mac address) update component info. */
 int
-spp_classifier_mac_update(struct spp_component_info *component_info)
+spp_classifier_mac_update(struct sppwk_comp_info *component_info)
 {
 	int ret = SPP_RET_NG;
-	int id = component_info->component_id;
+	int id = component_info->comp_id;
 	struct management_info *mng_info = g_mng_infos + id;
 	struct component_info *cmp_info = NULL;
 
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index cededb2..71859e6 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -51,29 +51,29 @@ spp_forward_init(void)
 
 /* Update forward info */
 int
-spp_forward_update(struct spp_component_info *component)
+spp_forward_update(struct sppwk_comp_info *component)
 {
 	int cnt = 0;
-	int num_rx = component->num_rx_port;
-	int num_tx = component->num_tx_port;
-	int max = (num_rx > num_tx)?num_rx*num_tx:num_tx;
-	struct forward_info *info = &g_forward_info[component->component_id];
+	int nof_rx = component->nof_rx;
+	int nof_tx = component->nof_tx;
+	int max = (nof_rx > nof_tx)?nof_rx*nof_tx:nof_tx;
+	struct forward_info *info = &g_forward_info[component->comp_id];
 	struct forward_path *path = &info->path[info->upd_index];
 
 	/* Forward component allows only one receiving port. */
 	if ((component->wk_type == SPPWK_TYPE_FWD) &&
-			unlikely(num_rx > 1)) {
+			unlikely(nof_rx > 1)) {
 		RTE_LOG(ERR, FORWARD,
 			"Component[%d] Setting error. (type = %d, rx = %d)\n",
-			component->component_id, component->wk_type, num_rx);
+			component->comp_id, component->wk_type, nof_rx);
 		return SPP_RET_NG;
 	}
 
 	/* Component allows only one transmit port. */
-	if (unlikely(num_tx != 0) && unlikely(num_tx != 1)) {
+	if (unlikely(nof_tx != 0) && unlikely(nof_tx != 1)) {
 		RTE_LOG(ERR, FORWARD,
 			"Component[%d] Setting error. (type = %d, tx = %d)\n",
-			component->component_id, component->wk_type, num_tx);
+			component->comp_id, component->wk_type, nof_tx);
 		return SPP_RET_NG;
 	}
 
@@ -82,19 +82,19 @@ spp_forward_update(struct spp_component_info *component)
 	RTE_LOG(INFO, FORWARD,
 			"Component[%d] Start update component. "
 			"(name = %s, type = %d)\n",
-			component->component_id,
+			component->comp_id,
 			component->name,
 			component->wk_type);
 
 	memcpy(&path->name, component->name, SPP_NAME_STR_LEN);
 	path->wk_type = component->wk_type;
-	path->num_rx = component->num_rx_port;
-	path->num_tx = component->num_tx_port;
-	for (cnt = 0; cnt < num_rx; cnt++)
+	path->num_rx = component->nof_rx;
+	path->num_tx = component->nof_tx;
+	for (cnt = 0; cnt < nof_rx; cnt++)
 		memcpy(&path->ports[cnt].rx, component->rx_ports[cnt],
 				sizeof(struct sppwk_port_info));
 
-	/* Transmit port is set according with larger num_rx / num_tx. */
+	/* Transmit port is set according with larger nof_rx / nof_tx. */
 	for (cnt = 0; cnt < max; cnt++)
 		memcpy(&path->ports[cnt].tx, component->tx_ports[0],
 				sizeof(struct sppwk_port_info));
@@ -106,7 +106,7 @@ spp_forward_update(struct spp_component_info *component)
 	RTE_LOG(INFO, FORWARD,
 			"Component[%d] Complete update component. "
 			"(name = %s, type = %d)\n",
-			component->component_id,
+			component->comp_id,
 			component->name,
 			component->wk_type);
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index deb5c7e..ec2292c 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -25,7 +25,7 @@ static struct startup_param g_startup_param;
 static struct iface_info g_iface_info;
 
 /* Component management information */
-static struct spp_component_info g_component_info[RTE_MAX_LCORE];
+static struct sppwk_comp_info g_component_info[RTE_MAX_LCORE];
 
 /* Core management information */
 static struct core_mng_info g_core_info[RTE_MAX_LCORE];
-- 
2.17.1


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

* [spp] [PATCH 2/2] shared/sec: rename enum spp_core_status
  2019-05-31  3:37 [spp] [PATCH 0/2] Rename struct of component ogawa.yasufumi
  2019-05-31  3:37 ` [spp] [PATCH 1/2] shared/sec: rename struct spp_component_info ogawa.yasufumi
@ 2019-05-31  3:37 ` ogawa.yasufumi
  1 sibling, 0 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:37 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename enum `spp_core_status` to
`sppwk_lcore_status` to be more specific.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/mirror/spp_mirror.c                        |  2 +-
 src/shared/secondary/spp_worker_th/cmd_utils.c | 10 +++++-----
 src/shared/secondary/spp_worker_th/cmd_utils.h | 12 ++++++------
 src/vf/spp_vf.c                                |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 5c82e2b..d5abf7b 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -517,7 +517,7 @@ slave_main(void *arg __attribute__ ((unused)))
 	int ret = SPP_RET_OK;
 	int cnt = 0;
 	unsigned int lcore_id = rte_lcore_id();
-	enum spp_core_status status = SPP_CORE_STOP;
+	enum sppwk_lcore_status status = SPP_CORE_STOP;
 	struct core_mng_info *info = &g_core_info[lcore_id];
 	struct core_info *core = get_core_info(lcore_id);
 
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.c b/src/shared/secondary/spp_worker_th/cmd_utils.c
index cacb565..07d6a2a 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.c
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.c
@@ -189,7 +189,7 @@ spp_vf_add_vhost_pmd(int index, int client)
 }
 
 /* Get core status */
-enum spp_core_status
+enum sppwk_lcore_status
 spp_get_core_status(unsigned int lcore_id)
 {
 	return (g_mng_data.p_core_info + lcore_id)->status;
@@ -202,7 +202,7 @@ spp_get_core_status(unsigned int lcore_id)
  * If core is in use, status will be checked.
  */
 static int
-check_core_status(enum spp_core_status status)
+check_core_status(enum sppwk_lcore_status status)
 {
 	unsigned int lcore_id = 0;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
@@ -216,7 +216,7 @@ check_core_status(enum spp_core_status status)
 }
 
 int
-check_core_status_wait(enum spp_core_status status)
+check_core_status_wait(enum sppwk_lcore_status status)
 {
 	int cnt = 0;
 	for (cnt = 0; cnt < SPP_CORE_STATUS_CHECK_MAX; cnt++) {
@@ -233,14 +233,14 @@ check_core_status_wait(enum spp_core_status status)
 /* Set core status */
 void
 set_core_status(unsigned int lcore_id,
-		enum spp_core_status status)
+		enum sppwk_lcore_status status)
 {
 	(g_mng_data.p_core_info + lcore_id)->status = status;
 }
 
 /* Set all core to given status */
 void
-set_all_core_status(enum spp_core_status status)
+set_all_core_status(enum sppwk_lcore_status status)
 {
 	unsigned int lcore_id = 0;
 	RTE_LCORE_FOREACH_SLAVE(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 9b01ff9..b1febe9 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -77,7 +77,7 @@
 #define CORE_TYPE_MIRROR_STR	     "mirror"
 
 /* State on component */
-enum spp_core_status {
+enum sppwk_lcore_status {
 	SPP_CORE_UNUSE,        /**< Not used */
 	SPP_CORE_STOP,         /**< Stopped */
 	SPP_CORE_IDLE,         /**< Idling */
@@ -248,7 +248,7 @@ struct core_info {
 /* Manage core status and component information as global variable */
 struct core_mng_info {
 	/* Status of cpu core */
-	volatile enum spp_core_status status;
+	volatile enum sppwk_lcore_status status;
 
 	/* Index number of core information for reference */
 	volatile int ref_index;
@@ -374,7 +374,7 @@ int spp_vf_add_vhost_pmd(int index, int client);
  * @return
  *  Status of specified logical core.
  */
-enum spp_core_status spp_get_core_status(unsigned int lcore_id);
+enum sppwk_lcore_status spp_get_core_status(unsigned int lcore_id);
 
 /**
  * Get component type of target component_info
@@ -397,7 +397,7 @@ enum sppwk_worker_type spp_get_component_type(int id);
  * @retval 0  succeeded.
  * @retval -1 failed.
  */
-int check_core_status_wait(enum spp_core_status status);
+int check_core_status_wait(enum sppwk_lcore_status status);
 
 /**
  * Set core status
@@ -408,7 +408,7 @@ int check_core_status_wait(enum spp_core_status status);
  *  set status.
  *
  */
-void set_core_status(unsigned int lcore_id, enum spp_core_status status);
+void set_core_status(unsigned int lcore_id, enum sppwk_lcore_status status);
 
 /**
  * Set all core status to given
@@ -417,7 +417,7 @@ void set_core_status(unsigned int lcore_id, enum spp_core_status status);
  *  set status.
  *
  */
-void set_all_core_status(enum spp_core_status status);
+void set_all_core_status(enum sppwk_lcore_status status);
 
 /**
  * Set all of component status to SPP_CORE_STOP_REQUEST if received signal
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index ec2292c..94da67a 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -190,7 +190,7 @@ slave_main(void *arg __attribute__ ((unused)))
 	int ret = 0;
 	int cnt = 0;
 	unsigned int lcore_id = rte_lcore_id();
-	enum spp_core_status status = SPP_CORE_STOP;
+	enum sppwk_lcore_status status = SPP_CORE_STOP;
 	struct core_mng_info *info = &g_core_info[lcore_id];
 	struct core_info *core = get_core_info(lcore_id);
 
-- 
2.17.1


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  3:37 [spp] [PATCH 0/2] Rename struct of component ogawa.yasufumi
2019-05-31  3:37 ` [spp] [PATCH 1/2] shared/sec: rename struct spp_component_info ogawa.yasufumi
2019-05-31  3:37 ` [spp] [PATCH 2/2] shared/sec: rename enum spp_core_status 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