[spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule

x-fn-spp at sl.ntt-tx.co.jp x-fn-spp at sl.ntt-tx.co.jp
Thu Feb 8 06:51:46 CET 2018


From: Kentaro Watanabe <watanabe.kentaro.z01 at as.ntt-tx.co.jp>

Hi, all

> Hi everyone,
> 
> As announced in DPDK Summit, we would like to introduce a SR-IOV like network 
> functionality to SPP on DPDK17.08[1].
<snip>
> Limitaion#1: vlan support is not yet, this feature is in still our backlogs.

Following patches enables spp_vf to support vlan feature.

On 2017/12/28 13:55, x-fn-spp at sl.ntt-tx.co.jp wrote:
> From: Hiroyuki Nakamura <nakamura.hioryuki at po.ntt-tx.co.jp>
> > Hi everyone,
> > This the first patch of series for spp_vf. Some of them might not comply
> with coding style for whitespace or indenting and I would like to send
> patches to fix it later.
> > I also would like to send another series of patches for documentation after
> you accept first series.

Above coding style violation is also fixed.

On 2018/02/08 1:50, Ferruh Yigit wrote:
> On 12/28/2017 4:55 AM, x-fn-spp at sl.ntt-tx.co.jp wrote:
>> From: Hiroyuki Nakamura <nakamura.hioryuki at po.ntt-tx.co.jp>
>>
<snip>
> > Hi Daiki, Yasufum,
> > This breaks the build with dpdk master because RTE_LOG_LEVEL removed in this
> release.

To support latest dpdk, "RTE_LOG_LEVEL" is removed.

Thanks,


* Fixed warnings etc. in checkpatch.sh of DPDK.
* Change tab to space except indent tab.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01 at as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki at lab.ntt.co.jp>
---
 src/vf/Makefile           |   2 +-
 src/vf/classifier_mac.c   | 267 ++++++++++++++++++++++++++++------------------
 src/vf/command_conn.c     |  26 ++---
 src/vf/command_conn.h     |   8 +-
 src/vf/command_dec.c      | 189 ++++++++++++++++++++------------
 src/vf/command_dec.h      |  12 ++-
 src/vf/command_proc.c     |  61 +++++++----
 src/vf/command_proc.h     |   4 +-
 src/vf/ringlatencystats.c |  37 ++++---
 src/vf/ringlatencystats.h |  11 +-
 src/vf/spp_forward.c      |  30 ++++--
 src/vf/spp_vf.c           | 239 +++++++++++++++++++++--------------------
 src/vf/spp_vf.h           |  36 +++----
 src/vf/string_buffer.c    |   4 +-
 src/vf/string_buffer.h    |  15 ++-
 15 files changed, 547 insertions(+), 394 deletions(-)

diff --git a/src/vf/Makefile b/src/vf/Makefile
index 503b50b..d54af25 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -33,7 +33,7 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
 
-# Default target, can be overriden by command line or environment
+# Default target, can be overridden by command line or environment
 include $(RTE_SDK)/mk/rte.vars.mk
 
 # binary name
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 760d597..939f8c9 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -38,24 +38,24 @@
 /* number of classifier information (reference/update) */
 #define NUM_CLASSIFIER_MAC_INFO 2
 
-/* interval that wait untill change update index
-		micro second */
+/* interval that wait until change update index (micro second) */
 #define CHANGE_UPDATE_INDEX_WAIT_INTERVAL SPP_CHANGE_UPDATE_INTERVAL
 
-/* interval that transmit burst packet, if buffer is not filled.
-		nano second */
+/* interval that transmit burst packet, if buffer is not filled (nano second) */
 #define DRAIN_TX_PACKET_INTERVAL 100
 
-/* hash table name buffer size
-	[reson for value]
-		in dpdk's lib/librte_hash/rte_cuckoo_hash.c
-			snprintf(ring_name, sizeof(ring_name), "HT_%s", params->name);
-			snprintf(hash_name, sizeof(hash_name), "HT_%s", params->name);
-		ring_name buffer size is RTE_RING_NAMESIZE
-		hash_name buffer size is RTE_HASH_NAMESIZE */
+/*
+ * hash table name buffer size
+ *[reson for value]
+ *	in dpdk's lib/librte_hash/rte_cuckoo_hash.c
+ *		snprintf(ring_name, sizeof(ring_name), "HT_%s", params->name);
+ *		snprintf(hash_name, sizeof(hash_name), "HT_%s", params->name);
+ *	ring_name buffer size is RTE_RING_NAMESIZE
+ *	hash_name buffer size is RTE_HASH_NAMESIZE
+ */
 static const size_t HASH_TABLE_NAME_BUF_SZ =
-		((RTE_HASH_NAMESIZE < RTE_RING_NAMESIZE) ? 
-		RTE_HASH_NAMESIZE: RTE_RING_NAMESIZE) - 3;
+		((RTE_HASH_NAMESIZE < RTE_RING_NAMESIZE) ?  RTE_HASH_NAMESIZE :
+		RTE_RING_NAMESIZE) - 3;
 
 /* mac address string(xx:xx:xx:xx:xx:xx) buffer size */
 static const size_t ETHER_ADDR_STR_BUF_SZ =
@@ -65,25 +65,50 @@ static const size_t ETHER_ADDR_STR_BUF_SZ =
 
 /* classified data (destination port, target packets, etc) */
 struct classified_data {
-	enum port_type  if_type;              /* interface type (see "enum port_type") */
-	int             if_no;                /* index of ports handled by classifier  */
-	int             if_no_global;         /* id for interface generated by spp_vf  */
-	uint16_t        port;                 /* port id generated by DPDK */
-	uint16_t        num_pkt;              /* the number of packets in pkts[]       */
-	struct rte_mbuf *pkts[MAX_PKT_BURST]; /* packet array to be classified         */
+	/* interface type (see "enum port_type") */
+	enum port_type  if_type;
+
+	/* index of ports handled by classifier */
+	int             if_no;
+
+	/* id for interface generated by spp_vf */
+	int             if_no_global;
+
+	/* port id generated by DPDK */
+	uint16_t        port;
+
+	/* the number of packets in pkts[] */
+	uint16_t        num_pkt;
+
+	/* packet array to be classified */
+	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
 /* classifier information */
 struct classifier_mac_info {
-	char name[SPP_NAME_STR_LEN];               /* component name                    */
-	struct rte_hash *classifier_table;         /* hash table keeps classifier_table */
-	int num_active_classified;                 /* number of valid classification    */
-	int active_classifieds[RTE_MAX_ETHPORTS];  /* index of valid classification     */
-	int default_classified;                    /* index of default classification   */
-	int n_classified_data_tx;                  /* number of transmission ports      */
-	struct classified_data classified_data_rx; /* recive port handled by classifier */
+	/* component name */
+	char name[SPP_NAME_STR_LEN];
+
+	/* hash table keeps classifier_table */
+	struct rte_hash *classifier_table;
+
+	/* number of valid classification */
+	int num_active_classified;
+
+	/* index of valid classification */
+	int active_classifieds[RTE_MAX_ETHPORTS];
+
+	/* index of default classification */
+	int default_classified;
+
+	/* number of transmission ports */
+	int n_classified_data_tx;
+
+	/* receive port handled by classifier */
+	struct classified_data classified_data_rx;
+
+	/* transmission ports handled by classifier */
 	struct classified_data classified_data_tx[RTE_MAX_ETHPORTS];
-						/* transmission ports handled by classifier */
 };
 
 /* classifier management information */
@@ -120,8 +145,10 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 	struct rte_hash **classifier_table = &classifier_info->classifier_table;
 	struct ether_addr eth_addr;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	struct classified_data *classified_data_rx = &classifier_info->classified_data_rx;
-	struct classified_data *classified_data_tx = classifier_info->classified_data_tx;
+	struct classified_data *classified_data_rx =
+			&classifier_info->classified_data_rx;
+	struct classified_data *classified_data_tx =
+			classifier_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
 
 	rte_hash_reset(*classifier_table);
@@ -135,10 +162,13 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 		classified_data_rx->port         = 0;
 		classified_data_rx->num_pkt      = 0;
 	} else {
-		classified_data_rx->if_type      = component_info->rx_ports[0]->if_type;
+		classified_data_rx->if_type      =
+				component_info->rx_ports[0]->if_type;
 		classified_data_rx->if_no        = 0;
-		classified_data_rx->if_no_global = component_info->rx_ports[0]->if_no;
-		classified_data_rx->port         = component_info->rx_ports[0]->dpdk_port;
+		classified_data_rx->if_no_global =
+				component_info->rx_ports[0]->if_no;
+		classified_data_rx->port         =
+				component_info->rx_ports[0]->dpdk_port;
 		classified_data_rx->num_pkt      = 0;
 	}
 
@@ -152,9 +182,8 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 		classified_data_tx[i].port         = tx_port->dpdk_port;
 		classified_data_tx[i].num_pkt      = 0;
 
-		if (component_info->tx_ports[i]->mac_addr == 0) {
+		if (component_info->tx_ports[i]->mac_addr == 0)
 			continue;
-		}
 
 		/* store active tx_port that associate with mac address */
 		classifier_info->active_classifieds[classifier_info->
@@ -174,14 +203,16 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 
 		/* add entry to classifier mac table */
 		rte_memcpy(&eth_addr, &tx_port->mac_addr, ETHER_ADDR_LEN);
-		ether_format_addr(mac_addr_str, sizeof(mac_addr_str), &eth_addr);
+		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
+				&eth_addr);
 
 		ret = rte_hash_add_key_data(*classifier_table,
-				(void*)&eth_addr, (void*)(long)i);
+				(void *)&eth_addr, (void *)(long)i);
 		if (unlikely(ret < 0)) {
 			RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 					"Cannot add entry to classifier mac table. "
-					"ret=%d, mac_addr=%s\n", ret, mac_addr_str);
+					"ret=%d, mac_addr=%s\n",
+					ret, mac_addr_str);
 			rte_hash_free(*classifier_table);
 			*classifier_table = NULL;
 			return -1;
@@ -189,9 +220,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 
 		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. "
 				"mac_addr=%s, if_type=%d, if_no=%d, dpdk_port=%d\n",
-				mac_addr_str, 
-				tx_port->if_type, 
-				tx_port->if_no, 
+				mac_addr_str,
+				tx_port->if_type,
+				tx_port->if_no,
 				tx_port->dpdk_port);
 	}
 
@@ -221,18 +252,21 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	memset(&component_info, 0x00, sizeof(component_info));
 
 #ifdef RTE_MACHINE_CPUFLAG_SSE4_2
-	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Enabled SSE4.2. use crc hash.\n");
+	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Enabled SSE4.2. use CRC hash.\n");
 #else
-	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Disabled SSE4.2. use jenkins hash.\n");
+	RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC, "Disabled SSE4.2. use Jenkins hash.\n");
 #endif
 
 	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
 
-		classifier_mac_table = &classifier_mng_info->info[i].classifier_table;
+		classifier_mac_table =
+				&classifier_mng_info->info[i].classifier_table;
 
 		/* make hash table name(require uniqueness between processes) */
 		sprintf(hash_table_name, "cmtab_%07x%02hx%x",
-				getpid(), rte_atomic16_add_return(&g_hash_table_count, 1), i);
+				getpid(),
+				rte_atomic16_add_return(&g_hash_table_count, 1),
+				i);
 
 		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
 				hash_table_name, HASH_TABLE_NAME_BUF_SZ);
@@ -261,7 +295,8 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 			info[classifier_mng_info->ref_index], &component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-				"Cannot initialize classifer mac table. ret=%d\n", ret);
+				"Cannot initialize classifier mac table. ret=%d\n",
+				ret);
 		return -1;
 	}
 
@@ -278,8 +313,9 @@ uninit_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	int i;
 
 	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
-		if (classifier_mng_info->info[i].classifier_table != NULL){
-			rte_hash_free(classifier_mng_info->info[i].classifier_table);
+		if (classifier_mng_info->info[i].classifier_table != NULL) {
+			rte_hash_free(classifier_mng_info->info[i].
+					classifier_table);
 			classifier_mng_info->info[i].classifier_table = NULL;
 			classifier_mng_info->ref_index = 0;
 			classifier_mng_info->upd_index = 0;
@@ -298,14 +334,15 @@ transmit_packet(struct classified_data *classified_data)
 	if (classified_data->if_type == RING)
 		/* if tx-if is ring, set ringlatencystats */
 		spp_ringlatencystats_add_time_stamp(classified_data->if_no,
-				classified_data->pkts, classified_data->num_pkt);
+				classified_data->pkts,
+				classified_data->num_pkt);
 #endif
 
 	/* transmit packets */
 	n_tx = rte_eth_tx_burst(classified_data->port, 0,
 			classified_data->pkts, classified_data->num_pkt);
 
-	/* free cannnot transmit packets */
+	/* free cannot transmit packets */
 	if (unlikely(n_tx != classified_data->num_pkt)) {
 		for (i = n_tx; i < classified_data->num_pkt; i++)
 			rte_pktmbuf_free(classified_data->pkts[i]);
@@ -323,12 +360,13 @@ static inline void
 transmit_all_packet(struct classifier_mac_info *classifier_info)
 {
 	int i;
-	struct classified_data *classified_data_tx = classifier_info->classified_data_tx;
+	struct classified_data *classified_data_tx =
+				classifier_info->classified_data_tx;
 
 	for (i = 0; i < classifier_info->n_classified_data_tx; i++) {
 		if (unlikely(classified_data_tx[i].num_pkt != 0)) {
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
-					"transimit all packets (drain). "
+					"transmit all packets (drain). "
 					"index=%d, "
 					"num_pkt=%hu\n",
 					i,
@@ -338,8 +376,7 @@ transmit_all_packet(struct classifier_mac_info *classifier_info)
 	}
 }
 
-/* set mbuf pointer to tx buffer
-	and transmit packet, if buffer is filled */
+/* set mbuf pointer to tx buffer and transmit packet, if buffer is filled */
 static inline void
 push_packet(struct rte_mbuf *pkt, struct classified_data *classified_data)
 {
@@ -348,7 +385,7 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *classified_data)
 	/* transmit packet, if buffer is filled */
 	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-				"transimit packets (buffer is filled). "
+				"transmit packets (buffer is filled). "
 				"if_type=%d, if_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
 				classified_data->if_type,
 				classified_data->if_no_global,
@@ -368,24 +405,27 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
 	int i;
 
 	if (unlikely(classifier_info->num_active_classified == 0)) {
-		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "No mac address.(l2multicast packet)\n");
+		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "No mac address.(l2 multicast packet)\n");
 		rte_pktmbuf_free(pkt);
 		return;
 	}
 
-	rte_mbuf_refcnt_update(pkt, (classifier_info->num_active_classified - 1));
+	rte_mbuf_refcnt_update(pkt,
+			(classifier_info->num_active_classified - 1));
 
-	for (i= 0; i < classifier_info->num_active_classified; i++) {
-		push_packet(pkt, classified_data + 
+	for (i = 0; i < classifier_info->num_active_classified; i++) {
+		push_packet(pkt, classified_data +
 				(long)classifier_info->active_classifieds[i]);
 	}
 }
 
-/* classify packet by destination mac address,
-		and transmit packet (conditional). */
+/*
+ * classify packet by destination mac address,
+ * and transmit packet (conditional).
+ */
 static inline void
 classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
-		struct classifier_mac_info *classifier_info, 
+		struct classifier_mac_info *classifier_info,
 		struct classified_data *classified_data)
 {
 	int ret;
@@ -399,21 +439,24 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 
 		/* find in table (by destination mac address)*/
 		ret = rte_hash_lookup_data(classifier_info->classifier_table,
-				(const void*)&eth->d_addr, &lookup_data);
+				(const void *)&eth->d_addr, &lookup_data);
 		if (ret < 0) {
 			/* L2 multicast(include broadcast) ? */
 			if (unlikely(is_multicast_ether_addr(&eth->d_addr))) {
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 						"multicast mac address.\n");
 				handle_l2multicast_packet(rx_pkts[i],
-						classifier_info, classified_data);
+						classifier_info,
+						classified_data);
 				continue;
 			}
 
 			/* if no default, drop packet */
-			if (unlikely(classifier_info->default_classified == -1)) {
+			if (unlikely(classifier_info->default_classified ==
+					-1)) {
 				ether_format_addr(mac_addr_str,
-						sizeof(mac_addr_str), &eth->d_addr);
+						sizeof(mac_addr_str),
+						&eth->d_addr);
 				RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 						"unknown mac address. "
 						"ret=%d, mac_addr=%s\n",
@@ -422,14 +465,17 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 				continue;
 			}
 
-			/* to default classifed */
+			/* to default classified */
 			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 					"to default classified.\n");
-			lookup_data = (void *)(long)classifier_info->default_classified;
+			lookup_data = (void *)(long)classifier_info->
+					default_classified;
 		}
 
-		/* set mbuf pointer to tx buffer
-			and transmit packet, if buffer is filled */
+		/*
+		 * set mbuf pointer to tx buffer
+		 * and transmit packet, if buffer is filled
+		 */
 		push_packet(rx_pkts[i], classified_data + (long)lookup_data);
 	}
 }
@@ -438,7 +484,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 static inline void
 change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 {
-	if (unlikely(classifier_mng_info->ref_index == 
+	if (unlikely(classifier_mng_info->ref_index ==
 			classifier_mng_info->upd_index)) {
 
 		/* Transmit all packets for switching the using data. */
@@ -448,7 +494,7 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"Core[%u] Change update index.\n", id);
 		classifier_mng_info->ref_index =
-				(classifier_mng_info->upd_index + 1) % 
+				(classifier_mng_info->upd_index + 1) %
 				NUM_CLASSIFIER_MAC_INFO;
 	}
 }
@@ -477,16 +523,18 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 			"Component[%u] Start update component.\n", id);
 
 	/* wait until no longer access the new update side */
-	while(likely(classifier_mng_info->ref_index == classifier_mng_info->upd_index))
+	while (likely(classifier_mng_info->ref_index ==
+			classifier_mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
-	classifier_info = classifier_mng_info->info + classifier_mng_info->upd_index;
+	classifier_info = classifier_mng_info->info +
+				classifier_mng_info->upd_index;
 
 	/* initialize update side classifier information */
 	ret = init_classifier_info(classifier_info, component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-				"Cannot update classifer mac. ret=%d\n", ret);
+				"Cannot update classifier mac. ret=%d\n", ret);
 		return ret;
 	}
 	memcpy(classifier_info->name, component_info->name, SPP_NAME_STR_LEN);
@@ -495,7 +543,8 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 	classifier_mng_info->upd_index = classifier_mng_info->ref_index;
 
 	/* wait until no longer access the new update side */
-	while(likely(classifier_mng_info->ref_index == classifier_mng_info->upd_index))
+	while (likely(classifier_mng_info->ref_index ==
+			classifier_mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
@@ -530,13 +579,13 @@ spp_classifier_mac_do(int id)
 	if (unlikely(ret != 0))
 		return ret;
 
-	while(likely(spp_get_core_status(lcore_id) == SPP_CORE_FORWARD) &&
+	while (likely(spp_get_core_status(lcore_id) == SPP_CORE_FORWARD) &&
 			likely(spp_check_core_index(lcore_id) == 0)) {
 		/* change index of update side */
 		change_update_index(classifier_mng_info, id);
 
-		/* decide classifier infomation of the current cycle */
-		classifier_info = classifier_mng_info->info + 
+		/* decide classifier information of the current cycle */
+		classifier_info = classifier_mng_info->info +
 				classifier_mng_info->ref_index;
 		classified_data_rx = &classifier_info->classified_data_rx;
 		classified_data_tx = classifier_info->classified_data_tx;
@@ -544,18 +593,20 @@ spp_classifier_mac_do(int id)
 		/* drain tx packets, if buffer is not filled for interval */
 		cur_tsc = rte_rdtsc();
 		if (unlikely(cur_tsc - prev_tsc > drain_tsc)) {
-			for (i = 0; i < classifier_info->n_classified_data_tx; i++) {
-				if (unlikely(classified_data_tx[i].num_pkt != 0)) {
-					RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-							"transimit packets (drain). "
-							"index=%d, "
-							"num_pkt=%hu, "
-							"interval=%lu\n",
-							i,
-							classified_data_tx[i].num_pkt,
-							cur_tsc - prev_tsc);
-					transmit_packet(&classified_data_tx[i]);
-				}
+			for (i = 0; i < classifier_info->n_classified_data_tx;
+					i++) {
+				if (likely(classified_data_tx[i].num_pkt == 0))
+					continue;
+
+				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
+						"transmit packets (drain). "
+						"index=%d, "
+						"num_pkt=%hu, "
+						"interval=%lu\n",
+						i,
+						classified_data_tx[i].num_pkt,
+						cur_tsc - prev_tsc);
+				transmit_packet(&classified_data_tx[i]);
 			}
 			prev_tsc = cur_tsc;
 		}
@@ -572,11 +623,13 @@ spp_classifier_mac_do(int id)
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 		if (classified_data_rx->if_type == RING)
 			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->if_no, rx_pkts, n_rx);
+					classified_data_rx->if_no,
+					rx_pkts, n_rx);
 #endif
 
 		/* classify and transmit (filled) */
-		classify_packet(rx_pkts, n_rx, classifier_info, classified_data_tx);
+		classify_packet(rx_pkts, n_rx, classifier_info,
+				classified_data_tx);
 	}
 
 	/* just in case */
@@ -603,14 +656,14 @@ spp_classifier_get_component_status(
 	struct spp_port_index tx_ports[RTE_MAX_ETHPORTS];
 
 	classifier_mng_info = g_classifier_mng_info + id;
-	if (! is_used_mng_info(classifier_mng_info)) {
+	if (!is_used_mng_info(classifier_mng_info)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Component[%d] Not used. (status)(core = %d, type = %d)\n",
 				id, lcore_id, SPP_COMPONENT_CLASSIFIER_MAC);
 		return -1;
 	}
 
-	classifier_info = classifier_mng_info->info + 
+	classifier_info = classifier_mng_info->info +
 			classifier_mng_info->ref_index;
 
 	classified_data = classifier_info->classified_data_tx;
@@ -618,8 +671,10 @@ spp_classifier_get_component_status(
 	memset(rx_ports, 0x00, sizeof(rx_ports));
 	if (classifier_info->classified_data_rx.if_type != UNDEF) {
 		num_rx = 1;
-		rx_ports[0].if_type = classifier_info->classified_data_rx.if_type;
-		rx_ports[0].if_no   = classifier_info->classified_data_rx.if_no_global;
+		rx_ports[0].if_type = classifier_info->
+				classified_data_rx.if_type;
+		rx_ports[0].if_no   = classifier_info->
+				classified_data_rx.if_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
@@ -657,10 +712,10 @@ spp_classifier_mac_iterate_table(
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		classifier_mng_info = g_classifier_mng_info + i;
-		if (! is_used_mng_info(classifier_mng_info))
+		if (!is_used_mng_info(classifier_mng_info))
 			continue;
 
-		classifier_info = classifier_mng_info->info + 
+		classifier_info = classifier_mng_info->info +
 				classifier_mng_info->ref_index;
 
 		classified_data = classifier_info->classified_data_tx;
@@ -669,8 +724,12 @@ spp_classifier_mac_iterate_table(
 			"Core[%u] Start iterate classifier table.\n", i);
 
 		if (classifier_info->default_classified >= 0) {
-			port.if_type = (classified_data + classifier_info->default_classified)->if_type;
-			port.if_no   = (classified_data + classifier_info->default_classified)->if_no_global;
+			port.if_type = (classified_data +
+					classifier_info->default_classified)->
+					if_type;
+			port.if_no   = (classified_data +
+					classifier_info->default_classified)->
+					if_no_global;
 
 			(*params->element_proc)(
 					params,
@@ -680,8 +739,9 @@ spp_classifier_mac_iterate_table(
 		}
 
 		next = 0;
-		while(1) {
-			ret = rte_hash_iterate(classifier_info->classifier_table,
+		while (1) {
+			ret = rte_hash_iterate(
+					classifier_info->classifier_table,
 					&key, &data, &next);
 
 			if (unlikely(ret < 0))
@@ -691,7 +751,8 @@ spp_classifier_mac_iterate_table(
 					(const struct ether_addr *)key);
 
 			port.if_type = (classified_data + (long)data)->if_type;
-			port.if_no   = (classified_data + (long)data)->if_no_global;
+			port.if_no   = (classified_data + (long)data)->
+					if_no_global;
 
 			(*params->element_proc)(
 					params,
diff --git a/src/vf/command_conn.c b/src/vf/command_conn.c
index f3aa76f..9d4659b 100644
--- a/src/vf/command_conn.c
+++ b/src/vf/command_conn.c
@@ -16,11 +16,11 @@
 /* one receive message size */
 #define MESSAGE_BUFFER_BLOCK_SIZE 2048
 
-/* controller's ip address */
+/* controller's IP address */
 static char g_controller_ip[128] = "";
 
 /* controller's port number */
-static int g_controller_port = 0;
+static int g_controller_port;
 
 /* initialize command connection */
 int
@@ -40,15 +40,15 @@ spp_connect_to_controller(int *sock)
 	int ret = -1;
 	int sock_flg = 0;
 
-	if (likely(*sock >=0))
+	if (likely(*sock >= 0))
 		return 0;
 
 	/* create socket */
 	RTE_LOG(INFO, SPP_COMMAND_PROC, "Creating socket...\n");
 	*sock = socket(AF_INET, SOCK_STREAM, 0);
 	if (unlikely(*sock < 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, 
-				"Cannot create tcp socket. errno=%d\n", errno);
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Cannot create TCP socket. errno=%d\n", errno);
 		return SPP_CONNERR_TEMPORARY;
 	}
 
@@ -58,12 +58,14 @@ spp_connect_to_controller(int *sock)
 	controller_addr.sin_port = htons(g_controller_port);
 
 	/* connect to */
-	RTE_LOG(INFO, SPP_COMMAND_PROC, "Trying to connect ... socket=%d\n", *sock);
+	RTE_LOG(INFO, SPP_COMMAND_PROC, "Trying to connect ... socket=%d\n",
+			*sock);
 	ret = connect(*sock, (struct sockaddr *)&controller_addr,
 			sizeof(controller_addr));
 	if (unlikely(ret < 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
-				"Cannot connect to controller. errno=%d\n", errno);
+				"Cannot connect to controller. errno=%d\n",
+				errno);
 		close(*sock);
 		*sock = -1;
 		return SPP_CONNERR_TEMPORARY;
@@ -94,12 +96,12 @@ spp_receive_message(int *sock, char **strbuf)
 		if (likely(ret == 0)) {
 			RTE_LOG(INFO, SPP_COMMAND_PROC,
 					"Controller has performed an shutdown.");
-		} else if (likely(errno == EAGAIN || errno == EWOULDBLOCK)) {
-			/* no receive message */
-			return 0;
-		} else {
+		} else if (unlikely(errno != EAGAIN && errno != EWOULDBLOCK)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Receive failure. errno=%d\n", errno);
+		} else {
+			/* no receive message */
+			return 0;
 		}
 
 		RTE_LOG(INFO, SPP_COMMAND_PROC, "Assume Server closed connection.\n");
@@ -125,7 +127,7 @@ spp_receive_message(int *sock, char **strbuf)
 
 /* send message */
 int
-spp_send_message(int *sock, const char* message, size_t message_len)
+spp_send_message(int *sock, const char *message, size_t message_len)
 {
 	int ret = -1;
 
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index d414ec6..8f3b9cf 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -3,11 +3,11 @@
 
 /** result code - temporary error. please retry */
 #define SPP_CONNERR_TEMPORARY -1
-/** result code - fatal error occurred. should teminate process. */
+/** result code - fatal error occurred. should terminate process. */
 #define SPP_CONNERR_FATAL     -2
 
 /**
- * intialize command connection.
+ * initialize command connection.
  *
  * @param controller_ip
  *  controller listen ip address.
@@ -44,7 +44,7 @@ int spp_connect_to_controller(int *sock);
  * @retval 0 <                   succeeded. number of bytes received.
  * @retval 0                     no receive message.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect.
- * @retval SPP_CONNERR_FATAL     fatal error occurred. should teminate process.
+ * @retval SPP_CONNERR_FATAL     fatal error occurred. should terminate process.
  */
 int spp_receive_message(int *sock, char **msgbuf);
 
@@ -65,6 +65,6 @@ int spp_receive_message(int *sock, char **msgbuf);
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect.
  */
-int spp_send_message(int *sock, const char* message, size_t message_len);
+int spp_send_message(int *sock, const char *message, size_t message_len);
 
 #endif /* _COMMAND_CONN_H_ */
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 9576c6f..8e82f1f 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -9,18 +9,22 @@
 
 #define RTE_LOGTYPE_SPP_COMMAND_PROC RTE_LOGTYPE_USER1
 
-/* classifier type string list
-	do it same as the order of enum spp_classifier_type (spp_vf.h) */
-static const char *CLASSIFILER_TYPE_STRINGS[] = {
+/*
+ * classifier type string list
+ * do it same as the order of enum spp_classifier_type (spp_vf.h)
+ */
+const char *CLASSIFILER_TYPE_STRINGS[] = {
 	"none",
 	"mac",
 
 	/* termination */ "",
 };
 
-/* command action type string list
-	do it same as the order of enum spp_command_action (spp_vf.h) */
-static const char *COMMAND_ACTION_STRINGS[] = {
+/*
+ * command action type string list
+ * do it same as the order of enum spp_command_action (spp_vf.h)
+ */
+const char *COMMAND_ACTION_STRINGS[] = {
 	"none",
 	"start",
 	"stop",
@@ -30,9 +34,11 @@ static const char *COMMAND_ACTION_STRINGS[] = {
 	/* termination */ "",
 };
 
-/* port rxtx string list
-	do it same as the order of enum spp_port_rxtx (spp_vf.h) */
-static const char *PORT_RXTX_STRINGS[] = {
+/*
+ * port rxtx string list
+ * do it same as the order of enum spp_port_rxtx (spp_vf.h)
+ */
+const char *PORT_RXTX_STRINGS[] = {
 	"none",
 	"rx",
 	"tx",
@@ -56,7 +62,7 @@ set_decode_error(struct spp_command_decode_error *error,
 /* set decode error */
 inline int
 set_string_value_decode_error(struct spp_command_decode_error *error,
-		const char* value, const char *error_name)
+		const char *value, const char *error_name)
 {
 	strcpy(error->value, value);
 	return set_decode_error(error, SPP_CMD_DERR_BAD_VALUE, error_name);
@@ -72,7 +78,7 @@ decode_parameter_value(char *string, int max, int *argc, char *argv[])
 	char *saveptr = NULL;
 
 	argv_tok = strtok_r(string, delim, &saveptr);
-	while(argv_tok != NULL) {
+	while (argv_tok != NULL) {
 		if (cnt >= max)
 			return -1;
 		argv[cnt] = argv_tok;
@@ -98,7 +104,8 @@ get_arrary_index(const char *match, const char *list[])
 
 /* Get unsigned int type value */
 static int
-get_uint_value(	unsigned int *output,
+get_uint_value(
+		unsigned int *output,
 		const char *arg_val,
 		unsigned int min,
 		unsigned int max)
@@ -149,7 +156,8 @@ decode_core_value(void *output, const char *arg_val)
 	int ret = 0;
 	ret = get_uint_value(output, arg_val, 0, RTE_MAX_LCORE-1);
 	if (unlikely(ret < 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad core id. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad core id. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -163,12 +171,17 @@ decode_component_action_value(void *output, const char *arg_val)
 	int ret = 0;
 	ret = get_arrary_index(arg_val, COMMAND_ACTION_STRINGS);
 	if (unlikely(ret <= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown component action. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Unknown component action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
-	if (unlikely(ret != SPP_CMD_ACTION_START) && unlikely(ret != SPP_CMD_ACTION_STOP)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown component action. val=%s\n", arg_val);
+	if (unlikely(ret != SPP_CMD_ACTION_START) &&
+			unlikely(ret != SPP_CMD_ACTION_STOP)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Unknown component action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -248,12 +261,17 @@ decode_port_action_value(void *output, const char *arg_val)
 	int ret = 0;
 	ret = get_arrary_index(arg_val, COMMAND_ACTION_STRINGS);
 	if (unlikely(ret <= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Unknown port action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
-	if (unlikely(ret != SPP_CMD_ACTION_ADD) && unlikely(ret != SPP_CMD_ACTION_DEL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n", arg_val);
+	if (unlikely(ret != SPP_CMD_ACTION_ADD) &&
+			unlikely(ret != SPP_CMD_ACTION_DEL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Unknown port action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -274,9 +292,13 @@ decode_port_port_value(void *output, const char *arg_val)
 		return -1;
 
 	if ((port->action == SPP_CMD_ACTION_ADD) &&
-			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no, SPP_PORT_RXTX_RX) >= 0) &&
-			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no, SPP_PORT_RXTX_TX) >= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Port in used. (port command) val=%s\n", arg_val);
+			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+					SPP_PORT_RXTX_RX) >= 0) &&
+			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+					SPP_PORT_RXTX_TX) >= 0)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Port in used. (port command) val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -294,13 +316,17 @@ decode_port_rxtx_value(void *output, const char *arg_val)
 
 	ret = get_arrary_index(arg_val, PORT_RXTX_STRINGS);
 	if (unlikely(ret <= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port rxtx. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port rxtx. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
 	if ((port->action == SPP_CMD_ACTION_ADD) &&
-			(spp_check_used_port(port->port.if_type, port->port.if_no, ret) >= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Port in used. (port command) val=%s\n", arg_val);
+			(spp_check_used_port(port->port.if_type,
+					port->port.if_no, ret) >= 0)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Port in used. (port command) val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -353,12 +379,15 @@ decode_classifier_action_value(void *output, const char *arg_val)
 	int ret = 0;
 	ret = get_arrary_index(arg_val, COMMAND_ACTION_STRINGS);
 	if (unlikely(ret <= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
-	if (unlikely(ret != SPP_CMD_ACTION_ADD) && unlikely(ret != SPP_CMD_ACTION_DEL)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n", arg_val);
+	if (unlikely(ret != SPP_CMD_ACTION_ADD) &&
+			unlikely(ret != SPP_CMD_ACTION_DEL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown port action. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -373,7 +402,9 @@ decode_classifier_type_value(void *output, const char *arg_val)
 	int ret = 0;
 	ret = get_arrary_index(arg_val, CLASSIFILER_TYPE_STRINGS);
 	if (unlikely(ret <= 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown classifier type. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Unknown classifier type. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
@@ -387,12 +418,13 @@ decode_classifier_value_value(void *output, const char *arg_val)
 {
 	int ret = -1;
 	struct spp_command_classifier_table *classifier_table = output;
-	switch(classifier_table->type) {
-		case SPP_CLASSIFIER_TYPE_MAC:
-			ret = decode_mac_addr_str_value(classifier_table->value, arg_val);
-			break;
-		default:
-			break;
+	switch (classifier_table->type) {
+	case SPP_CLASSIFIER_TYPE_MAC:
+		ret = decode_mac_addr_str_value(classifier_table->value,
+				arg_val);
+		break;
+	default:
+		break;
 	}
 	return ret;
 }
@@ -411,12 +443,14 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		return -1;
 
 	if (spp_check_added_port(tmp_port.if_type, tmp_port.if_no) == 0) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Port not added. val=%s\n", arg_val);
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Port not added. val=%s\n",
+				arg_val);
 		return -1;
 	}
 
 	if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) {
-		if (!spp_check_mac_used_port(0, tmp_port.if_type, tmp_port.if_no)) {
+		if (!spp_check_mac_used_port(0, tmp_port.if_type,
+				tmp_port.if_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -427,7 +461,8 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		if (mac_addr < 0)
 			return -1;
 
-		if (!spp_check_mac_used_port((uint64_t)mac_addr, tmp_port.if_type, tmp_port.if_no)) {
+		if (!spp_check_mac_used_port((uint64_t)mac_addr,
+				tmp_port.if_type, tmp_port.if_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -454,22 +489,26 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 	{                                /* classifier_table */
 		{
 			.name = "action",
-			.offset = offsetof(struct spp_command, spec.classifier_table.action),
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.action),
 			.func = decode_classifier_action_value
 		},
 		{
 			.name = "type",
-			.offset = offsetof(struct spp_command, spec.classifier_table.type),
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.type),
 			.func = decode_classifier_type_value
 		},
 		{
 			.name = "value",
-			.offset = offsetof(struct spp_command, spec.classifier_table),
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table),
 			.func = decode_classifier_value_value
 		},
 		{
 			.name = "port",
-			.offset = offsetof(struct spp_command, spec.classifier_table),
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table),
 			.func = decode_classifier_port_value
 		},
 		DECODE_PARAMETER_LIST_EMPTY,
@@ -481,7 +520,8 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 	{                                /* component        */
 		{
 			.name = "action",
-			.offset = offsetof(struct spp_command, spec.component.action),
+			.offset = offsetof(struct spp_command,
+					spec.component.action),
 			.func = decode_component_action_value
 		},
 		{
@@ -504,7 +544,8 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 	{                                /* port             */
 		{
 			.name = "action",
-			.offset = offsetof(struct spp_command, spec.port.action),
+			.offset = offsetof(struct spp_command,
+					spec.port.action),
 			.func = decode_port_action_value
 		},
 		{
@@ -530,22 +571,25 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 
 /* check by list for each command line parameter */
 static int
-decode_comand_parameter_in_list(struct spp_command_request *request,
+decode_command_parameter_in_list(struct spp_command_request *request,
 				int argc, char *argv[],
 				struct spp_command_decode_error *error)
 {
 	int ret = 0;
 	int ci = request->commands[0].type;
 	int pi = 0;
-	static struct decode_parameter_list *list = NULL;
-	for(pi = 1; pi < argc; pi++) {
+	struct decode_parameter_list *list = NULL;
+	for (pi = 1; pi < argc; pi++) {
 		list = &parameter_list[ci][pi-1];
-		ret = (*list->func)((void *)((char*)&request->commands[0]+list->offset), argv[pi]);
+		ret = (*list->func)((void *)
+				((char *)&request->commands[0]+list->offset),
+				argv[pi]);
 		if (unlikely(ret < 0)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Bad value. command=%s, name=%s, index=%d, value=%s\n",
 					argv[0], list->name, pi, argv[pi]);
-			return set_string_value_decode_error(error, argv[pi], list->name);
+			return set_string_value_decode_error(error, argv[pi],
+					list->name);
 		}
 	}
 	return 0;
@@ -562,15 +606,18 @@ struct decode_command_list {
 
 /* command list */
 static struct decode_command_list command_list[] = {
-	{ "classifier_table", 5, 5, decode_comand_parameter_in_list }, /* classifier_table */
-	{ "flush",            1, 1, NULL },	/* flush            */
-	{ "_get_client_id",   1, 1, NULL },	/* _get_client_id   */
-	{ "status",           1, 1, NULL },	/* status           */
-	{ "exit",             1, 1, NULL },	/* exit             */
-	{ "component",        3, 5, decode_comand_parameter_in_list }, /* component        */
-	{ "port",             5, 5, decode_comand_parameter_in_list }, /* port             */
-	{ "cancel",           1, 1, NULL },	/* cancel           */
-	{ "",                 0, 0, NULL }	/* termination      */
+	{ "classifier_table", 5, 5, decode_command_parameter_in_list },
+						/* classifier_table */
+	{ "flush",            1, 1, NULL },     /* flush            */
+	{ "_get_client_id",   1, 1, NULL },     /* _get_client_id   */
+	{ "status",           1, 1, NULL },     /* status           */
+	{ "exit",             1, 1, NULL },     /* exit             */
+	{ "component",        3, 5, decode_command_parameter_in_list },
+						/* component        */
+	{ "port",             5, 5, decode_command_parameter_in_list },
+						/* port             */
+	{ "cancel",           1, 1, NULL },     /* cancel           */
+	{ "",                 0, 0, NULL }      /* termination      */
 };
 
 /* Decode command line parameters */
@@ -589,7 +636,8 @@ decode_command_in_list(struct spp_command_request *request,
 	memset(tmp_str, 0x00, sizeof(tmp_str));
 
 	strcpy(tmp_str, request_str);
-	ret = decode_parameter_value(tmp_str, SPP_CMD_MAX_PARAMETERS, &argc, argv);
+	ret = decode_parameter_value(tmp_str, SPP_CMD_MAX_PARAMETERS,
+			&argc, argv);
 	if (ret < 0) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC, "Parameter number over limit."
 				"request_str=%s\n", request_str);
@@ -599,14 +647,16 @@ decode_command_in_list(struct spp_command_request *request,
 
 	for (i = 0; command_list[i].name[0] != '\0'; i++) {
 		list = &command_list[i];
-		if (strcmp(argv[0], list->name) != 0) {
+		if (strcmp(argv[0], list->name) != 0)
 			continue;
-		}
 
-		if (unlikely(argc < list->param_min) || unlikely(list->param_max < argc)) {
-			RTE_LOG(ERR, SPP_COMMAND_PROC, "Parameter number out of range."
+		if (unlikely(argc < list->param_min) ||
+				unlikely(list->param_max < argc)) {
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Parameter number out of range."
 					"request_str=%s\n", request_str);
-			return set_decode_error(error, SPP_CMD_DERR_BAD_FORMAT, NULL);
+			return set_decode_error(error, SPP_CMD_DERR_BAD_FORMAT,
+					NULL);
 		}
 
 		request->commands[0].type = i;
@@ -616,15 +666,18 @@ decode_command_in_list(struct spp_command_request *request,
 		return 0;
 	}
 
-	RTE_LOG(ERR, SPP_COMMAND_PROC, "Unknown command. command=%s, request_str=%s\n",
+	RTE_LOG(ERR, SPP_COMMAND_PROC,
+			"Unknown command. command=%s, request_str=%s\n",
 			argv[0], request_str);
 	return set_string_value_decode_error(error, argv[0], "command");
 }
 
 /* decode request from no-null-terminated string */
 int
-spp_command_decode_request(struct spp_command_request *request, const char *request_str,
-		size_t request_str_len, struct spp_command_decode_error *error)
+spp_command_decode_request(
+		struct spp_command_request *request,
+		const char *request_str, size_t request_str_len,
+		struct spp_command_decode_error *error)
 {
 	int ret = -1;
 	int i;
@@ -634,7 +687,7 @@ spp_command_decode_request(struct spp_command_request *request, const char *requ
 	ret = decode_command_in_list(request, request_str, error);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC, "Cannot decode command request. "
-				"ret=%d, request_str=%.*s\n", 
+				"ret=%d, request_str=%.*s\n",
 				ret, (int)request_str_len, request_str);
 		return ret;
 	}
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 1ab2e43..7fc5f66 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,8 +1,6 @@
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
-//#include "spp_vf.h"
-
 /* max number of command per request */
 #define SPP_CMD_MAX_COMMANDS 32
 
@@ -20,7 +18,7 @@
 
 /* decode error code */
 enum spp_command_decode_error_code {
-	/* not use 0, in general 0 is ok */
+	/* not use 0, in general 0 is OK */
 	SPP_CMD_DERR_BAD_FORMAT = 1,
 	SPP_CMD_DERR_UNKNOWN_COMMAND,
 	SPP_CMD_DERR_NO_PARAM,
@@ -28,8 +26,12 @@ enum spp_command_decode_error_code {
 	SPP_CMD_DERR_BAD_VALUE,
 };
 
-/* command type
-	do it same as the order of COMMAND_TYPE_STRINGS */
+/**
+ * spp command type.
+ *
+ * @attention This enumerated type must have the same order of command_list
+ *            defined in command_dec.c
+*/
 enum spp_command_type {
 	SPP_CMDTYPE_CLASSIFIER_TABLE,
 	SPP_CMDTYPE_FLUSH,
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index a97b9af..b06ed27 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -172,7 +172,8 @@ execute_command(const struct spp_command *command)
 
 	switch (command->type) {
 	case SPP_CMDTYPE_CLASSIFIER_TABLE:
-		RTE_LOG(INFO, SPP_COMMAND_PROC, "Execute classifier_table command.\n");
+		RTE_LOG(INFO, SPP_COMMAND_PROC,
+				"Execute classifier_table command.\n");
 		ret = spp_update_classifier_table(
 				command->spec.classifier_table.action,
 				command->spec.classifier_table.type,
@@ -195,7 +196,8 @@ execute_command(const struct spp_command *command)
 		break;
 
 	case SPP_CMDTYPE_PORT:
-		RTE_LOG(INFO, SPP_COMMAND_PROC, "Execute port command. (act = %d)\n",
+		RTE_LOG(INFO, SPP_COMMAND_PROC,
+				"Execute port command. (act = %d)\n",
 				command->spec.port.action);
 		ret = spp_update_port(
 				command->spec.port.action,
@@ -210,7 +212,9 @@ execute_command(const struct spp_command *command)
 		break;
 
 	default:
-		RTE_LOG(INFO, SPP_COMMAND_PROC, "Execute other command. type=%d\n", command->type);
+		RTE_LOG(INFO, SPP_COMMAND_PROC,
+				"Execute other command. type=%d\n",
+				command->type);
 		/* nothing to do here */
 		break;
 	}
@@ -220,7 +224,9 @@ execute_command(const struct spp_command *command)
 
 /* make decode error message for response */
 static const char *
-make_decode_error_message(const struct spp_command_decode_error *decode_error, char *message)
+make_decode_error_message(
+		const struct spp_command_decode_error *decode_error,
+		char *message)
 {
 	switch (decode_error->code) {
 	case SPP_CMD_DERR_BAD_FORMAT:
@@ -232,11 +238,13 @@ make_decode_error_message(const struct spp_command_decode_error *decode_error, c
 		break;
 
 	case SPP_CMD_DERR_NO_PARAM:
-		sprintf(message, "not enough parameter(%s)", decode_error->value_name);
+		sprintf(message, "not enough parameter(%s)",
+				decode_error->value_name);
 		break;
 
 	case SPP_CMD_DERR_BAD_TYPE:
-		sprintf(message, "bad value type(%s)", decode_error->value_name);
+		sprintf(message, "bad value type(%s)",
+				decode_error->value_name);
 		break;
 
 	case SPP_CMD_DERR_BAD_VALUE:
@@ -272,7 +280,6 @@ set_command_results(struct command_result *result,
 		memset(result->error_message, 0x00, CMD_RES_ERR_MSG_SIZE);
 		break;
 	}
-	return;
 }
 
 /* set decode error to command result */
@@ -765,7 +772,8 @@ send_decode_error_response(int *sock, const struct spp_command_request *request,
 			request->num_command, command_results);
 	if (unlikely(ret < 0)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make command result response.\n");
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Failed to make command result response.\n");
 		return;
 	}
 
@@ -785,23 +793,25 @@ send_decode_error_response(int *sock, const struct spp_command_request *request,
 		return;
 	}
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "Make command response (decode error). "
+	RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+			"Make command response (decode error). "
 			"response_str=\n%s\n", msg);
 
 	/* send response to requester */
 	ret = spp_send_message(sock, msg, strlen(msg));
 	if (unlikely(ret != 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to send decode error response.\n");
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Failed to send decode error response.\n");
 		/* not return */
 	}
 
 	spp_strbuf_free(msg);
-	return;
 }
 
 /* send response for command execution result */
 static void
-send_command_result_response(int *sock, const struct spp_command_request *request,
+send_command_result_response(int *sock,
+		const struct spp_command_request *request,
 		struct command_result *command_results)
 {
 	int ret = -1;
@@ -818,7 +828,8 @@ send_command_result_response(int *sock, const struct spp_command_request *reques
 			request->num_command, command_results);
 	if (unlikely(ret < 0)) {
 		spp_strbuf_free(tmp_buff);
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make command result response.\n");
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"Failed to make command result response.\n");
 		return;
 	}
 
@@ -827,7 +838,8 @@ send_command_result_response(int *sock, const struct spp_command_request *reques
 		ret = append_client_id_value("client_id", &tmp_buff, NULL);
 		if (unlikely(ret < 0)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make client id response.\n");
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Failed to make client id response.\n");
 			return;
 		}
 	}
@@ -837,7 +849,8 @@ send_command_result_response(int *sock, const struct spp_command_request *reques
 		ret = append_info_value("info", &tmp_buff);
 		if (unlikely(ret < 0)) {
 			spp_strbuf_free(tmp_buff);
-			RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to make status response.\n");
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Failed to make status response.\n");
 			return;
 		}
 	}
@@ -858,18 +871,19 @@ send_command_result_response(int *sock, const struct spp_command_request *reques
 		return;
 	}
 
-	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "Make command response (command result). "
+	RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+			"Make command response (command result). "
 			"response_str=\n%s\n", msg);
 
 	/* send response to requester */
 	ret = spp_send_message(sock, msg, strlen(msg));
 	if (unlikely(ret != 0)) {
-		RTE_LOG(ERR, SPP_COMMAND_PROC, "Failed to send command result response.\n");
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+			"Failed to send command result response.\n");
 		/* not return */
 	}
 
 	spp_strbuf_free(msg);
-	return;
 }
 
 /* process command request from no-null-terminated string */
@@ -888,7 +902,8 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 	memset(command_results, 0, sizeof(command_results));
 
 	RTE_LOG(DEBUG, SPP_COMMAND_PROC, "Start command request processing. "
-			"request_str=\n%.*s\n", (int)request_str_len, request_str);
+			"request_str=\n%.*s\n",
+			(int)request_str_len, request_str);
 
 	/* decode request message */
 	ret = spp_command_decode_request(
@@ -898,7 +913,8 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 		set_decode_error_to_results(command_results, &request,
 				&decode_error);
 		send_decode_error_response(sock, &request, command_results);
-		RTE_LOG(DEBUG, SPP_COMMAND_PROC, "End command request processing.\n");
+		RTE_LOG(DEBUG, SPP_COMMAND_PROC,
+				"End command request processing.\n");
 		return 0;
 	}
 
@@ -927,7 +943,8 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 	if (request.is_requested_exit) {
 		/* Terminated by process exit command.                       */
 		/* Other route is normal end because it responds to command. */
-		RTE_LOG(INFO, SPP_COMMAND_PROC, "No response with process exit command.\n");
+		RTE_LOG(INFO, SPP_COMMAND_PROC,
+				"No response with process exit command.\n");
 		return -1;
 	}
 
@@ -954,7 +971,7 @@ spp_command_proc_do(void)
 	int msg_ret = -1;
 
 	static int sock = -1;
-	static char *msgbuf = NULL;
+	static char *msgbuf;
 
 	if (unlikely(msgbuf == NULL)) {
 		msgbuf = spp_strbuf_allocate(CMD_REQ_BUF_INIT_SIZE);
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 05cb1f1..6b88da7 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -2,10 +2,10 @@
 #define _COMMAND_PROC_H_
 
 /**
- * intialize command processor.
+ * initialize command processor.
  *
  * @param controller_ip
- *  controller listen ip address.
+ *  controller listen IP address.
  *
  * @param controller_port
  *  controller listen port number.
diff --git a/src/vf/ringlatencystats.c b/src/vf/ringlatencystats.c
index 32ff55c..a866485 100644
--- a/src/vf/ringlatencystats.c
+++ b/src/vf/ringlatencystats.c
@@ -20,19 +20,20 @@
 
 /** ring latency statistics information */
 struct ring_latency_stats_info {
-	uint64_t timer_tsc;   /**< sampling interval counter */
-	uint64_t prev_tsc;    /**< previous time */
-	struct spp_ringlatencystats_ring_latency_stats stats;  /**< ring latency statistics list */
+	uint64_t timer_tsc;     /**< sampling interval counter */
+	uint64_t prev_tsc;      /**< previous time */
+	struct spp_ringlatencystats_ring_latency_stats stats;
+				/**< ring latency statistics list */
 };
 
 /** sampling interval */
-static uint64_t g_samp_intvl = 0;
+static uint64_t g_samp_intvl;
 
 /** ring latency statistics information instance */
-static struct ring_latency_stats_info *g_stats_info = NULL;
+static struct ring_latency_stats_info *g_stats_info;
 
-/** number of ring latency statisics */
-static uint16_t g_stats_count = 0;
+/** number of ring latency statistics */
+static uint16_t g_stats_count;
 
 /* clock cycles per nano second */
 static inline uint64_t
@@ -44,10 +45,11 @@ cycles_per_ns(void)
 int
 spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count)
 {
-	/* allocate memory for ring latency statisics infromation */
+	/* allocate memory for ring latency statistics information */
 	g_stats_info = rte_zmalloc(
 			"global ring_latency_stats_info",
-			sizeof(struct ring_latency_stats_info) * stats_count, 0);
+			sizeof(struct ring_latency_stats_info) * stats_count,
+			0);
 	if (unlikely(g_stats_info == NULL)) {
 		RTE_LOG(ERR, SPP_RING_LATENCY_STATS,
 				"Cannot allocate memory for ring latency stats info\n");
@@ -60,7 +62,8 @@ spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count)
 
 	RTE_LOG(DEBUG, SPP_RING_LATENCY_STATS,
 			"g_samp_intvl=%lu, g_stats_count=%hu, cpns=%lu, NS_PER_SEC=%f\n",
-			g_samp_intvl, g_stats_count, cycles_per_ns(), NS_PER_SEC);
+			g_samp_intvl, g_stats_count,
+			cycles_per_ns(), NS_PER_SEC);
 
 	return 0;
 }
@@ -68,7 +71,7 @@ spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count)
 void
 spp_ringlatencystats_uninit(void)
 {
-	/* free memory for ring latency statisics infromation */
+	/* free memory for ring latency statistics information */
 	if (likely(g_stats_info != NULL)) {
 		rte_free(g_stats_info);
 		g_stats_count = 0;
@@ -96,12 +99,13 @@ spp_ringlatencystats_add_time_stamp(int ring_id,
 		/* set tsc to mbuf::timestamp */
 		if (unlikely(stats_info->timer_tsc >= g_samp_intvl)) {
 			RTE_LOG(DEBUG, SPP_RING_LATENCY_STATS,
-					"Set timestamp. ring_id=%d, pkts_index=%u, timestamp=%lu\n", ring_id, i, now);
+					"Set timestamp. ring_id=%d, pkts_index=%u, timestamp=%lu\n",
+					ring_id, i, now);
 			pkts[i]->timestamp = now;
 			stats_info->timer_tsc = 0;
 		}
 
-		/* update previus tsc */
+		/* update previous tsc */
 		stats_info->prev_tsc = now;
 	}
 }
@@ -122,11 +126,14 @@ spp_ringlatencystats_calculate_latency(int ring_id,
 
 		/* when mbuf::timestamp is not zero */
 		/* calculate latency */
-		latency = (uint64_t)floor((now - pkts[i]->timestamp) / cycles_per_ns());
+		latency = (uint64_t)floor((now - pkts[i]->timestamp) /
+				cycles_per_ns());
 		if (likely(latency < SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT-1))
 			stats_info->stats.slot[latency]++;
 		else
-			stats_info->stats.slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT-1]++;
+			stats_info->stats.slot[
+					SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT
+					-1]++;
 	}
 }
 
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index bc47699..2e64d63 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -8,13 +8,14 @@
 
 /** ring latency statistics */
 struct spp_ringlatencystats_ring_latency_stats {
-	uint64_t slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT]; /**< slots to save latency */
+	/**< slots to save latency */
+	uint64_t slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT];
 };
 
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 /**
- * initialize ring latency statisics.
+ * initialize ring latency statistics.
  *
  * @retval 0: succeeded.
  * @retval -1: failed.
@@ -22,7 +23,7 @@ struct spp_ringlatencystats_ring_latency_stats {
 int spp_ringlatencystats_init(uint64_t samp_intvl, uint16_t stats_count);
 
 /**
- *uninitialize ring latency statisics.
+ *uninitialize ring latency statistics.
  */
 void spp_ringlatencystats_uninit(void);
 
@@ -43,14 +44,14 @@ void spp_ringlatencystats_calculate_latency(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
 
 /**
- * get number of ring latency statisics.
+ * get number of ring latency statistics.
  *
  * @return spp_ringlatencystats_init's parameter "stats_count"
  */
 int spp_ringlatencystats_get_count(void);
 
 /**
- *get specific ring latency statisics.
+ *get specific ring latency statistics.
  */
 void spp_ringlatencystats_get_stats(int ring_id,
 		struct spp_ringlatencystats_ring_latency_stats *stats);
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 3fbfaa5..b2a3728 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -14,17 +14,18 @@ struct forward_rxtx {
 
 /* Information on the path used for forward. */
 struct forward_path {
-	char name[SPP_NAME_STR_LEN];	/* component name          */
-	volatile enum spp_component_type type;	/* component type          */
-	int num;			/* number of receive ports */
+	char name[SPP_NAME_STR_LEN];    /* component name          */
+	volatile enum spp_component_type type;
+					/* component type          */
+	int num;                        /* number of receive ports */
 	struct forward_rxtx ports[RTE_MAX_ETHPORTS];
 					/* port used for transfer  */
 };
 
 /* Information for forward. */
 struct forward_info {
-	volatile int ref_index;		/* index to reference area */
-	volatile int upd_index;		/* index to update area    */
+	volatile int ref_index; /* index to reference area */
+	volatile int upd_index; /* index to update area    */
 	struct forward_path path[SPP_INFO_AREA_MAX];
 };
 
@@ -61,15 +62,18 @@ spp_forward_update(struct spp_component_info *component)
 	struct forward_path *path = &info->path[info->upd_index];
 
 	/* Forward component allows only one receiving port. */
-	if ((component->type == SPP_COMPONENT_FORWARD) && unlikely(num_rx > 1)) {
-		RTE_LOG(ERR, FORWARD, "Component[%d] Setting error. (type = %d, rx = %d)\n",
+	if ((component->type == SPP_COMPONENT_FORWARD) &&
+			unlikely(num_rx > 1)) {
+		RTE_LOG(ERR, FORWARD,
+			"Component[%d] Setting error. (type = %d, rx = %d)\n",
 			component->component_id, component->type, num_rx);
 		return -1;
 	}
 
 	/* Component allows only one transmit port. */
 	if (unlikely(num_tx != 0) && unlikely(num_tx != 1)) {
-		RTE_LOG(ERR, FORWARD, "Component[%d] Setting error. (type = %d, tx = %d)\n",
+		RTE_LOG(ERR, FORWARD,
+			"Component[%d] Setting error. (type = %d, tx = %d)\n",
 			component->component_id, component->type, num_tx);
 		return -1;
 	}
@@ -78,7 +82,9 @@ 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->name, component->type);
+			component->component_id,
+			component->name,
+			component->type);
 
 	memcpy(&path->name, component->name, SPP_NAME_STR_LEN);
 	path->type = component->type;
@@ -93,12 +99,14 @@ spp_forward_update(struct spp_component_info *component)
 				sizeof(struct spp_port_info));
 
 	info->upd_index = info->ref_index;
-	while(likely(info->ref_index == info->upd_index))
+	while (likely(info->ref_index == info->upd_index))
 		rte_delay_us_block(SPP_CHANGE_UPDATE_INTERVAL);
 
 	RTE_LOG(INFO, FORWARD,
 			"Component[%d] Complete update component. (name = %s, type = %d)\n",
-			component->component_id, component->name, component->type);
+			component->component_id,
+			component->name,
+			component->type);
 
 	return 0;
 }
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 3613d46..1756326 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -80,16 +80,21 @@ struct cancel_backup_info {
 };
 
 /* Declare global variables */
-static unsigned int g_main_lcore_id = 0xffffffff;
-static struct startup_param		g_startup_param;
-static struct if_info			g_if_info;
-static struct spp_component_info	g_component_info[RTE_MAX_LCORE];
-static struct core_mng_info		g_core_info[RTE_MAX_LCORE];
+static unsigned int         g_main_lcore_id = 0xffffffff;
+static struct startup_param g_startup_param;
 
-static int 				g_change_core[RTE_MAX_LCORE];  /* TODO(yasufum) add desc how it is used and why changed component is kept */
-static int 				g_change_component[RTE_MAX_LCORE];
+static struct if_info            g_if_info;
+static struct spp_component_info g_component_info[RTE_MAX_LCORE];
+static struct core_mng_info      g_core_info[RTE_MAX_LCORE];
 
-static struct cancel_backup_info	g_backup_info;
+/*
+ * TODO(yasufum) add desc how it is used
+ * and why changed component is kept
+ */
+static int g_change_core[RTE_MAX_LCORE];
+static int g_change_component[RTE_MAX_LCORE];
+
+static struct cancel_backup_info g_backup_info;
 
 /* Print help message */
 static void
@@ -185,7 +190,8 @@ add_vhost_pmd(int index, int client)
 			name, iface, nr_queues, client);
 	ret = rte_eth_dev_attach(devargs, &vhost_port_id);
 	if (unlikely(ret < 0)) {
-		RTE_LOG(ERR, APP, "rte_eth_dev_attach error. (ret = %d)\n", ret);
+		RTE_LOG(ERR, APP, "rte_eth_dev_attach error. (ret = %d)\n",
+				ret);
 		return ret;
 	}
 
@@ -270,9 +276,8 @@ check_core_status_wait(enum spp_core_status status)
 	for (cnt = 0; cnt < SPP_CORE_STATUS_CHECK_MAX; cnt++) {
 		sleep(1);
 		int ret = check_core_status(status);
-		if (ret == 0) {
+		if (ret == 0)
 			return 0;
-		}
 	}
 
 	RTE_LOG(ERR, APP, "Status check time out. (status = %d)\n", status);
@@ -313,10 +318,10 @@ stop_process(int signal) {
 }
 
 /**
- * Convert string of given client id to inteter
+ * Convert string of given client id to integer
  *
- * If succeeded, client id of interger is assigned to client_id and
- * reuturn 0. Or return -1 if failed.
+ * If succeeded, client id of integer is assigned to client_id and
+ * return 0. Or return -1 if failed.
  */
 static int
 parse_app_client_id(const char *client_id_str, int *client_id)
@@ -336,7 +341,7 @@ parse_app_client_id(const char *client_id_str, int *client_id)
 	return 0;
 }
 
-/* Parse options for server ip and port */
+/* Parse options for server IP and port */
 static int
 parse_app_server(const char *server_str, char *server_ip, int *server_port)
 {
@@ -356,7 +361,7 @@ parse_app_server(const char *server_str, char *server_ip, int *server_port)
 	memcpy(server_ip, server_str, pos);
 	server_ip[pos] = '\0';
 	*server_port = port;
-	RTE_LOG(DEBUG, APP, "Set server ip   = %s\n", server_ip);
+	RTE_LOG(DEBUG, APP, "Set server IP   = %s\n", server_ip);
 	RTE_LOG(DEBUG, APP, "Set server port = %d\n", *server_port);
 	return 0;
 }
@@ -372,19 +377,20 @@ parse_app_args(int argc, char *argv[])
 	const int argcopt = argc;
 	char *argvopt[argcopt];
 	const char *progname = argv[0];
-	static struct option lgopts[] = { 
-			{ "client-id", required_argument, NULL, SPP_LONGOPT_RETVAL_CLIENT_ID },
-			{ "vhost-client", no_argument, NULL, SPP_LONGOPT_RETVAL_VHOST_CLIENT },
+	static struct option lgopts[] = {
+			{ "client-id", required_argument, NULL,
+					SPP_LONGOPT_RETVAL_CLIENT_ID },
+			{ "vhost-client", no_argument, NULL,
+					SPP_LONGOPT_RETVAL_VHOST_CLIENT },
 			{ 0 },
 	};
 
 	/**
-	 * Save argv to argvopt to aovid loosing the order of options
+	 * Save argv to argvopt to avoid losing the order of options
 	 * by getopt_long()
 	 */
-	for (cnt = 0; cnt < argcopt; cnt++) {
+	for (cnt = 0; cnt < argcopt; cnt++)
 		argvopt[cnt] = argv[cnt];
-	}
 
 	/* Clear startup parameters */
 	memset(&g_startup_param, 0x00, sizeof(g_startup_param));
@@ -396,7 +402,8 @@ parse_app_args(int argc, char *argv[])
 			&option_index)) != EOF) {
 		switch (opt) {
 		case SPP_LONGOPT_RETVAL_CLIENT_ID:
-			if (parse_app_client_id(optarg, &g_startup_param.client_id) != 0) {
+			if (parse_app_client_id(optarg,
+					&g_startup_param.client_id) != 0) {
 				usage(progname);
 				return -1;
 			}
@@ -416,7 +423,6 @@ parse_app_args(int argc, char *argv[])
 		default:
 			usage(progname);
 			return -1;
-			break;
 		}
 	}
 
@@ -448,16 +454,12 @@ get_if_area(enum port_type if_type, int if_no)
 	switch (if_type) {
 	case PHY:
 		return &g_if_info.nic[if_no];
-		break;
 	case VHOST:
 		return &g_if_info.vhost[if_no];
-		break;
 	case RING:
 		return &g_if_info.ring[if_no];
-		break;
 	default:
 		return NULL;
-		break;
 	}
 }
 
@@ -670,9 +672,8 @@ init_component_info(void)
 {
 	int cnt;
 	memset(&g_component_info, 0x00, sizeof(g_component_info));
-	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
+	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++)
 		g_component_info[cnt].component_id = cnt;
-	}
 	memset(g_change_component, 0x00, sizeof(g_change_component));
 }
 
@@ -704,9 +705,8 @@ set_nic_interface(void)
 
 	/* NIC Setting */
 	g_if_info.num_nic = rte_eth_dev_count();
-	if (g_if_info.num_nic > RTE_MAX_ETHPORTS) {
+	if (g_if_info.num_nic > RTE_MAX_ETHPORTS)
 		g_if_info.num_nic = RTE_MAX_ETHPORTS;
-	}
 
 	for (nic_cnt = 0; nic_cnt < g_if_info.num_nic; nic_cnt++) {
 		g_if_info.nic[nic_cnt].if_type   = PHY;
@@ -725,15 +725,14 @@ set_nic_interface(void)
 static int
 init_manage_data(void)
 {
-	/* Initialize interface and core infomation */
+	/* Initialize interface and core information */
 	init_if_info();
 	init_core_info();
 	init_component_info();
 
 	int ret_nic = set_nic_interface();
-	if (unlikely(ret_nic != 0)) {
+	if (unlikely(ret_nic != 0))
 		return -1;
-	}
 
 	return 0;
 }
@@ -759,27 +758,25 @@ print_ring_latency_stats(void)
 	printf("RING Latency\n");
 	printf(" RING");
 	for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
-		if (g_if_info.ring[ring_cnt].if_type == UNDEF) {
+		if (g_if_info.ring[ring_cnt].if_type == UNDEF)
 			continue;
-		}
+
 		spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
 		printf(", %-18d", ring_cnt);
 	}
 	printf("\n");
 
-	for (stats_cnt = 0; stats_cnt < SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT; stats_cnt++) {
+	for (stats_cnt = 0; stats_cnt < SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT;
+			stats_cnt++) {
 		printf("%3dns", stats_cnt);
 		for (ring_cnt = 0; ring_cnt < RTE_MAX_ETHPORTS; ring_cnt++) {
-			if (g_if_info.ring[ring_cnt].if_type == UNDEF) {
+			if (g_if_info.ring[ring_cnt].if_type == UNDEF)
 				continue;
-			}
 
 			printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
 		}
 		printf("\n");
 	}
-
-	return;
 }
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
 
@@ -791,7 +788,7 @@ del_vhost_sockfile(struct spp_port_info *vhost)
 {
 	int cnt;
 
-	/* Do not rmeove for if it is running in vhost-client mode. */
+	/* Do not remove for if it is running in vhost-client mode. */
 	if (g_startup_param.vhost_client != 0)
 		return;
 
@@ -859,28 +856,33 @@ slave_main(void *arg __attribute__ ((unused)))
 	RTE_LOG(INFO, APP, "Core[%d] Start.\n", lcore_id);
 	set_core_status(lcore_id, SPP_CORE_IDLE);
 
-	while((status = spp_get_core_status(lcore_id)) != SPP_CORE_STOP_REQUEST) {
+	while ((status = spp_get_core_status(lcore_id)) !=
+			SPP_CORE_STOP_REQUEST) {
 		if (status != SPP_CORE_FORWARD)
 			continue;
 
 		if (spp_check_core_index(lcore_id)) {
 			/* Setting with the flush command trigger. */
-			info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+			info->ref_index = (info->upd_index+1) %
+					SPP_INFO_AREA_MAX;
 			core = get_core_info(lcore_id);
 		}
 
 		for (cnt = 0; cnt < core->num; cnt++) {
-			if (spp_get_component_type(lcore_id) == SPP_COMPONENT_CLASSIFIER_MAC) {
+			if (spp_get_component_type(lcore_id) ==
+					SPP_COMPONENT_CLASSIFIER_MAC) {
 				/* Classifier loops inside the function. */
 				ret = spp_classifier_mac_do(core->id[cnt]);
 				break;
-			} else {
-				/* Forward / Merge returns at once.          */
-				/* It is for processing multiple components. */
-				ret = spp_forward(core->id[cnt]);
-				if (unlikely(ret != 0))
-					break;
 			}
+
+			/*
+			 * Forward / Merge returns at once.
+			 * It is for processing multiple components.
+			 */
+			ret = spp_forward(core->id[cnt]);
+			if (unlikely(ret != 0))
+				break;
 		}
 		if (unlikely(ret != 0)) {
 			RTE_LOG(ERR, APP, "Core[%d] Component Error. (id = %d)\n",
@@ -895,8 +897,11 @@ slave_main(void *arg __attribute__ ((unused)))
 }
 
 /* TODO(yasufum) refactor, change if to iface. */
-/* TODO(yasufum) change test using ut_main(), or add desccription for what and why use it */
-/* TODO(yasufum) change to return -1 explicity if error is occured. */
+/*
+ * TODO(yasufum) change test using ut_main(),
+ * or add description for what and why use it
+ */
+/* TODO(yasufum) change to return -1 explicitly if error is occurred. */
 int
 #ifndef USE_UT_SPP_VF
 main(int argc, char *argv[])
@@ -909,7 +914,8 @@ ut_main(int argc, char *argv[])
 	/* Daemonize process */
 	int ret_daemon = daemon(0, 0);
 	if (unlikely(ret_daemon != 0)) {
-		RTE_LOG(ERR, APP, "daemonize is faild. (ret = %d)\n", ret_daemon);
+		RTE_LOG(ERR, APP, "daemonize is failed. (ret = %d)\n",
+				ret_daemon);
 		return ret_daemon;
 	}
 #endif
@@ -918,11 +924,10 @@ ut_main(int argc, char *argv[])
 	signal(SIGTERM, stop_process);
 	signal(SIGINT,  stop_process);
 
-	while(1) {
+	while (1) {
 		int ret_dpdk = rte_eal_init(argc, argv);
-		if (unlikely(ret_dpdk < 0)) {
+		if (unlikely(ret_dpdk < 0))
 			break;
-		}
 
 		argc -= ret_dpdk;
 		argv += ret_dpdk;
@@ -932,22 +937,19 @@ ut_main(int argc, char *argv[])
 
 		/* Parse spp_vf specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
-		if (unlikely(ret_parse != 0)) {
+		if (unlikely(ret_parse != 0))
 			break;
-		}
 
 		/* Get lcore id of main thread to set its status after */
 		g_main_lcore_id = rte_lcore_id();
 
 		int ret_manage = init_manage_data();
-		if (unlikely(ret_manage != 0)) {
+		if (unlikely(ret_manage != 0))
 			break;
-		}
 
 		int ret_classifier_mac_init = spp_classifier_mac_init();
-		if (unlikely(ret_classifier_mac_init != 0)) {
+		if (unlikely(ret_classifier_mac_init != 0))
 			break;
-		}
 
 		spp_forward_init();
 
@@ -955,16 +957,15 @@ ut_main(int argc, char *argv[])
 		int ret_command_init = spp_command_proc_init(
 				g_startup_param.server_ip,
 				g_startup_param.server_port);
-		if (unlikely(ret_command_init != 0)) {
+		if (unlikely(ret_command_init != 0))
 			break;
-		}
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 		int ret_ringlatency = spp_ringlatencystats_init(
-				SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL, g_if_info.num_ring);
-		if (unlikely(ret_ringlatency != 0)) {
+				SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
+				g_if_info.num_ring);
+		if (unlikely(ret_ringlatency != 0))
 			break;
-		}
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
 
 		/* Start worker threads of classifier and forwarder */
@@ -976,9 +977,8 @@ ut_main(int argc, char *argv[])
 		/* Set the status of main thread to idle */
 		g_core_info[g_main_lcore_id].status = SPP_CORE_IDLE;
 		int ret_wait = check_core_status_wait(SPP_CORE_IDLE);
-		if (unlikely(ret_wait != 0)) {
+		if (unlikely(ret_wait != 0))
 			break;
-		}
 
 		/* Start forwarding */
 		set_all_core_status(SPP_CORE_FORWARD);
@@ -991,15 +991,15 @@ ut_main(int argc, char *argv[])
 		/* Enter loop for accepting commands */
 		int ret_do = 0;
 #ifndef USE_UT_SPP_VF
-		while(likely(g_core_info[g_main_lcore_id].status != SPP_CORE_STOP_REQUEST)) {
+		while (likely(g_core_info[g_main_lcore_id].status !=
+				SPP_CORE_STOP_REQUEST)) {
 #else
 		{
 #endif
 			/* Receive command */
 			ret_do = spp_command_proc_do();
-			if (unlikely(ret_do != 0)) {
+			if (unlikely(ret_do != 0))
 				break;
-			}
 
 			sleep(1);
 
@@ -1018,15 +1018,16 @@ ut_main(int argc, char *argv[])
 	}
 
 	/* Finalize to exit */
-	if (g_main_lcore_id == rte_lcore_id())
-	{
+	if (g_main_lcore_id == rte_lcore_id()) {
 		g_core_info[g_main_lcore_id].status = SPP_CORE_STOP;
 		int ret_core_end = check_core_status_wait(SPP_CORE_STOP);
-		if (unlikely(ret_core_end != 0)) {
+		if (unlikely(ret_core_end != 0))
 			RTE_LOG(ERR, APP, "Core did not stop.\n");
-		}
 
-		/* Remove vhost sock file if it is not running in vhost-client mode */
+		/*
+		 * Remove vhost sock file if it is not running
+		 *  in vhost-client mode
+		 */
 		del_vhost_sockfile(g_if_info.vhost);
 	}
 
@@ -1119,13 +1120,15 @@ set_component_change_port(struct spp_port_info *port, enum spp_port_rxtx rxtx)
 {
 	int ret = 0;
 	if ((rxtx == SPP_PORT_RXTX_RX) || (rxtx == SPP_PORT_RXTX_ALL)) {
-		ret = spp_check_used_port(port->if_type, port->if_no, SPP_PORT_RXTX_RX);
+		ret = spp_check_used_port(port->if_type, port->if_no,
+				SPP_PORT_RXTX_RX);
 		if (ret >= 0)
 			g_change_component[ret] = 1;
 	}
 
 	if ((rxtx == SPP_PORT_RXTX_TX) || (rxtx == SPP_PORT_RXTX_ALL)) {
-		ret = spp_check_used_port(port->if_type, port->if_no, SPP_PORT_RXTX_TX);
+		ret = spp_check_used_port(port->if_type, port->if_no,
+				SPP_PORT_RXTX_TX);
 		if (ret >= 0)
 			g_change_component[ret] = 1;
 	}
@@ -1148,7 +1151,8 @@ spp_update_classifier_table(
 
 		ret_mac = spp_change_mac_str_to_int64(data);
 		if (unlikely(ret_mac == -1)) {
-			RTE_LOG(ERR, APP, "MAC address format error. ( mac = %s )\n", data);
+			RTE_LOG(ERR, APP, "MAC address format error. ( mac = %s )\n",
+					data);
 			return SPP_RET_NG;
 		}
 		mac_addr = (uint64_t)ret_mac;
@@ -1168,7 +1172,8 @@ spp_update_classifier_table(
 		if (action == SPP_CMD_ACTION_DEL) {
 			/* Delete */
 			if ((port_info->mac_addr != 0) &&
-					unlikely(port_info->mac_addr != mac_addr)) {
+					unlikely(port_info->mac_addr !=
+							mac_addr)) {
 				RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
 						data);
 				return SPP_RET_NG;
@@ -1176,8 +1181,7 @@ spp_update_classifier_table(
 
 			port_info->mac_addr = 0;
 			memset(port_info->mac_addr_str, 0x00, SPP_MIN_STR_LEN);
-		}
-		else if (action == SPP_CMD_ACTION_ADD) {
+		} else if (action == SPP_CMD_ACTION_ADD) {
 			/* Setting */
 			if (unlikely(port_info->mac_addr != 0)) {
 				RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d )\n",
@@ -1240,9 +1244,8 @@ get_del_core_element(int info, int num, int *array)
 	/* Last element is excluded from movement. */
 	max--;
 
-	for (cnt = match; cnt < max; cnt++) {
+	for (cnt = match; cnt < max; cnt++)
 		array[cnt] = array[cnt+1];
-	}
 
 	/* Last element is cleared. */
 	array[cnt] = 0;
@@ -1286,7 +1289,8 @@ spp_update_component(
 		}
 
 		core = &info->core[info->upd_index];
-		if ((core->type != SPP_COMPONENT_UNUSE) && (core->type != type)) {
+		if ((core->type != SPP_COMPONENT_UNUSE) &&
+				(core->type != type)) {
 			RTE_LOG(ERR, APP, "Component type is error.\n");
 			return SPP_RET_NG;
 		}
@@ -1370,9 +1374,8 @@ get_del_port_element(
 	/* Last element is excluded from movement. */
 	max--;
 
-	for (cnt = match; cnt < max; cnt++) {
+	for (cnt = match; cnt < max; cnt++)
 		array[cnt] = array[cnt+1];
-	}
 
 	/* Last element is cleared. */
 	array[cnt] = NULL;
@@ -1456,7 +1459,8 @@ flush_port(void)
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &g_if_info.vhost[cnt];
 		if ((port->if_type != UNDEF) && (port->dpdk_port < 0)) {
-			ret = add_vhost_pmd(port->if_no, g_startup_param.vhost_client);
+			ret = add_vhost_pmd(port->if_no,
+					g_startup_param.vhost_client);
 			if (ret < 0)
 				return SPP_RET_NG;
 			port->dpdk_port = ret;
@@ -1495,17 +1499,17 @@ flush_core(void)
 	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		if (g_change_core[cnt] != 0) {
 			info = &g_core_info[cnt];
-			while(likely(info->ref_index == info->upd_index))
+			while (likely(info->ref_index == info->upd_index))
 				rte_delay_us_block(SPP_CHANGE_UPDATE_INTERVAL);
 
 			memcpy(&info->core[info->upd_index],
 					&info->core[info->ref_index],
-					sizeof(struct core_info)); 
+					sizeof(struct core_info));
 		}
 	}
 }
 
-/* Flush chagned component */
+/* Flush changed component */
 static int
 flush_component(void)
 {
@@ -1513,19 +1517,20 @@ flush_component(void)
 	int cnt = 0;
 	struct spp_component_info *component_info = NULL;
 
-	for(cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
+	for (cnt = 0; cnt < RTE_MAX_LCORE; cnt++) {
 		if (g_change_component[cnt] == 0)
 			continue;
 
 		component_info = &g_component_info[cnt];
-		if (component_info->type == SPP_COMPONENT_CLASSIFIER_MAC) {
+		if (component_info->type == SPP_COMPONENT_CLASSIFIER_MAC)
 			ret = spp_classifier_mac_update(component_info);
-		} else {
+		else
 			ret = spp_forward_update(component_info);
-		}
+
 		if (unlikely(ret < 0)) {
 			RTE_LOG(ERR, APP, "Flush error. ( component = %s, type = %d)\n",
-					component_info->name, component_info->type);
+					component_info->name,
+					component_info->type);
 			return SPP_RET_NG;
 		}
 	}
@@ -1560,7 +1565,7 @@ spp_cancel(void)
 	cancel_mng_info(&g_backup_info);
 }
 
-/* Iterate core infomartion */
+/* Iterate core information */
 int
 spp_iterate_core_info(struct spp_iterate_core_params *params)
 {
@@ -1620,7 +1625,7 @@ spp_iterate_classifier_table(
 
 	ret = spp_classifier_mac_iterate_table(params);
 	if (unlikely(ret != 0)) {
-		RTE_LOG(ERR, APP, "Cannot iterate classfier_mac_table.\n");
+		RTE_LOG(ERR, APP, "Cannot iterate classifier_mac_table.\n");
 		return SPP_RET_NG;
 	}
 
@@ -1628,8 +1633,8 @@ spp_iterate_classifier_table(
 }
 
 /**
- * Sepeparate port id of combination of iface type and number and
- * assign to given argment, if_type and if_no.
+ * Separate port id of combination of iface type and number and
+ * assign to given argument, if_type and if_no.
  *
  * For instance, 'ring:0' is separated to 'ring' and '0'.
  *
@@ -1643,21 +1648,25 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
 	char *endptr = NULL;
 
 	/* Find out which type of interface from port */
-	if (strncmp(port, SPP_IFTYPE_NIC_STR ":", strlen(SPP_IFTYPE_NIC_STR)+1) == 0) {
+	if (strncmp(port, SPP_IFTYPE_NIC_STR ":",
+			strlen(SPP_IFTYPE_NIC_STR)+1) == 0) {
 		/* NIC */
 		type = PHY;
 		no_str = &port[strlen(SPP_IFTYPE_NIC_STR)+1];
-	} else if (strncmp(port, SPP_IFTYPE_VHOST_STR ":", strlen(SPP_IFTYPE_VHOST_STR)+1) == 0) {
+	} else if (strncmp(port, SPP_IFTYPE_VHOST_STR ":",
+			strlen(SPP_IFTYPE_VHOST_STR)+1) == 0) {
 		/* VHOST */
 		type = VHOST;
 		no_str = &port[strlen(SPP_IFTYPE_VHOST_STR)+1];
-	} else if (strncmp(port, SPP_IFTYPE_RING_STR ":", strlen(SPP_IFTYPE_RING_STR)+1) == 0) {
+	} else if (strncmp(port, SPP_IFTYPE_RING_STR ":",
+			strlen(SPP_IFTYPE_RING_STR)+1) == 0) {
 		/* RING */
 		type = RING;
 		no_str = &port[strlen(SPP_IFTYPE_RING_STR)+1];
 	} else {
 		/* OTHER */
-		RTE_LOG(ERR, APP, "Unknown interface type. (port = %s)\n", port);
+		RTE_LOG(ERR, APP, "Unknown interface type. (port = %s)\n",
+				port);
 		return -1;
 	}
 
@@ -1678,12 +1687,12 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
 }
 
 /**
- * Generate a formatted string of conbination from interface type and
+ * Generate a formatted string of combination from interface type and
  * number and assign to given 'port'
  */
 int spp_format_port_string(char *port, enum port_type if_type, int if_no)
 {
-	const char* if_type_str;
+	const char *if_type_str;
 
 	switch (if_type) {
 	case PHY:
@@ -1721,25 +1730,23 @@ spp_change_mac_str_to_int64(const char *mac)
 	RTE_LOG(DEBUG, APP, "MAC address change. (mac = %s)\n", mac);
 
 	strcpy(tmp_mac, mac);
-	while(1) {
+	while (1) {
 		/* Split by colon(':') */
 		char *ret_tok = strtok_r(str, ":", &saveptr);
-		if (unlikely(ret_tok == NULL)) {
+		if (unlikely(ret_tok == NULL))
 			break;
-		}
 
 		/* Check for mal-formatted address */
 		if (unlikely(token_cnt >= ETHER_ADDR_LEN)) {
 			RTE_LOG(ERR, APP, "MAC address format error. (mac = %s)\n",
-					 mac);
+					mac);
 			return -1;
 		}
 
 		/* Convert string to hex value */
 		int ret_tol = strtol(ret_tok, &endptr, 16);
-		if (unlikely(ret_tok == endptr) || unlikely(*endptr != '\0')) {
+		if (unlikely(ret_tok == endptr) || unlikely(*endptr != '\0'))
 			break;
-		}
 
 		/* Append separated value to the result */
 		token_val = (int64_t)ret_tol;
@@ -1759,7 +1766,7 @@ spp_change_mac_str_to_int64(const char *mac)
 enum spp_component_type
 spp_change_component_type(const char *type_str)
 {
-	if(strncmp(type_str, CORE_TYPE_CLASSIFIER_MAC_STR,
+	if (strncmp(type_str, CORE_TYPE_CLASSIFIER_MAC_STR,
 			 strlen(CORE_TYPE_CLASSIFIER_MAC_STR)+1) == 0) {
 		/* Classifier */
 		return SPP_COMPONENT_CLASSIFIER_MAC;
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 3c1f586..4ab9afe 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -90,11 +90,11 @@ struct spp_port_index {
  * Port info
  */
 struct spp_port_info {
-	enum port_type	if_type;
-	int		if_no;
-	int		dpdk_port;
-	uint64_t	mac_addr;
-	char		mac_addr_str[SPP_MIN_STR_LEN];
+	enum port_type  if_type;
+	int             if_no;
+	int             dpdk_port;
+	uint64_t        mac_addr;
+	char            mac_addr_str[SPP_MIN_STR_LEN];
 };
 
 /*
@@ -111,17 +111,6 @@ struct spp_component_info {
 	struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
 };
 
-#if 0
-/*
- * Core info
- */
-struct spp_core_info {
-	enum spp_core_status status;
-	int num_component;
-	int component_id[SPP_CONFIG_CORE_MAX];
-};
-#endif
-
 /*
  * Get client ID
  * RETURN : CLIENT ID(0~127)
@@ -190,7 +179,7 @@ struct spp_iterate_core_params {
 	spp_iterate_core_element_proc element_proc;
 };
 
-/* Iterate core infomartion */
+/* Iterate core information */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
 /* definition of iterated classifier element procedure function */
@@ -210,7 +199,8 @@ struct spp_iterate_classifier_table_params {
 /*
  * Iterate Classifier_table
  */
-int spp_iterate_classifier_table(struct spp_iterate_classifier_table_params *params);
+int spp_iterate_classifier_table(
+		struct spp_iterate_classifier_table_params *params);
 
 /* Get core status */
 enum spp_core_status spp_get_core_status(unsigned int lcore_id);
@@ -244,7 +234,10 @@ int spp_get_component_id(const char *name);
  * Check mac address used on the port for registering or removing
  * RETURN : True if target MAC address matches MAC address of port.
  */
-int spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no);
+int spp_check_mac_used_port(
+		uint64_t mac_addr,
+		enum port_type if_type,
+		int if_no);
 
 /*
  * Check if port has been added.
@@ -263,7 +256,10 @@ int spp_check_flush_port(enum port_type if_type, int if_no);
  * OK : match component ID
  * NG : SPP_RET_NG
  */
-int spp_check_used_port(enum port_type if_type, int if_no, enum spp_port_rxtx rxtx);
+int spp_check_used_port(
+		enum port_type if_type,
+		int if_no,
+		enum spp_port_rxtx rxtx);
 
 /*
  * Change mac address string to int64
diff --git a/src/vf/string_buffer.c b/src/vf/string_buffer.c
index 07ba8cc..28df6ae 100644
--- a/src/vf/string_buffer.c
+++ b/src/vf/string_buffer.c
@@ -39,7 +39,7 @@ strbuf_reallocate(char *strbuf, size_t required_len)
 char*
 spp_strbuf_allocate(size_t capacity)
 {
-	char* buf = (char *)malloc(capacity + sizeof(size_t));
+	char *buf = (char *)malloc(capacity + sizeof(size_t));
 	if (unlikely(buf == NULL))
 		return NULL;
 
@@ -54,7 +54,7 @@ spp_strbuf_allocate(size_t capacity)
 
 /* free message buffer */
 void
-spp_strbuf_free(char* strbuf)
+spp_strbuf_free(char *strbuf)
 {
 	if (likely(strbuf != NULL)) {
 		RTE_LOG(DEBUG, SPP_STRING_BUFF,
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 9879b9d..60645e9 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -9,10 +9,10 @@
  * @param capacity
  *  initial buffer size (include null char).
  *
- * @retval not-NULL pointer to the allocated memory. 
+ * @retval not-NULL pointer to the allocated memory.
  * @retval NULL     error.
  */
-char* spp_strbuf_allocate(size_t capacity);
+char *spp_strbuf_allocate(size_t capacity);
 
 /**
  * free string buffer.
@@ -20,7 +20,7 @@ char* spp_strbuf_allocate(size_t capacity);
  * @param strbuf
  *  spp_strbuf_allocate/spp_strbuf_append return value.
  */
-void spp_strbuf_free(char* strbuf);
+void spp_strbuf_free(char *strbuf);
 
 /**
  * append string to buffer.
@@ -35,11 +35,10 @@ void spp_strbuf_free(char* strbuf);
  * @param append_len
  *  length of append string.
  *
- * @return if the capacity is enough, the 1st parameter "strbuf", 
- *         if it is insufficient, a new pointer to the allocated memory.
- *         in that case, old strbuf is freed in the function.
+ * @return if "strbuf" has enough space to append, returns "strbuf"
+ *         else returns a new pointer to the allocated memory.
  */
-char* spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
+char *spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
 
 /**
  * remove string from front.
@@ -51,6 +50,6 @@ char* spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
  * @param remove_len
  *  length of remove.
  */
-char* spp_strbuf_remove_front(char *strbuf, size_t remove_len);
+char *spp_strbuf_remove_front(char *strbuf, size_t remove_len);
 
 #endif /* _STRING_BUFFER_H_ */
-- 
1.9.1



More information about the spp mailing list