Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
@ 2018-02-08  5:51 x-fn-spp
  2018-02-08  5:55 ` [spp] [PATCH 2/9] spp_vf: refactor comments and variable names x-fn-spp
                   ` (9 more replies)
  0 siblings, 10 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:51 UTC (permalink / raw)
  To: spp

From: Kentaro Watanabe <watanabe.kentaro.z01@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@sl.ntt-tx.co.jp wrote:
> From: Hiroyuki Nakamura <nakamura.hioryuki@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@sl.ntt-tx.co.jp wrote:
>> From: Hiroyuki Nakamura <nakamura.hioryuki@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@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@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

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

* [spp] [PATCH 2/9] spp_vf: refactor comments and variable names
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
@ 2018-02-08  5:55 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 3/9] spp_vf: change header file to doxygen format x-fn-spp
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:55 UTC (permalink / raw)
  To: spp

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

* Add description, such as definition and structure members.
* Change abbreviation of variable name and function name.
  (if->iface, manage->mng)
* Delete unnecessary function.(ut_main())

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c |  94 ++++++++--------
 src/vf/command_dec.c    |  40 ++++---
 src/vf/command_dec.h    |  51 ++++++---
 src/vf/command_proc.c   |  14 ++-
 src/vf/spp_forward.c    |  21 ++--
 src/vf/spp_vf.c         | 293 +++++++++++++++++++++++++-----------------------
 src/vf/spp_vf.h         |  47 ++++----
 7 files changed, 306 insertions(+), 254 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 939f8c9..cd186a2 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -61,18 +61,16 @@ static const size_t HASH_TABLE_NAME_BUF_SZ =
 static const size_t ETHER_ADDR_STR_BUF_SZ =
 		ETHER_ADDR_LEN * 2 + (ETHER_ADDR_LEN - 1) + 1;
 
-/* TODO(yasufum) add explanation of data structure of classifier and mng info */
-
 /* classified data (destination port, target packets, etc) */
 struct classified_data {
 	/* interface type (see "enum port_type") */
-	enum port_type  if_type;
+	enum port_type  iface_type;
 
 	/* index of ports handled by classifier */
-	int             if_no;
+	int             iface_no;
 
 	/* id for interface generated by spp_vf */
-	int             if_no_global;
+	int             iface_no_global;
 
 	/* port id generated by DPDK */
 	uint16_t        port;
@@ -113,8 +111,13 @@ struct classifier_mac_info {
 
 /* classifier management information */
 struct classifier_mac_mng_info {
+	/* classifier information */
 	struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+
+	/* Reference index number for classifier information */
 	volatile int ref_index;
+
+	/* Update index number for classifier information */
 	volatile int upd_index;
 };
 
@@ -156,17 +159,17 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 	classifier_info->default_classified = -1;
 	classifier_info->n_classified_data_tx = component_info->num_tx_port;
 	if (component_info->num_rx_port == 0) {
-		classified_data_rx->if_type      = UNDEF;
-		classified_data_rx->if_no        = 0;
-		classified_data_rx->if_no_global = 0;
+		classified_data_rx->iface_type      = UNDEF;
+		classified_data_rx->iface_no        = 0;
+		classified_data_rx->iface_no_global = 0;
 		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_no        = 0;
-		classified_data_rx->if_no_global =
-				component_info->rx_ports[0]->if_no;
+		classified_data_rx->iface_type      =
+				component_info->rx_ports[0]->iface_type;
+		classified_data_rx->iface_no        = 0;
+		classified_data_rx->iface_no_global =
+				component_info->rx_ports[0]->iface_no;
 		classified_data_rx->port         =
 				component_info->rx_ports[0]->dpdk_port;
 		classified_data_rx->num_pkt      = 0;
@@ -176,9 +179,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 		tx_port = component_info->tx_ports[i];
 
 		/* store ports information */
-		classified_data_tx[i].if_type      = tx_port->if_type;
-		classified_data_tx[i].if_no        = i;
-		classified_data_tx[i].if_no_global = tx_port->if_no;
+		classified_data_tx[i].iface_type      = tx_port->iface_type;
+		classified_data_tx[i].iface_no        = i;
+		classified_data_tx[i].iface_no_global = tx_port->iface_no;
 		classified_data_tx[i].port         = tx_port->dpdk_port;
 		classified_data_tx[i].num_pkt      = 0;
 
@@ -194,9 +197,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
 			classifier_info->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
-					"if_type=%d, if_no=%d, dpdk_port=%d\n",
-					tx_port->if_type,
-					tx_port->if_no,
+					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					tx_port->iface_type,
+					tx_port->iface_no,
 					tx_port->dpdk_port);
 			continue;
 		}
@@ -219,10 +222,10 @@ 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=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
 				mac_addr_str,
-				tx_port->if_type,
-				tx_port->if_no,
+				tx_port->iface_type,
+				tx_port->iface_no,
 				tx_port->dpdk_port);
 	}
 
@@ -331,9 +334,9 @@ transmit_packet(struct classified_data *classified_data)
 	uint16_t n_tx;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-	if (classified_data->if_type == RING)
+	if (classified_data->iface_type == RING)
 		/* if tx-if is ring, set ringlatencystats */
-		spp_ringlatencystats_add_time_stamp(classified_data->if_no,
+		spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
 				classified_data->pkts,
 				classified_data->num_pkt);
 #endif
@@ -386,10 +389,10 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *classified_data)
 	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"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,
-				classified_data->if_no,
+				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+				classified_data->iface_type,
+				classified_data->iface_no_global,
+				classified_data->iface_no,
 				classified_data->port,
 				classified_data->num_pkt);
 		transmit_packet(classified_data);
@@ -611,7 +614,7 @@ spp_classifier_mac_do(int id)
 			prev_tsc = cur_tsc;
 		}
 
-		if (classified_data_rx->if_type == UNDEF)
+		if (classified_data_rx->iface_type == UNDEF)
 			continue;
 
 		/* retrieve packets */
@@ -621,9 +624,9 @@ spp_classifier_mac_do(int id)
 			continue;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (classified_data_rx->if_type == RING)
+		if (classified_data_rx->iface_type == RING)
 			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->if_no,
+					classified_data_rx->iface_no,
 					rx_pkts, n_rx);
 #endif
 
@@ -669,19 +672,19 @@ spp_classifier_get_component_status(
 	classified_data = classifier_info->classified_data_tx;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (classifier_info->classified_data_rx.if_type != UNDEF) {
+	if (classifier_info->classified_data_rx.iface_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].iface_type = classifier_info->
+				classified_data_rx.iface_type;
+		rx_ports[0].iface_no   = classifier_info->
+				classified_data_rx.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
 	num_tx = classifier_info->n_classified_data_tx;
 	for (i = 0; i < num_tx; i++) {
-		tx_ports[i].if_type = classified_data[i].if_type;
-		tx_ports[i].if_no   = classified_data[i].if_no_global;
+		tx_ports[i].iface_type = classified_data[i].iface_type;
+		tx_ports[i].iface_no   = classified_data[i].iface_no_global;
 	}
 
 	/* Set the information with the function specified by the command. */
@@ -724,12 +727,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 +
+			port.iface_type = (classified_data +
 					classifier_info->default_classified)->
-					if_type;
-			port.if_no   = (classified_data +
+					iface_type;
+			port.iface_no   = (classified_data +
 					classifier_info->default_classified)->
-					if_no_global;
+					iface_no_global;
 
 			(*params->element_proc)(
 					params,
@@ -750,9 +753,10 @@ spp_classifier_mac_iterate_table(
 			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 					(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.iface_type = (classified_data + (long)data)->
+					iface_type;
+			port.iface_no   = (classified_data + (long)data)->
+					iface_no_global;
 
 			(*params->element_proc)(
 					params,
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 8e82f1f..59e825c 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -140,7 +140,7 @@ decode_port_value(void *output, const char *arg_val)
 {
 	int ret = 0;
 	struct spp_port_index *port = output;
-	ret = spp_get_if_info(arg_val, &port->if_type, &port->if_no);
+	ret = spp_get_iface_index(arg_val, &port->iface_type, &port->iface_no);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad port. val=%s\n", arg_val);
 		return -1;
@@ -292,9 +292,11 @@ 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_check_used_port(tmp_port.iface_type,
+					tmp_port.iface_no,
 					SPP_PORT_RXTX_RX) >= 0) &&
-			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+			(spp_check_used_port(tmp_port.iface_type,
+					tmp_port.iface_no,
 					SPP_PORT_RXTX_TX) >= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
 				"Port in used. (port command) val=%s\n",
@@ -302,8 +304,8 @@ decode_port_port_value(void *output, const char *arg_val)
 		return -1;
 	}
 
-	port->port.if_type = tmp_port.if_type;
-	port->port.if_no   = tmp_port.if_no;
+	port->port.iface_type = tmp_port.iface_type;
+	port->port.iface_no   = tmp_port.iface_no;
 	return 0;
 }
 
@@ -322,8 +324,8 @@ decode_port_rxtx_value(void *output, const char *arg_val)
 	}
 
 	if ((port->action == SPP_CMD_ACTION_ADD) &&
-			(spp_check_used_port(port->port.if_type,
-					port->port.if_no, ret) >= 0)) {
+			(spp_check_used_port(port->port.iface_type,
+					port->port.iface_no, ret) >= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
 				"Port in used. (port command) val=%s\n",
 				arg_val);
@@ -442,15 +444,15 @@ decode_classifier_port_value(void *output, const char *arg_val)
 	if (ret < 0)
 		return -1;
 
-	if (spp_check_added_port(tmp_port.if_type, tmp_port.if_no) == 0) {
+	if (spp_check_added_port(tmp_port.iface_type, tmp_port.iface_no) == 0) {
 		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.iface_type,
+				tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -462,7 +464,7 @@ decode_classifier_port_value(void *output, const char *arg_val)
 			return -1;
 
 		if (!spp_check_mac_used_port((uint64_t)mac_addr,
-				tmp_port.if_type, tmp_port.if_no)) {
+				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -470,8 +472,8 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		}
 	}
 
-	classifier_table->port.if_type = tmp_port.if_type;
-	classifier_table->port.if_no   = tmp_port.if_no;
+	classifier_table->port.iface_type = tmp_port.iface_type;
+	classifier_table->port.iface_no   = tmp_port.iface_no;
 	return 0;
 }
 
@@ -479,9 +481,10 @@ decode_classifier_port_value(void *output, const char *arg_val)
 
 /* parameter list for decoding */
 struct decode_parameter_list {
-	const char *name;
-	size_t offset;
+	const char *name;       /* Parameter name */
+	size_t offset;          /* Offset value of struct spp_command */
 	int (*func)(void *output, const char *arg_val);
+				/* Pointer to parameter handling function */
 };
 
 /* parameter list for each command */
@@ -597,11 +600,12 @@ decode_command_parameter_in_list(struct spp_command_request *request,
 
 /* command list for decoding */
 struct decode_command_list {
-	const char *name;
-	int   param_min;
-	int   param_max;
+	const char *name;       /* Command name */
+	int   param_min;        /* Min number of parameters */
+	int   param_max;        /* Max number of parameters */
 	int (*func)(struct spp_command_request *request, int argc, char *argv[],
 			struct spp_command_decode_error *error);
+				/* Pointer to command handling function */
 };
 
 /* command list */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 7fc5f66..77cae87 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -31,7 +31,7 @@ enum spp_command_decode_error_code {
  *
  * @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,
@@ -45,9 +45,16 @@ enum spp_command_type {
 
 /* "classifier_table" command specific parameters */
 struct spp_command_classifier_table {
+	/* Action identifier (add or del) */
 	enum spp_command_action action;
+
+	/* Classify type (currently only for mac) */
 	enum spp_classifier_type type;
+
+	/* Value to be classified */
 	char value[SPP_CMD_VALUE_BUFSZ];
+
+	/* Destination port type and number */
 	struct spp_port_index port;
 };
 
@@ -58,48 +65,56 @@ struct spp_command_flush {
 
 /* "component" command parameters */
 struct spp_command_component {
-	enum spp_command_action action;
-	char name[SPP_CMD_NAME_BUFSZ];
-	unsigned int core;
-	enum spp_component_type type;
+	enum spp_command_action action; /* Action identifier (start or stop) */
+	char name[SPP_CMD_NAME_BUFSZ];  /* Component name */
+	unsigned int core;              /* Logical core number */
+	enum spp_component_type type;   /* Component type */
 };
 
 /* "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action;
-	struct spp_port_index port;
-	enum spp_port_rxtx rxtx;
-	char name[SPP_CMD_NAME_BUFSZ];
+	enum spp_command_action action; /* Action identifier (add or del) */
+	struct spp_port_index port;     /* Port type and number */
+	enum spp_port_rxtx rxtx;        /* rx/tx identifier */
+	char name[SPP_CMD_NAME_BUFSZ];  /* Attached component name */
 };
 
 /* command parameters */
 struct spp_command {
-	enum spp_command_type type;
+	enum spp_command_type type; /* Command type */
 
 	union {
+		/* Structured data for classifier_table command  */
 		struct spp_command_classifier_table classifier_table;
+
+		/* Structured data for flush command  */
 		struct spp_command_flush flush;
+
+		/* Structured data for component command  */
 		struct spp_command_component component;
+
+		/* Structured data for port command  */
 		struct spp_command_port port;
 	} spec;
 };
 
 /* request parameters */
 struct spp_command_request {
-	int num_command;
-	int num_valid_command;
+	int num_command;                /* Number of accepted commands */
+	int num_valid_command;          /* Number of executed commands */
 	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
+					/* Information of executed commands */
 
-	int is_requested_client_id;
-	int is_requested_status;
-	int is_requested_exit;
+	int is_requested_client_id;     /* Id for get_client_id command */
+	int is_requested_status;        /* Id for status command */
+	int is_requested_exit;          /* Id for exit command */
 };
 
 /* decode error information */
 struct spp_command_decode_error {
-	int code;
-	char value_name[SPP_CMD_NAME_BUFSZ];
-	char value[SPP_CMD_VALUE_BUFSZ];
+	int code;                            /* Error code */
+	char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
+	char value[SPP_CMD_VALUE_BUFSZ];     /* Error value */
 };
 
 /* decode request from no-null-terminated string */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index b06ed27..f51c800 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -36,14 +36,22 @@ enum command_result_code {
 
 /* command execution result information */
 struct command_result {
+	/* Response code */
 	int code;
+
+	/* Response message */
 	char result[SPP_CMD_NAME_BUFSZ];
+
+	/* Detailed response message */
 	char error_message[CMD_RES_ERR_MSG_SIZE];
 };
 
 /* command response list control structure */
 struct command_response_list {
+	/* Tag name */
 	char tag_name[SPP_CMD_NAME_BUFSZ];
+
+	/* Pointer to handling function */
 	int (*func)(const char *name, char **output, void *tmp);
 };
 
@@ -432,8 +440,8 @@ apeend_port_array(const char *name, char **output,
 	}
 
 	for (i = 0; i < num; i++) {
-		spp_format_port_string(port_str, ports[i].if_type,
-				ports[i].if_no);
+		spp_format_port_string(port_str, ports[i].iface_type,
+				ports[i].iface_no);
 
 		sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
 
@@ -552,7 +560,7 @@ append_classifier_element_value(
 		return ret;
 	}
 
-	spp_format_port_string(port_str, port->if_type, port->if_no);
+	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
 	ret = append_json_str_value("type", &tmp_buff, "mac");
 	if (unlikely(ret < 0))
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index b2a3728..c5c0e3c 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -8,8 +8,8 @@
 
 /* A set of port info of rx and tx */
 struct forward_rxtx {
-	struct spp_port_info rx;
-	struct spp_port_info tx;
+	struct spp_port_info rx; /* rx port */
+	struct spp_port_info tx; /* tx port */
 };
 
 /* Information on the path used for forward. */
@@ -27,6 +27,7 @@ struct forward_info {
 	volatile int ref_index; /* index to reference area */
 	volatile int upd_index; /* index to update area    */
 	struct forward_path path[SPP_INFO_AREA_MAX];
+				/* Information of data path */
 };
 
 struct forward_info g_forward_info[RTE_MAX_LCORE];
@@ -151,12 +152,12 @@ spp_forward(int id)
 			continue;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (rx->if_type == RING)
-			spp_ringlatencystats_calculate_latency(rx->if_no,
+		if (rx->iface_type == RING)
+			spp_ringlatencystats_calculate_latency(rx->iface_no,
 					bufs, nb_rx);
 
-		if (tx->if_type == RING)
-			spp_ringlatencystats_add_time_stamp(tx->if_no,
+		if (tx->iface_type == RING)
+			spp_ringlatencystats_add_time_stamp(tx->iface_no,
 					bufs, nb_rx);
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
 
@@ -201,14 +202,14 @@ spp_forward_get_component_status(
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
 	for (cnt = 0; cnt < path->num; cnt++) {
-		rx_ports[cnt].if_type = path->ports[cnt].rx.if_type;
-		rx_ports[cnt].if_no   = path->ports[cnt].rx.if_no;
+		rx_ports[cnt].iface_type = path->ports[cnt].rx.iface_type;
+		rx_ports[cnt].iface_no   = path->ports[cnt].rx.iface_no;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
 	num_tx = (path->num > 0)?1:0;
-	tx_ports[0].if_type = path->ports[0].tx.if_type;
-	tx_ports[0].if_no   = path->ports[0].tx.if_no;
+	tx_ports[0].iface_type = path->ports[0].tx.iface_type;
+	tx_ports[0].iface_no   = path->ports[0].tx.iface_no;
 
 	/* Set the information with the function specified by the command. */
 	ret = (*params->element_proc)(
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 1756326..49c56e3 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -13,10 +13,13 @@
 #include "spp_forward.h"
 #include "command_proc.h"
 
-/* TODO(yasufum) add desc how there are used */
+/* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
+
+/* Sampling interval timer for latency evaluation */
 #define SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL 1000000
 
+/* Name string for each component */
 #define CORE_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
 #define CORE_TYPE_MERGE_STR          "merge"
 #define CORE_TYPE_FORWARD_STR        "forward"
@@ -25,10 +28,12 @@
 enum SPP_LONGOPT_RETVAL {
 	SPP_LONGOPT_RETVAL__ = 127,
 
-	/* add below */
-	/* TODO(yasufum) add description what and why add below */
-	SPP_LONGOPT_RETVAL_CLIENT_ID,
-	SPP_LONGOPT_RETVAL_VHOST_CLIENT
+	/*
+	 * Return value definition for getopt_long()
+	 * Only for long option
+	 */
+	SPP_LONGOPT_RETVAL_CLIENT_ID,   /* --client-id    */
+	SPP_LONGOPT_RETVAL_VHOST_CLIENT /* --vhost-client */
 };
 
 /* Flag of processing type to copy management information */
@@ -40,60 +45,84 @@ enum copy_mng_flg {
 
 /* Manage given options as global variable */
 struct startup_param {
-	int client_id;
+	int client_id;          /* Client ID of spp_vf */
 	char server_ip[INET_ADDRSTRLEN];
-	int server_port;
-	int vhost_client;
+				/* IP address sting of spp controller */
+	int server_port;        /* Port Number of spp controller */
+	int vhost_client;       /* Flag for --vhost-client option */
 };
 
 /* Manage number of interfaces  and port information as global variable */
-/* TODO(yasufum) refactor, change if to iface */
-struct if_info {
-	int num_nic;
-	int num_vhost;
-	int num_ring;
+struct iface_info {
+	int num_nic;            /* The number of phy */
+	int num_vhost;          /* The number of vhost */
+	int num_ring;           /* The number of ring */
 	struct spp_port_info nic[RTE_MAX_ETHPORTS];
+				/* Port information of phy */
 	struct spp_port_info vhost[RTE_MAX_ETHPORTS];
+				/* Port information of vhost */
 	struct spp_port_info ring[RTE_MAX_ETHPORTS];
+				/* Port information of ring */
 };
 
 /* Manage component running in core as global variable */
 struct core_info {
 	volatile enum spp_component_type type;
-	int num;
-	int id[RTE_MAX_LCORE];
+				/* Component type */
+	int num;                /* The number of IDs below */
+	int id[RTE_MAX_LCORE];  /* ID list of components executed on cpu core */
 };
 
 /* Manage core status and component information as global variable */
 struct core_mng_info {
+	/* Status of cpu core */
 	volatile enum spp_core_status status;
+
+	/* Index number of core information for reference */
 	volatile int ref_index;
+
+	/* Index number of core information for updating */
 	volatile int upd_index;
+
+	/* Core information of each cpu core */
 	struct core_info core[SPP_INFO_AREA_MAX];
 };
 
 /* Manage data to be backup */
 struct cancel_backup_info {
+	/* Backup data of core information */
 	struct core_mng_info core[RTE_MAX_LCORE];
+
+	/* Backup data of component information */
 	struct spp_component_info component[RTE_MAX_LCORE];
-	struct if_info interface;
+
+	/* Backup data of interface information */
+	struct iface_info interface;
 };
 
 /* Declare global variables */
-static unsigned int         g_main_lcore_id = 0xffffffff;
+/* Logical core ID for main process */
+static unsigned int g_main_lcore_id = 0xffffffff;
+
+/* Execution parameter of spp_vf */
 static struct startup_param g_startup_param;
 
-static struct if_info            g_if_info;
+/* Interface management information */
+static struct iface_info g_iface_info;
+
+/* Component management information */
 static struct spp_component_info g_component_info[RTE_MAX_LCORE];
-static struct core_mng_info      g_core_info[RTE_MAX_LCORE];
 
-/*
- * TODO(yasufum) add desc how it is used
- * and why changed component is kept
- */
+/* Core management information */
+static struct core_mng_info g_core_info[RTE_MAX_LCORE];
+
+/* Array of update indicator for core management information */
 static int g_change_core[RTE_MAX_LCORE];
+
+/* Array of update indicator for component management information */
 static int g_change_component[RTE_MAX_LCORE];
 
+/* Backup information for cancel command */
 static struct cancel_backup_info g_backup_info;
 
 /* Print help message */
@@ -444,20 +473,17 @@ parse_app_args(int argc, char *argv[])
  * Return port info of given type and num of interface
  *
  * It returns NULL value if given type is invalid.
- *
- * TODO(yasufum) refactor name of func to be more understandable (area?)
- * TODO(yasufum) refactor, change if to iface.
  */
 static struct spp_port_info *
-get_if_area(enum port_type if_type, int if_no)
+get_iface_info(enum port_type iface_type, int iface_no)
 {
-	switch (if_type) {
+	switch (iface_type) {
 	case PHY:
-		return &g_if_info.nic[if_no];
+		return &g_iface_info.nic[iface_no];
 	case VHOST:
-		return &g_if_info.vhost[if_no];
+		return &g_iface_info.vhost[iface_no];
 	case RING:
-		return &g_if_info.ring[if_no];
+		return &g_iface_info.ring[iface_no];
 	default:
 		return NULL;
 	}
@@ -516,44 +542,44 @@ dump_component_info(const struct spp_component_info *component_info)
 
 /* Dump of interface information */
 static void
-dump_interface_info(const struct if_info *if_info)
+dump_interface_info(const struct iface_info *iface_info)
 {
 	const struct spp_port_info *port = NULL;
 	int cnt = 0;
 	RTE_LOG(DEBUG, APP, "interface phy=%d, vhost=%d, ring=%d\n",
-			if_info->num_nic,
-			if_info->num_vhost,
-			if_info->num_ring);
+			iface_info->num_nic,
+			iface_info->num_vhost,
+			iface_info->num_ring);
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->nic[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->nic[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->vhost[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->vhost[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->ring[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->ring[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
@@ -564,7 +590,7 @@ static void
 dump_all_mng_info(
 		const struct core_mng_info *core,
 		const struct spp_component_info *component,
-		const struct if_info *interface)
+		const struct iface_info *interface)
 {
 	if (rte_log_get_global_level() < RTE_LOG_DEBUG)
 		return;
@@ -579,10 +605,10 @@ static void
 copy_mng_info(
 		struct core_mng_info *dst_core,
 		struct spp_component_info *dst_component,
-		struct if_info *dst_interface,
+		struct iface_info *dst_interface,
 		const struct core_mng_info *src_core,
 		const struct spp_component_info *src_component,
-		const struct if_info *src_interface,
+		const struct iface_info *src_interface,
 		enum copy_mng_flg flg)
 {
 	int upd_index = 0;
@@ -611,16 +637,16 @@ copy_mng_info(
 	memcpy(dst_component, src_component,
 			sizeof(struct spp_component_info)*RTE_MAX_LCORE);
 	memcpy(dst_interface, src_interface,
-			sizeof(struct if_info));
+			sizeof(struct iface_info));
 }
 
 /* Backup the management information */
 static void
 backup_mng_info(struct cancel_backup_info *backup)
 {
-	dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+	dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
 	copy_mng_info(backup->core, backup->component, &backup->interface,
-			g_core_info, g_component_info, &g_if_info,
+			g_core_info, g_component_info, &g_iface_info,
 			COPY_MNG_FLG_ALLCOPY);
 	dump_all_mng_info(backup->core, backup->component, &backup->interface);
 	memset(g_change_core, 0x00, sizeof(g_change_core));
@@ -632,35 +658,34 @@ static void
 cancel_mng_info(struct cancel_backup_info *backup)
 {
 	dump_all_mng_info(backup->core, backup->component, &backup->interface);
-	copy_mng_info(g_core_info, g_component_info, &g_if_info,
+	copy_mng_info(g_core_info, g_component_info, &g_iface_info,
 			backup->core, backup->component, &backup->interface,
 			COPY_MNG_FLG_ALLCOPY);
-	dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+	dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
 	memset(g_change_core, 0x00, sizeof(g_change_core));
 	memset(g_change_component, 0x00, sizeof(g_change_component));
 }
 
 /**
- * Initialize g_if_info
+ * Initialize g_iface_info
  *
- * Clear g_if_info and set initial value.
- * TODO(yasufum) refactor, change if to iface.
+ * Clear g_iface_info and set initial value.
  */
 static void
-init_if_info(void)
+init_iface_info(void)
 {
 	int port_cnt;  /* increment ether ports */
-	memset(&g_if_info, 0x00, sizeof(g_if_info));
+	memset(&g_iface_info, 0x00, sizeof(g_iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
-		g_if_info.nic[port_cnt].if_type   = UNDEF;
-		g_if_info.nic[port_cnt].if_no     = port_cnt;
-		g_if_info.nic[port_cnt].dpdk_port = -1;
-		g_if_info.vhost[port_cnt].if_type   = UNDEF;
-		g_if_info.vhost[port_cnt].if_no     = port_cnt;
-		g_if_info.vhost[port_cnt].dpdk_port = -1;
-		g_if_info.ring[port_cnt].if_type   = UNDEF;
-		g_if_info.ring[port_cnt].if_no     = port_cnt;
-		g_if_info.ring[port_cnt].dpdk_port = -1;
+		g_iface_info.nic[port_cnt].iface_type   = UNDEF;
+		g_iface_info.nic[port_cnt].iface_no     = port_cnt;
+		g_iface_info.nic[port_cnt].dpdk_port = -1;
+		g_iface_info.vhost[port_cnt].iface_type   = UNDEF;
+		g_iface_info.vhost[port_cnt].iface_no     = port_cnt;
+		g_iface_info.vhost[port_cnt].dpdk_port = -1;
+		g_iface_info.ring[port_cnt].iface_type   = UNDEF;
+		g_iface_info.ring[port_cnt].iface_no     = port_cnt;
+		g_iface_info.ring[port_cnt].dpdk_port = -1;
 	}
 }
 
@@ -695,8 +720,6 @@ init_core_info(void)
 
 /**
  * Setup port info of port on host
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 static int
 set_nic_interface(void)
@@ -704,13 +727,13 @@ set_nic_interface(void)
 	int nic_cnt = 0;
 
 	/* NIC Setting */
-	g_if_info.num_nic = rte_eth_dev_count();
-	if (g_if_info.num_nic > RTE_MAX_ETHPORTS)
-		g_if_info.num_nic = RTE_MAX_ETHPORTS;
+	g_iface_info.num_nic = rte_eth_dev_count();
+	if (g_iface_info.num_nic > RTE_MAX_ETHPORTS)
+		g_iface_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;
-		g_if_info.nic[nic_cnt].dpdk_port = nic_cnt;
+	for (nic_cnt = 0; nic_cnt < g_iface_info.num_nic; nic_cnt++) {
+		g_iface_info.nic[nic_cnt].iface_type   = PHY;
+		g_iface_info.nic[nic_cnt].dpdk_port = nic_cnt;
 	}
 
 	return 0;
@@ -718,15 +741,12 @@ set_nic_interface(void)
 
 /**
  * Setup management info for spp_vf
- *
- * TODO(yasufum) refactor, change if to iface.
- * TODO(yasufum) refactor, change function name from manage to mng or management
  */
 static int
-init_manage_data(void)
+init_mng_data(void)
 {
 	/* Initialize interface and core information */
-	init_if_info();
+	init_iface_info();
 	init_core_info();
 	init_component_info();
 
@@ -740,8 +760,6 @@ init_manage_data(void)
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 /**
  * Print statistics of time for packet processing in ring interface
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 static void
 print_ring_latency_stats(void)
@@ -758,7 +776,7 @@ 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_iface_info.ring[ring_cnt].iface_type == UNDEF)
 			continue;
 
 		spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
@@ -770,7 +788,7 @@ print_ring_latency_stats(void)
 			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_iface_info.ring[ring_cnt].iface_type == UNDEF)
 				continue;
 
 			printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
@@ -793,7 +811,7 @@ del_vhost_sockfile(struct spp_port_info *vhost)
 		return;
 
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		if (likely(vhost[cnt].if_type == UNDEF)) {
+		if (likely(vhost[cnt].iface_type == UNDEF)) {
 			/* Skip removing if it is not using vhost */
 			continue;
 		}
@@ -896,18 +914,13 @@ slave_main(void *arg __attribute__ ((unused)))
 	return ret;
 }
 
-/* TODO(yasufum) refactor, change if to iface. */
-/*
- * TODO(yasufum) change test using ut_main(),
- * or add description for what and why use it
+/**
+ * Main function
+ *
+ * Return -1 explicitly if error is occurred.
  */
-/* TODO(yasufum) change to return -1 explicitly if error is occurred. */
 int
-#ifndef USE_UT_SPP_VF
 main(int argc, char *argv[])
-#else /* ifndef USE_UT_SPP_VF */
-ut_main(int argc, char *argv[])
-#endif  /* ifndef USE_UT_SPP_VF */
 {
 	int ret = -1;
 #ifdef SPP_DEMONIZE
@@ -943,8 +956,8 @@ ut_main(int argc, char *argv[])
 		/* 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))
+		int ret_mng = init_mng_data();
+		if (unlikely(ret_mng != 0))
 			break;
 
 		int ret_classifier_mac_init = spp_classifier_mac_init();
@@ -963,7 +976,7 @@ ut_main(int argc, char *argv[])
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 		int ret_ringlatency = spp_ringlatencystats_init(
 				SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
-				g_if_info.num_ring);
+				g_iface_info.num_ring);
 		if (unlikely(ret_ringlatency != 0))
 			break;
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -1028,7 +1041,7 @@ ut_main(int argc, char *argv[])
 		 * Remove vhost sock file if it is not running
 		 *  in vhost-client mode
 		 */
-		del_vhost_sockfile(g_if_info.vhost);
+		del_vhost_sockfile(g_iface_info.vhost);
 	}
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
@@ -1047,13 +1060,14 @@ spp_get_client_id(void)
 
 /**
  * Check mac address used on the port for registering or removing
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 int
-spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
+spp_check_mac_used_port(
+		uint64_t mac_addr,
+		enum port_type iface_type,
+		int iface_no)
 {
-	struct spp_port_info *port_info = get_if_area(if_type, if_no);
+	struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
 	return (mac_addr == port_info->mac_addr);
 }
 
@@ -1061,19 +1075,19 @@ spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
  * Check if port has been added.
  */
 int
-spp_check_added_port(enum port_type if_type, int if_no)
+spp_check_added_port(enum port_type iface_type, int iface_no)
 {
-	struct spp_port_info *port = get_if_area(if_type, if_no);
-	return port->if_type != UNDEF;
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
+	return port->iface_type != UNDEF;
 }
 
 /*
  * Check if port has been flushed.
  */
 int
-spp_check_flush_port(enum port_type if_type, int if_no)
+spp_check_flush_port(enum port_type iface_type, int iface_no)
 {
-	struct spp_port_info *port = get_if_area(if_type, if_no);
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
 	return port->dpdk_port >= 0;
 }
 
@@ -1081,12 +1095,15 @@ spp_check_flush_port(enum port_type if_type, int if_no)
  * Check if component is using port.
  */
 int
-spp_check_used_port(enum port_type if_type, int if_no, enum spp_port_rxtx rxtx)
+spp_check_used_port(
+		enum port_type iface_type,
+		int iface_no,
+		enum spp_port_rxtx rxtx)
 {
 	int cnt, port_cnt, max = 0;
 	struct spp_component_info *component = NULL;
 	struct spp_port_info **port_array = NULL;
-	struct spp_port_info *port = get_if_area(if_type, if_no);
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
 
 	if (port == NULL)
 		return SPP_RET_NG;
@@ -1120,14 +1137,14 @@ 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,
+		ret = spp_check_used_port(port->iface_type, port->iface_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,
+		ret = spp_check_used_port(port->iface_type, port->iface_no,
 				SPP_PORT_RXTX_TX);
 		if (ret >= 0)
 			g_change_component[ret] = 1;
@@ -1147,7 +1164,7 @@ spp_update_classifier_table(
 
 	if (type == SPP_CLASSIFIER_TYPE_MAC) {
 		RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
-				data, port->if_type, port->if_no);
+				data, port->iface_type, port->iface_no);
 
 		ret_mac = spp_change_mac_str_to_int64(data);
 		if (unlikely(ret_mac == -1)) {
@@ -1157,15 +1174,15 @@ spp_update_classifier_table(
 		}
 		mac_addr = (uint64_t)ret_mac;
 
-		port_info = get_if_area(port->if_type, port->if_no);
+		port_info = get_iface_info(port->iface_type, port->iface_no);
 		if (unlikely(port_info == NULL)) {
 			RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
-					port->if_type, port->if_no);
+					port->iface_type, port->iface_no);
 			return SPP_RET_NG;
 		}
-		if (unlikely(port_info->if_type == UNDEF)) {
+		if (unlikely(port_info->iface_type == UNDEF)) {
 			RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
-					port->if_type, port->if_no);
+					port->iface_type, port->iface_no);
 			return SPP_RET_NG;
 		}
 
@@ -1185,7 +1202,8 @@ spp_update_classifier_table(
 			/* Setting */
 			if (unlikely(port_info->mac_addr != 0)) {
 				RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d )\n",
-						 port->if_type, port->if_no);
+						port->iface_type,
+						port->iface_no);
 				return SPP_RET_NG;
 			}
 
@@ -1194,7 +1212,6 @@ spp_update_classifier_table(
 		}
 	}
 
-	/* TODO(yasufum) add desc how it is used and why changed core is kept */
 	set_component_change_port(port_info, SPP_PORT_RXTX_TX);
 	return SPP_RET_OK;
 }
@@ -1406,7 +1423,7 @@ spp_update_port(enum spp_command_action action,
 	}
 
 	component = &g_component_info[component_id];
-	port_info = get_if_area(port->if_type, port->if_no);
+	port_info = get_iface_info(port->iface_type, port->iface_no);
 	if (rxtx == SPP_PORT_RXTX_RX) {
 		num = &component->num_rx_port;
 		ports = component->rx_ports;
@@ -1426,7 +1443,7 @@ spp_update_port(enum spp_command_action action,
 			break;
 		}
 
-		port_info->if_type = port->if_type;
+		port_info->iface_type = port->iface_type;
 		ports[*num] = port_info;
 		(*num)++;
 
@@ -1457,9 +1474,9 @@ flush_port(void)
 
 	/* Initialize added vhost. */
 	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,
+		port = &g_iface_info.vhost[cnt];
+		if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+			ret = add_vhost_pmd(port->iface_no,
 					g_startup_param.vhost_client);
 			if (ret < 0)
 				return SPP_RET_NG;
@@ -1469,9 +1486,9 @@ flush_port(void)
 
 	/* Initialize added ring. */
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &g_if_info.ring[cnt];
-		if ((port->if_type != UNDEF) && (port->dpdk_port < 0)) {
-			ret = add_ring_pmd(port->if_no);
+		port = &g_iface_info.ring[cnt];
+		if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+			ret = add_ring_pmd(port->iface_no);
 			if (ret < 0)
 				return SPP_RET_NG;
 			port->dpdk_port = ret;
@@ -1634,14 +1651,12 @@ spp_iterate_classifier_table(
 
 /**
  * Separate port id of combination of iface type and number and
- * assign to given argument, if_type and if_no.
+ * assign to given argument, iface_type and iface_no.
  *
  * For instance, 'ring:0' is separated to 'ring' and '0'.
- *
- * TODO(yasufum) change if to iface
  */
 int
-spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
+spp_get_iface_index(const char *port, enum port_type *iface_type, int *iface_no)
 {
 	enum port_type type = UNDEF;
 	const char *no_str = NULL;
@@ -1678,11 +1693,11 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
 		return -1;
 	}
 
-	*if_type = type;
-	*if_no = ret_no;
+	*iface_type = type;
+	*iface_no = ret_no;
 
 	RTE_LOG(DEBUG, APP, "Port = %s => Type = %d No = %d\n",
-			port, *if_type, *if_no);
+			port, *iface_type, *iface_no);
 	return 0;
 }
 
@@ -1690,25 +1705,25 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
  * 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)
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no)
 {
-	const char *if_type_str;
+	const char *iface_type_str;
 
-	switch (if_type) {
+	switch (iface_type) {
 	case PHY:
-		if_type_str = SPP_IFTYPE_NIC_STR;
+		iface_type_str = SPP_IFTYPE_NIC_STR;
 		break;
 	case RING:
-		if_type_str = SPP_IFTYPE_RING_STR;
+		iface_type_str = SPP_IFTYPE_RING_STR;
 		break;
 	case VHOST:
-		if_type_str = SPP_IFTYPE_VHOST_STR;
+		iface_type_str = SPP_IFTYPE_VHOST_STR;
 		break;
 	default:
 		return -1;
 	}
 
-	sprintf(port, "%s:%d", if_type_str, if_no);
+	sprintf(port, "%s:%d", iface_type_str, iface_no);
 
 	return 0;
 }
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 4ab9afe..07f2e2a 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -82,33 +82,35 @@ enum spp_command_action {
  * Interface information structure
  */
 struct spp_port_index {
-	enum port_type  if_type;
-	int             if_no;
+	enum port_type  iface_type; /* Interface type (phy/vhost/ring) */
+	int             iface_no;   /* Interface number */
 };
 
 /*
  * 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 iface_type; /* Interface type (phy/vhost/ring) */
+	int            iface_no;   /* Interface number */
+	int            dpdk_port;  /* DPDK port number */
+	uint64_t       mac_addr;   /* Mac address for classifying */
+	char           mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
 };
 
 /*
  * Component info
  */
 struct spp_component_info {
-	char name[SPP_NAME_STR_LEN];
-	enum spp_component_type type;
-	unsigned int lcore_id;
-	int component_id;
-	int num_rx_port;
-	int num_tx_port;
+	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 */
 };
 
 /*
@@ -236,20 +238,20 @@ int spp_get_component_id(const char *name);
  */
 int spp_check_mac_used_port(
 		uint64_t mac_addr,
-		enum port_type if_type,
-		int if_no);
+		enum port_type iface_type,
+		int iface_no);
 
 /*
  * Check if port has been added.
  * RETURN : True if port has been added.
  */
-int spp_check_added_port(enum port_type if_type, int if_no);
+int spp_check_added_port(enum port_type iface_type, int iface_no);
 
 /*
  * Check if port has been flushed.
  * RETURN : True if port has been flushed.
  */
-int spp_check_flush_port(enum port_type if_type, int if_no);
+int spp_check_flush_port(enum port_type iface_type, int iface_no);
 
 /*
  * Check if component is using port.
@@ -257,8 +259,8 @@ int spp_check_flush_port(enum port_type if_type, int if_no);
  * NG : SPP_RET_NG
  */
 int spp_check_used_port(
-		enum port_type if_type,
-		int if_no,
+		enum port_type iface_type,
+		int iface_no,
 		enum spp_port_rxtx rxtx);
 
 /*
@@ -274,7 +276,10 @@ int64_t spp_change_mac_str_to_int64(const char *mac);
  * OK : 0
  * NG : -1
  */
-int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
+int spp_get_iface_index(
+		const char *port,
+		enum port_type *iface_type,
+		int *iface_no);
 
 /*
  * Format port string form if-type/if-number
@@ -282,7 +287,7 @@ int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
  * OK : 0
  * NG : -1
  */
-int spp_format_port_string(char *port, enum port_type if_type, int if_no);
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
 /*
  * Change component type from string to type value.
-- 
1.9.1

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

* [spp] [PATCH 3/9] spp_vf: change header file to doxygen format
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
  2018-02-08  5:55 ` [spp] [PATCH 2/9] spp_vf: refactor comments and variable names x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 4/9] spp_vf: add BSD license x-fn-spp
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

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

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.h   |  49 ++++++-
 src/vf/command_conn.h     |  26 ++--
 src/vf/command_dec.h      | 134 ++++++++++-------
 src/vf/command_proc.h     |  13 +-
 src/vf/ringlatencystats.h |  39 ++++-
 src/vf/spp_forward.h      |  55 ++++++-
 src/vf/spp_vf.h           | 362 ++++++++++++++++++++++++++++++++++------------
 src/vf/string_buffer.h    |  14 +-
 8 files changed, 510 insertions(+), 182 deletions(-)

diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index b4e6715..b947bf7 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,12 +1,25 @@
 #ifndef _CLASSIFIER_MAC_H_
 #define _CLASSIFIER_MAC_H_
 
+/**
+ * @file
+ * SPP Classifier
+ *
+ * Classifier component provides packet forwarding function from
+ * one port to one port. Classifier has table of virtual MAC address.
+ * According to this table, classifier lookups L2 destination MAC address
+ * and determines which port to be transferred to incoming packets.
+ */
+
 /* forward declaration */
 struct spp_component_info;
 struct spp_iterate_classifier_table_params;
 
 /**
  * classifier(mac address) initialize globals.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_init(void);
 
@@ -14,10 +27,11 @@ int spp_classifier_mac_init(void);
  * classifier(mac address) update component info.
  *
  * @param component_info
- *  point to struct spp_component_info.
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of classifier.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_update(struct spp_component_info *component_info);
 
@@ -25,15 +39,27 @@ int spp_classifier_mac_update(struct spp_component_info *component_info);
  * classifier(mac address) thread function.
  *
  * @param id
- *  unique component ID.
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_do(int id);
 
-/*
- * classifier get component status
+/**
+ * classifier get component status.
+ *
+ *
+ * @param lcore_id
+ *  The logical core ID for classifier.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of classifier status.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int
 spp_classifier_get_component_status(unsigned int lcore_id, int id,
@@ -41,6 +67,13 @@ spp_classifier_get_component_status(unsigned int lcore_id, int id,
 
 /**
  * classifier(mac address) iterate classifier table.
+ *
+ * @param params
+ *  Point to struct spp_iterate_classifier_table_params.@n
+ *  Detailed data of classifier table.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params);
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index 8f3b9cf..b52ab32 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -1,6 +1,13 @@
 #ifndef _COMMAND_CONN_H_
 #define _COMMAND_CONN_H_
 
+/**
+ * @file
+ * SPP Connection
+ *
+ * Command connection management.
+ */
+
 /** result code - temporary error. please retry */
 #define SPP_CONNERR_TEMPORARY -1
 /** result code - fatal error occurred. should terminate process. */
@@ -10,10 +17,9 @@
  * initialize command connection.
  *
  * @param controller_ip
- *  controller listen ip address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
@@ -26,7 +32,7 @@ int spp_command_conn_init(const char *controller_ip, int controller_port);
  * @note bocking.
  *
  * @param sock
- *  socket that connect to controller.
+ *  Socket number for connecting to controller.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please retry.
@@ -39,7 +45,9 @@ int spp_connect_to_controller(int *sock);
  * @note non-blocking.
  *
  * @param sock
- *  socket that read data.
+ *  The socket number for the connection.
+ * @param msgbuf
+ *  The pointer to command message buffer.
  *
  * @retval 0 <                   succeeded. number of bytes received.
  * @retval 0                     no receive message.
@@ -54,13 +62,11 @@ int spp_receive_message(int *sock, char **msgbuf);
  * @note non-blocking.
  *
  * @param sock
- *  socket that write data.
- *
+ *  The socket number to be sent.
  * @param message
- *  send data.
- *
+ *  The pointer to the message to be sent.
  * @param message_len
- *  send data length.
+ *  The length of message.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect.
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 77cae87..3eb4bc4 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,29 +1,36 @@
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
-/* max number of command per request */
+/**
+ * @file
+ * SPP command decode
+ *
+ * Decode and validate the command message string.
+ */
+
+/** max number of command per request */
 #define SPP_CMD_MAX_COMMANDS 32
 
-/* maximum number of parameters per command */
+/** maximum number of parameters per command */
 #define SPP_CMD_MAX_PARAMETERS 8
 
-/* command name string buffer size (include null char) */
+/** command name string buffer size (include null char) */
 #define SPP_CMD_NAME_BUFSZ  32
 
-/* command value string buffer size (include null char) */
+/** command value string buffer size (include null char) */
 #define SPP_CMD_VALUE_BUFSZ 128
 
-/* string that specify unused */
+/** string that specify unused */
 #define SPP_CMD_UNUSE "unuse"
 
-/* decode error code */
+/** decode error code */
 enum spp_command_decode_error_code {
 	/* not use 0, in general 0 is OK */
-	SPP_CMD_DERR_BAD_FORMAT = 1,
-	SPP_CMD_DERR_UNKNOWN_COMMAND,
-	SPP_CMD_DERR_NO_PARAM,
-	SPP_CMD_DERR_BAD_TYPE,
-	SPP_CMD_DERR_BAD_VALUE,
+	SPP_CMD_DERR_BAD_FORMAT = 1,  /**< Wrong format */
+	SPP_CMD_DERR_UNKNOWN_COMMAND, /**< Unknown command */
+	SPP_CMD_DERR_NO_PARAM,        /**< No parameters */
+	SPP_CMD_DERR_BAD_TYPE,        /**< Wrong data type */
+	SPP_CMD_DERR_BAD_VALUE,       /**< Wrong value */
 };
 
 /**
@@ -33,28 +40,28 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE,
-	SPP_CMDTYPE_FLUSH,
-	SPP_CMDTYPE_CLIENT_ID,
-	SPP_CMDTYPE_STATUS,
-	SPP_CMDTYPE_EXIT,
-	SPP_CMDTYPE_COMPONENT,
-	SPP_CMDTYPE_PORT,
-	SPP_CMDTYPE_CANCEL,
+	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
+	SPP_CMDTYPE_FLUSH,            /**< flush command */
+	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
+	SPP_CMDTYPE_STATUS,           /**< status command */
+	SPP_CMDTYPE_EXIT,             /**< exit command */
+	SPP_CMDTYPE_COMPONENT,        /**< component command */
+	SPP_CMDTYPE_PORT,             /**< port command */
+	SPP_CMDTYPE_CANCEL,           /**< cancel command */
 };
 
-/* "classifier_table" command specific parameters */
+/** "classifier_table" command specific parameters */
 struct spp_command_classifier_table {
-	/* Action identifier (add or del) */
+	/** Action identifier (add or del) */
 	enum spp_command_action action;
 
-	/* Classify type (currently only for mac) */
+	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/* Value to be classified */
+	/** Value to be classified */
 	char value[SPP_CMD_VALUE_BUFSZ];
 
-	/* Destination port type and number */
+	/** Destination port type and number */
 	struct spp_port_index port;
 };
 
@@ -63,61 +70,84 @@ struct spp_command_flush {
 	/* nothing specific */
 };
 
-/* "component" command parameters */
+/** "component" command parameters */
 struct spp_command_component {
-	enum spp_command_action action; /* Action identifier (start or stop) */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Component name */
-	unsigned int core;              /* Logical core number */
-	enum spp_component_type type;   /* Component type */
+	/**< Action identifier (start or stop) */
+	enum spp_command_action action;
+
+	/**< Component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/**< Logical core number */
+	unsigned int core;
+
+	/**< Component type */
+	enum spp_component_type type;
 };
 
-/* "port" command parameters */
+/** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /* Action identifier (add or del) */
-	struct spp_port_index port;     /* Port type and number */
-	enum spp_port_rxtx rxtx;        /* rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Attached component name */
+	enum spp_command_action action; /**< Action identifier (add or del) */
+	struct spp_port_index port;     /**< Port type and number */
+	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
+	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
 };
 
-/* command parameters */
+/** command parameters */
 struct spp_command {
-	enum spp_command_type type; /* Command type */
+	enum spp_command_type type; /**< Command type */
 
 	union {
-		/* Structured data for classifier_table command  */
+		/** Structured data for classifier_table command  */
 		struct spp_command_classifier_table classifier_table;
 
-		/* Structured data for flush command  */
+		/** Structured data for flush command  */
 		struct spp_command_flush flush;
 
-		/* Structured data for component command  */
+		/** Structured data for component command  */
 		struct spp_command_component component;
 
-		/* Structured data for port command  */
+		/** Structured data for port command  */
 		struct spp_command_port port;
 	} spec;
 };
 
-/* request parameters */
+/** request parameters */
 struct spp_command_request {
-	int num_command;                /* Number of accepted commands */
-	int num_valid_command;          /* Number of executed commands */
+	int num_command;                /**< Number of accepted commands */
+	int num_valid_command;          /**< Number of executed commands */
 	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
-					/* Information of executed commands */
+					/**< Information of executed commands */
 
-	int is_requested_client_id;     /* Id for get_client_id command */
-	int is_requested_status;        /* Id for status command */
-	int is_requested_exit;          /* Id for exit command */
+	int is_requested_client_id;     /**< Id for get_client_id command */
+	int is_requested_status;        /**< Id for status command */
+	int is_requested_exit;          /**< Id for exit command */
 };
 
-/* decode error information */
+/** decode error information */
 struct spp_command_decode_error {
-	int code;                            /* Error code */
-	char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
-	char value[SPP_CMD_VALUE_BUFSZ];     /* Error value */
+	int code;                            /**< Error code */
+	char value_name[SPP_CMD_NAME_BUFSZ]; /**< Error value name */
+	char value[SPP_CMD_VALUE_BUFSZ];     /**< Error value */
 };
 
-/* decode request from no-null-terminated string */
+/**
+ * decode request from no-null-terminated string
+ *
+ * @param request
+ *  The pointer to struct spp_command_request.@n
+ *  The result value of decoding the command message.
+ * @param request_str
+ *  The pointer to requested command message.
+ * @param request_str_len
+ *  The length of requested command message.
+ * @param error
+ *  The pointer to struct spp_command_decode_error.@n
+ *  Detailed error information will be stored.
+ *
+ * @retval 0  succeeded.
+ * @retval !0 failed.
+ */
 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);
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 6b88da7..04296de 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -2,13 +2,20 @@
 #define _COMMAND_PROC_H_
 
 /**
+ * @file
+ * SPP Command processing
+ *
+ * Receive and process the command message, then send back the
+ * result JSON formatted data.
+ */
+
+/**
  * initialize command processor.
  *
  * @param controller_ip
- *  controller listen IP address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index 2e64d63..5bc230d 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -1,6 +1,13 @@
 #ifndef _RINGLATENCYSTATS_H_
 #define _RINGLATENCYSTATS_H_
 
+/**
+ * @file
+ * SPP RING latency statistics
+ *
+ * Measure the latency through ring-PMD.
+ */
+
 #include <rte_mbuf.h>
 
 /** number of slots to save latency. 0ns~99ns and 100ns over */
@@ -8,7 +15,7 @@
 
 /** ring latency statistics */
 struct spp_ringlatencystats_ring_latency_stats {
-	/**< slots to save latency */
+	/** slots to save latency */
 	uint64_t slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT];
 };
 
@@ -17,6 +24,11 @@ struct spp_ringlatencystats_ring_latency_stats {
 /**
  * initialize ring latency statistics.
  *
+ * @param samp_intvl
+ *  The interval timer(ns) to refer the counter.
+ * @param stats_count
+ *  The number of ring to be measured.
+ *
  * @retval 0: succeeded.
  * @retval -1: failed.
  */
@@ -30,7 +42,15 @@ void spp_ringlatencystats_uninit(void);
 /**
  * add time-stamp to mbuf's member.
  *
- * call at enqueue.
+ * @note call at enqueue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_add_time_stamp(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -38,7 +58,15 @@ void spp_ringlatencystats_add_time_stamp(int ring_id,
 /**
  * calculate latency.
  *
- * call at dequeue.
+ * @note call at dequeue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_calculate_latency(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -52,6 +80,11 @@ int spp_ringlatencystats_get_count(void);
 
 /**
  *get specific ring latency statistics.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param stats
+ *  The statistics values.
  */
 void spp_ringlatencystats_get_stats(int ring_id,
 		struct spp_ringlatencystats_ring_latency_stats *stats);
diff --git a/src/vf/spp_forward.h b/src/vf/spp_forward.h
index 5e5cf0f..b2965a6 100644
--- a/src/vf/spp_forward.h
+++ b/src/vf/spp_forward.h
@@ -1,21 +1,62 @@
 #ifndef __SPP_FORWARD_H__
 #define __SPP_FORWARD_H__
 
-/* Clear info */
-void spp_forward_init(void);
+/**
+ * @file
+ * SPP Forwarder and Merger
+ *
+ * Forwarder
+ * This component provides function for packet processing from one port
+ * to one port. Incoming packets from port are to be transferred to
+ * specific one port. The direction of this transferring is specified
+ * by port command.
+ * Merger
+ * This component provides packet forwarding function from multiple
+ * ports to one port. Incoming packets from multiple ports are to be
+ * transferred to one specific port. The flow of this merging process
+ * is specified by port command.
+ */
 
-/* Clear info for one element. */
-void spp_forward_init_info(int id);
+/** Clear info */
+void spp_forward_init(void);
 
-/* Update forward info */
+/**
+ * Update forward info
+ *
+ * @param component
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of forwarder and merger.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_update(struct spp_component_info *component);
 
-/*
+/**
  * Merge/Forward
+ *
+ * @param id
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_forward(int id);
 
-/* Merge/Forward get component status */
+/**
+ * Merge/Forward get component status
+ *
+ * @param lcore_id
+ *  The logical core ID for forwarder and merger.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of forwarder/merger status.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_get_component_status(
 		unsigned int lcore_id, int id,
 		struct spp_iterate_core_params *params);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 07f2e2a..70e105b 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -1,128 +1,164 @@
 #ifndef __SPP_VF_H__
 #define __SPP_VF_H__
 
+/**
+ * @file
+ * SPP_VF main
+ *
+ * Main function of spp_vf.
+ * This provides the function for initializing and starting the threads.
+ */
+
 #include "common.h"
 
+/** Identifier string for each component (status command) @{*/
 #define SPP_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
 #define SPP_TYPE_MERGE_STR          "merge"
 #define SPP_TYPE_FORWARD_STR        "forward"
 #define SPP_TYPE_UNUSE_STR          "unuse"
+/**@}*/
 
+/** Identifier string for each interface @{*/
 #define SPP_IFTYPE_NIC_STR   "phy"
 #define SPP_IFTYPE_VHOST_STR "vhost"
 #define SPP_IFTYPE_RING_STR  "ring"
+/**@}*/
 
+/** The max number of client ID */
 #define SPP_CLIENT_MAX    128
+
+/** The max number of buffer for management */
 #define SPP_INFO_AREA_MAX 2
+
+/** The length of shortest character string */
 #define SPP_MIN_STR_LEN   32
+
+/** The length of NAME string */
 #define SPP_NAME_STR_LEN  128
 
+/** Update wait timer (micro sec) */
 #define SPP_CHANGE_UPDATE_INTERVAL 10
 
+/** Character sting for default port of classifier */
 #define SPP_DEFAULT_CLASSIFIED_SPEC_STR     "default"
+
+/** Character sting for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR "00:00:00:00:00:01"
+
+/** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
-/*
+/**
  * State on component
  */
 enum spp_core_status {
-	SPP_CORE_UNUSE,
-	SPP_CORE_STOP,
-	SPP_CORE_IDLE,
-	SPP_CORE_FORWARD,
-	SPP_CORE_STOP_REQUEST,
-	SPP_CORE_IDLE_REQUEST
+	SPP_CORE_UNUSE,        /**< Not used */
+	SPP_CORE_STOP,         /**< Stopped */
+	SPP_CORE_IDLE,         /**< Idling */
+	SPP_CORE_FORWARD,      /**< Forwarding  */
+	SPP_CORE_STOP_REQUEST, /**< Request stopping */
+	SPP_CORE_IDLE_REQUEST  /**< Request idling */
 };
 
-/*
+/**
  * Process type for each component
  */
 enum spp_component_type {
-	SPP_COMPONENT_UNUSE,
-	SPP_COMPONENT_CLASSIFIER_MAC,
-	SPP_COMPONENT_MERGE,
-	SPP_COMPONENT_FORWARD,
+	SPP_COMPONENT_UNUSE,          /**< Not used */
+	SPP_COMPONENT_CLASSIFIER_MAC, /**< Classifier_mac */
+	SPP_COMPONENT_MERGE,          /**< Merger */
+	SPP_COMPONENT_FORWARD,        /**< Forwarder */
 };
 
-/*
+/**
  * Classifier Type
  */
 enum spp_classifier_type {
-	SPP_CLASSIFIER_TYPE_NONE,
-	SPP_CLASSIFIER_TYPE_MAC
+	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
+	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
 };
 
-/*
+/**
  * API Return value
  */
 enum spp_return_value {
-	SPP_RET_OK = 0,
-	SPP_RET_NG = -1,
+	SPP_RET_OK = 0,  /**< succeeded */
+	SPP_RET_NG = -1, /**< failed */
 };
 
-/* Port type (rx or tx) */
+/** Port type (rx or tx) */
 enum spp_port_rxtx {
-	SPP_PORT_RXTX_NONE,
-	SPP_PORT_RXTX_RX,
-	SPP_PORT_RXTX_TX,
-	SPP_PORT_RXTX_ALL,
+	SPP_PORT_RXTX_NONE, /**< none */
+	SPP_PORT_RXTX_RX,   /**< rx port */
+	SPP_PORT_RXTX_TX,   /**< tx port */
+	SPP_PORT_RXTX_ALL,  /**< rx/tx port */
 };
 
-/* command setting type */
+/** command setting type */
 enum spp_command_action {
-	SPP_CMD_ACTION_NONE,
-	SPP_CMD_ACTION_START,
-	SPP_CMD_ACTION_STOP,
-	SPP_CMD_ACTION_ADD,
-	SPP_CMD_ACTION_DEL,
+	SPP_CMD_ACTION_NONE,  /**< none */
+	SPP_CMD_ACTION_START, /**< start */
+	SPP_CMD_ACTION_STOP,  /**< stop */
+	SPP_CMD_ACTION_ADD,   /**< add */
+	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
-/*
+/**
  * Interface information structure
  */
 struct spp_port_index {
-	enum port_type  iface_type; /* Interface type (phy/vhost/ring) */
-	int             iface_no;   /* Interface number */
+	enum port_type  iface_type; /**< Interface type (phy/vhost/ring) */
+	int             iface_no;   /**< Interface number */
 };
 
-/*
+/**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /* Interface type (phy/vhost/ring) */
-	int            iface_no;   /* Interface number */
-	int            dpdk_port;  /* DPDK port number */
-	uint64_t       mac_addr;   /* Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
+	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
+	int            iface_no;   /**< Interface number */
+	int            dpdk_port;  /**< DPDK port number */
+	uint64_t       mac_addr;   /**< Mac address for classifying */
+	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
 };
 
-/*
+/**
  * 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 */
+	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 */
+					/**< Array of pointers to rx ports */
 	struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
-					/* Array of pointers to tx ports */
+					/**< Array of pointers to tx ports */
 };
 
-/*
+/**
  * Get client ID
- * RETURN : CLIENT ID(0~127)
+ *
+ * @return Client ID(0~127)
  */
 int spp_get_client_id(void);
 
-/*
+/**
  * Update Classifier_table
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param type
+ *  Classify type (currently only for mac)
+ * @param data
+ *  Value to be classified
+ * @param port
+ *  Destination port type and number
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_classifier_table(
 		enum spp_command_action action,
@@ -130,20 +166,40 @@ int spp_update_classifier_table(
 		const char *data,
 		const struct spp_port_index *port);
 
-/*
+/**
  * Update component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (start or stop)
+ * @param name
+ *  Component name
+ * @param lcore_id
+ *  Logical core number
+ * @param type
+ *  Component type
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_component(
 		enum spp_command_action action,
 		const char *name, unsigned int lcore_id,
 		enum spp_component_type type);
 
-/*
+/**
  * Update port
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param port
+ *  Port type and number
+ * @param rxtx
+ *  rx/tx identifier
+ * @param name
+ *  Attached component name
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_port(
 		enum spp_command_action action,
@@ -151,19 +207,20 @@ int spp_update_port(
 		enum spp_port_rxtx rxtx,
 		const char *name);
 
-/*
+/**
  * Flush SPP component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_flush(void);
 
-/*
+/**
  * Cancel data that is not flushing
  */
 void spp_cancel(void);
 
-/* definition of iterated core element procedure function */
+/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
@@ -175,16 +232,28 @@ typedef int (*spp_iterate_core_element_proc)(
 		const int num_tx,
 		const struct spp_port_index *tx_ports);
 
-/* iterate core information  parameters */
+/** iterate core information parameters */
 struct spp_iterate_core_params {
+	/** Output buffer */
 	char *output;
+
+	/** The function for creating core information */
 	spp_iterate_core_element_proc element_proc;
 };
 
-/* Iterate core information */
+/**
+ * Iterate core information
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  The value for generating core information (status command).
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
+ */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/* definition of iterated classifier element procedure function */
+/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
@@ -192,105 +261,206 @@ typedef int (*spp_iterate_classifier_element_proc)(
 		const char *data,
 		const struct spp_port_index *port);
 
-/* iterate classifier table parameters */
+/** iterate classifier table parameters */
 struct spp_iterate_classifier_table_params {
 	void *output;
 	spp_iterate_classifier_element_proc element_proc;
 };
 
-/*
+/**
  * Iterate Classifier_table
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_classifier_table_params.@n
+ *  The value for generating classifier table.
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_iterate_classifier_table(
 		struct spp_iterate_classifier_table_params *params);
 
-/* Get core status */
+/**
+ * Get core status
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Status of specified logical core.
+ */
 enum spp_core_status spp_get_core_status(unsigned int lcore_id);
 
-/* Get component type of target core */
+/**
+ * Get component type of target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component executed on specified logical core
+ */
 enum spp_component_type spp_get_component_type(unsigned int lcore_id);
 
-/* Get component type being updated on target core */
+/**
+ * Get component type being updated on target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component that will be executed on
+ *  specified logical core after update.
+ */
 enum spp_component_type spp_get_component_type_update(unsigned int lcore_id);
 
-/*
+/**
  * Get core ID of target component
- * RETURN : core ID
+ *
+ * @param component_id
+ *  unique component ID.
+ *
+ * @return
+ *  Logical core id of specified component.
  */
 unsigned int spp_get_component_core(int component_id);
 
-/*
+/**
  * Check core index change
- * RETURN : True if index has changed.
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  True if index has changed.
  */
 int spp_check_core_index(unsigned int lcore_id);
 
-/*
+/**
  * Get name matching component ID
- * OK : component ID
- * NG : SPP_RET_NG
+ *
+ * @param name
+ *  Component name.
+ *
+ * @retval 0~127      Component ID.
+ * @retval SPP_RET_NG failed.
  */
 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.
+ *
+ * @param mac_addr
+ *  Mac address to be validated.
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if target MAC address matches MAC address of port.
  */
 int spp_check_mac_used_port(
 		uint64_t mac_addr,
 		enum port_type iface_type,
 		int iface_no);
 
-/*
+/**
  * Check if port has been added.
- * RETURN : True if port has been added.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been added.
  */
 int spp_check_added_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if port has been flushed.
- * RETURN : True if port has been flushed.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been flushed.
  */
 int spp_check_flush_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if component is using port.
- * OK : match component ID
- * NG : SPP_RET_NG
+ *
+ * @param iface_type
+ *  Interface type to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ * @param rxtx
+ *  tx/rx type to be validated.
+ *
+ * @retval 0~127      match component ID
+ * @retval SPP_RET_NG failed.
  */
 int spp_check_used_port(
 		enum port_type iface_type,
 		int iface_no,
 		enum spp_port_rxtx rxtx);
 
-/*
+/**
  * Change mac address string to int64
- * OK : int64 that store mac address
- * NG : -1
+ *
+ * @param mac
+ *  Character string of MAC address to be converted.
+ *
+ * @retval 0< int64 that store mac address
+ * @retval -1
  */
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
-/*
+/**
  * Extract if-type/if-number from port string
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_get_iface_index(
 		const char *port,
 		enum port_type *iface_type,
 		int *iface_no);
 
-/*
+/**
  * Format port string form if-type/if-number
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type.
+ * @param iface_no
+ *  Interface number.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Change component type from string to type value.
+ *
+ * @param type_str
+ *  Name string for each component
+ *
+ * @return
+ *  Component type corresponding to type_str.
  */
 enum spp_component_type spp_change_component_type(const char *type_str);
 
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 60645e9..947748e 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -2,6 +2,14 @@
 #define _STRING_BUFFER_H_
 
 /**
+ * @file
+ * SPP String buffer management
+ *
+ * Management features of string buffer which is used for communicating
+ * between spp_vf and controller.
+ */
+
+/**
  * allocate string buffer from heap memory.
  *
  * @attention allocated memory must free by spp_strbuf_free function.
@@ -28,10 +36,8 @@ void spp_strbuf_free(char *strbuf);
  * @param strbuf
  *  destination string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param append
  *  string to append. normal c-string.
- *
  * @param append_len
  *  length of append string.
  *
@@ -46,9 +52,11 @@ char *spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
  * @param strbuf
  *  target string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param remove_len
  *  length of remove.
+ *
+ * @return
+ *  The pointer to removed string.
  */
 char *spp_strbuf_remove_front(char *strbuf, size_t remove_len);
 
-- 
1.9.1

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

* [spp] [PATCH 4/9] spp_vf: add BSD license
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
  2018-02-08  5:55 ` [spp] [PATCH 2/9] spp_vf: refactor comments and variable names x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 3/9] spp_vf: change header file to doxygen format x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08 15:14   ` Ferruh Yigit
  2018-02-08  5:56 ` [spp] [PATCH 5/9] spp_vf: add VLAN tag operate function to port x-fn-spp
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

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

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c   | 33 +++++++++++++++++++++++++++++++++
 src/vf/classifier_mac.h   | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_conn.c     | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_conn.h     | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_dec.c      | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_dec.h      | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_proc.c     | 33 +++++++++++++++++++++++++++++++++
 src/vf/command_proc.h     | 33 +++++++++++++++++++++++++++++++++
 src/vf/ringlatencystats.c | 33 +++++++++++++++++++++++++++++++++
 src/vf/ringlatencystats.h | 33 +++++++++++++++++++++++++++++++++
 src/vf/spp_forward.c      | 33 +++++++++++++++++++++++++++++++++
 src/vf/spp_forward.h      | 33 +++++++++++++++++++++++++++++++++
 src/vf/spp_vf.c           | 33 +++++++++++++++++++++++++++++++++
 src/vf/spp_vf.h           | 33 +++++++++++++++++++++++++++++++++
 src/vf/string_buffer.c    | 33 +++++++++++++++++++++++++++++++++
 src/vf/string_buffer.h    | 33 +++++++++++++++++++++++++++++++++
 16 files changed, 528 insertions(+)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index cd186a2..c69d337 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <stdio.h>
diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index b947bf7..157bf13 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _CLASSIFIER_MAC_H_
 #define _CLASSIFIER_MAC_H_
 
diff --git a/src/vf/command_conn.c b/src/vf/command_conn.c
index 9d4659b..4c37e00 100644
--- a/src/vf/command_conn.c
+++ b/src/vf/command_conn.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index b52ab32..076cecb 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_CONN_H_
 #define _COMMAND_CONN_H_
 
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 59e825c..f117bc9 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 3eb4bc4..2c5a5a3 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index f51c800..e6abae6 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 04296de..436e2e4 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_PROC_H_
 #define _COMMAND_PROC_H_
 
diff --git a/src/vf/ringlatencystats.c b/src/vf/ringlatencystats.c
index a866485..b6ecebb 100644
--- a/src/vf/ringlatencystats.c
+++ b/src/vf/ringlatencystats.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <stdio.h>
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index 5bc230d..67e198e 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _RINGLATENCYSTATS_H_
 #define _RINGLATENCYSTATS_H_
 
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index c5c0e3c..1c125d1 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <rte_cycles.h>
 
 #include "spp_vf.h"
diff --git a/src/vf/spp_forward.h b/src/vf/spp_forward.h
index b2965a6..c989f19 100644
--- a/src/vf/spp_forward.h
+++ b/src/vf/spp_forward.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef __SPP_FORWARD_H__
 #define __SPP_FORWARD_H__
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 49c56e3..3c3fd3f 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <getopt.h>
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 70e105b..afe72b3 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef __SPP_VF_H__
 #define __SPP_VF_H__
 
diff --git a/src/vf/string_buffer.c b/src/vf/string_buffer.c
index 28df6ae..8df72dc 100644
--- a/src/vf/string_buffer.c
+++ b/src/vf/string_buffer.c
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 947748e..be97b24 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -1,3 +1,36 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _STRING_BUFFER_H_
 #define _STRING_BUFFER_H_
 
-- 
1.9.1

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

* [spp] [PATCH 5/9] spp_vf: add VLAN tag operate function to port
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (2 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 4/9] spp_vf: add BSD license x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 6/9] spp_vf: refactor struct and variable names x-fn-spp
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Add VLAN tag operate function to port.
* Support set operation type of VLAN tag at port command.
* Support display information of VLAN tag at status command.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/Makefile         |   2 +-
 src/vf/classifier_mac.c |  23 +--
 src/vf/command_dec.c    | 104 +++++++++++-
 src/vf/command_dec.h    |  26 ++-
 src/vf/command_proc.c   | 143 ++++++++++++++--
 src/vf/spp_forward.c    |  22 +--
 src/vf/spp_port.c       | 436 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/vf/spp_port.h       | 141 ++++++++++++++++
 src/vf/spp_vf.c         |  49 +++++-
 src/vf/spp_vf.h         |  58 ++++++-
 10 files changed, 941 insertions(+), 63 deletions(-)
 create mode 100644 src/vf/spp_port.c
 create mode 100644 src/vf/spp_port.h

diff --git a/src/vf/Makefile b/src/vf/Makefile
index d54af25..fe2ef2d 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -40,7 +40,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 APP = spp_vf
 
 # all source are stored in SRCS-y
-SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c ../shared/common.c
+SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c spp_port.c ../shared/common.c
 
 CFLAGS += $(WERROR_FLAGS) -O3
 CFLAGS += -I$(SRCDIR)/../shared
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index c69d337..d050039 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -52,7 +52,7 @@
 #include <rte_hash.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "classifier_mac.h"
 
 #define RTE_LOGTYPE_SPP_CLASSIFIER_MAC RTE_LOGTYPE_USER1
@@ -366,16 +366,8 @@ transmit_packet(struct classified_data *classified_data)
 	int i;
 	uint16_t n_tx;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-	if (classified_data->iface_type == RING)
-		/* if tx-if is ring, set ringlatencystats */
-		spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
-				classified_data->pkts,
-				classified_data->num_pkt);
-#endif
-
 	/* transmit packets */
-	n_tx = rte_eth_tx_burst(classified_data->port, 0,
+	n_tx = spp_eth_tx_burst(classified_data->port, 0,
 			classified_data->pkts, classified_data->num_pkt);
 
 	/* free cannot transmit packets */
@@ -522,6 +514,8 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 {
 	if (unlikely(classifier_mng_info->ref_index ==
 			classifier_mng_info->upd_index)) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
 		transmit_all_packet(classifier_mng_info->info +
@@ -651,18 +645,11 @@ spp_classifier_mac_do(int id)
 			continue;
 
 		/* retrieve packets */
-		n_rx = rte_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (classified_data_rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->iface_no,
-					rx_pkts, n_rx);
-#endif
-
 		/* classify and transmit (filled) */
 		classify_packet(rx_pkts, n_rx, classifier_info,
 				classified_data_tx);
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index f117bc9..134e78d 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -34,6 +34,7 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <rte_ether.h>
 #include <rte_log.h>
 #include <rte_branch_prediction.h>
 
@@ -79,6 +80,18 @@ const char *PORT_RXTX_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STRINGS[] = {
+	"none",
+	"add_vlantag",
+	"del_vlantag",
+
+	/* termination */ "",
+};
+
 /* set decode error */
 inline int
 set_decode_error(struct spp_command_decode_error *error,
@@ -135,6 +148,27 @@ get_arrary_index(const char *match, const char *list[])
 	return -1;
 }
 
+/* Get int type value */
+static int
+get_int_value(
+		int *output,
+		const char *arg_val,
+		int min,
+		int max)
+{
+	int ret = 0;
+	char *endptr = NULL;
+	ret = strtol(arg_val, &endptr, 0);
+	if (unlikely(endptr == arg_val) || unlikely(*endptr != '\0'))
+		return -1;
+
+	if (unlikely(ret < min) || unlikely(ret > max))
+		return -1;
+
+	*output = ret;
+	return 0;
+}
+
 /* Get unsigned int type value */
 static int
 get_uint_value(
@@ -385,6 +419,59 @@ decode_port_name_value(void *output, const char *arg_val)
 	return decode_str_value(output, arg_val);
 }
 
+#/* decoding procedure of port ability for port command */
+static int
+decode_port_ability_value(void *output, const char *arg_val)
+{
+	int ret = 0;
+	struct spp_command_port *port = output;
+	struct spp_port_ability *ability = &port->ability;
+
+	switch (ability->ope) {
+	case SPP_PORT_ABILITY_OPE_NONE:
+		ret = get_arrary_index(arg_val, PORT_ABILITY_STRINGS);
+		if (unlikely(ret <= 0)) {
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Unknown port ability. val=%s\n",
+					arg_val);
+			return -1;
+		}
+		ability->ope  = ret;
+		ability->rxtx = port->rxtx;
+		break;
+	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		if (ability->data.vlantag.pcp == 0) {
+			ret = get_int_value(&ability->data.vlantag.vid,
+					arg_val, 0, ETH_VLAN_ID_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN ID. val=%s\n",
+						arg_val);
+				return -1;
+			}
+			ability->data.vlantag.pcp = -1;
+		} else {
+			ret = get_int_value(&ability->data.vlantag.pcp,
+					arg_val, 0, SPP_VLAN_PCP_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN PCP. val=%s\n",
+						arg_val);
+				return -1;
+			}
+		}
+		break;
+	case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		/* Nothing to do. */
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	return 0;
+}
+
 /* decoding procedure of mac address string */
 static int
 decode_mac_addr_str_value(void *output, const char *arg_val)
@@ -599,6 +686,21 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.offset = offsetof(struct spp_command, spec.port.name),
 			.func = decode_port_name_value
 		},
+		{
+			.name = "port ability 1",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 2",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 3",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
 		DECODE_PARAMETER_LIST_EMPTY,
 	},
 	{ DECODE_PARAMETER_LIST_EMPTY }, /* cancel           */
@@ -651,7 +753,7 @@ static struct decode_command_list command_list[] = {
 	{ "exit",             1, 1, NULL },     /* exit             */
 	{ "component",        3, 5, decode_command_parameter_in_list },
 						/* component        */
-	{ "port",             5, 5, decode_command_parameter_in_list },
+	{ "port",             5, 8, decode_command_parameter_in_list },
 						/* port             */
 	{ "cancel",           1, 1, NULL },     /* cancel           */
 	{ "",                 0, 0, NULL }      /* termination      */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 2c5a5a3..5111b58 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -105,25 +105,35 @@ struct spp_command_flush {
 
 /** "component" command parameters */
 struct spp_command_component {
-	/**< Action identifier (start or stop) */
+	/** Action identifier (start or stop) */
 	enum spp_command_action action;
 
-	/**< Component name */
+	/** Component name */
 	char name[SPP_CMD_NAME_BUFSZ];
 
-	/**< Logical core number */
+	/** Logical core number */
 	unsigned int core;
 
-	/**< Component type */
+	/** Component type */
 	enum spp_component_type type;
 };
 
 /** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /**< Action identifier (add or del) */
-	struct spp_port_index port;     /**< Port type and number */
-	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
+	/** Action identifier (add or del) */
+	enum spp_command_action action;
+
+	/** Port type and number */
+	struct spp_port_index port;
+
+	/** rx/tx identifier */
+	enum spp_port_rxtx rxtx;
+
+	/** Attached component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/** Port ability */
+	struct spp_port_ability ability;
 };
 
 /** command parameters */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index e6abae6..fa9a2ca 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -38,6 +38,7 @@
 #include <rte_branch_prediction.h>
 
 #include "spp_vf.h"
+#include "spp_port.h"
 #include "string_buffer.h"
 #include "command_conn.h"
 #include "command_dec.h"
@@ -88,6 +89,18 @@ struct command_response_list {
 	int (*func)(const char *name, char **output, void *tmp);
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STATUS_STRINGS[] = {
+	"none",
+	"add",
+	"del",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -244,7 +257,8 @@ execute_command(const struct spp_command *command)
 				command->spec.port.action,
 				&command->spec.port.port,
 				command->spec.port.rxtx,
-				command->spec.port.name);
+				command->spec.port.name,
+				&command->spec.port.ability);
 		break;
 
 	case SPP_CMDTYPE_CANCEL:
@@ -455,15 +469,35 @@ append_interface_value(const char *name, char **output,
 	return ret;
 }
 
-/* append a list of port numbers for JSON format */
+/* append a value of vlan for JSON format */
+static int
+append_vlan_value(char **output, const int ope, const int vid, const int pcp)
+{
+	int ret = 0;
+	ret = append_json_str_value("operation", output,
+			PORT_ABILITY_STATUS_STRINGS[ope]);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("id", output, vid);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("pcp", output, pcp);
+	if (unlikely(ret < 0))
+		return -1;
+
+	return 0;
+}
+
+/* append a block of vlan for JSON format */
 static int
-apeend_port_array(const char *name, char **output,
-		const int num, const struct spp_port_index *ports)
+append_vlan_block(const char *name, char **output,
+		const int port_id, const enum spp_port_rxtx rxtx)
 {
 	int ret = -1;
 	int i = 0;
-	char port_str[CMD_TAG_APPEND_SIZE];
-	char append_str[CMD_TAG_APPEND_SIZE];
+	struct spp_port_ability *info = NULL;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -472,15 +506,90 @@ apeend_port_array(const char *name, char **output,
 		return -1;
 	}
 
-	for (i = 0; i < num; i++) {
-		spp_format_port_string(port_str, ports[i].iface_type,
-				ports[i].iface_no);
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	for (i = 0; i < SPP_PORT_ABILITY_MAX; i++) {
+		switch (info[i].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+			ret = append_vlan_value(&tmp_buff, info[i].ope,
+					info[i].data.vlantag.vid,
+					info[i].data.vlantag.pcp);
+			if (unlikely(ret < 0))
+				return -1;
+
+			/*
+			 * Change counter to "maximum+1" for exit the loop.
+			 * An if statement after loop termination is false
+			 * by "maximum+1 ".
+			 */
+			i = SPP_PORT_ABILITY_MAX + 1;
+			break;
+		default:
+			/* not used */
+			break;
+		}
+	}
+	if (i == SPP_PORT_ABILITY_MAX) {
+		ret = append_vlan_value(&tmp_buff, SPP_PORT_ABILITY_OPE_NONE,
+				0, 0);
+		if (unlikely(ret < 0))
+			return -1;
+	}
+
+	ret = append_json_block_brackets(name, output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
 
-		sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
+/* append a block of port numbers for JSON format */
+static int
+append_port_block(char **output, const struct spp_port_index *port,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	char port_str[CMD_TAG_APPEND_SIZE];
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = port_block)\n");
+		return -1;
+	}
+
+	spp_format_port_string(port_str, port->iface_type, port->iface_no);
+	ret = append_json_str_value("port", &tmp_buff, port_str);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_vlan_block("vlan", &tmp_buff,
+			spp_get_dpdk_port(port->iface_type, port->iface_no),
+			rxtx);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_block_brackets("", output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
+
+/* append a list of port numbers for JSON format */
+static int
+append_port_array(const char *name, char **output, const int num,
+		const struct spp_port_index *ports,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	int i = 0;
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = %s)\n",
+				name);
+		return -1;
+	}
 
-		tmp_buff = spp_strbuf_append(tmp_buff, append_str,
-				strlen(append_str));
-		if (unlikely(tmp_buff == NULL))
+	for (i = 0; i < num; i++) {
+		ret = append_port_block(&tmp_buff, &ports[i], rxtx);
+		if (unlikely(ret < 0))
 			return -1;
 	}
 
@@ -528,13 +637,13 @@ append_core_element_value(
 		return ret;
 
 	if (unuse_flg) {
-		ret = apeend_port_array("rx_port", &tmp_buff,
-				num_rx, rx_ports);
+		ret = append_port_array("rx_port", &tmp_buff,
+				num_rx, rx_ports, SPP_PORT_RXTX_RX);
 		if (unlikely(ret < 0))
 			return ret;
 
-		ret = apeend_port_array("tx_port", &tmp_buff,
-				num_tx, tx_ports);
+		ret = append_port_array("tx_port", &tmp_buff,
+				num_tx, tx_ports, SPP_PORT_RXTX_TX);
 		if (unlikely(ret < 0))
 			return ret;
 	}
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 1c125d1..8d291a1 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -34,7 +34,7 @@
 #include <rte_cycles.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "spp_forward.h"
 
 #define RTE_LOGTYPE_FORWARD RTE_LOGTYPE_USER1
@@ -150,8 +150,12 @@ static inline void
 change_forward_index(int id)
 {
 	struct forward_info *info = &g_forward_info[id];
-	if (info->ref_index == info->upd_index)
+	if (info->ref_index == info->upd_index) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
+
 		info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+	}
 }
 /**
  * Forwarding packets as forwarder or merger
@@ -180,23 +184,13 @@ spp_forward(int id)
 		tx = &path->ports[cnt].tx;
 
 		/* Receive packets */
-		nb_rx = rte_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
+		nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
 		if (unlikely(nb_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(rx->iface_no,
-					bufs, nb_rx);
-
-		if (tx->iface_type == RING)
-			spp_ringlatencystats_add_time_stamp(tx->iface_no,
-					bufs, nb_rx);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
 		/* Send packets */
 		if (tx->dpdk_port >= 0)
-			nb_tx = rte_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
+			nb_tx = spp_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
 
 		/* Discard remained packets to release mbuf */
 		if (unlikely(nb_tx < nb_rx)) {
diff --git a/src/vf/spp_port.c b/src/vf/spp_port.c
new file mode 100644
index 0000000..3c6a87c
--- /dev/null
+++ b/src/vf/spp_port.c
@@ -0,0 +1,436 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_udp.h>
+#include <rte_tcp.h>
+#include <rte_net_crc.h>
+
+#include "spp_vf.h"
+#include "spp_port.h"
+#include "ringlatencystats.h"
+
+/* Port ability management information */
+struct port_ability_mng_info {
+	volatile int ref_index; /* Index to reference area */
+	volatile int upd_index; /* Index to update area    */
+	struct spp_port_ability ability[SPP_INFO_AREA_MAX]
+				[SPP_PORT_ABILITY_MAX];
+				/* Port ability information */
+};
+
+/* Port ability port information */
+struct port_ability_port_mng_info {
+	/* Interface type (phy/vhost/ring) */
+	enum port_type iface_type;
+
+	/* Interface number */
+	int            iface_no;
+
+	/* Management data of port ability for receiving */
+	struct port_ability_mng_info rx;
+
+	/* Management data of port ability for sending */
+	struct port_ability_mng_info tx;
+};
+
+/* Information for VLAN tag management. */
+struct port_ability_port_mng_info g_port_mng_info[RTE_MAX_ETHPORTS];
+
+/* TPID of VLAN. */
+static uint16_t g_vlan_tpid;
+
+/* Initialize port ability. */
+void
+spp_port_ability_init(void)
+{
+	int cnt = 0;
+	g_vlan_tpid = rte_cpu_to_be_16(ETHER_TYPE_VLAN);
+	memset(g_port_mng_info, 0x00, sizeof(g_port_mng_info));
+	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
+		g_port_mng_info[cnt].rx.ref_index = 0;
+		g_port_mng_info[cnt].rx.upd_index = 1;
+		g_port_mng_info[cnt].tx.ref_index = 0;
+		g_port_mng_info[cnt].tx.upd_index = 1;
+	}
+}
+
+/* Get information of port ability. */
+inline void
+spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info)
+{
+	struct port_ability_mng_info *mng = NULL;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &g_port_mng_info[port_id].rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &g_port_mng_info[port_id].tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+	*info = mng->ability[mng->ref_index];
+}
+
+/* Calculation and Setting of FCS. */
+static inline void
+set_fcs_packet(struct rte_mbuf *pkt)
+{
+	uint32_t *fcs = NULL;
+	fcs = rte_pktmbuf_mtod_offset(pkt, uint32_t *, pkt->data_len);
+	*fcs = rte_net_crc_calc(rte_pktmbuf_mtod(pkt, void *),
+			pkt->data_len, RTE_NET_CRC32_ETH);
+}
+
+/* Add VLAN tag to packet. */
+static inline int
+add_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data)
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	struct vlan_hdr  *vlan      = NULL;
+	const struct spp_vlantag_info *vlantag = &data->vlantag;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets with VLAN tags, only VLAN ID is updated */
+		new_ether = old_ether;
+		vlan = (struct vlan_hdr *)&new_ether[1];
+	} else {
+		/* For packets without VLAN tag, add VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_prepend(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to get additional header area.\n");
+			return -1;
+		}
+
+		rte_memcpy(new_ether, old_ether, sizeof(struct ether_hdr));
+		vlan = (struct vlan_hdr *)&new_ether[1];
+		vlan->eth_proto = new_ether->ether_type;
+		new_ether->ether_type = g_vlan_tpid;
+	}
+
+	vlan->vlan_tci = vlantag->tci;
+	set_fcs_packet(pkt);
+	return 0;
+}
+
+/* Add VLAN tag to all packets. */
+static inline int
+add_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = add_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to add VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Delete VLAN tag to packet. */
+static inline int
+del_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data __attribute__ ((unused)))
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	uint32_t *old, *new;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets without VLAN tag, delete VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_adj(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to delete unnecessary header area.\n");
+			return -1;
+		}
+
+		old = (uint32_t *)old_ether;
+		new = (uint32_t *)new_ether;
+		new[2] = old[2];
+		new[1] = old[1];
+		new[0] = old[0];
+		old[0] = 0;
+		set_fcs_packet(pkt);
+	}
+	return 0;
+}
+
+/* Delete VLAN tag to all packets. */
+static inline int
+del_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = del_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to del VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Change index of management information. */
+void
+spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx)
+{
+	int cnt;
+	static int num_rx;
+	static int rx_list[RTE_MAX_ETHPORTS];
+	static int num_tx;
+	static int tx_list[RTE_MAX_ETHPORTS];
+	struct port_ability_mng_info *mng = NULL;
+
+	if (type == PORT_ABILITY_CHG_INDEX_UPD) {
+		switch (rxtx) {
+		case SPP_PORT_RXTX_RX:
+			mng = &g_port_mng_info[port_id].rx;
+			mng->upd_index = mng->ref_index;
+			rx_list[num_rx++] = port_id;
+			break;
+		case SPP_PORT_RXTX_TX:
+			mng = &g_port_mng_info[port_id].tx;
+			mng->upd_index = mng->ref_index;
+			tx_list[num_tx++] = port_id;
+			break;
+		default:
+			/* Not used. */
+			break;
+		}
+		return;
+	}
+
+	for (cnt = 0; cnt < num_rx; cnt++) {
+		mng = &g_port_mng_info[rx_list[cnt]].rx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		rx_list[cnt] = 0;
+	}
+	for (cnt = 0; cnt < num_tx; cnt++) {
+		mng = &g_port_mng_info[tx_list[cnt]].tx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		tx_list[cnt] = 0;
+	}
+
+	num_rx = 0;
+	num_tx = 0;
+}
+
+/* Set ability data of port ability. */
+static void
+port_ability_set_ability(
+		struct spp_port_info *port,
+		enum spp_port_rxtx rxtx)
+{
+	int in_cnt, out_cnt = 0;
+	int port_id = port->dpdk_port;
+	struct port_ability_port_mng_info *port_mng = &g_port_mng_info[port_id];
+	struct port_ability_mng_info *mng         = NULL;
+	struct spp_port_ability      *in_ability  = port->ability;
+	struct spp_port_ability      *out_ability = NULL;
+	struct spp_vlantag_info      *tag         = NULL;
+
+	port_mng->iface_type = port->iface_type;
+	port_mng->iface_no   = port->iface_no;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &port_mng->rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &port_mng->tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	out_ability = mng->ability[mng->upd_index];
+	memset(out_ability, 0x00, sizeof(struct spp_port_ability)
+			* SPP_PORT_ABILITY_MAX);
+	for (in_cnt = 0; in_cnt < SPP_PORT_ABILITY_MAX; in_cnt++) {
+		if (in_ability[in_cnt].rxtx != rxtx)
+			continue;
+
+		memcpy(&out_ability[out_cnt], &in_ability[in_cnt],
+				sizeof(struct spp_port_ability));
+
+		switch (out_ability[out_cnt].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+			tag = &out_ability[out_cnt].data.vlantag;
+			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
+					tag->vid, tag->pcp));
+			break;
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		default:
+			/* Nothing to do. */
+			break;
+		}
+
+		out_cnt++;
+	}
+
+	spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_UPD,
+			port_id, rxtx);
+}
+
+/* Update port capability. */
+void
+spp_port_ability_update(const struct spp_component_info *component)
+{
+	int cnt;
+	struct spp_port_info *port = NULL;
+	for (cnt = 0; cnt < component->num_rx_port; cnt++) {
+		port = component->rx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_RX);
+	}
+
+	for (cnt = 0; cnt < component->num_tx_port; cnt++) {
+		port = component->tx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_TX);
+	}
+}
+
+/* Definition of functions that operate port abilities. */
+typedef int (*port_ability_func)(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data);
+
+/* List of functions per port ability. */
+port_ability_func port_ability_function_list[] = {
+	NULL,                    /* None */
+	add_vlantag_all_packets, /* Add VLAN tag */
+	del_vlantag_all_packets, /* Del VLAN tag */
+	NULL                     /* Termination */
+};
+
+/* Each packet operation of port capability. */
+static inline int
+port_ability_each_operation(uint16_t port_id,
+		struct rte_mbuf **pkts, const uint16_t nb_pkts,
+		enum spp_port_rxtx rxtx)
+{
+	int cnt, buf;
+	int ok_pkts = nb_pkts;
+	struct spp_port_ability *info = NULL;
+
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	if (unlikely(info[0].ope == SPP_PORT_ABILITY_OPE_NONE))
+		return nb_pkts;
+
+	for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+		if (info[cnt].ope == SPP_PORT_ABILITY_OPE_NONE)
+			break;
+
+		ok_pkts = port_ability_function_list[info[cnt].ope](
+				pkts, ok_pkts, &info->data);
+	}
+
+	/* Discard remained packets to release mbuf. */
+	if (unlikely(ok_pkts < nb_pkts)) {
+		for (buf = ok_pkts; buf < nb_pkts; buf++)
+			rte_pktmbuf_free(pkts[buf]);
+	}
+
+	return ok_pkts;
+}
+
+/* Wrapper function for rte_eth_rx_burst(). */
+inline uint16_t
+spp_eth_rx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+{
+	uint16_t nb_rx = 0;
+	nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
+	if (unlikely(nb_rx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_calculate_latency(
+				g_port_mng_info[port_id].iface_no,
+				rx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return port_ability_each_operation(port_id, rx_pkts, nb_rx,
+			SPP_PORT_RXTX_RX);
+}
+
+/* Wrapper function for rte_eth_tx_burst(). */
+inline uint16_t
+spp_eth_tx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	nb_tx = port_ability_each_operation(port_id, tx_pkts, nb_pkts,
+			SPP_PORT_RXTX_TX);
+	if (unlikely(nb_tx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_add_time_stamp(
+				g_port_mng_info[port_id].iface_no,
+				tx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return rte_eth_tx_burst(port_id, 0, tx_pkts, nb_tx);
+}
diff --git a/src/vf/spp_port.h b/src/vf/spp_port.h
new file mode 100644
index 0000000..85ba5f3
--- /dev/null
+++ b/src/vf/spp_port.h
@@ -0,0 +1,141 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __SPP_PORT_H__
+#define __SPP_PORT_H__
+
+/**
+ * @file
+ * SPP Port ability
+ *
+ * Provide about the ability per port.
+ */
+
+#include "spp_vf.h"
+
+/** Calculate TCI of VLAN tag. */
+#define SPP_VLANTAG_CALC_TCI(id, pcp) (((pcp & 0x07) << 13) | (id & 0x0fff))
+
+/** Type for changing index. */
+enum port_ability_chg_index_type {
+	/** Type for changing index to reference area. */
+	PORT_ABILITY_CHG_INDEX_REF,
+
+	/** Type for changing index to update area. */
+	PORT_ABILITY_CHG_INDEX_UPD,
+};
+
+/** Initialize port ability. */
+void spp_port_ability_init(void);
+
+/**
+ * Get information of port ability.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param info
+ *  Port ability information.
+ */
+void spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info);
+
+/**
+ * Change index of management information.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param type
+ *  Type for changing index.
+ */
+void spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx);
+
+/**
+ * Update port capability.
+ *
+ * @param component_info
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of port ability.
+ */
+void spp_port_ability_update(const struct spp_component_info *component);
+
+/**
+ * Wrapper function for rte_eth_rx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the receive queue from which to retrieve input packets.
+ *  SPP is fixed at 0.
+ * @param rx_pkts
+ *  The address of an array of pointers to *rte_mbuf* structures that
+ *  must be large enough to store *nb_pkts* pointers in it.
+ * @param nb_pkts
+ *  The maximum number of packets to retrieve.
+ *
+ * @return
+ *  The number of packets actually retrieved, which is the number
+ *  of pointers to *rte_mbuf* structures effectively supplied to the
+ *  *rx_pkts* array.
+ */
+uint16_t spp_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_tx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the transmit queue through which output packets must be sent.
+ *  SPP is fixed at 0.
+ * @param tx_pkts
+ *  The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
+ *  which contain the output packets.
+ * @param nb_pkts
+ *  The maximum number of packets to transmit.
+ *
+ * @return
+ *  The number of output packets actually stored in transmit descriptors of
+ *  the transmit ring. The return value can be less than the value of the
+ *  *tx_pkts* parameter when the transmit ring is full or has been filled up.
+ */
+uint16_t spp_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
+#endif /*  __SPP_PORT_H__ */
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 3c3fd3f..3766f92 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -45,6 +45,7 @@
 #include "classifier_mac.h"
 #include "spp_forward.h"
 #include "command_proc.h"
+#include "spp_port.h"
 
 /* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
@@ -998,6 +999,7 @@ main(int argc, char *argv[])
 			break;
 
 		spp_forward_init();
+		spp_port_ability_init();
 
 		/* Setup connection for accepting commands from controller */
 		int ret_command_init = spp_command_proc_init(
@@ -1437,12 +1439,14 @@ int
 spp_update_port(enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name)
+		const char *name,
+		const struct spp_port_ability *ability)
 {
 	int ret = SPP_RET_NG;
 	int ret_check = -1;
 	int ret_del = -1;
 	int component_id = 0;
+	int cnt = 0;
 	struct spp_component_info *component = NULL;
 	struct spp_port_info *port_info = NULL;
 	int *num = NULL;
@@ -1476,6 +1480,20 @@ spp_update_port(enum spp_command_action action,
 			break;
 		}
 
+		if (ability->ope != SPP_PORT_ABILITY_OPE_NONE) {
+			while ((cnt < SPP_PORT_ABILITY_MAX) &&
+					(port_info->ability[cnt].ope !=
+					SPP_PORT_ABILITY_OPE_NONE)) {
+				cnt++;
+			}
+			if (cnt >= SPP_PORT_ABILITY_MAX) {
+				RTE_LOG(ERR, APP, "No space of port ability.\n");
+				return SPP_RET_NG;
+			}
+			memcpy(&port_info->ability[cnt], ability,
+					sizeof(struct spp_port_ability));
+		}
+
 		port_info->iface_type = port->iface_type;
 		ports[*num] = port_info;
 		(*num)++;
@@ -1484,9 +1502,20 @@ spp_update_port(enum spp_command_action action,
 		break;
 
 	case SPP_CMD_ACTION_DEL:
+		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+			if (port_info->ability[cnt].ope ==
+					SPP_PORT_ABILITY_OPE_NONE)
+				continue;
+
+			if (port_info->ability[cnt].rxtx == rxtx)
+				memset(&port_info->ability[cnt], 0x00,
+					sizeof(struct spp_port_ability));
+		}
+
 		ret_del = get_del_port_element(port_info, *num, ports);
 		if (ret_del == 0)
 			(*num)--; /* If deleted, decrement number. */
+
 		ret = SPP_RET_OK;
 		break;
 	default:
@@ -1572,6 +1601,8 @@ flush_component(void)
 			continue;
 
 		component_info = &g_component_info[cnt];
+		spp_port_ability_update(component_info);
+
 		if (component_info->type == SPP_COMPONENT_CLASSIFIER_MAC)
 			ret = spp_classifier_mac_update(component_info);
 		else
@@ -1682,6 +1713,22 @@ spp_iterate_classifier_table(
 	return SPP_RET_OK;
 }
 
+/* Get the port number of DPDK. */
+int
+spp_get_dpdk_port(enum port_type iface_type, int iface_no)
+{
+	switch (iface_type) {
+	case PHY:
+		return g_iface_info.nic[iface_no].dpdk_port;
+	case RING:
+		return g_iface_info.ring[iface_no].dpdk_port;
+	case VHOST:
+		return g_iface_info.vhost[iface_no].dpdk_port;
+	default:
+		return -1;
+	}
+}
+
 /**
  * Separate port id of combination of iface type and number and
  * assign to given argument, iface_type and iface_no.
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index afe72b3..dcfeb00 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -81,6 +81,15 @@
 /** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
+/** Maximum number of port abilities available */
+#define SPP_PORT_ABILITY_MAX 4
+
+/** Maximum VLAN ID */
+#define SPP_VLAN_VID_MAX 4096
+
+/** Maximum VLAN PCP */
+#define SPP_VLAN_PCP_MAX 7
+
 /**
  * State on component
  */
@@ -136,6 +145,13 @@ enum spp_command_action {
 	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
+/** Port ability operation */
+enum spp_port_ability_ope {
+	SPP_PORT_ABILITY_OPE_NONE,        /**< none */
+	SPP_PORT_ABILITY_OPE_ADD_VLANTAG, /**< add VLAN tag */
+	SPP_PORT_ABILITY_OPE_DEL_VLANTAG, /**< delete VLAN tag */
+};
+
 /**
  * Interface information structure
  */
@@ -144,6 +160,26 @@ struct spp_port_index {
 	int             iface_no;   /**< Interface number */
 };
 
+/** VLAN tag information */
+struct spp_vlantag_info {
+	int vid; /**< VLAN ID */
+	int pcp; /**< Priority Code Point */
+	int tci; /**< Tag Control Information */
+};
+
+/** Data for each port ability */
+union spp_ability_data {
+	/** VLAN tag information */
+	struct spp_vlantag_info vlantag;
+};
+
+/** Port ability information */
+struct spp_port_ability {
+	enum spp_port_ability_ope ope; /**< Operation */
+	enum spp_port_rxtx rxtx;       /**< rx/tx identifier */
+	union spp_ability_data data;   /**< Port ability data */
+};
+
 /**
  * Port info
  */
@@ -153,6 +189,8 @@ struct spp_port_info {
 	int            dpdk_port;  /**< DPDK port number */
 	uint64_t       mac_addr;   /**< Mac address for classifying */
 	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
+					/**< Port ability */
 };
 
 /**
@@ -238,7 +276,8 @@ int spp_update_port(
 		enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name);
+		const char *name,
+		const struct spp_port_ability *ability);
 
 /**
  * Flush SPP component
@@ -253,8 +292,8 @@ int spp_flush(void);
  */
 void spp_cancel(void);
 
-/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
+/** definition of iterated core element procedure function */
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
 		const unsigned int lcore_id,
@@ -286,8 +325,8 @@ struct spp_iterate_core_params {
  */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
+/** definition of iterated classifier element procedure function */
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
@@ -454,6 +493,19 @@ int spp_check_used_port(
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
 /**
+ * Get the port number of DPDK.
+ *
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @return
+ *  Port id generated by DPDK.
+ */
+int spp_get_dpdk_port(enum port_type iface_type, int iface_no);
+
+/**
  * Extract if-type/if-number from port string
  *
  * @param port
-- 
1.9.1

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

* [spp] [PATCH 6/9] spp_vf: refactor struct and variable names
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (3 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 5/9] spp_vf: add VLAN tag operate function to port x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 7/9] spp_vf: add VID classification to the classifier x-fn-spp
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Change abbreviation of struct name, variable name and function name
  in classifier_mac.c.

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 314 +++++++++++++++++++++++-------------------------
 1 file changed, 152 insertions(+), 162 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index d050039..44a8dae 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -115,8 +115,8 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier information */
-struct classifier_mac_info {
+/* classifier component information */
+struct component_info {
 	/* component name */
 	char name[SPP_NAME_STR_LEN];
 
@@ -143,9 +143,9 @@ struct classifier_mac_info {
 };
 
 /* classifier management information */
-struct classifier_mac_mng_info {
+struct management_info {
 	/* classifier information */
-	struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+	struct component_info cmp_infos[NUM_CLASSIFIER_MAC_INFO];
 
 	/* Reference index number for classifier information */
 	volatile int ref_index;
@@ -155,7 +155,7 @@ struct classifier_mac_mng_info {
 };
 
 /* classifier information per lcore */
-static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
+static struct management_info g_mng_infos[RTE_MAX_LCORE];
 
 /**
  * Hash table count used for making a name of hash table
@@ -166,69 +166,70 @@ static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
 static inline int
-is_used_mng_info(const struct classifier_mac_mng_info *mng_info)
+is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL && mng_info->info[0].classifier_table != NULL);
+	return (mng_info != NULL &&
+			mng_info->cmp_infos[0].classifier_table != NULL);
 }
 
 /* initialize classifier information. */
 static int
-init_classifier_info(struct classifier_mac_info *classifier_info,
+init_component_info(struct component_info *cmp_info,
 		const struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &classifier_info->classifier_table;
+	struct rte_hash **classifier_table = &cmp_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 *clsd_data_rx =
+			&cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx =
+			cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
 
 	rte_hash_reset(*classifier_table);
-	classifier_info->num_active_classified = 0;
-	classifier_info->default_classified = -1;
-	classifier_info->n_classified_data_tx = component_info->num_tx_port;
+	cmp_info->num_active_classified = 0;
+	cmp_info->default_classified = -1;
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	if (component_info->num_rx_port == 0) {
-		classified_data_rx->iface_type      = UNDEF;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global = 0;
-		classified_data_rx->port         = 0;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->iface_type      = UNDEF;
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global = 0;
+		clsd_data_rx->port            = 0;
+		clsd_data_rx->num_pkt         = 0;
 	} else {
-		classified_data_rx->iface_type      =
+		clsd_data_rx->iface_type      =
 				component_info->rx_ports[0]->iface_type;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global =
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global =
 				component_info->rx_ports[0]->iface_no;
-		classified_data_rx->port         =
+		clsd_data_rx->port            =
 				component_info->rx_ports[0]->dpdk_port;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->num_pkt         = 0;
 	}
 
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
 
 		/* store ports information */
-		classified_data_tx[i].iface_type      = tx_port->iface_type;
-		classified_data_tx[i].iface_no        = i;
-		classified_data_tx[i].iface_no_global = tx_port->iface_no;
-		classified_data_tx[i].port         = tx_port->dpdk_port;
-		classified_data_tx[i].num_pkt      = 0;
+		clsd_data_tx[i].iface_type      = tx_port->iface_type;
+		clsd_data_tx[i].iface_no        = i;
+		clsd_data_tx[i].iface_no_global = tx_port->iface_no;
+		clsd_data_tx[i].port            = tx_port->dpdk_port;
+		clsd_data_tx[i].num_pkt         = 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->
+		cmp_info->active_classifieds[cmp_info->
 				num_active_classified++] = i;
 
 		/* store default classified */
 		if (unlikely(tx_port->mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			classifier_info->default_classified = i;
+			cmp_info->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
 					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
 					tx_port->iface_type,
@@ -267,7 +268,7 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 
 /* initialize classifier. */
 static int
-init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
 	int i;
@@ -276,15 +277,15 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
-	memset(classifier_mng_info, 0, sizeof(struct classifier_mac_mng_info));
+	memset(mng_info, 0, sizeof(struct management_info));
 	/*
 	 * Set the same value for "ref_index" and "upd_index"
 	 * so that it will not be changed from others during initialization,
 	 * and update "upd_index" after initialization is completed.
 	 * Therefore, this setting is consciously described.
 	 */
-	classifier_mng_info->ref_index = 0;
-	classifier_mng_info->upd_index = 0;
+	mng_info->ref_index = 0;
+	mng_info->upd_index = 0;
 	memset(&component_info, 0x00, sizeof(component_info));
 
 #ifdef RTE_MACHINE_CPUFLAG_SSE4_2
@@ -296,7 +297,7 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
 
 		classifier_mac_table =
-				&classifier_mng_info->info[i].classifier_table;
+				&mng_info->cmp_infos[i].classifier_table;
 
 		/* make hash table name(require uniqueness between processes) */
 		sprintf(hash_table_name, "cmtab_%07x%02hx%x",
@@ -327,8 +328,8 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* populate the classifier information at reference */
-	ret = init_classifier_info(&classifier_mng_info->
-			info[classifier_mng_info->ref_index], &component_info);
+	ret = init_component_info(&mng_info->
+			cmp_infos[mng_info->ref_index], &component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot initialize classifier mac table. ret=%d\n",
@@ -337,113 +338,112 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* updating side can be set by completion of initialization. */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index + 1;
+	mng_info->upd_index = mng_info->ref_index + 1;
 
 	return 0;
 }
 
 /* uninitialize classifier. */
 static void
-uninit_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+uninit_classifier(struct management_info *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].
+		if (mng_info->cmp_infos[i].classifier_table != NULL) {
+			rte_hash_free(mng_info->cmp_infos[i].
 					classifier_table);
-			classifier_mng_info->info[i].classifier_table = NULL;
-			classifier_mng_info->ref_index = 0;
-			classifier_mng_info->upd_index = 0;
+			mng_info->cmp_infos[i].classifier_table = NULL;
+			mng_info->ref_index = 0;
+			mng_info->upd_index = 0;
 		}
 	}
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_packet(struct classified_data *classified_data)
+transmit_packet(struct classified_data *clsd_data)
 {
 	int i;
 	uint16_t n_tx;
 
 	/* transmit packets */
-	n_tx = spp_eth_tx_burst(classified_data->port, 0,
-			classified_data->pkts, classified_data->num_pkt);
+	n_tx = spp_eth_tx_burst(clsd_data->port, 0,
+			clsd_data->pkts, clsd_data->num_pkt);
 
 	/* 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]);
+	if (unlikely(n_tx != clsd_data->num_pkt)) {
+		for (i = n_tx; i < clsd_data->num_pkt; i++)
+			rte_pktmbuf_free(clsd_data->pkts[i]);
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"drop packets(tx). num=%hu, dpdk_port=%hu\n",
-				(uint16_t)(classified_data->num_pkt - n_tx),
-				classified_data->port);
+				(uint16_t)(clsd_data->num_pkt - n_tx),
+				clsd_data->port);
 	}
 
-	classified_data->num_pkt = 0;
+	clsd_data->num_pkt = 0;
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_all_packet(struct classifier_mac_info *classifier_info)
+transmit_all_packet(struct component_info *cmp_info)
 {
 	int i;
-	struct classified_data *classified_data_tx =
-				classifier_info->classified_data_tx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 
-	for (i = 0; i < classifier_info->n_classified_data_tx; i++) {
-		if (unlikely(classified_data_tx[i].num_pkt != 0)) {
+	for (i = 0; i < cmp_info->n_classified_data_tx; i++) {
+		if (unlikely(clsd_data_tx[i].num_pkt != 0)) {
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 					"transmit all packets (drain). "
 					"index=%d, "
 					"num_pkt=%hu\n",
 					i,
-					classified_data_tx[i].num_pkt);
-			transmit_packet(&classified_data_tx[i]);
+					clsd_data_tx[i].num_pkt);
+			transmit_packet(&clsd_data_tx[i]);
 		}
 	}
 }
 
 /* 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)
+push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 {
-	classified_data->pkts[classified_data->num_pkt++] = pkt;
+	clsd_data->pkts[clsd_data->num_pkt++] = pkt;
 
 	/* transmit packet, if buffer is filled */
-	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
+	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
 				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
-				classified_data->iface_type,
-				classified_data->iface_no_global,
-				classified_data->iface_no,
-				classified_data->port,
-				classified_data->num_pkt);
-		transmit_packet(classified_data);
+				clsd_data->iface_type,
+				clsd_data->iface_no_global,
+				clsd_data->iface_no,
+				clsd_data->port,
+				clsd_data->num_pkt);
+		transmit_packet(clsd_data);
 	}
 }
 
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int i;
 
-	if (unlikely(classifier_info->num_active_classified == 0)) {
+	if (unlikely(cmp_info->num_active_classified == 0)) {
 		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));
+			(cmp_info->num_active_classified - 1));
 
-	for (i = 0; i < classifier_info->num_active_classified; i++) {
-		push_packet(pkt, classified_data +
-				(long)classifier_info->active_classifieds[i]);
+	for (i = 0; i < cmp_info->num_active_classified; i++) {
+		push_packet(pkt, clsd_data +
+				(long)cmp_info->active_classifieds[i]);
 	}
 }
 
@@ -453,8 +453,8 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
  */
 static inline void
 classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int ret;
 	int i;
@@ -466,7 +466,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
 
 		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(classifier_info->classifier_table,
+		ret = rte_hash_lookup_data(cmp_info->classifier_table,
 				(const void *)&eth->d_addr, &lookup_data);
 		if (ret < 0) {
 			/* L2 multicast(include broadcast) ? */
@@ -474,13 +474,13 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 						"multicast mac address.\n");
 				handle_l2multicast_packet(rx_pkts[i],
-						classifier_info,
-						classified_data);
+						cmp_info,
+						clsd_data);
 				continue;
 			}
 
 			/* if no default, drop packet */
-			if (unlikely(classifier_info->default_classified ==
+			if (unlikely(cmp_info->default_classified ==
 					-1)) {
 				ether_format_addr(mac_addr_str,
 						sizeof(mac_addr_str),
@@ -496,7 +496,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 			/* to default classified */
 			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 					"to default classified.\n");
-			lookup_data = (void *)(long)classifier_info->
+			lookup_data = (void *)(long)cmp_info->
 					default_classified;
 		}
 
@@ -504,27 +504,27 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		 * set mbuf pointer to tx buffer
 		 * and transmit packet, if buffer is filled
 		 */
-		push_packet(rx_pkts[i], classified_data + (long)lookup_data);
+		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
 /* change update index at classifier management information */
 static inline void
-change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
+change_update_index(struct management_info *mng_info, int id)
 {
-	if (unlikely(classifier_mng_info->ref_index ==
-			classifier_mng_info->upd_index)) {
+	if (unlikely(mng_info->ref_index ==
+			mng_info->upd_index)) {
 		/* Change reference index of port ability. */
 		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
-		transmit_all_packet(classifier_mng_info->info +
-				classifier_mng_info->ref_index);
+		transmit_all_packet(mng_info->cmp_infos +
+				mng_info->ref_index);
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"Core[%u] Change update index.\n", id);
-		classifier_mng_info->ref_index =
-				(classifier_mng_info->upd_index + 1) %
+		mng_info->ref_index =
+				(mng_info->upd_index + 1) %
 				NUM_CLASSIFIER_MAC_INFO;
 	}
 }
@@ -533,7 +533,7 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 int
 spp_classifier_mac_init(void)
 {
-	memset(g_classifier_mng_info, 0, sizeof(g_classifier_mng_info));
+	memset(g_mng_infos, 0, sizeof(g_mng_infos));
 
 	return 0;
 }
@@ -544,37 +544,34 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int id = component_info->component_id;
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
-	classifier_info = classifier_mng_info->info +
-				classifier_mng_info->upd_index;
+	cmp_info = mng_info->cmp_infos + mng_info->upd_index;
 
 	/* initialize update side classifier information */
-	ret = init_classifier_info(classifier_info, component_info);
+	ret = init_component_info(cmp_info, component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot update classifier mac. ret=%d\n", ret);
 		return ret;
 	}
-	memcpy(classifier_info->name, component_info->name, SPP_NAME_STR_LEN);
+	memcpy(cmp_info->name, component_info->name, SPP_NAME_STR_LEN);
 
 	/* change index of reference side */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index;
+	mng_info->upd_index = 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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
@@ -591,41 +588,38 @@ spp_classifier_mac_do(int id)
 	int i;
 	int n_rx;
 	unsigned int lcore_id = rte_lcore_id();
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 	struct rte_mbuf *rx_pkts[MAX_PKT_BURST];
 
-	struct classified_data *classified_data_rx = NULL;
-	struct classified_data *classified_data_tx = NULL;
+	struct classified_data *clsd_data_rx = NULL;
+	struct classified_data *clsd_data_tx = NULL;
 
 	uint64_t cur_tsc, prev_tsc = 0;
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 			US_PER_S * DRAIN_TX_PACKET_INTERVAL;
 
 	/* initialize */
-	ret = init_classifier(classifier_mng_info);
+	ret = init_classifier(mng_info);
 	if (unlikely(ret != 0))
 		return ret;
 
 	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);
+		change_update_index(mng_info, id);
 
 		/* 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;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+		clsd_data_rx = &cmp_info->classified_data_rx;
+		clsd_data_tx = cmp_info->classified_data_tx;
 
 		/* 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;
+			for (i = 0; i < cmp_info->n_classified_data_tx;
 					i++) {
-				if (likely(classified_data_tx[i].num_pkt == 0))
+				if (likely(clsd_data_tx[i].num_pkt == 0))
 					continue;
 
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
@@ -634,32 +628,31 @@ spp_classifier_mac_do(int id)
 						"num_pkt=%hu, "
 						"interval=%lu\n",
 						i,
-						classified_data_tx[i].num_pkt,
+						clsd_data_tx[i].num_pkt,
 						cur_tsc - prev_tsc);
-				transmit_packet(&classified_data_tx[i]);
+				transmit_packet(&clsd_data_tx[i]);
 			}
 			prev_tsc = cur_tsc;
 		}
 
-		if (classified_data_rx->iface_type == UNDEF)
+		if (clsd_data_rx->iface_type == UNDEF)
 			continue;
 
 		/* retrieve packets */
-		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(clsd_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
 		/* classify and transmit (filled) */
-		classify_packet(rx_pkts, n_rx, classifier_info,
-				classified_data_tx);
+		classify_packet(rx_pkts, n_rx, cmp_info, clsd_data_tx);
 	}
 
 	/* just in case */
-	change_update_index(classifier_mng_info, id);
+	change_update_index(mng_info, id);
 
 	/* uninitialize */
-	uninit_classifier(classifier_mng_info);
+	uninit_classifier(mng_info);
 
 	return 0;
 }
@@ -672,45 +665,43 @@ spp_classifier_get_component_status(
 {
 	int ret = -1;
 	int i, num_tx, num_rx = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index rx_ports[RTE_MAX_ETHPORTS];
 	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)) {
+	mng_info = g_mng_infos + id;
+	if (!is_used_mng_info(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_mng_info->ref_index;
-
-	classified_data = classifier_info->classified_data_tx;
+	cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+	clsd_data = cmp_info->classified_data_tx;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (classifier_info->classified_data_rx.iface_type != UNDEF) {
+	if (cmp_info->classified_data_rx.iface_type != UNDEF) {
 		num_rx = 1;
-		rx_ports[0].iface_type = classifier_info->
+		rx_ports[0].iface_type = cmp_info->
 				classified_data_rx.iface_type;
-		rx_ports[0].iface_no   = classifier_info->
+		rx_ports[0].iface_no   = cmp_info->
 				classified_data_rx.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
-	num_tx = classifier_info->n_classified_data_tx;
+	num_tx = cmp_info->n_classified_data_tx;
 	for (i = 0; i < num_tx; i++) {
-		tx_ports[i].iface_type = classified_data[i].iface_type;
-		tx_ports[i].iface_no   = classified_data[i].iface_no_global;
+		tx_ports[i].iface_type = clsd_data[i].iface_type;
+		tx_ports[i].iface_no   = clsd_data[i].iface_no_global;
 	}
 
 	/* Set the information with the function specified by the command. */
 	ret = (*params->element_proc)(
 		params, lcore_id,
-		classifier_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
+		cmp_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
 		num_rx, rx_ports, num_tx, tx_ports);
 	if (unlikely(ret != 0))
 		return -1;
@@ -727,31 +718,30 @@ spp_classifier_mac_iterate_table(
 	const void *key;
 	void *data;
 	uint32_t next = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index port;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
-		classifier_mng_info = g_classifier_mng_info + i;
-		if (!is_used_mng_info(classifier_mng_info))
+		mng_info = g_mng_infos + i;
+		if (!is_used_mng_info(mng_info))
 			continue;
 
-		classifier_info = classifier_mng_info->info +
-				classifier_mng_info->ref_index;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
 
-		classified_data = classifier_info->classified_data_tx;
+		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (classifier_info->default_classified >= 0) {
-			port.iface_type = (classified_data +
-					classifier_info->default_classified)->
+		if (cmp_info->default_classified >= 0) {
+			port.iface_type = (clsd_data +
+					cmp_info->default_classified)->
 					iface_type;
-			port.iface_no   = (classified_data +
-					classifier_info->default_classified)->
+			port.iface_no   = (clsd_data +
+					cmp_info->default_classified)->
 					iface_no_global;
 
 			(*params->element_proc)(
@@ -764,7 +754,7 @@ spp_classifier_mac_iterate_table(
 		next = 0;
 		while (1) {
 			ret = rte_hash_iterate(
-					classifier_info->classifier_table,
+					cmp_info->classifier_table,
 					&key, &data, &next);
 
 			if (unlikely(ret < 0))
@@ -773,9 +763,9 @@ spp_classifier_mac_iterate_table(
 			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 					(const struct ether_addr *)key);
 
-			port.iface_type = (classified_data + (long)data)->
+			port.iface_type = (clsd_data + (long)data)->
 					iface_type;
-			port.iface_no   = (classified_data + (long)data)->
+			port.iface_no   = (clsd_data + (long)data)->
 					iface_no_global;
 
 			(*params->element_proc)(
-- 
1.9.1

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

* [spp] [PATCH 7/9] spp_vf: add VID classification to the classifier
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (4 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 6/9] spp_vf: refactor struct and variable names x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 8/9] spp_vf: refactor to comply with coding style x-fn-spp
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

Existing classifier has table of virtual MAC address(A).
According to this table, classifier lookups L2 destination MAC address and
determines which port to be transferred to incoming packets.

This patch also supports vlan-tag(TPID:0x8100), and has the virtual
MAC tables for each VID(B).
If the TPID of incoming packet equals 0x8100,
then lookup these tables(B) and determines which port to be transferred.
Otherwise, incoming packet is transferred according to table(A).

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 656 +++++++++++++++++++++++++++++++++++-------------
 src/vf/command_dec.c    |  87 +++++--
 src/vf/command_dec.h    |  41 ++-
 src/vf/command_proc.c   |  41 ++-
 src/vf/spp_vf.c         | 150 ++++++-----
 src/vf/spp_vf.h         |  41 +--
 6 files changed, 728 insertions(+), 288 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 44a8dae..789492b 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -77,6 +77,9 @@
 /* interval that transmit burst packet, if buffer is not filled (nano second) */
 #define DRAIN_TX_PACKET_INTERVAL 100
 
+/* VID of VLAN untagged */
+#define VLAN_UNTAGGED_VID 0x0fff
+
 /*
  * hash table name buffer size
  *[reson for value]
@@ -115,13 +118,10 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier component information */
-struct component_info {
-	/* component name */
-	char name[SPP_NAME_STR_LEN];
-
-	/* hash table keeps classifier_table */
-	struct rte_hash *classifier_table;
+/* mac address classification */
+struct mac_classification {
+	/* hash table keeps classification */
+	struct rte_hash *classification_tab;
 
 	/* number of valid classification */
 	int num_active_classified;
@@ -131,6 +131,15 @@ struct component_info {
 
 	/* index of default classification */
 	int default_classified;
+};
+
+/* classifier component information */
+struct component_info {
+	/* component name */
+	char name[SPP_NAME_STR_LEN];
+
+	/* mac address classification per vlan-id */
+	struct mac_classification *mac_classifications[SPP_NUM_VLAN_VID];
 
 	/* number of transmission ports */
 	int n_classified_data_tx;
@@ -152,6 +161,9 @@ struct management_info {
 
 	/* Update index number for classifier information */
 	volatile int upd_index;
+
+	/* used flag */
+	volatile int is_used;
 };
 
 /* classifier information per lcore */
@@ -165,11 +177,200 @@ static struct management_info g_mng_infos[RTE_MAX_LCORE];
  */
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
+/* get vid from packet */
+static inline uint16_t
+get_vid(const struct rte_mbuf *pkt)
+{
+	struct ether_hdr *eth;
+	struct vlan_hdr *vh;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+		/* vlan tagged */
+		vh = (struct vlan_hdr *)(eth + 1);
+		return rte_be_to_cpu_16(vh->vlan_tci) & 0x0fff;
+	}
+
+	/* vlan untagged */
+	return VLAN_UNTAGGED_VID;
+}
+
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+
+#define LOG_DBG(name, fmt, ...)                                        \
+		RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,                  \
+				"[%s]Log(%s:%d):"fmt,                  \
+				name, __func__, __LINE__, __VA_ARGS__)
+
+static void
+log_packet(const char *name, struct rte_mbuf *pkt,
+		const char *func_name, int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u\n",
+			name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt));
+}
+
+#define LOG_PKT(name, pkt) \
+		log_packet(name, pkt, __func__, __LINE__)
+
+static void
+log_classification(
+		long clsd_idx,
+		struct rte_mbuf *pkt,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+	char iface_str[SPP_NAME_STR_LEN];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Classification(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u, tx_iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt),
+			iface_str);
+}
+
+#define LOG_CLS(clsd_idx, pkt, cmp_info, clsd_data)                    \
+		log_classification(clsd_idx, pkt, cmp_info, clsd_data, \
+				__func__, __LINE__)
+
+static void
+log_entry(
+		long clsd_idx,
+		uint16_t vid,
+		const char *mac_addr_str,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	char iface_str[SPP_NAME_STR_LEN];
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Entry(%s:%d). vid=%hu, mac_addr=%s, iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			vid,
+			mac_addr_str,
+			iface_str);
+}
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)           \
+		log_entry(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data, \
+				__func__, __LINE__)
+#else
+#define LOG_DBG(name, fmt, ...)
+#define LOG_PKT(name, pkt)
+#define LOG_CLS(pkt, clsd_idx, cmp_info, clsd_data)
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)
+#endif
+
+/* check if management information is used. */
 static inline int
 is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL &&
-			mng_info->cmp_infos[0].classifier_table != NULL);
+	return (mng_info != NULL && mng_info->is_used);
+}
+
+/* create mac classification instance. */
+static struct mac_classification *
+create_mac_classification(void)
+{
+	struct mac_classification *mac_cls;
+	char hash_tab_name[HASH_TABLE_NAME_BUF_SZ];
+	struct rte_hash **mac_cls_tab;
+
+	mac_cls = (struct mac_classification *)rte_zmalloc(
+			NULL, sizeof(struct mac_classification), 0);
+
+	if (unlikely(mac_cls == NULL))
+		return NULL;
+
+	mac_cls->num_active_classified = 0;
+	mac_cls->default_classified = -1;
+
+	mac_cls_tab = &mac_cls->classification_tab;
+
+	/* make hash table name(require uniqueness between processes) */
+	sprintf(hash_tab_name, "cmtab_%07x%02hx",
+			getpid(),
+			rte_atomic16_add_return(&g_hash_table_count, 1));
+
+	RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
+			hash_tab_name, HASH_TABLE_NAME_BUF_SZ);
+
+	/* set hash creating parameters */
+	struct rte_hash_parameters hash_params = {
+			.name      = hash_tab_name,
+			.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
+			.key_len   = sizeof(struct ether_addr),
+			.hash_func = DEFAULT_HASH_FUNC,
+			.hash_func_init_val = 0,
+			.socket_id = rte_socket_id(),
+	};
+
+	/* create classifier mac table (hash table) */
+	*mac_cls_tab = rte_hash_create(&hash_params);
+	if (unlikely(*mac_cls_tab == NULL)) {
+		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create mac classification table. "
+				"name=%s\n", hash_tab_name);
+		rte_free(mac_cls);
+		return NULL;
+	}
+
+	return mac_cls;
 }
 
 /* initialize classifier information. */
@@ -179,19 +380,15 @@ init_component_info(struct component_info *cmp_info,
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &cmp_info->classifier_table;
+	struct mac_classification *mac_cls;
 	struct ether_addr eth_addr;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	struct classified_data *clsd_data_rx =
-			&cmp_info->classified_data_rx;
-	struct classified_data *clsd_data_tx =
-			cmp_info->classified_data_tx;
+	struct classified_data *clsd_data_rx = &cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
+	uint16_t vid;
 
-	rte_hash_reset(*classifier_table);
-	cmp_info->num_active_classified = 0;
-	cmp_info->default_classified = -1;
-	cmp_info->n_classified_data_tx = component_info->num_tx_port;
+	/* set rx */
 	if (component_info->num_rx_port == 0) {
 		clsd_data_rx->iface_type      = UNDEF;
 		clsd_data_rx->iface_no        = 0;
@@ -209,8 +406,11 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_rx->num_pkt         = 0;
 	}
 
+	/* set tx */
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
+		vid = tx_port->class_id.vlantag.vid;
 
 		/* store ports information */
 		clsd_data_tx[i].iface_type      = tx_port->iface_type;
@@ -219,19 +419,33 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_tx[i].port            = tx_port->dpdk_port;
 		clsd_data_tx[i].num_pkt         = 0;
 
-		if (component_info->tx_ports[i]->mac_addr == 0)
+		if (tx_port->class_id.mac_addr == 0)
 			continue;
 
+		/* if mac classification is NULL, make instance */
+		if (unlikely(cmp_info->mac_classifications[vid] == NULL)) {
+			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
+					"Mac classification is not registered. create."
+					"vid=%hu\n", vid);
+			cmp_info->mac_classifications[vid] =
+					create_mac_classification();
+			if (unlikely(cmp_info->mac_classifications[vid] ==
+					NULL))
+				return -1;
+		}
+		mac_cls = cmp_info->mac_classifications[vid];
+
 		/* store active tx_port that associate with mac address */
-		cmp_info->active_classifieds[cmp_info->
-				num_active_classified++] = i;
+		mac_cls->active_classifieds[
+				mac_cls->num_active_classified++] = i;
 
 		/* store default classified */
-		if (unlikely(tx_port->mac_addr ==
+		if (unlikely(tx_port->class_id.mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			cmp_info->default_classified = i;
+			mac_cls->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
-					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					"vid=%hu, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					vid,
 					tx_port->iface_type,
 					tx_port->iface_no,
 					tx_port->dpdk_port);
@@ -239,24 +453,24 @@ init_component_info(struct component_info *cmp_info,
 		}
 
 		/* add entry to classifier mac table */
-		rte_memcpy(&eth_addr, &tx_port->mac_addr, ETHER_ADDR_LEN);
+		rte_memcpy(&eth_addr, &tx_port->class_id.mac_addr,
+				ETHER_ADDR_LEN);
 		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 				&eth_addr);
 
-		ret = rte_hash_add_key_data(*classifier_table,
+		ret = rte_hash_add_key_data(mac_cls->classification_tab,
 				(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);
-			rte_hash_free(*classifier_table);
-			*classifier_table = NULL;
+					"ret=%d, vid=%hu, mac_addr=%s\n",
+					ret, vid, mac_addr_str);
 			return -1;
 		}
 
 		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. "
-				"mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				"vid=%hu, mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				vid,
 				mac_addr_str,
 				tx_port->iface_type,
 				tx_port->iface_no,
@@ -271,10 +485,6 @@ static int
 init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
-	int i;
-	char hash_table_name[HASH_TABLE_NAME_BUF_SZ];
-
-	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
 	memset(mng_info, 0, sizeof(struct management_info));
@@ -294,39 +504,6 @@ init_classifier(struct management_info *mng_info)
 	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 =
-				&mng_info->cmp_infos[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);
-
-		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
-				hash_table_name, HASH_TABLE_NAME_BUF_SZ);
-
-		/* set hash creating parameters */
-		struct rte_hash_parameters hash_params = {
-				.name      = hash_table_name,
-				.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
-				.key_len   = sizeof(struct ether_addr),
-				.hash_func = DEFAULT_HASH_FUNC,
-				.hash_func_init_val = 0,
-				.socket_id = rte_socket_id(),
-		};
-
-		/* create classifier mac table (hash table) */
-		*classifier_mac_table = rte_hash_create(&hash_params);
-		if (unlikely(*classifier_mac_table == NULL)) {
-			RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create classifier mac table. "
-					"name=%s\n", hash_table_name);
-			return -1;
-		}
-	}
-
 	/* populate the classifier information at reference */
 	ret = init_component_info(&mng_info->
 			cmp_infos[mng_info->ref_index], &component_info);
@@ -339,25 +516,48 @@ init_classifier(struct management_info *mng_info)
 
 	/* updating side can be set by completion of initialization. */
 	mng_info->upd_index = mng_info->ref_index + 1;
+	mng_info->is_used = 1;
 
 	return 0;
 }
 
+/* free mac classification instance. */
+static inline void
+free_mac_classification(struct mac_classification *mac_cls)
+{
+	if (mac_cls == NULL)
+		return;
+
+	if (mac_cls->classification_tab != NULL)
+		rte_hash_free(mac_cls->classification_tab);
+
+	rte_free(mac_cls);
+}
+
+/* uninitialize classifier information. */
+static void
+uninit_component_info(struct component_info *cmp_info)
+{
+	int i;
+
+	for (i = 0; i < SPP_NUM_VLAN_VID; ++i)
+		free_mac_classification(cmp_info->mac_classifications[i]);
+
+	memset(cmp_info, 0, sizeof(struct component_info));
+}
+
 /* uninitialize classifier. */
 static void
 uninit_classifier(struct management_info *mng_info)
 {
 	int i;
 
-	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
-		if (mng_info->cmp_infos[i].classifier_table != NULL) {
-			rte_hash_free(mng_info->cmp_infos[i].
-					classifier_table);
-			mng_info->cmp_infos[i].classifier_table = NULL;
-			mng_info->ref_index = 0;
-			mng_info->upd_index = 0;
-		}
-	}
+	mng_info->is_used = 0;
+
+	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
+		uninit_component_info(mng_info->cmp_infos + (long)i);
+
+	memset(mng_info, 0, sizeof(struct management_info));
 }
 
 /* transmit packet to one destination. */
@@ -414,7 +614,8 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
-				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+				"iface_type=%d, iface_no={%d,%d}, "
+				"tx_port=%hu, num_pkt=%hu\n",
 				clsd_data->iface_type,
 				clsd_data->iface_no_global,
 				clsd_data->iface_no,
@@ -424,6 +625,22 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	}
 }
 
+/* get index of general default classified */
+static inline int
+get_general_default_classified_index(struct component_info *cmp_info)
+{
+	struct mac_classification *mac_cls;
+
+	mac_cls = cmp_info->mac_classifications[VLAN_UNTAGGED_VID];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Untagged's default is not set. vid=%d\n",
+				(int)VLAN_UNTAGGED_VID);
+		return -1;
+	}
+
+	return mac_cls->default_classified;
+}
+
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
@@ -431,20 +648,103 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
 		struct classified_data *clsd_data)
 {
 	int i;
+	struct mac_classification *mac_cls;
+	uint16_t vid = get_vid(pkt);
+	int gen_def_clsd_idx = get_general_default_classified_index(cmp_info);
+	int n_act_clsd;
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL ||
+			mac_cls->num_active_classified == 0)) {
+		/* specific vlan is not registered
+		 * use untagged's default(as general default)
+		 */
+		if (unlikely(gen_def_clsd_idx < 0)) {
+			/* untagged's default is not registered too */
+			RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
+					"No entry.(l2 multicast packet)\n");
+			rte_pktmbuf_free(pkt);
+			return;
+		}
 
-	if (unlikely(cmp_info->num_active_classified == 0)) {
-		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "No mac address.(l2 multicast packet)\n");
-		rte_pktmbuf_free(pkt);
+		/* transmit to untagged's default(as general default) */
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
 		return;
 	}
 
-	rte_mbuf_refcnt_update(pkt,
-			(cmp_info->num_active_classified - 1));
+	/* add to mbuf's refcnt */
+	n_act_clsd = mac_cls->num_active_classified;
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID)
+		++n_act_clsd;
 
-	for (i = 0; i < cmp_info->num_active_classified; i++) {
+	rte_mbuf_refcnt_update(pkt, (int16_t)(n_act_clsd - 1));
+
+	/* transmit to specific segment & general default */
+	for (i = 0; i < mac_cls->num_active_classified; i++) {
+		LOG_CLS((long)mac_cls->active_classifieds[i],
+				pkt, cmp_info, clsd_data);
 		push_packet(pkt, clsd_data +
-				(long)cmp_info->active_classifieds[i]);
+				(long)mac_cls->active_classifieds[i]);
+	}
+
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID) {
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
+	}
+}
+
+/* select index of classified */
+static inline int
+select_classified_index(const struct rte_mbuf *pkt,
+		struct component_info *cmp_info)
+{
+	int ret;
+	struct ether_hdr *eth;
+	void *lookup_data;
+	struct mac_classification *mac_cls;
+	uint16_t vid;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Mac classification is not registered. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
+	}
+
+	/* find in table (by destination mac address) */
+	ret = rte_hash_lookup_data(mac_cls->classification_tab,
+			(const void *)&eth->d_addr, &lookup_data);
+	if (ret >= 0) {
+		LOG_DBG(cmp_info->name, "Mac address is registered. ret=%d, vid=%hu\n",
+				ret, vid);
+		return (int)(long)lookup_data;
+	}
+
+	LOG_DBG(cmp_info->name,
+			"Mac address is not registered. ret=%d, (EINVAL=%d, ENOENT=%d)\n",
+			ret, EINVAL, ENOENT);
+
+	/* check if packet is l2 multicast */
+	if (unlikely(is_multicast_ether_addr(&eth->d_addr)))
+		return -2;
+
+	/* if default is not set, use untagged's default */
+	if (unlikely(mac_cls->default_classified < 0 &&
+			vid != VLAN_UNTAGGED_VID)) {
+		LOG_DBG(cmp_info->name, "Vid's default is not set. use general default. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
 	}
+
+	/* use default */
+	LOG_DBG(cmp_info->name, "Use vid's default. vid=%hu\n", vid);
+	return mac_cls->default_classified;
 }
 
 /*
@@ -456,55 +756,29 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		struct component_info *cmp_info,
 		struct classified_data *clsd_data)
 {
-	int ret;
 	int i;
-	struct ether_hdr *eth;
-	void *lookup_data;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	long clsd_idx;
 
 	for (i = 0; i < n_rx; i++) {
-		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
-
-		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(cmp_info->classifier_table,
-				(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],
-						cmp_info,
-						clsd_data);
-				continue;
-			}
-
-			/* if no default, drop packet */
-			if (unlikely(cmp_info->default_classified ==
-					-1)) {
-				ether_format_addr(mac_addr_str,
-						sizeof(mac_addr_str),
-						&eth->d_addr);
-				RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-						"unknown mac address. "
-						"ret=%d, mac_addr=%s\n",
-						ret, mac_addr_str);
-				rte_pktmbuf_free(rx_pkts[i]);
-				continue;
-			}
-
-			/* to default classified */
-			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-					"to default classified.\n");
-			lookup_data = (void *)(long)cmp_info->
-					default_classified;
+		LOG_PKT(cmp_info->name, rx_pkts[i]);
+
+		clsd_idx = select_classified_index(rx_pkts[i], cmp_info);
+		LOG_CLS(clsd_idx, rx_pkts[i], cmp_info, clsd_data);
+
+		if (likely(clsd_idx >= 0)) {
+			LOG_DBG(cmp_info->name, "as unicast packet. i=%d\n",
+					i);
+			push_packet(rx_pkts[i], clsd_data + clsd_idx);
+		} else if (unlikely(clsd_idx == -1)) {
+			LOG_DBG(cmp_info->name, "no destination. drop packet. i=%d\n",
+					i);
+			rte_pktmbuf_free(rx_pkts[i]);
+		} else if (unlikely(clsd_idx == -2)) {
+			LOG_DBG(cmp_info->name, "as multicast packet. i=%d\n",
+					i);
+			handle_l2multicast_packet(rx_pkts[i],
+					cmp_info, clsd_data);
 		}
-
-		/*
-		 * set mbuf pointer to tx buffer
-		 * and transmit packet, if buffer is filled
-		 */
-		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
@@ -574,6 +848,9 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
+	/* uninitialize old */
+	uninit_component_info(mng_info->cmp_infos + mng_info->upd_index);
+
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"Component[%u] Complete update component.\n", id);
 
@@ -601,8 +878,10 @@ spp_classifier_mac_do(int id)
 
 	/* initialize */
 	ret = init_classifier(mng_info);
-	if (unlikely(ret != 0))
+	if (unlikely(ret != 0)) {
+		uninit_classifier(mng_info);
 		return ret;
+	}
 
 	while (likely(spp_get_core_status(lcore_id) == SPP_CORE_FORWARD) &&
 			likely(spp_check_core_index(lcore_id) == 0)) {
@@ -709,20 +988,79 @@ spp_classifier_get_component_status(
 	return 0;
 }
 
+static void
+mac_classification_iterate_table(
+		struct spp_iterate_classifier_table_params *params,
+		uint16_t vid,
+		struct mac_classification *mac_cls,
+		__rte_unused struct component_info *cmp_info,
+		struct classified_data *clsd_data)
+{
+	int ret;
+	const void *key;
+	void *data;
+	uint32_t next;
+	struct spp_port_index port;
+	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	enum spp_classifier_type type;
+
+	type = SPP_CLASSIFIER_TYPE_VLAN;
+	if (unlikely(vid == VLAN_UNTAGGED_VID))
+		type = SPP_CLASSIFIER_TYPE_MAC;
+
+	if (mac_cls->default_classified >= 0) {
+		port.iface_type = (clsd_data +
+				mac_cls->default_classified)->iface_type;
+		port.iface_no   = (clsd_data +
+				mac_cls->default_classified)->iface_no_global;
+
+		LOG_ENT((long)mac_cls->default_classified,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				&port);
+	}
+
+	next = 0;
+	while (1) {
+		ret = rte_hash_iterate(mac_cls->classification_tab,
+				&key, &data, &next);
+
+		if (unlikely(ret < 0))
+			break;
+
+		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
+				(const struct ether_addr *)key);
+
+		port.iface_type = (clsd_data + (long)data)->iface_type;
+		port.iface_no   = (clsd_data + (long)data)->iface_no_global;
+
+		LOG_ENT((long)data, vid, mac_addr_str, cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				mac_addr_str,
+				&port);
+	}
+}
+
 /* classifier(mac address) iterate classifier table. */
 int
 spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params)
 {
-	int ret, i;
-	const void *key;
-	void *data;
-	uint32_t next = 0;
+	int i, n;
 	struct management_info *mng_info;
 	struct component_info *cmp_info;
 	struct classified_data *clsd_data;
-	struct spp_port_index port;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		mng_info = g_mng_infos + i;
@@ -730,49 +1068,21 @@ spp_classifier_mac_iterate_table(
 			continue;
 
 		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-
 		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (cmp_info->default_classified >= 0) {
-			port.iface_type = (clsd_data +
-					cmp_info->default_classified)->
-					iface_type;
-			port.iface_no   = (clsd_data +
-					cmp_info->default_classified)->
-					iface_no_global;
-
-			(*params->element_proc)(
-					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					SPP_DEFAULT_CLASSIFIED_SPEC_STR,
-					&port);
-		}
-
-		next = 0;
-		while (1) {
-			ret = rte_hash_iterate(
-					cmp_info->classifier_table,
-					&key, &data, &next);
-
-			if (unlikely(ret < 0))
-				break;
-
-			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
-					(const struct ether_addr *)key);
-
-			port.iface_type = (clsd_data + (long)data)->
-					iface_type;
-			port.iface_no   = (clsd_data + (long)data)->
-					iface_no_global;
+		for (n = 0; n < SPP_NUM_VLAN_VID; ++n) {
+			if (cmp_info->mac_classifications[n] == NULL)
+				continue;
 
-			(*params->element_proc)(
+			mac_classification_iterate_table(
 					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					mac_addr_str,
-					&port);
+					(uint16_t)n,
+					cmp_info->mac_classifications[n],
+					cmp_info,
+					clsd_data);
 		}
 	}
 
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 134e78d..39c2939 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -50,6 +50,7 @@
 const char *CLASSIFILER_TYPE_STRINGS[] = {
 	"none",
 	"mac",
+	"vlan",
 
 	/* termination */ "",
 };
@@ -534,21 +535,18 @@ decode_classifier_type_value(void *output, const char *arg_val)
 	return 0;
 }
 
-/* decoding procedure of value for classifier_table command */
+/* decoding procedure of vlan id for classifier_table command */
 static int
-decode_classifier_value_value(void *output, const char *arg_val)
+decode_classifier_vid_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,
+	ret = get_int_value(output, arg_val, 0, ETH_VLAN_ID_MAX);
+	if (unlikely(ret < 0)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad VLAN ID. val=%s\n",
 				arg_val);
-		break;
-	default:
-		break;
+		return -1;
 	}
-	return ret;
+	return 0;
 }
 
 /* decoding procedure of port for classifier_table command */
@@ -570,20 +568,24 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		return -1;
 	}
 
+	if (classifier_table->type == SPP_CLASSIFIER_TYPE_MAC)
+		classifier_table->vid = ETH_VLAN_ID_MAX;
+
 	if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) {
-		if (!spp_check_mac_used_port(0, tmp_port.iface_type,
-				tmp_port.iface_no)) {
+		if (!spp_check_classid_used_port(ETH_VLAN_ID_MAX, 0,
+				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
 			return -1;
 		}
 	} else if (unlikely(classifier_table->action == SPP_CMD_ACTION_DEL)) {
-		mac_addr = spp_change_mac_str_to_int64(classifier_table->value);
+		mac_addr = spp_change_mac_str_to_int64(classifier_table->mac);
 		if (mac_addr < 0)
 			return -1;
 
-		if (!spp_check_mac_used_port((uint64_t)mac_addr,
+		if (!spp_check_classid_used_port(classifier_table->vid,
+				(uint64_t)mac_addr,
 				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
@@ -609,7 +611,7 @@ struct decode_parameter_list {
 
 /* parameter list for each command */
 static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
-	{                                /* classifier_table */
+	{                                /* classifier_table(mac) */
 		{
 			.name = "action",
 			.offset = offsetof(struct spp_command,
@@ -623,10 +625,43 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.func = decode_classifier_type_value
 		},
 		{
-			.name = "value",
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
+		},
+		{
+			.name = "port",
 			.offset = offsetof(struct spp_command,
 					spec.classifier_table),
-			.func = decode_classifier_value_value
+			.func = decode_classifier_port_value
+		},
+		DECODE_PARAMETER_LIST_EMPTY,
+	},
+	{                                /* classifier_table(VLAN) */
+		{
+			.name = "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),
+			.func = decode_classifier_type_value
+		},
+		{
+			.name = "vlan id",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.vid),
+			.func = decode_classifier_vid_value
+		},
+		{
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
 		},
 		{
 			.name = "port",
@@ -746,7 +781,9 @@ struct decode_command_list {
 /* command list */
 static struct decode_command_list command_list[] = {
 	{ "classifier_table", 5, 5, decode_command_parameter_in_list },
-						/* classifier_table */
+						/* classifier_table(mac) */
+	{ "classifier_table", 6, 6, decode_command_parameter_in_list },
+						/* classifier_table(vlan) */
 	{ "flush",            1, 1, NULL },     /* flush            */
 	{ "_get_client_id",   1, 1, NULL },     /* _get_client_id   */
 	{ "status",           1, 1, NULL },     /* status           */
@@ -766,6 +803,7 @@ decode_command_in_list(struct spp_command_request *request,
 			struct spp_command_decode_error *error)
 {
 	int ret = 0;
+	int command_name_check = 0;
 	struct decode_command_list *list = NULL;
 	int i = 0;
 	int argc = 0;
@@ -791,11 +829,8 @@ decode_command_in_list(struct spp_command_request *request,
 
 		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);
+			command_name_check = 1;
+			continue;
 		}
 
 		request->commands[0].type = i;
@@ -805,6 +840,12 @@ decode_command_in_list(struct spp_command_request *request,
 		return 0;
 	}
 
+	if (command_name_check != 0) {
+		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);
+	}
+
 	RTE_LOG(ERR, SPP_COMMAND_PROC,
 			"Unknown command. command=%s, request_str=%s\n",
 			argv[0], request_str);
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 5111b58..3876344 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -73,14 +73,32 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
-	SPP_CMDTYPE_FLUSH,            /**< flush command */
-	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
-	SPP_CMDTYPE_STATUS,           /**< status command */
-	SPP_CMDTYPE_EXIT,             /**< exit command */
-	SPP_CMDTYPE_COMPONENT,        /**< component command */
-	SPP_CMDTYPE_PORT,             /**< port command */
-	SPP_CMDTYPE_CANCEL,           /**< cancel command */
+	/** classifier_table command(mac) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_MAC,
+
+	/** classifier_table command(VLAN) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN,
+
+	/** flush command */
+	SPP_CMDTYPE_FLUSH,
+
+	/** get_client_id command */
+	SPP_CMDTYPE_CLIENT_ID,
+
+	/** status command */
+	SPP_CMDTYPE_STATUS,
+
+	/** exit command */
+	SPP_CMDTYPE_EXIT,
+
+	/** component command */
+	SPP_CMDTYPE_COMPONENT,
+
+	/** port command */
+	SPP_CMDTYPE_PORT,
+
+	/** cancel command */
+	SPP_CMDTYPE_CANCEL,
 };
 
 /** "classifier_table" command specific parameters */
@@ -91,8 +109,11 @@ struct spp_command_classifier_table {
 	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/** Value to be classified */
-	char value[SPP_CMD_VALUE_BUFSZ];
+	/** VLAN ID to be classified */
+	int vid;
+
+	/** MAC address to be classified */
+	char mac[SPP_CMD_VALUE_BUFSZ];
 
 	/** Destination port type and number */
 	struct spp_port_index port;
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index fa9a2ca..ca7f5ca 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -101,6 +101,18 @@ const char *PORT_ABILITY_STATUS_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * classifier type string list
+ * do it same as the order of enum spp_classifier_type (spp_vf.h)
+ */
+const char *CLASSIFILER_TYPE_STATUS_STRINGS[] = {
+	"none",
+	"mac",
+	"vlan",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -225,13 +237,15 @@ execute_command(const struct spp_command *command)
 	int ret = 0;
 
 	switch (command->type) {
-	case SPP_CMDTYPE_CLASSIFIER_TABLE:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_MAC:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN:
 		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,
-				command->spec.classifier_table.value,
+				command->spec.classifier_table.vid,
+				command->spec.classifier_table.mac,
 				&command->spec.classifier_table.port);
 		break;
 
@@ -687,13 +701,14 @@ append_core_value(const char *name, char **output,
 static int
 append_classifier_element_value(
 		struct spp_iterate_classifier_table_params *params,
-		__rte_unused enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type,
+		int vid, const char *mac,
 		const struct spp_port_index *port)
 {
 	int ret = -1;
 	char *buff, *tmp_buff;
 	char port_str[CMD_TAG_APPEND_SIZE];
+	char value_str[SPP_MIN_STR_LEN];
 	buff = params->output;
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
@@ -704,11 +719,25 @@ append_classifier_element_value(
 
 	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
-	ret = append_json_str_value("type", &tmp_buff, "mac");
+	ret = append_json_str_value("type", &tmp_buff,
+			CLASSIFILER_TYPE_STATUS_STRINGS[type]);
 	if (unlikely(ret < 0))
 		return ret;
 
-	ret = append_json_str_value("value", &tmp_buff, data);
+	memset(value_str, 0x00, SPP_MIN_STR_LEN);
+	switch (type) {
+	case SPP_CLASSIFIER_TYPE_MAC:
+		sprintf(value_str, "%s", mac);
+		break;
+	case SPP_CLASSIFIER_TYPE_VLAN:
+		sprintf(value_str, "%d/%s", vid, mac);
+		break;
+	default:
+		/* not used */
+		break;
+	}
+
+	ret = append_json_str_value("value", &tmp_buff, value_str);
 	if (unlikely(ret < 0))
 		return ret;
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 3766f92..4dcb302 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -590,10 +590,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->vhost[cnt];
@@ -601,10 +603,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->ring[cnt];
@@ -612,10 +616,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 }
 
@@ -711,15 +717,21 @@ init_iface_info(void)
 	int port_cnt;  /* increment ether ports */
 	memset(&g_iface_info, 0x00, sizeof(g_iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
-		g_iface_info.nic[port_cnt].iface_type   = UNDEF;
-		g_iface_info.nic[port_cnt].iface_no     = port_cnt;
-		g_iface_info.nic[port_cnt].dpdk_port = -1;
-		g_iface_info.vhost[port_cnt].iface_type   = UNDEF;
-		g_iface_info.vhost[port_cnt].iface_no     = port_cnt;
-		g_iface_info.vhost[port_cnt].dpdk_port = -1;
-		g_iface_info.ring[port_cnt].iface_type   = UNDEF;
-		g_iface_info.ring[port_cnt].iface_no     = port_cnt;
-		g_iface_info.ring[port_cnt].dpdk_port = -1;
+		g_iface_info.nic[port_cnt].iface_type = UNDEF;
+		g_iface_info.nic[port_cnt].iface_no   = port_cnt;
+		g_iface_info.nic[port_cnt].dpdk_port  = -1;
+		g_iface_info.nic[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.vhost[port_cnt].iface_type = UNDEF;
+		g_iface_info.vhost[port_cnt].iface_no   = port_cnt;
+		g_iface_info.vhost[port_cnt].dpdk_port  = -1;
+		g_iface_info.vhost[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.ring[port_cnt].iface_type = UNDEF;
+		g_iface_info.ring[port_cnt].iface_no   = port_cnt;
+		g_iface_info.ring[port_cnt].dpdk_port  = -1;
+		g_iface_info.ring[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
 	}
 }
 
@@ -1097,13 +1109,13 @@ spp_get_client_id(void)
  * Check mac address used on the port for registering or removing
  */
 int
-spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no)
+spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no)
 {
 	struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
-	return (mac_addr == port_info->mac_addr);
+	return ((mac_addr == port_info->class_id.mac_addr) &&
+			(vid == port_info->class_id.vlantag.vid));
 }
 
 /*
@@ -1189,62 +1201,78 @@ set_component_change_port(struct spp_port_info *port, enum spp_port_rxtx rxtx)
 int
 spp_update_classifier_table(
 		enum spp_command_action action,
-		enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type __attribute__ ((unused)),
+		int vid,
+		const char *mac_addr_str,
 		const struct spp_port_index *port)
 {
 	struct spp_port_info *port_info = NULL;
 	int64_t ret_mac = 0;
 	uint64_t mac_addr = 0;
 
-	if (type == SPP_CLASSIFIER_TYPE_MAC) {
-		RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
-				data, port->iface_type, port->iface_no);
+	RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, mac addr = %s, port = %d:%d )\n",
+			mac_addr_str, port->iface_type, port->iface_no);
+
+	ret_mac = spp_change_mac_str_to_int64(mac_addr_str);
+	if (unlikely(ret_mac == -1)) {
+		RTE_LOG(ERR, APP, "MAC address format error. ( mac = %s )\n",
+				mac_addr_str);
+		return SPP_RET_NG;
+	}
+	mac_addr = (uint64_t)ret_mac;
+
+	port_info = get_iface_info(port->iface_type, port->iface_no);
+	if (unlikely(port_info == NULL)) {
+		RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
+	if (unlikely(port_info->iface_type == UNDEF)) {
+		RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
 
-		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);
+	if (action == SPP_CMD_ACTION_DEL) {
+		/* Delete */
+		if ((port_info->class_id.vlantag.vid != 0) &&
+				unlikely(port_info->class_id.vlantag.vid !=
+				vid)) {
+			RTE_LOG(ERR, APP, "VLAN ID is different. ( vid = %d )\n",
+					vid);
+			return SPP_RET_NG;
+		}
+		if ((port_info->class_id.mac_addr != 0) &&
+				unlikely(port_info->class_id.mac_addr !=
+						mac_addr)) {
+			RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
-		mac_addr = (uint64_t)ret_mac;
 
-		port_info = get_iface_info(port->iface_type, port->iface_no);
-		if (unlikely(port_info == NULL)) {
-			RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		port_info->class_id.vlantag.vid = ETH_VLAN_ID_MAX;
+		port_info->class_id.mac_addr    = 0;
+		memset(port_info->class_id.mac_addr_str, 0x00, SPP_MIN_STR_LEN);
+	} else if (action == SPP_CMD_ACTION_ADD) {
+		/* Setting */
+		if (unlikely(port_info->class_id.vlantag.vid !=
+				ETH_VLAN_ID_MAX)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, vlan = %d != %d )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.vlantag.vid, vid);
 			return SPP_RET_NG;
 		}
-		if (unlikely(port_info->iface_type == UNDEF)) {
-			RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		if (unlikely(port_info->class_id.mac_addr != 0)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, mac = %s != %s )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.mac_addr_str,
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
 
-		if (action == SPP_CMD_ACTION_DEL) {
-			/* Delete */
-			if ((port_info->mac_addr != 0) &&
-					unlikely(port_info->mac_addr !=
-							mac_addr)) {
-				RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
-						data);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = 0;
-			memset(port_info->mac_addr_str, 0x00, SPP_MIN_STR_LEN);
-		} 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",
-						port->iface_type,
-						port->iface_no);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = mac_addr;
-			strcpy(port_info->mac_addr_str, data);
-		}
+		port_info->class_id.vlantag.vid = vid;
+		port_info->class_id.mac_addr    = mac_addr;
+		strcpy(port_info->class_id.mac_addr_str, mac_addr_str);
 	}
 
 	set_component_change_port(port_info, SPP_PORT_RXTX_TX);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index dcfeb00..ed3b9ae 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -84,8 +84,8 @@
 /** Maximum number of port abilities available */
 #define SPP_PORT_ABILITY_MAX 4
 
-/** Maximum VLAN ID */
-#define SPP_VLAN_VID_MAX 4096
+/** Number of VLAN ID */
+#define SPP_NUM_VLAN_VID 4096
 
 /** Maximum VLAN PCP */
 #define SPP_VLAN_PCP_MAX 7
@@ -117,7 +117,8 @@ enum spp_component_type {
  */
 enum spp_classifier_type {
 	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
-	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
+	SPP_CLASSIFIER_TYPE_MAC,  /**< MAC address */
+	SPP_CLASSIFIER_TYPE_VLAN  /**< VLAN ID */
 };
 
 /**
@@ -180,15 +181,22 @@ struct spp_port_ability {
 	union spp_ability_data data;   /**< Port ability data */
 };
 
+/** Port class identifier for classifying */
+struct spp_port_class_identifier {
+	uint64_t mac_addr;                      /**< Mac address (binary) */
+	char     mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address (text) */
+	struct spp_vlantag_info vlantag;        /**< VLAN tag information */
+};
+
 /**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
-	int            iface_no;   /**< Interface number */
-	int            dpdk_port;  /**< DPDK port number */
-	uint64_t       mac_addr;   /**< Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	enum port_type iface_type;      /**< Interface type (phy/vhost/ring) */
+	int            iface_no;        /**< Interface number */
+	int            dpdk_port;       /**< DPDK port number */
+	struct spp_port_class_identifier class_id;
+					/**< Port class identifier */
 	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
 					/**< Port ability */
 };
@@ -234,7 +242,8 @@ int spp_get_client_id(void);
 int spp_update_classifier_table(
 		enum spp_command_action action,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid,
+		const char *mac,
 		const struct spp_port_index *port);
 
 /**
@@ -330,7 +339,7 @@ struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid, const char *mac,
 		const struct spp_port_index *port);
 
 /** iterate classifier table parameters */
@@ -422,6 +431,8 @@ int spp_get_component_id(const char *name);
 /**
  * Check mac address used on the port for registering or removing
  *
+ * @param vid
+ *  VLAN ID to be validated.
  * @param mac_addr
  *  Mac address to be validated.
  * @param iface_type
@@ -430,12 +441,12 @@ int spp_get_component_id(const char *name);
  *  Interface number to be validated.
  *
  * @return
- *  True if target MAC address matches MAC address of port.
+ *  True if target identifier(VLAN ID, MAC address)
+ *  matches identifier(VLAN ID, MAC address) of port.
  */
-int spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no);
+int spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no);
 
 /**
  * Check if port has been added.
-- 
1.9.1

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

* [spp] [PATCH 8/9] spp_vf: refactor to comply with coding style
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (5 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 7/9] spp_vf: add VID classification to the classifier x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  5:56 ` [spp] [PATCH 9/9] spp_vf: change log level setting x-fn-spp
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Refactoring has been made for spp_vf.py to comply with
  python coding style(pycodestyle)

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/spp_vf.py | 143 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 81 insertions(+), 62 deletions(-)

diff --git a/src/spp_vf.py b/src/spp_vf.py
index c0706c0..0d706ee 100755
--- a/src/spp_vf.py
+++ b/src/spp_vf.py
@@ -13,6 +13,7 @@ import sys
 
 import json
 
+
 class GrowingList(list):
     """GrowingList"""
 
@@ -21,6 +22,7 @@ class GrowingList(list):
             self.extend([None]*(index + 1 - len(self)))
         list.__setitem__(self, index, value)
 
+
 MAX_SECONDARY = 16
 
 # init
@@ -28,14 +30,15 @@ PRIMARY = ''
 SECONDARY_LIST = []
 SECONDARY_COUNT = 0
 
-#init primary comm channel
+# init primary comm channel
 MAIN2PRIMARY = Queue()
 PRIMARY2MAIN = Queue()
 
-#init secondary comm channel list
+# init secondary comm channel list
 MAIN2SEC = GrowingList()
 SEC2MAIN = GrowingList()
 
+
 def connectionthread(name, client_id, conn, m2s, s2m):
     """Manage secondary process connections"""
 
@@ -43,28 +46,29 @@ def connectionthread(name, client_id, conn, m2s, s2m):
     recv_str = 'recv'
     recv_json = None
 
-    #infinite loop so that function do not terminate and thread do not end.
+    # infinite loop so that function do not terminate and thread do not end.
     while True:
         try:
-            _, _, _ = select.select([conn,], [conn,], [], 5)
+            _, _, _ = select.select([conn, ], [conn, ], [], 5)
         except select.error:
             break
 
-        #Sending message to connected secondary
+        # Sending message to connected secondary
         try:
             cmd_str = m2s.get(True)
-            conn.send(cmd_str) #send only takes string
+            conn.send(cmd_str)  # send only takes string
         except KeyError:
             break
         except Exception, excep:
-            print (str(excep))
+            print(str(excep))
             break
 
-        #Receiving from secondary
+        # Receiving from secondary
         try:
             recv_str = ""
             while True:
-                data = conn.recv(1024) # 1024 stands for bytes of data to be received
+                # 1024 stands for bytes of data to be received
+                data = conn.recv(1024)
                 if data:
                     recv_str = recv_str + data
                     if len(data) < 1024:
@@ -73,42 +77,45 @@ def connectionthread(name, client_id, conn, m2s, s2m):
                     break
             if len(recv_str) > 0:
                 recv_json = json.loads(recv_str)
-                recv_str = "recv:" + str(conn.fileno()) + ":len:" + str(len(recv_str)) + ":\n" + json.dumps(recv_json, indent=4) + "\n"
+                recv_str = "recv:" + str(conn.fileno()) \
+                           + ":len:" + str(len(recv_str)) + ":\n" \
+                           + json.dumps(recv_json, indent=4) + "\n"
 
             if not data:
                 s2m.put(recv_str + "closing:" + str(conn))
                 break
 
-            #s2m.put("recv:" + str(conn.fileno()) + ":{" + recv_str + "}")
+            # s2m.put("recv:" + str(conn.fileno()) + ":{" + recv_str + "}")
             s2m.put(recv_str)
         except Exception, excep:
-            print (str(excep))
+            print(str(excep))
             break
 
     SECONDARY_LIST.remove(client_id)
     conn.close()
 
+
 def getclientid(conn):
     """Get client_id from client"""
 
     try:
         conn.send("_get_client_id")
-        #conn.send("{\"commands\":[{\"command\":\"process\"}]}")
+        # conn.send("{\"commands\":[{\"command\":\"process\"}]}")
     except KeyError:
         return -1
 
     data = conn.recv(1024)
-    if data == None:
+    if data is None:
         return -1
 
-    #client_id = int(data.strip('\0'))
+    # client_id = int(data.strip('\0'))
     json_dict = json.loads(data)
     client_id = int(json_dict['client_id'])
 
     if client_id < 0 or client_id > MAX_SECONDARY:
         return -1
 
-    print ("secondary id %d" % client_id)
+    print("secondary id %d" % client_id)
     return client_id
 
     found = 0
@@ -140,6 +147,7 @@ def getclientid(conn):
 
     return free_client_id
 
+
 def acceptthread(sock, main2sec, sec2main):
     """Listen for secondary processes"""
 
@@ -147,16 +155,16 @@ def acceptthread(sock, main2sec, sec2main):
 
     try:
         while True:
-            #Accepting incoming connections
+            # Accepting incoming connections
             conn, _ = sock.accept()
 
             client_id = getclientid(conn)
             if client_id < 0:
                 break
 
-            #Creating new thread.
-            #Calling secondarythread function for this function and passing
-            #conn as argument.
+            # Creating new thread.
+            # Calling secondarythread function for this function and passing
+            # conn as argument.
 
             SECONDARY_LIST.append(client_id)
             main2sec[client_id] = Queue()
@@ -167,35 +175,39 @@ def acceptthread(sock, main2sec, sec2main):
                               sec2main[client_id], ))
             SECONDARY_COUNT += 1
     except Exception, excep:
-        print (str(excep))
+        print(str(excep))
         sock.close()
 
+
 def command_primary(command):
     """Send command to primary process"""
 
     if PRIMARY:
         MAIN2PRIMARY.put(command)
-        print (PRIMARY2MAIN.get(True))
+        print(PRIMARY2MAIN.get(True))
     else:
-        print ("primary not started")
+        print("primary not started")
+
 
 def command_secondary(sec_id, command):
     """Send command to secondary process with sec_id"""
 
     if sec_id in SECONDARY_LIST:
         MAIN2SEC[sec_id].put(command)
-        print (SEC2MAIN[sec_id].get(True))
+        print(SEC2MAIN[sec_id].get(True))
     else:
-        print ("secondary id %d not exist" % sec_id)
+        print("secondary id %d not exist" % sec_id)
+
 
 def print_status():
     """Display information about connected clients"""
 
-    print ("Soft Patch Panel Status :")
-    print ("primary: %d" % PRIMARY)
-    print ("secondary count: %d" % len(SECONDARY_LIST))
+    print("Soft Patch Panel Status :")
+    print("primary: %d" % PRIMARY)
+    print("secondary count: %d" % len(SECONDARY_LIST))
     for i in SECONDARY_LIST:
-        print ("Connected secondary id: %d" % i)
+        print("Connected secondary id: %d" % i)
+
 
 def primarythread(sock, main2primary, primary2main):
     """Manage primary process connection"""
@@ -204,41 +216,44 @@ def primarythread(sock, main2primary, primary2main):
     cmd_str = ''
 
     while True:
-        #waiting for connection
+        # waiting for connection
         PRIMARY = False
         conn, addr = sock.accept()
         PRIMARY = True
 
         while conn:
             try:
-                _, _, _ = select.select([conn,], [conn,], [], 5)
+                _, _, _ = select.select([conn, ], [conn, ], [], 5)
             except select.error:
                 break
 
-            #Sending message to connected primary
+            # Sending message to connected primary
             try:
                 cmd_str = main2primary.get(True)
-                conn.send(cmd_str) #send only takes string
+                conn.send(cmd_str)  # send only takes string
             except KeyError:
                 break
             except Exception, excep:
-                print (str(excep))
+                print(str(excep))
                 break
 
-            #Receiving from primary
+            # Receiving from primary
             try:
-                data = conn.recv(1024) # 1024 stands for bytes of data to be received
+                # 1024 stands for bytes of data to be received
+                data = conn.recv(1024)
                 if data:
-                    primary2main.put("recv:" + str(addr) + ":" + "{" + data + "}")
+                    primary2main.put("recv:" + str(addr) + ":"
+                                     + "{" + data + "}")
                 else:
                     primary2main.put("closing:" + str(addr))
                     conn.close()
                     break
             except Exception, excep:
-                print (str(excep))
+                print(str(excep))
                 break
 
-    print ("primary communication thread end")
+    print("primary communication thread end")
+
 
 def close_all_secondary():
     """Exit all secondary processes"""
@@ -252,6 +267,7 @@ def close_all_secondary():
         command_secondary(i, 'exit')
     SECONDARY_COUNT = 0
 
+
 def check_sec_cmds(cmds):
     """Validate secondary commands before sending"""
 
@@ -284,6 +300,7 @@ def check_sec_cmds(cmds):
 
     return valid
 
+
 class Shell(cmd.Cmd):
     """SPP command prompt"""
 
@@ -302,8 +319,7 @@ class Shell(cmd.Cmd):
         else:
             completions = [p
                            for p in self.COMMANDS
-                           if p.startswith(text)
-                          ]
+                           if p.startswith(text)]
         return completions
 
     def complete_sec(self, text, line, begidx, endidx):
@@ -314,8 +330,7 @@ class Shell(cmd.Cmd):
         else:
             completions = [p
                            for p in self.COMMANDS
-                           if p.startswith(text)
-                          ]
+                           if p.startswith(text)]
         return completions
 
     def do_status(self, _):
@@ -329,23 +344,23 @@ class Shell(cmd.Cmd):
         if command and command in self.COMMANDS:
             command_primary(command)
         else:
-            print ("primary invalid command")
+            print("primary invalid command")
 
     def do_sec(self, arg):
         """Send command to secondary process"""
 
         cmds = arg.split(';')
         if len(cmds) < 2:
-            print ("error")
+            print("error")
         elif str.isdigit(cmds[0]):
             sec_id = int(cmds[0])
             if check_sec_cmds(cmds[1]):
                 command_secondary(sec_id, cmds[1])
             else:
-                print ("invalid cmd")
+                print("invalid cmd")
         else:
-            print (cmds[0])
-            print ("first %s" % cmds[1])
+            print(cmds[0])
+            print("first %s" % cmds[1])
 
     def do_record(self, arg):
         """Save future commands to filename:  RECORD filename.cmd"""
@@ -365,7 +380,7 @@ class Shell(cmd.Cmd):
                     lines.append(line)
                 self.cmdqueue.extend(lines)
         except IOError:
-            print ("Error: File does not exist.")
+            print("Error: File does not exist.")
 
     def precmd(self, line):
         line = line.lower()
@@ -395,49 +410,52 @@ class Shell(cmd.Cmd):
             self.close()
             return True
 
+
 def main(argv):
     """main"""
 
     # Defining server address and port
-    host = ''  #'localhost' or '127.0.0.1' or '' are all same
+    host = ''  # 'localhost' or '127.0.0.1' or '' are all same
 
     try:
-        opts, _ = getopt.getopt(argv, "p:s:h", ["help", "primary = ", "secondary"])
+        opts, _ = getopt.getopt(argv, "p:s:h",
+                                ["help", "primary = ", "secondary"])
     except getopt.GetoptError:
-        print ('spp.py -p <primary__port_number> -s <secondary_port_number>')
+        print('spp.py -p <primary_port_number> -s <secondary_port_number>')
         sys.exit(2)
     for opt, arg in opts:
         if opt in ("-h", "--help"):
-            print ('spp.py -p <primary__port_number> -s <secondary_port_number>')
+            print('spp.py -p <primary_port_number> -s <secondary_port_number>')
             sys.exit()
         elif opt in ("-p", "--primary"):
             primary_port = int(arg)
-            print ("primary port : %d" % primary_port)
+            print("primary port : %d" % primary_port)
         elif opt in ("-s", "--secondary"):
             secondary_port = int(arg)
-            print ('secondary port : %d' % secondary_port)
+            print('secondary port : %d' % secondary_port)
 
-    #Creating primary socket object
+    # Creating primary socket object
     primary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
-    #Binding primary socket to a address. bind() takes tuple of host and port.
+    # Binding primary socket to a address. bind() takes tuple of host and port.
     primary_sock.bind((host, primary_port))
 
-    #Listening primary at the address
-    primary_sock.listen(1) #5 denotes the number of clients can queue
+    # Listening primary at the address
+    primary_sock.listen(1)  # 5 denotes the number of clients can queue
 
     primary_thread = Thread(target=primarythread,
                             args=(primary_sock, MAIN2PRIMARY, PRIMARY2MAIN,))
     primary_thread.daemon = True
     primary_thread.start()
 
-    #Creating secondary socket object
+    # Creating secondary socket object
     secondary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
-    #Binding secondary socket to a address. bind() takes tuple of host and port.
+    # Binding secondary socket to a address.
+    # bind() takes tuple of host and port.
     secondary_sock.bind((host, secondary_port))
 
-    #Listening secondary at the address
+    # Listening secondary at the address
     secondary_sock.listen(MAX_SECONDARY)
 
     # secondary process handling thread
@@ -452,5 +470,6 @@ def main(argv):
     secondary_sock.shutdown(socket.SHUT_RDWR)
     secondary_sock.close()
 
+
 if __name__ == "__main__":
     main(sys.argv[1:])
-- 
1.9.1

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

* [spp] [PATCH 9/9] spp_vf: change log level setting
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (6 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 8/9] spp_vf: refactor to comply with coding style x-fn-spp
@ 2018-02-08  5:56 ` x-fn-spp
  2018-02-08  7:45 ` [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule Yasufumi Ogawa
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
  9 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-08  5:56 UTC (permalink / raw)
  To: spp

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

Change for "CONFIG_RTE_LOG_LEVEL" deleted at "DPDK18.02".
After "DPDK18.02", log level can be changed by "--log-level".

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/spp_vf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 4dcb302..a36bf1c 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -991,9 +991,6 @@ main(int argc, char *argv[])
 		argc -= ret_dpdk;
 		argv += ret_dpdk;
 
-		/* Set log level  */
-		rte_log_set_global_level(RTE_LOG_LEVEL);
-
 		/* Parse spp_vf specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != 0))
-- 
1.9.1

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

* Re: [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (7 preceding siblings ...)
  2018-02-08  5:56 ` [spp] [PATCH 9/9] spp_vf: change log level setting x-fn-spp
@ 2018-02-08  7:45 ` Yasufumi Ogawa
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
  9 siblings, 0 replies; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-08  7:45 UTC (permalink / raw)
  To: x-fn-spp, spp, ferruh.yigit

On 2018/02/08 14:51, x-fn-spp@sl.ntt-tx.co.jp wrote:
> From: Kentaro Watanabe <watanabe.kentaro.z01@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@sl.ntt-tx.co.jp wrote:
>> From: Hiroyuki Nakamura <nakamura.hioryuki@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@sl.ntt-tx.co.jp wrote:
>>> From: Hiroyuki Nakamura <nakamura.hioryuki@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,
> 
Hi, Kentaro

Thanks for your contribution! I confirmed that it is compiled with the
latest DPDK successfully and source codes are cleaned up well.

Acked-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

> 
> * Fixed warnings etc. in checkpatch.sh of DPDK.
> * Change tab to space except indent tab.
> 
> Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
> Signed-off-by: Naoki Takada <takada.naoki@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(-)

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

* Re: [spp] [PATCH 4/9] spp_vf: add BSD license
  2018-02-08  5:56 ` [spp] [PATCH 4/9] spp_vf: add BSD license x-fn-spp
@ 2018-02-08 15:14   ` Ferruh Yigit
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
  0 siblings, 1 reply; 40+ messages in thread
From: Ferruh Yigit @ 2018-02-08 15:14 UTC (permalink / raw)
  To: x-fn-spp, spp; +Cc: Hemant Agrawal

On 2/8/2018 5:56 AM, x-fn-spp@sl.ntt-tx.co.jp wrote:
> From: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
> 
> Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
> Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
> ---
>  src/vf/classifier_mac.c   | 33 +++++++++++++++++++++++++++++++++
>  src/vf/classifier_mac.h   | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_conn.c     | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_conn.h     | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_dec.c      | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_dec.h      | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_proc.c     | 33 +++++++++++++++++++++++++++++++++
>  src/vf/command_proc.h     | 33 +++++++++++++++++++++++++++++++++
>  src/vf/ringlatencystats.c | 33 +++++++++++++++++++++++++++++++++
>  src/vf/ringlatencystats.h | 33 +++++++++++++++++++++++++++++++++
>  src/vf/spp_forward.c      | 33 +++++++++++++++++++++++++++++++++
>  src/vf/spp_forward.h      | 33 +++++++++++++++++++++++++++++++++
>  src/vf/spp_vf.c           | 33 +++++++++++++++++++++++++++++++++
>  src/vf/spp_vf.h           | 33 +++++++++++++++++++++++++++++++++
>  src/vf/string_buffer.c    | 33 +++++++++++++++++++++++++++++++++
>  src/vf/string_buffer.h    | 33 +++++++++++++++++++++++++++++++++

This patch adds a fixed license header which has Intel as copyright owner. But
there are some file added by ntt, like spp_vf, you may want to keep your
copyright for those files.

Also DPDK is switching to SPDX tags, that makes license headers easy, we can
think about same thing for spp. Not for this patchset, but for future.

<...>

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

* Re: [spp] [spp 02181] Re:  [PATCH 4/9] spp_vf: add BSD license
  2018-02-08 15:14   ` Ferruh Yigit
@ 2018-02-09  3:03     ` Nakamura Hioryuki
  2018-02-09  3:39       ` [spp] [PATCH 1/7] spp_vf: refactor to comply with coding rule x-fn-spp
                         ` (7 more replies)
  0 siblings, 8 replies; 40+ messages in thread
From: Nakamura Hioryuki @ 2018-02-09  3:03 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: spp, Hemant Agrawal

Thank you for reviewing and pointing out.

Revised patches are posted in the following emails.

> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
> think about same thing for spp. Not for this patchset, but for future.

Ok, Thank you for information.
"spp_vf: add BSD license" is deleted from revised patchset, we will make
change license header for future.

Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
deleted, because this will conflict with Yasufumi’s patch 
"[PATCH 2/2] spp_vf: update to improve usability"

-- 
Nakamura Hioryuki <nakamua.hiroyuki@po.ntt-tx.co.jp>

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

* [spp] [PATCH 1/7] spp_vf: refactor to comply with coding rule
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
@ 2018-02-09  3:39       ` x-fn-spp
  2018-02-09  3:39       ` [spp] [PATCH 2/7] spp_vf: refactor comments and variable names x-fn-spp
                         ` (6 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:39 UTC (permalink / raw)
  To: spp

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

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

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@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

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

* [spp] [PATCH 2/7] spp_vf: refactor comments and variable names
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
  2018-02-09  3:39       ` [spp] [PATCH 1/7] spp_vf: refactor to comply with coding rule x-fn-spp
@ 2018-02-09  3:39       ` x-fn-spp
  2018-02-09  3:39       ` [spp] [PATCH 3/7] spp_vf: change header file to doxygen format x-fn-spp
                         ` (5 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:39 UTC (permalink / raw)
  To: spp

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

* Add description, such as definition and structure members.
* Change abbreviation of variable name and function name.
  (if->iface, manage->mng)
* Delete unnecessary function.(ut_main())

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c |  94 ++++++++--------
 src/vf/command_dec.c    |  40 ++++---
 src/vf/command_dec.h    |  51 ++++++---
 src/vf/command_proc.c   |  14 ++-
 src/vf/spp_forward.c    |  21 ++--
 src/vf/spp_vf.c         | 293 +++++++++++++++++++++++++-----------------------
 src/vf/spp_vf.h         |  47 ++++----
 7 files changed, 306 insertions(+), 254 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 939f8c9..cd186a2 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -61,18 +61,16 @@ static const size_t HASH_TABLE_NAME_BUF_SZ =
 static const size_t ETHER_ADDR_STR_BUF_SZ =
 		ETHER_ADDR_LEN * 2 + (ETHER_ADDR_LEN - 1) + 1;
 
-/* TODO(yasufum) add explanation of data structure of classifier and mng info */
-
 /* classified data (destination port, target packets, etc) */
 struct classified_data {
 	/* interface type (see "enum port_type") */
-	enum port_type  if_type;
+	enum port_type  iface_type;
 
 	/* index of ports handled by classifier */
-	int             if_no;
+	int             iface_no;
 
 	/* id for interface generated by spp_vf */
-	int             if_no_global;
+	int             iface_no_global;
 
 	/* port id generated by DPDK */
 	uint16_t        port;
@@ -113,8 +111,13 @@ struct classifier_mac_info {
 
 /* classifier management information */
 struct classifier_mac_mng_info {
+	/* classifier information */
 	struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+
+	/* Reference index number for classifier information */
 	volatile int ref_index;
+
+	/* Update index number for classifier information */
 	volatile int upd_index;
 };
 
@@ -156,17 +159,17 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 	classifier_info->default_classified = -1;
 	classifier_info->n_classified_data_tx = component_info->num_tx_port;
 	if (component_info->num_rx_port == 0) {
-		classified_data_rx->if_type      = UNDEF;
-		classified_data_rx->if_no        = 0;
-		classified_data_rx->if_no_global = 0;
+		classified_data_rx->iface_type      = UNDEF;
+		classified_data_rx->iface_no        = 0;
+		classified_data_rx->iface_no_global = 0;
 		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_no        = 0;
-		classified_data_rx->if_no_global =
-				component_info->rx_ports[0]->if_no;
+		classified_data_rx->iface_type      =
+				component_info->rx_ports[0]->iface_type;
+		classified_data_rx->iface_no        = 0;
+		classified_data_rx->iface_no_global =
+				component_info->rx_ports[0]->iface_no;
 		classified_data_rx->port         =
 				component_info->rx_ports[0]->dpdk_port;
 		classified_data_rx->num_pkt      = 0;
@@ -176,9 +179,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 		tx_port = component_info->tx_ports[i];
 
 		/* store ports information */
-		classified_data_tx[i].if_type      = tx_port->if_type;
-		classified_data_tx[i].if_no        = i;
-		classified_data_tx[i].if_no_global = tx_port->if_no;
+		classified_data_tx[i].iface_type      = tx_port->iface_type;
+		classified_data_tx[i].iface_no        = i;
+		classified_data_tx[i].iface_no_global = tx_port->iface_no;
 		classified_data_tx[i].port         = tx_port->dpdk_port;
 		classified_data_tx[i].num_pkt      = 0;
 
@@ -194,9 +197,9 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
 			classifier_info->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
-					"if_type=%d, if_no=%d, dpdk_port=%d\n",
-					tx_port->if_type,
-					tx_port->if_no,
+					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					tx_port->iface_type,
+					tx_port->iface_no,
 					tx_port->dpdk_port);
 			continue;
 		}
@@ -219,10 +222,10 @@ 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=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
 				mac_addr_str,
-				tx_port->if_type,
-				tx_port->if_no,
+				tx_port->iface_type,
+				tx_port->iface_no,
 				tx_port->dpdk_port);
 	}
 
@@ -331,9 +334,9 @@ transmit_packet(struct classified_data *classified_data)
 	uint16_t n_tx;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-	if (classified_data->if_type == RING)
+	if (classified_data->iface_type == RING)
 		/* if tx-if is ring, set ringlatencystats */
-		spp_ringlatencystats_add_time_stamp(classified_data->if_no,
+		spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
 				classified_data->pkts,
 				classified_data->num_pkt);
 #endif
@@ -386,10 +389,10 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *classified_data)
 	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"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,
-				classified_data->if_no,
+				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+				classified_data->iface_type,
+				classified_data->iface_no_global,
+				classified_data->iface_no,
 				classified_data->port,
 				classified_data->num_pkt);
 		transmit_packet(classified_data);
@@ -611,7 +614,7 @@ spp_classifier_mac_do(int id)
 			prev_tsc = cur_tsc;
 		}
 
-		if (classified_data_rx->if_type == UNDEF)
+		if (classified_data_rx->iface_type == UNDEF)
 			continue;
 
 		/* retrieve packets */
@@ -621,9 +624,9 @@ spp_classifier_mac_do(int id)
 			continue;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (classified_data_rx->if_type == RING)
+		if (classified_data_rx->iface_type == RING)
 			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->if_no,
+					classified_data_rx->iface_no,
 					rx_pkts, n_rx);
 #endif
 
@@ -669,19 +672,19 @@ spp_classifier_get_component_status(
 	classified_data = classifier_info->classified_data_tx;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (classifier_info->classified_data_rx.if_type != UNDEF) {
+	if (classifier_info->classified_data_rx.iface_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].iface_type = classifier_info->
+				classified_data_rx.iface_type;
+		rx_ports[0].iface_no   = classifier_info->
+				classified_data_rx.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
 	num_tx = classifier_info->n_classified_data_tx;
 	for (i = 0; i < num_tx; i++) {
-		tx_ports[i].if_type = classified_data[i].if_type;
-		tx_ports[i].if_no   = classified_data[i].if_no_global;
+		tx_ports[i].iface_type = classified_data[i].iface_type;
+		tx_ports[i].iface_no   = classified_data[i].iface_no_global;
 	}
 
 	/* Set the information with the function specified by the command. */
@@ -724,12 +727,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 +
+			port.iface_type = (classified_data +
 					classifier_info->default_classified)->
-					if_type;
-			port.if_no   = (classified_data +
+					iface_type;
+			port.iface_no   = (classified_data +
 					classifier_info->default_classified)->
-					if_no_global;
+					iface_no_global;
 
 			(*params->element_proc)(
 					params,
@@ -750,9 +753,10 @@ spp_classifier_mac_iterate_table(
 			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 					(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.iface_type = (classified_data + (long)data)->
+					iface_type;
+			port.iface_no   = (classified_data + (long)data)->
+					iface_no_global;
 
 			(*params->element_proc)(
 					params,
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 8e82f1f..59e825c 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -140,7 +140,7 @@ decode_port_value(void *output, const char *arg_val)
 {
 	int ret = 0;
 	struct spp_port_index *port = output;
-	ret = spp_get_if_info(arg_val, &port->if_type, &port->if_no);
+	ret = spp_get_iface_index(arg_val, &port->iface_type, &port->iface_no);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad port. val=%s\n", arg_val);
 		return -1;
@@ -292,9 +292,11 @@ 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_check_used_port(tmp_port.iface_type,
+					tmp_port.iface_no,
 					SPP_PORT_RXTX_RX) >= 0) &&
-			(spp_check_used_port(tmp_port.if_type, tmp_port.if_no,
+			(spp_check_used_port(tmp_port.iface_type,
+					tmp_port.iface_no,
 					SPP_PORT_RXTX_TX) >= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
 				"Port in used. (port command) val=%s\n",
@@ -302,8 +304,8 @@ decode_port_port_value(void *output, const char *arg_val)
 		return -1;
 	}
 
-	port->port.if_type = tmp_port.if_type;
-	port->port.if_no   = tmp_port.if_no;
+	port->port.iface_type = tmp_port.iface_type;
+	port->port.iface_no   = tmp_port.iface_no;
 	return 0;
 }
 
@@ -322,8 +324,8 @@ decode_port_rxtx_value(void *output, const char *arg_val)
 	}
 
 	if ((port->action == SPP_CMD_ACTION_ADD) &&
-			(spp_check_used_port(port->port.if_type,
-					port->port.if_no, ret) >= 0)) {
+			(spp_check_used_port(port->port.iface_type,
+					port->port.iface_no, ret) >= 0)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
 				"Port in used. (port command) val=%s\n",
 				arg_val);
@@ -442,15 +444,15 @@ decode_classifier_port_value(void *output, const char *arg_val)
 	if (ret < 0)
 		return -1;
 
-	if (spp_check_added_port(tmp_port.if_type, tmp_port.if_no) == 0) {
+	if (spp_check_added_port(tmp_port.iface_type, tmp_port.iface_no) == 0) {
 		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.iface_type,
+				tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -462,7 +464,7 @@ decode_classifier_port_value(void *output, const char *arg_val)
 			return -1;
 
 		if (!spp_check_mac_used_port((uint64_t)mac_addr,
-				tmp_port.if_type, tmp_port.if_no)) {
+				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
@@ -470,8 +472,8 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		}
 	}
 
-	classifier_table->port.if_type = tmp_port.if_type;
-	classifier_table->port.if_no   = tmp_port.if_no;
+	classifier_table->port.iface_type = tmp_port.iface_type;
+	classifier_table->port.iface_no   = tmp_port.iface_no;
 	return 0;
 }
 
@@ -479,9 +481,10 @@ decode_classifier_port_value(void *output, const char *arg_val)
 
 /* parameter list for decoding */
 struct decode_parameter_list {
-	const char *name;
-	size_t offset;
+	const char *name;       /* Parameter name */
+	size_t offset;          /* Offset value of struct spp_command */
 	int (*func)(void *output, const char *arg_val);
+				/* Pointer to parameter handling function */
 };
 
 /* parameter list for each command */
@@ -597,11 +600,12 @@ decode_command_parameter_in_list(struct spp_command_request *request,
 
 /* command list for decoding */
 struct decode_command_list {
-	const char *name;
-	int   param_min;
-	int   param_max;
+	const char *name;       /* Command name */
+	int   param_min;        /* Min number of parameters */
+	int   param_max;        /* Max number of parameters */
 	int (*func)(struct spp_command_request *request, int argc, char *argv[],
 			struct spp_command_decode_error *error);
+				/* Pointer to command handling function */
 };
 
 /* command list */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 7fc5f66..77cae87 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -31,7 +31,7 @@ enum spp_command_decode_error_code {
  *
  * @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,
@@ -45,9 +45,16 @@ enum spp_command_type {
 
 /* "classifier_table" command specific parameters */
 struct spp_command_classifier_table {
+	/* Action identifier (add or del) */
 	enum spp_command_action action;
+
+	/* Classify type (currently only for mac) */
 	enum spp_classifier_type type;
+
+	/* Value to be classified */
 	char value[SPP_CMD_VALUE_BUFSZ];
+
+	/* Destination port type and number */
 	struct spp_port_index port;
 };
 
@@ -58,48 +65,56 @@ struct spp_command_flush {
 
 /* "component" command parameters */
 struct spp_command_component {
-	enum spp_command_action action;
-	char name[SPP_CMD_NAME_BUFSZ];
-	unsigned int core;
-	enum spp_component_type type;
+	enum spp_command_action action; /* Action identifier (start or stop) */
+	char name[SPP_CMD_NAME_BUFSZ];  /* Component name */
+	unsigned int core;              /* Logical core number */
+	enum spp_component_type type;   /* Component type */
 };
 
 /* "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action;
-	struct spp_port_index port;
-	enum spp_port_rxtx rxtx;
-	char name[SPP_CMD_NAME_BUFSZ];
+	enum spp_command_action action; /* Action identifier (add or del) */
+	struct spp_port_index port;     /* Port type and number */
+	enum spp_port_rxtx rxtx;        /* rx/tx identifier */
+	char name[SPP_CMD_NAME_BUFSZ];  /* Attached component name */
 };
 
 /* command parameters */
 struct spp_command {
-	enum spp_command_type type;
+	enum spp_command_type type; /* Command type */
 
 	union {
+		/* Structured data for classifier_table command  */
 		struct spp_command_classifier_table classifier_table;
+
+		/* Structured data for flush command  */
 		struct spp_command_flush flush;
+
+		/* Structured data for component command  */
 		struct spp_command_component component;
+
+		/* Structured data for port command  */
 		struct spp_command_port port;
 	} spec;
 };
 
 /* request parameters */
 struct spp_command_request {
-	int num_command;
-	int num_valid_command;
+	int num_command;                /* Number of accepted commands */
+	int num_valid_command;          /* Number of executed commands */
 	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
+					/* Information of executed commands */
 
-	int is_requested_client_id;
-	int is_requested_status;
-	int is_requested_exit;
+	int is_requested_client_id;     /* Id for get_client_id command */
+	int is_requested_status;        /* Id for status command */
+	int is_requested_exit;          /* Id for exit command */
 };
 
 /* decode error information */
 struct spp_command_decode_error {
-	int code;
-	char value_name[SPP_CMD_NAME_BUFSZ];
-	char value[SPP_CMD_VALUE_BUFSZ];
+	int code;                            /* Error code */
+	char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
+	char value[SPP_CMD_VALUE_BUFSZ];     /* Error value */
 };
 
 /* decode request from no-null-terminated string */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index b06ed27..f51c800 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -36,14 +36,22 @@ enum command_result_code {
 
 /* command execution result information */
 struct command_result {
+	/* Response code */
 	int code;
+
+	/* Response message */
 	char result[SPP_CMD_NAME_BUFSZ];
+
+	/* Detailed response message */
 	char error_message[CMD_RES_ERR_MSG_SIZE];
 };
 
 /* command response list control structure */
 struct command_response_list {
+	/* Tag name */
 	char tag_name[SPP_CMD_NAME_BUFSZ];
+
+	/* Pointer to handling function */
 	int (*func)(const char *name, char **output, void *tmp);
 };
 
@@ -432,8 +440,8 @@ apeend_port_array(const char *name, char **output,
 	}
 
 	for (i = 0; i < num; i++) {
-		spp_format_port_string(port_str, ports[i].if_type,
-				ports[i].if_no);
+		spp_format_port_string(port_str, ports[i].iface_type,
+				ports[i].iface_no);
 
 		sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
 
@@ -552,7 +560,7 @@ append_classifier_element_value(
 		return ret;
 	}
 
-	spp_format_port_string(port_str, port->if_type, port->if_no);
+	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
 	ret = append_json_str_value("type", &tmp_buff, "mac");
 	if (unlikely(ret < 0))
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index b2a3728..c5c0e3c 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -8,8 +8,8 @@
 
 /* A set of port info of rx and tx */
 struct forward_rxtx {
-	struct spp_port_info rx;
-	struct spp_port_info tx;
+	struct spp_port_info rx; /* rx port */
+	struct spp_port_info tx; /* tx port */
 };
 
 /* Information on the path used for forward. */
@@ -27,6 +27,7 @@ struct forward_info {
 	volatile int ref_index; /* index to reference area */
 	volatile int upd_index; /* index to update area    */
 	struct forward_path path[SPP_INFO_AREA_MAX];
+				/* Information of data path */
 };
 
 struct forward_info g_forward_info[RTE_MAX_LCORE];
@@ -151,12 +152,12 @@ spp_forward(int id)
 			continue;
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (rx->if_type == RING)
-			spp_ringlatencystats_calculate_latency(rx->if_no,
+		if (rx->iface_type == RING)
+			spp_ringlatencystats_calculate_latency(rx->iface_no,
 					bufs, nb_rx);
 
-		if (tx->if_type == RING)
-			spp_ringlatencystats_add_time_stamp(tx->if_no,
+		if (tx->iface_type == RING)
+			spp_ringlatencystats_add_time_stamp(tx->iface_no,
 					bufs, nb_rx);
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
 
@@ -201,14 +202,14 @@ spp_forward_get_component_status(
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
 	for (cnt = 0; cnt < path->num; cnt++) {
-		rx_ports[cnt].if_type = path->ports[cnt].rx.if_type;
-		rx_ports[cnt].if_no   = path->ports[cnt].rx.if_no;
+		rx_ports[cnt].iface_type = path->ports[cnt].rx.iface_type;
+		rx_ports[cnt].iface_no   = path->ports[cnt].rx.iface_no;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
 	num_tx = (path->num > 0)?1:0;
-	tx_ports[0].if_type = path->ports[0].tx.if_type;
-	tx_ports[0].if_no   = path->ports[0].tx.if_no;
+	tx_ports[0].iface_type = path->ports[0].tx.iface_type;
+	tx_ports[0].iface_no   = path->ports[0].tx.iface_no;
 
 	/* Set the information with the function specified by the command. */
 	ret = (*params->element_proc)(
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 1756326..49c56e3 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -13,10 +13,13 @@
 #include "spp_forward.h"
 #include "command_proc.h"
 
-/* TODO(yasufum) add desc how there are used */
+/* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
+
+/* Sampling interval timer for latency evaluation */
 #define SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL 1000000
 
+/* Name string for each component */
 #define CORE_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
 #define CORE_TYPE_MERGE_STR          "merge"
 #define CORE_TYPE_FORWARD_STR        "forward"
@@ -25,10 +28,12 @@
 enum SPP_LONGOPT_RETVAL {
 	SPP_LONGOPT_RETVAL__ = 127,
 
-	/* add below */
-	/* TODO(yasufum) add description what and why add below */
-	SPP_LONGOPT_RETVAL_CLIENT_ID,
-	SPP_LONGOPT_RETVAL_VHOST_CLIENT
+	/*
+	 * Return value definition for getopt_long()
+	 * Only for long option
+	 */
+	SPP_LONGOPT_RETVAL_CLIENT_ID,   /* --client-id    */
+	SPP_LONGOPT_RETVAL_VHOST_CLIENT /* --vhost-client */
 };
 
 /* Flag of processing type to copy management information */
@@ -40,60 +45,84 @@ enum copy_mng_flg {
 
 /* Manage given options as global variable */
 struct startup_param {
-	int client_id;
+	int client_id;          /* Client ID of spp_vf */
 	char server_ip[INET_ADDRSTRLEN];
-	int server_port;
-	int vhost_client;
+				/* IP address sting of spp controller */
+	int server_port;        /* Port Number of spp controller */
+	int vhost_client;       /* Flag for --vhost-client option */
 };
 
 /* Manage number of interfaces  and port information as global variable */
-/* TODO(yasufum) refactor, change if to iface */
-struct if_info {
-	int num_nic;
-	int num_vhost;
-	int num_ring;
+struct iface_info {
+	int num_nic;            /* The number of phy */
+	int num_vhost;          /* The number of vhost */
+	int num_ring;           /* The number of ring */
 	struct spp_port_info nic[RTE_MAX_ETHPORTS];
+				/* Port information of phy */
 	struct spp_port_info vhost[RTE_MAX_ETHPORTS];
+				/* Port information of vhost */
 	struct spp_port_info ring[RTE_MAX_ETHPORTS];
+				/* Port information of ring */
 };
 
 /* Manage component running in core as global variable */
 struct core_info {
 	volatile enum spp_component_type type;
-	int num;
-	int id[RTE_MAX_LCORE];
+				/* Component type */
+	int num;                /* The number of IDs below */
+	int id[RTE_MAX_LCORE];  /* ID list of components executed on cpu core */
 };
 
 /* Manage core status and component information as global variable */
 struct core_mng_info {
+	/* Status of cpu core */
 	volatile enum spp_core_status status;
+
+	/* Index number of core information for reference */
 	volatile int ref_index;
+
+	/* Index number of core information for updating */
 	volatile int upd_index;
+
+	/* Core information of each cpu core */
 	struct core_info core[SPP_INFO_AREA_MAX];
 };
 
 /* Manage data to be backup */
 struct cancel_backup_info {
+	/* Backup data of core information */
 	struct core_mng_info core[RTE_MAX_LCORE];
+
+	/* Backup data of component information */
 	struct spp_component_info component[RTE_MAX_LCORE];
-	struct if_info interface;
+
+	/* Backup data of interface information */
+	struct iface_info interface;
 };
 
 /* Declare global variables */
-static unsigned int         g_main_lcore_id = 0xffffffff;
+/* Logical core ID for main process */
+static unsigned int g_main_lcore_id = 0xffffffff;
+
+/* Execution parameter of spp_vf */
 static struct startup_param g_startup_param;
 
-static struct if_info            g_if_info;
+/* Interface management information */
+static struct iface_info g_iface_info;
+
+/* Component management information */
 static struct spp_component_info g_component_info[RTE_MAX_LCORE];
-static struct core_mng_info      g_core_info[RTE_MAX_LCORE];
 
-/*
- * TODO(yasufum) add desc how it is used
- * and why changed component is kept
- */
+/* Core management information */
+static struct core_mng_info g_core_info[RTE_MAX_LCORE];
+
+/* Array of update indicator for core management information */
 static int g_change_core[RTE_MAX_LCORE];
+
+/* Array of update indicator for component management information */
 static int g_change_component[RTE_MAX_LCORE];
 
+/* Backup information for cancel command */
 static struct cancel_backup_info g_backup_info;
 
 /* Print help message */
@@ -444,20 +473,17 @@ parse_app_args(int argc, char *argv[])
  * Return port info of given type and num of interface
  *
  * It returns NULL value if given type is invalid.
- *
- * TODO(yasufum) refactor name of func to be more understandable (area?)
- * TODO(yasufum) refactor, change if to iface.
  */
 static struct spp_port_info *
-get_if_area(enum port_type if_type, int if_no)
+get_iface_info(enum port_type iface_type, int iface_no)
 {
-	switch (if_type) {
+	switch (iface_type) {
 	case PHY:
-		return &g_if_info.nic[if_no];
+		return &g_iface_info.nic[iface_no];
 	case VHOST:
-		return &g_if_info.vhost[if_no];
+		return &g_iface_info.vhost[iface_no];
 	case RING:
-		return &g_if_info.ring[if_no];
+		return &g_iface_info.ring[iface_no];
 	default:
 		return NULL;
 	}
@@ -516,44 +542,44 @@ dump_component_info(const struct spp_component_info *component_info)
 
 /* Dump of interface information */
 static void
-dump_interface_info(const struct if_info *if_info)
+dump_interface_info(const struct iface_info *iface_info)
 {
 	const struct spp_port_info *port = NULL;
 	int cnt = 0;
 	RTE_LOG(DEBUG, APP, "interface phy=%d, vhost=%d, ring=%d\n",
-			if_info->num_nic,
-			if_info->num_vhost,
-			if_info->num_ring);
+			iface_info->num_nic,
+			iface_info->num_vhost,
+			iface_info->num_ring);
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->nic[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->nic[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->vhost[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->vhost[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &if_info->ring[cnt];
-		if (port->if_type == UNDEF)
+		port = &iface_info->ring[cnt];
+		if (port->iface_type == UNDEF)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
 				"mac=%08lx(%s)\n",
-				cnt, port->if_type, port->if_no,
+				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
 				port->mac_addr, port->mac_addr_str);
 	}
@@ -564,7 +590,7 @@ static void
 dump_all_mng_info(
 		const struct core_mng_info *core,
 		const struct spp_component_info *component,
-		const struct if_info *interface)
+		const struct iface_info *interface)
 {
 	if (rte_log_get_global_level() < RTE_LOG_DEBUG)
 		return;
@@ -579,10 +605,10 @@ static void
 copy_mng_info(
 		struct core_mng_info *dst_core,
 		struct spp_component_info *dst_component,
-		struct if_info *dst_interface,
+		struct iface_info *dst_interface,
 		const struct core_mng_info *src_core,
 		const struct spp_component_info *src_component,
-		const struct if_info *src_interface,
+		const struct iface_info *src_interface,
 		enum copy_mng_flg flg)
 {
 	int upd_index = 0;
@@ -611,16 +637,16 @@ copy_mng_info(
 	memcpy(dst_component, src_component,
 			sizeof(struct spp_component_info)*RTE_MAX_LCORE);
 	memcpy(dst_interface, src_interface,
-			sizeof(struct if_info));
+			sizeof(struct iface_info));
 }
 
 /* Backup the management information */
 static void
 backup_mng_info(struct cancel_backup_info *backup)
 {
-	dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+	dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
 	copy_mng_info(backup->core, backup->component, &backup->interface,
-			g_core_info, g_component_info, &g_if_info,
+			g_core_info, g_component_info, &g_iface_info,
 			COPY_MNG_FLG_ALLCOPY);
 	dump_all_mng_info(backup->core, backup->component, &backup->interface);
 	memset(g_change_core, 0x00, sizeof(g_change_core));
@@ -632,35 +658,34 @@ static void
 cancel_mng_info(struct cancel_backup_info *backup)
 {
 	dump_all_mng_info(backup->core, backup->component, &backup->interface);
-	copy_mng_info(g_core_info, g_component_info, &g_if_info,
+	copy_mng_info(g_core_info, g_component_info, &g_iface_info,
 			backup->core, backup->component, &backup->interface,
 			COPY_MNG_FLG_ALLCOPY);
-	dump_all_mng_info(g_core_info, g_component_info, &g_if_info);
+	dump_all_mng_info(g_core_info, g_component_info, &g_iface_info);
 	memset(g_change_core, 0x00, sizeof(g_change_core));
 	memset(g_change_component, 0x00, sizeof(g_change_component));
 }
 
 /**
- * Initialize g_if_info
+ * Initialize g_iface_info
  *
- * Clear g_if_info and set initial value.
- * TODO(yasufum) refactor, change if to iface.
+ * Clear g_iface_info and set initial value.
  */
 static void
-init_if_info(void)
+init_iface_info(void)
 {
 	int port_cnt;  /* increment ether ports */
-	memset(&g_if_info, 0x00, sizeof(g_if_info));
+	memset(&g_iface_info, 0x00, sizeof(g_iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
-		g_if_info.nic[port_cnt].if_type   = UNDEF;
-		g_if_info.nic[port_cnt].if_no     = port_cnt;
-		g_if_info.nic[port_cnt].dpdk_port = -1;
-		g_if_info.vhost[port_cnt].if_type   = UNDEF;
-		g_if_info.vhost[port_cnt].if_no     = port_cnt;
-		g_if_info.vhost[port_cnt].dpdk_port = -1;
-		g_if_info.ring[port_cnt].if_type   = UNDEF;
-		g_if_info.ring[port_cnt].if_no     = port_cnt;
-		g_if_info.ring[port_cnt].dpdk_port = -1;
+		g_iface_info.nic[port_cnt].iface_type   = UNDEF;
+		g_iface_info.nic[port_cnt].iface_no     = port_cnt;
+		g_iface_info.nic[port_cnt].dpdk_port = -1;
+		g_iface_info.vhost[port_cnt].iface_type   = UNDEF;
+		g_iface_info.vhost[port_cnt].iface_no     = port_cnt;
+		g_iface_info.vhost[port_cnt].dpdk_port = -1;
+		g_iface_info.ring[port_cnt].iface_type   = UNDEF;
+		g_iface_info.ring[port_cnt].iface_no     = port_cnt;
+		g_iface_info.ring[port_cnt].dpdk_port = -1;
 	}
 }
 
@@ -695,8 +720,6 @@ init_core_info(void)
 
 /**
  * Setup port info of port on host
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 static int
 set_nic_interface(void)
@@ -704,13 +727,13 @@ set_nic_interface(void)
 	int nic_cnt = 0;
 
 	/* NIC Setting */
-	g_if_info.num_nic = rte_eth_dev_count();
-	if (g_if_info.num_nic > RTE_MAX_ETHPORTS)
-		g_if_info.num_nic = RTE_MAX_ETHPORTS;
+	g_iface_info.num_nic = rte_eth_dev_count();
+	if (g_iface_info.num_nic > RTE_MAX_ETHPORTS)
+		g_iface_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;
-		g_if_info.nic[nic_cnt].dpdk_port = nic_cnt;
+	for (nic_cnt = 0; nic_cnt < g_iface_info.num_nic; nic_cnt++) {
+		g_iface_info.nic[nic_cnt].iface_type   = PHY;
+		g_iface_info.nic[nic_cnt].dpdk_port = nic_cnt;
 	}
 
 	return 0;
@@ -718,15 +741,12 @@ set_nic_interface(void)
 
 /**
  * Setup management info for spp_vf
- *
- * TODO(yasufum) refactor, change if to iface.
- * TODO(yasufum) refactor, change function name from manage to mng or management
  */
 static int
-init_manage_data(void)
+init_mng_data(void)
 {
 	/* Initialize interface and core information */
-	init_if_info();
+	init_iface_info();
 	init_core_info();
 	init_component_info();
 
@@ -740,8 +760,6 @@ init_manage_data(void)
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 /**
  * Print statistics of time for packet processing in ring interface
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 static void
 print_ring_latency_stats(void)
@@ -758,7 +776,7 @@ 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_iface_info.ring[ring_cnt].iface_type == UNDEF)
 			continue;
 
 		spp_ringlatencystats_get_stats(ring_cnt, &stats[ring_cnt]);
@@ -770,7 +788,7 @@ print_ring_latency_stats(void)
 			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_iface_info.ring[ring_cnt].iface_type == UNDEF)
 				continue;
 
 			printf(", 0x%-16lx", stats[ring_cnt].slot[stats_cnt]);
@@ -793,7 +811,7 @@ del_vhost_sockfile(struct spp_port_info *vhost)
 		return;
 
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		if (likely(vhost[cnt].if_type == UNDEF)) {
+		if (likely(vhost[cnt].iface_type == UNDEF)) {
 			/* Skip removing if it is not using vhost */
 			continue;
 		}
@@ -896,18 +914,13 @@ slave_main(void *arg __attribute__ ((unused)))
 	return ret;
 }
 
-/* TODO(yasufum) refactor, change if to iface. */
-/*
- * TODO(yasufum) change test using ut_main(),
- * or add description for what and why use it
+/**
+ * Main function
+ *
+ * Return -1 explicitly if error is occurred.
  */
-/* TODO(yasufum) change to return -1 explicitly if error is occurred. */
 int
-#ifndef USE_UT_SPP_VF
 main(int argc, char *argv[])
-#else /* ifndef USE_UT_SPP_VF */
-ut_main(int argc, char *argv[])
-#endif  /* ifndef USE_UT_SPP_VF */
 {
 	int ret = -1;
 #ifdef SPP_DEMONIZE
@@ -943,8 +956,8 @@ ut_main(int argc, char *argv[])
 		/* 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))
+		int ret_mng = init_mng_data();
+		if (unlikely(ret_mng != 0))
 			break;
 
 		int ret_classifier_mac_init = spp_classifier_mac_init();
@@ -963,7 +976,7 @@ ut_main(int argc, char *argv[])
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
 		int ret_ringlatency = spp_ringlatencystats_init(
 				SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL,
-				g_if_info.num_ring);
+				g_iface_info.num_ring);
 		if (unlikely(ret_ringlatency != 0))
 			break;
 #endif /* SPP_RINGLATENCYSTATS_ENABLE */
@@ -1028,7 +1041,7 @@ ut_main(int argc, char *argv[])
 		 * Remove vhost sock file if it is not running
 		 *  in vhost-client mode
 		 */
-		del_vhost_sockfile(g_if_info.vhost);
+		del_vhost_sockfile(g_iface_info.vhost);
 	}
 
 #ifdef SPP_RINGLATENCYSTATS_ENABLE
@@ -1047,13 +1060,14 @@ spp_get_client_id(void)
 
 /**
  * Check mac address used on the port for registering or removing
- *
- * TODO(yasufum) refactor, change if to iface.
  */
 int
-spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
+spp_check_mac_used_port(
+		uint64_t mac_addr,
+		enum port_type iface_type,
+		int iface_no)
 {
-	struct spp_port_info *port_info = get_if_area(if_type, if_no);
+	struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
 	return (mac_addr == port_info->mac_addr);
 }
 
@@ -1061,19 +1075,19 @@ spp_check_mac_used_port(uint64_t mac_addr, enum port_type if_type, int if_no)
  * Check if port has been added.
  */
 int
-spp_check_added_port(enum port_type if_type, int if_no)
+spp_check_added_port(enum port_type iface_type, int iface_no)
 {
-	struct spp_port_info *port = get_if_area(if_type, if_no);
-	return port->if_type != UNDEF;
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
+	return port->iface_type != UNDEF;
 }
 
 /*
  * Check if port has been flushed.
  */
 int
-spp_check_flush_port(enum port_type if_type, int if_no)
+spp_check_flush_port(enum port_type iface_type, int iface_no)
 {
-	struct spp_port_info *port = get_if_area(if_type, if_no);
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
 	return port->dpdk_port >= 0;
 }
 
@@ -1081,12 +1095,15 @@ spp_check_flush_port(enum port_type if_type, int if_no)
  * Check if component is using port.
  */
 int
-spp_check_used_port(enum port_type if_type, int if_no, enum spp_port_rxtx rxtx)
+spp_check_used_port(
+		enum port_type iface_type,
+		int iface_no,
+		enum spp_port_rxtx rxtx)
 {
 	int cnt, port_cnt, max = 0;
 	struct spp_component_info *component = NULL;
 	struct spp_port_info **port_array = NULL;
-	struct spp_port_info *port = get_if_area(if_type, if_no);
+	struct spp_port_info *port = get_iface_info(iface_type, iface_no);
 
 	if (port == NULL)
 		return SPP_RET_NG;
@@ -1120,14 +1137,14 @@ 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,
+		ret = spp_check_used_port(port->iface_type, port->iface_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,
+		ret = spp_check_used_port(port->iface_type, port->iface_no,
 				SPP_PORT_RXTX_TX);
 		if (ret >= 0)
 			g_change_component[ret] = 1;
@@ -1147,7 +1164,7 @@ spp_update_classifier_table(
 
 	if (type == SPP_CLASSIFIER_TYPE_MAC) {
 		RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
-				data, port->if_type, port->if_no);
+				data, port->iface_type, port->iface_no);
 
 		ret_mac = spp_change_mac_str_to_int64(data);
 		if (unlikely(ret_mac == -1)) {
@@ -1157,15 +1174,15 @@ spp_update_classifier_table(
 		}
 		mac_addr = (uint64_t)ret_mac;
 
-		port_info = get_if_area(port->if_type, port->if_no);
+		port_info = get_iface_info(port->iface_type, port->iface_no);
 		if (unlikely(port_info == NULL)) {
 			RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
-					port->if_type, port->if_no);
+					port->iface_type, port->iface_no);
 			return SPP_RET_NG;
 		}
-		if (unlikely(port_info->if_type == UNDEF)) {
+		if (unlikely(port_info->iface_type == UNDEF)) {
 			RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
-					port->if_type, port->if_no);
+					port->iface_type, port->iface_no);
 			return SPP_RET_NG;
 		}
 
@@ -1185,7 +1202,8 @@ spp_update_classifier_table(
 			/* Setting */
 			if (unlikely(port_info->mac_addr != 0)) {
 				RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d )\n",
-						 port->if_type, port->if_no);
+						port->iface_type,
+						port->iface_no);
 				return SPP_RET_NG;
 			}
 
@@ -1194,7 +1212,6 @@ spp_update_classifier_table(
 		}
 	}
 
-	/* TODO(yasufum) add desc how it is used and why changed core is kept */
 	set_component_change_port(port_info, SPP_PORT_RXTX_TX);
 	return SPP_RET_OK;
 }
@@ -1406,7 +1423,7 @@ spp_update_port(enum spp_command_action action,
 	}
 
 	component = &g_component_info[component_id];
-	port_info = get_if_area(port->if_type, port->if_no);
+	port_info = get_iface_info(port->iface_type, port->iface_no);
 	if (rxtx == SPP_PORT_RXTX_RX) {
 		num = &component->num_rx_port;
 		ports = component->rx_ports;
@@ -1426,7 +1443,7 @@ spp_update_port(enum spp_command_action action,
 			break;
 		}
 
-		port_info->if_type = port->if_type;
+		port_info->iface_type = port->iface_type;
 		ports[*num] = port_info;
 		(*num)++;
 
@@ -1457,9 +1474,9 @@ flush_port(void)
 
 	/* Initialize added vhost. */
 	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,
+		port = &g_iface_info.vhost[cnt];
+		if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+			ret = add_vhost_pmd(port->iface_no,
 					g_startup_param.vhost_client);
 			if (ret < 0)
 				return SPP_RET_NG;
@@ -1469,9 +1486,9 @@ flush_port(void)
 
 	/* Initialize added ring. */
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
-		port = &g_if_info.ring[cnt];
-		if ((port->if_type != UNDEF) && (port->dpdk_port < 0)) {
-			ret = add_ring_pmd(port->if_no);
+		port = &g_iface_info.ring[cnt];
+		if ((port->iface_type != UNDEF) && (port->dpdk_port < 0)) {
+			ret = add_ring_pmd(port->iface_no);
 			if (ret < 0)
 				return SPP_RET_NG;
 			port->dpdk_port = ret;
@@ -1634,14 +1651,12 @@ spp_iterate_classifier_table(
 
 /**
  * Separate port id of combination of iface type and number and
- * assign to given argument, if_type and if_no.
+ * assign to given argument, iface_type and iface_no.
  *
  * For instance, 'ring:0' is separated to 'ring' and '0'.
- *
- * TODO(yasufum) change if to iface
  */
 int
-spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
+spp_get_iface_index(const char *port, enum port_type *iface_type, int *iface_no)
 {
 	enum port_type type = UNDEF;
 	const char *no_str = NULL;
@@ -1678,11 +1693,11 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
 		return -1;
 	}
 
-	*if_type = type;
-	*if_no = ret_no;
+	*iface_type = type;
+	*iface_no = ret_no;
 
 	RTE_LOG(DEBUG, APP, "Port = %s => Type = %d No = %d\n",
-			port, *if_type, *if_no);
+			port, *iface_type, *iface_no);
 	return 0;
 }
 
@@ -1690,25 +1705,25 @@ spp_get_if_info(const char *port, enum port_type *if_type, int *if_no)
  * 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)
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no)
 {
-	const char *if_type_str;
+	const char *iface_type_str;
 
-	switch (if_type) {
+	switch (iface_type) {
 	case PHY:
-		if_type_str = SPP_IFTYPE_NIC_STR;
+		iface_type_str = SPP_IFTYPE_NIC_STR;
 		break;
 	case RING:
-		if_type_str = SPP_IFTYPE_RING_STR;
+		iface_type_str = SPP_IFTYPE_RING_STR;
 		break;
 	case VHOST:
-		if_type_str = SPP_IFTYPE_VHOST_STR;
+		iface_type_str = SPP_IFTYPE_VHOST_STR;
 		break;
 	default:
 		return -1;
 	}
 
-	sprintf(port, "%s:%d", if_type_str, if_no);
+	sprintf(port, "%s:%d", iface_type_str, iface_no);
 
 	return 0;
 }
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 4ab9afe..07f2e2a 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -82,33 +82,35 @@ enum spp_command_action {
  * Interface information structure
  */
 struct spp_port_index {
-	enum port_type  if_type;
-	int             if_no;
+	enum port_type  iface_type; /* Interface type (phy/vhost/ring) */
+	int             iface_no;   /* Interface number */
 };
 
 /*
  * 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 iface_type; /* Interface type (phy/vhost/ring) */
+	int            iface_no;   /* Interface number */
+	int            dpdk_port;  /* DPDK port number */
+	uint64_t       mac_addr;   /* Mac address for classifying */
+	char           mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
 };
 
 /*
  * Component info
  */
 struct spp_component_info {
-	char name[SPP_NAME_STR_LEN];
-	enum spp_component_type type;
-	unsigned int lcore_id;
-	int component_id;
-	int num_rx_port;
-	int num_tx_port;
+	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 */
 };
 
 /*
@@ -236,20 +238,20 @@ int spp_get_component_id(const char *name);
  */
 int spp_check_mac_used_port(
 		uint64_t mac_addr,
-		enum port_type if_type,
-		int if_no);
+		enum port_type iface_type,
+		int iface_no);
 
 /*
  * Check if port has been added.
  * RETURN : True if port has been added.
  */
-int spp_check_added_port(enum port_type if_type, int if_no);
+int spp_check_added_port(enum port_type iface_type, int iface_no);
 
 /*
  * Check if port has been flushed.
  * RETURN : True if port has been flushed.
  */
-int spp_check_flush_port(enum port_type if_type, int if_no);
+int spp_check_flush_port(enum port_type iface_type, int iface_no);
 
 /*
  * Check if component is using port.
@@ -257,8 +259,8 @@ int spp_check_flush_port(enum port_type if_type, int if_no);
  * NG : SPP_RET_NG
  */
 int spp_check_used_port(
-		enum port_type if_type,
-		int if_no,
+		enum port_type iface_type,
+		int iface_no,
 		enum spp_port_rxtx rxtx);
 
 /*
@@ -274,7 +276,10 @@ int64_t spp_change_mac_str_to_int64(const char *mac);
  * OK : 0
  * NG : -1
  */
-int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
+int spp_get_iface_index(
+		const char *port,
+		enum port_type *iface_type,
+		int *iface_no);
 
 /*
  * Format port string form if-type/if-number
@@ -282,7 +287,7 @@ int spp_get_if_info(const char *port, enum port_type *if_type, int *if_no);
  * OK : 0
  * NG : -1
  */
-int spp_format_port_string(char *port, enum port_type if_type, int if_no);
+int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
 /*
  * Change component type from string to type value.
-- 
1.9.1

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

* [spp] [PATCH 3/7] spp_vf: change header file to doxygen format
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
  2018-02-09  3:39       ` [spp] [PATCH 1/7] spp_vf: refactor to comply with coding rule x-fn-spp
  2018-02-09  3:39       ` [spp] [PATCH 2/7] spp_vf: refactor comments and variable names x-fn-spp
@ 2018-02-09  3:39       ` x-fn-spp
  2018-02-09  3:40       ` [spp] [PATCH 4/7] spp_vf: add VLAN tag operate function to port x-fn-spp
                         ` (4 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:39 UTC (permalink / raw)
  To: spp

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

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.h   |  49 ++++++-
 src/vf/command_conn.h     |  26 ++--
 src/vf/command_dec.h      | 134 ++++++++++-------
 src/vf/command_proc.h     |  13 +-
 src/vf/ringlatencystats.h |  39 ++++-
 src/vf/spp_forward.h      |  55 ++++++-
 src/vf/spp_vf.h           | 362 ++++++++++++++++++++++++++++++++++------------
 src/vf/string_buffer.h    |  14 +-
 8 files changed, 510 insertions(+), 182 deletions(-)

diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index b4e6715..b947bf7 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,12 +1,25 @@
 #ifndef _CLASSIFIER_MAC_H_
 #define _CLASSIFIER_MAC_H_
 
+/**
+ * @file
+ * SPP Classifier
+ *
+ * Classifier component provides packet forwarding function from
+ * one port to one port. Classifier has table of virtual MAC address.
+ * According to this table, classifier lookups L2 destination MAC address
+ * and determines which port to be transferred to incoming packets.
+ */
+
 /* forward declaration */
 struct spp_component_info;
 struct spp_iterate_classifier_table_params;
 
 /**
  * classifier(mac address) initialize globals.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_init(void);
 
@@ -14,10 +27,11 @@ int spp_classifier_mac_init(void);
  * classifier(mac address) update component info.
  *
  * @param component_info
- *  point to struct spp_component_info.
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of classifier.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_update(struct spp_component_info *component_info);
 
@@ -25,15 +39,27 @@ int spp_classifier_mac_update(struct spp_component_info *component_info);
  * classifier(mac address) thread function.
  *
  * @param id
- *  unique component ID.
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_do(int id);
 
-/*
- * classifier get component status
+/**
+ * classifier get component status.
+ *
+ *
+ * @param lcore_id
+ *  The logical core ID for classifier.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of classifier status.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int
 spp_classifier_get_component_status(unsigned int lcore_id, int id,
@@ -41,6 +67,13 @@ spp_classifier_get_component_status(unsigned int lcore_id, int id,
 
 /**
  * classifier(mac address) iterate classifier table.
+ *
+ * @param params
+ *  Point to struct spp_iterate_classifier_table_params.@n
+ *  Detailed data of classifier table.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params);
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index 8f3b9cf..b52ab32 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -1,6 +1,13 @@
 #ifndef _COMMAND_CONN_H_
 #define _COMMAND_CONN_H_
 
+/**
+ * @file
+ * SPP Connection
+ *
+ * Command connection management.
+ */
+
 /** result code - temporary error. please retry */
 #define SPP_CONNERR_TEMPORARY -1
 /** result code - fatal error occurred. should terminate process. */
@@ -10,10 +17,9 @@
  * initialize command connection.
  *
  * @param controller_ip
- *  controller listen ip address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
@@ -26,7 +32,7 @@ int spp_command_conn_init(const char *controller_ip, int controller_port);
  * @note bocking.
  *
  * @param sock
- *  socket that connect to controller.
+ *  Socket number for connecting to controller.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please retry.
@@ -39,7 +45,9 @@ int spp_connect_to_controller(int *sock);
  * @note non-blocking.
  *
  * @param sock
- *  socket that read data.
+ *  The socket number for the connection.
+ * @param msgbuf
+ *  The pointer to command message buffer.
  *
  * @retval 0 <                   succeeded. number of bytes received.
  * @retval 0                     no receive message.
@@ -54,13 +62,11 @@ int spp_receive_message(int *sock, char **msgbuf);
  * @note non-blocking.
  *
  * @param sock
- *  socket that write data.
- *
+ *  The socket number to be sent.
  * @param message
- *  send data.
- *
+ *  The pointer to the message to be sent.
  * @param message_len
- *  send data length.
+ *  The length of message.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect.
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 77cae87..3eb4bc4 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,29 +1,36 @@
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
-/* max number of command per request */
+/**
+ * @file
+ * SPP command decode
+ *
+ * Decode and validate the command message string.
+ */
+
+/** max number of command per request */
 #define SPP_CMD_MAX_COMMANDS 32
 
-/* maximum number of parameters per command */
+/** maximum number of parameters per command */
 #define SPP_CMD_MAX_PARAMETERS 8
 
-/* command name string buffer size (include null char) */
+/** command name string buffer size (include null char) */
 #define SPP_CMD_NAME_BUFSZ  32
 
-/* command value string buffer size (include null char) */
+/** command value string buffer size (include null char) */
 #define SPP_CMD_VALUE_BUFSZ 128
 
-/* string that specify unused */
+/** string that specify unused */
 #define SPP_CMD_UNUSE "unuse"
 
-/* decode error code */
+/** decode error code */
 enum spp_command_decode_error_code {
 	/* not use 0, in general 0 is OK */
-	SPP_CMD_DERR_BAD_FORMAT = 1,
-	SPP_CMD_DERR_UNKNOWN_COMMAND,
-	SPP_CMD_DERR_NO_PARAM,
-	SPP_CMD_DERR_BAD_TYPE,
-	SPP_CMD_DERR_BAD_VALUE,
+	SPP_CMD_DERR_BAD_FORMAT = 1,  /**< Wrong format */
+	SPP_CMD_DERR_UNKNOWN_COMMAND, /**< Unknown command */
+	SPP_CMD_DERR_NO_PARAM,        /**< No parameters */
+	SPP_CMD_DERR_BAD_TYPE,        /**< Wrong data type */
+	SPP_CMD_DERR_BAD_VALUE,       /**< Wrong value */
 };
 
 /**
@@ -33,28 +40,28 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE,
-	SPP_CMDTYPE_FLUSH,
-	SPP_CMDTYPE_CLIENT_ID,
-	SPP_CMDTYPE_STATUS,
-	SPP_CMDTYPE_EXIT,
-	SPP_CMDTYPE_COMPONENT,
-	SPP_CMDTYPE_PORT,
-	SPP_CMDTYPE_CANCEL,
+	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
+	SPP_CMDTYPE_FLUSH,            /**< flush command */
+	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
+	SPP_CMDTYPE_STATUS,           /**< status command */
+	SPP_CMDTYPE_EXIT,             /**< exit command */
+	SPP_CMDTYPE_COMPONENT,        /**< component command */
+	SPP_CMDTYPE_PORT,             /**< port command */
+	SPP_CMDTYPE_CANCEL,           /**< cancel command */
 };
 
-/* "classifier_table" command specific parameters */
+/** "classifier_table" command specific parameters */
 struct spp_command_classifier_table {
-	/* Action identifier (add or del) */
+	/** Action identifier (add or del) */
 	enum spp_command_action action;
 
-	/* Classify type (currently only for mac) */
+	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/* Value to be classified */
+	/** Value to be classified */
 	char value[SPP_CMD_VALUE_BUFSZ];
 
-	/* Destination port type and number */
+	/** Destination port type and number */
 	struct spp_port_index port;
 };
 
@@ -63,61 +70,84 @@ struct spp_command_flush {
 	/* nothing specific */
 };
 
-/* "component" command parameters */
+/** "component" command parameters */
 struct spp_command_component {
-	enum spp_command_action action; /* Action identifier (start or stop) */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Component name */
-	unsigned int core;              /* Logical core number */
-	enum spp_component_type type;   /* Component type */
+	/**< Action identifier (start or stop) */
+	enum spp_command_action action;
+
+	/**< Component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/**< Logical core number */
+	unsigned int core;
+
+	/**< Component type */
+	enum spp_component_type type;
 };
 
-/* "port" command parameters */
+/** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /* Action identifier (add or del) */
-	struct spp_port_index port;     /* Port type and number */
-	enum spp_port_rxtx rxtx;        /* rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Attached component name */
+	enum spp_command_action action; /**< Action identifier (add or del) */
+	struct spp_port_index port;     /**< Port type and number */
+	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
+	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
 };
 
-/* command parameters */
+/** command parameters */
 struct spp_command {
-	enum spp_command_type type; /* Command type */
+	enum spp_command_type type; /**< Command type */
 
 	union {
-		/* Structured data for classifier_table command  */
+		/** Structured data for classifier_table command  */
 		struct spp_command_classifier_table classifier_table;
 
-		/* Structured data for flush command  */
+		/** Structured data for flush command  */
 		struct spp_command_flush flush;
 
-		/* Structured data for component command  */
+		/** Structured data for component command  */
 		struct spp_command_component component;
 
-		/* Structured data for port command  */
+		/** Structured data for port command  */
 		struct spp_command_port port;
 	} spec;
 };
 
-/* request parameters */
+/** request parameters */
 struct spp_command_request {
-	int num_command;                /* Number of accepted commands */
-	int num_valid_command;          /* Number of executed commands */
+	int num_command;                /**< Number of accepted commands */
+	int num_valid_command;          /**< Number of executed commands */
 	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
-					/* Information of executed commands */
+					/**< Information of executed commands */
 
-	int is_requested_client_id;     /* Id for get_client_id command */
-	int is_requested_status;        /* Id for status command */
-	int is_requested_exit;          /* Id for exit command */
+	int is_requested_client_id;     /**< Id for get_client_id command */
+	int is_requested_status;        /**< Id for status command */
+	int is_requested_exit;          /**< Id for exit command */
 };
 
-/* decode error information */
+/** decode error information */
 struct spp_command_decode_error {
-	int code;                            /* Error code */
-	char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
-	char value[SPP_CMD_VALUE_BUFSZ];     /* Error value */
+	int code;                            /**< Error code */
+	char value_name[SPP_CMD_NAME_BUFSZ]; /**< Error value name */
+	char value[SPP_CMD_VALUE_BUFSZ];     /**< Error value */
 };
 
-/* decode request from no-null-terminated string */
+/**
+ * decode request from no-null-terminated string
+ *
+ * @param request
+ *  The pointer to struct spp_command_request.@n
+ *  The result value of decoding the command message.
+ * @param request_str
+ *  The pointer to requested command message.
+ * @param request_str_len
+ *  The length of requested command message.
+ * @param error
+ *  The pointer to struct spp_command_decode_error.@n
+ *  Detailed error information will be stored.
+ *
+ * @retval 0  succeeded.
+ * @retval !0 failed.
+ */
 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);
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 6b88da7..04296de 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -2,13 +2,20 @@
 #define _COMMAND_PROC_H_
 
 /**
+ * @file
+ * SPP Command processing
+ *
+ * Receive and process the command message, then send back the
+ * result JSON formatted data.
+ */
+
+/**
  * initialize command processor.
  *
  * @param controller_ip
- *  controller listen IP address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index 2e64d63..5bc230d 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -1,6 +1,13 @@
 #ifndef _RINGLATENCYSTATS_H_
 #define _RINGLATENCYSTATS_H_
 
+/**
+ * @file
+ * SPP RING latency statistics
+ *
+ * Measure the latency through ring-PMD.
+ */
+
 #include <rte_mbuf.h>
 
 /** number of slots to save latency. 0ns~99ns and 100ns over */
@@ -8,7 +15,7 @@
 
 /** ring latency statistics */
 struct spp_ringlatencystats_ring_latency_stats {
-	/**< slots to save latency */
+	/** slots to save latency */
 	uint64_t slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT];
 };
 
@@ -17,6 +24,11 @@ struct spp_ringlatencystats_ring_latency_stats {
 /**
  * initialize ring latency statistics.
  *
+ * @param samp_intvl
+ *  The interval timer(ns) to refer the counter.
+ * @param stats_count
+ *  The number of ring to be measured.
+ *
  * @retval 0: succeeded.
  * @retval -1: failed.
  */
@@ -30,7 +42,15 @@ void spp_ringlatencystats_uninit(void);
 /**
  * add time-stamp to mbuf's member.
  *
- * call at enqueue.
+ * @note call at enqueue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_add_time_stamp(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -38,7 +58,15 @@ void spp_ringlatencystats_add_time_stamp(int ring_id,
 /**
  * calculate latency.
  *
- * call at dequeue.
+ * @note call at dequeue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_calculate_latency(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -52,6 +80,11 @@ int spp_ringlatencystats_get_count(void);
 
 /**
  *get specific ring latency statistics.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param stats
+ *  The statistics values.
  */
 void spp_ringlatencystats_get_stats(int ring_id,
 		struct spp_ringlatencystats_ring_latency_stats *stats);
diff --git a/src/vf/spp_forward.h b/src/vf/spp_forward.h
index 5e5cf0f..b2965a6 100644
--- a/src/vf/spp_forward.h
+++ b/src/vf/spp_forward.h
@@ -1,21 +1,62 @@
 #ifndef __SPP_FORWARD_H__
 #define __SPP_FORWARD_H__
 
-/* Clear info */
-void spp_forward_init(void);
+/**
+ * @file
+ * SPP Forwarder and Merger
+ *
+ * Forwarder
+ * This component provides function for packet processing from one port
+ * to one port. Incoming packets from port are to be transferred to
+ * specific one port. The direction of this transferring is specified
+ * by port command.
+ * Merger
+ * This component provides packet forwarding function from multiple
+ * ports to one port. Incoming packets from multiple ports are to be
+ * transferred to one specific port. The flow of this merging process
+ * is specified by port command.
+ */
 
-/* Clear info for one element. */
-void spp_forward_init_info(int id);
+/** Clear info */
+void spp_forward_init(void);
 
-/* Update forward info */
+/**
+ * Update forward info
+ *
+ * @param component
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of forwarder and merger.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_update(struct spp_component_info *component);
 
-/*
+/**
  * Merge/Forward
+ *
+ * @param id
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_forward(int id);
 
-/* Merge/Forward get component status */
+/**
+ * Merge/Forward get component status
+ *
+ * @param lcore_id
+ *  The logical core ID for forwarder and merger.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of forwarder/merger status.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_get_component_status(
 		unsigned int lcore_id, int id,
 		struct spp_iterate_core_params *params);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 07f2e2a..70e105b 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -1,128 +1,164 @@
 #ifndef __SPP_VF_H__
 #define __SPP_VF_H__
 
+/**
+ * @file
+ * SPP_VF main
+ *
+ * Main function of spp_vf.
+ * This provides the function for initializing and starting the threads.
+ */
+
 #include "common.h"
 
+/** Identifier string for each component (status command) @{*/
 #define SPP_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
 #define SPP_TYPE_MERGE_STR          "merge"
 #define SPP_TYPE_FORWARD_STR        "forward"
 #define SPP_TYPE_UNUSE_STR          "unuse"
+/**@}*/
 
+/** Identifier string for each interface @{*/
 #define SPP_IFTYPE_NIC_STR   "phy"
 #define SPP_IFTYPE_VHOST_STR "vhost"
 #define SPP_IFTYPE_RING_STR  "ring"
+/**@}*/
 
+/** The max number of client ID */
 #define SPP_CLIENT_MAX    128
+
+/** The max number of buffer for management */
 #define SPP_INFO_AREA_MAX 2
+
+/** The length of shortest character string */
 #define SPP_MIN_STR_LEN   32
+
+/** The length of NAME string */
 #define SPP_NAME_STR_LEN  128
 
+/** Update wait timer (micro sec) */
 #define SPP_CHANGE_UPDATE_INTERVAL 10
 
+/** Character sting for default port of classifier */
 #define SPP_DEFAULT_CLASSIFIED_SPEC_STR     "default"
+
+/** Character sting for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR "00:00:00:00:00:01"
+
+/** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
-/*
+/**
  * State on component
  */
 enum spp_core_status {
-	SPP_CORE_UNUSE,
-	SPP_CORE_STOP,
-	SPP_CORE_IDLE,
-	SPP_CORE_FORWARD,
-	SPP_CORE_STOP_REQUEST,
-	SPP_CORE_IDLE_REQUEST
+	SPP_CORE_UNUSE,        /**< Not used */
+	SPP_CORE_STOP,         /**< Stopped */
+	SPP_CORE_IDLE,         /**< Idling */
+	SPP_CORE_FORWARD,      /**< Forwarding  */
+	SPP_CORE_STOP_REQUEST, /**< Request stopping */
+	SPP_CORE_IDLE_REQUEST  /**< Request idling */
 };
 
-/*
+/**
  * Process type for each component
  */
 enum spp_component_type {
-	SPP_COMPONENT_UNUSE,
-	SPP_COMPONENT_CLASSIFIER_MAC,
-	SPP_COMPONENT_MERGE,
-	SPP_COMPONENT_FORWARD,
+	SPP_COMPONENT_UNUSE,          /**< Not used */
+	SPP_COMPONENT_CLASSIFIER_MAC, /**< Classifier_mac */
+	SPP_COMPONENT_MERGE,          /**< Merger */
+	SPP_COMPONENT_FORWARD,        /**< Forwarder */
 };
 
-/*
+/**
  * Classifier Type
  */
 enum spp_classifier_type {
-	SPP_CLASSIFIER_TYPE_NONE,
-	SPP_CLASSIFIER_TYPE_MAC
+	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
+	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
 };
 
-/*
+/**
  * API Return value
  */
 enum spp_return_value {
-	SPP_RET_OK = 0,
-	SPP_RET_NG = -1,
+	SPP_RET_OK = 0,  /**< succeeded */
+	SPP_RET_NG = -1, /**< failed */
 };
 
-/* Port type (rx or tx) */
+/** Port type (rx or tx) */
 enum spp_port_rxtx {
-	SPP_PORT_RXTX_NONE,
-	SPP_PORT_RXTX_RX,
-	SPP_PORT_RXTX_TX,
-	SPP_PORT_RXTX_ALL,
+	SPP_PORT_RXTX_NONE, /**< none */
+	SPP_PORT_RXTX_RX,   /**< rx port */
+	SPP_PORT_RXTX_TX,   /**< tx port */
+	SPP_PORT_RXTX_ALL,  /**< rx/tx port */
 };
 
-/* command setting type */
+/** command setting type */
 enum spp_command_action {
-	SPP_CMD_ACTION_NONE,
-	SPP_CMD_ACTION_START,
-	SPP_CMD_ACTION_STOP,
-	SPP_CMD_ACTION_ADD,
-	SPP_CMD_ACTION_DEL,
+	SPP_CMD_ACTION_NONE,  /**< none */
+	SPP_CMD_ACTION_START, /**< start */
+	SPP_CMD_ACTION_STOP,  /**< stop */
+	SPP_CMD_ACTION_ADD,   /**< add */
+	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
-/*
+/**
  * Interface information structure
  */
 struct spp_port_index {
-	enum port_type  iface_type; /* Interface type (phy/vhost/ring) */
-	int             iface_no;   /* Interface number */
+	enum port_type  iface_type; /**< Interface type (phy/vhost/ring) */
+	int             iface_no;   /**< Interface number */
 };
 
-/*
+/**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /* Interface type (phy/vhost/ring) */
-	int            iface_no;   /* Interface number */
-	int            dpdk_port;  /* DPDK port number */
-	uint64_t       mac_addr;   /* Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
+	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
+	int            iface_no;   /**< Interface number */
+	int            dpdk_port;  /**< DPDK port number */
+	uint64_t       mac_addr;   /**< Mac address for classifying */
+	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
 };
 
-/*
+/**
  * 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 */
+	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 */
+					/**< Array of pointers to rx ports */
 	struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
-					/* Array of pointers to tx ports */
+					/**< Array of pointers to tx ports */
 };
 
-/*
+/**
  * Get client ID
- * RETURN : CLIENT ID(0~127)
+ *
+ * @return Client ID(0~127)
  */
 int spp_get_client_id(void);
 
-/*
+/**
  * Update Classifier_table
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param type
+ *  Classify type (currently only for mac)
+ * @param data
+ *  Value to be classified
+ * @param port
+ *  Destination port type and number
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_classifier_table(
 		enum spp_command_action action,
@@ -130,20 +166,40 @@ int spp_update_classifier_table(
 		const char *data,
 		const struct spp_port_index *port);
 
-/*
+/**
  * Update component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (start or stop)
+ * @param name
+ *  Component name
+ * @param lcore_id
+ *  Logical core number
+ * @param type
+ *  Component type
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_component(
 		enum spp_command_action action,
 		const char *name, unsigned int lcore_id,
 		enum spp_component_type type);
 
-/*
+/**
  * Update port
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param port
+ *  Port type and number
+ * @param rxtx
+ *  rx/tx identifier
+ * @param name
+ *  Attached component name
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_port(
 		enum spp_command_action action,
@@ -151,19 +207,20 @@ int spp_update_port(
 		enum spp_port_rxtx rxtx,
 		const char *name);
 
-/*
+/**
  * Flush SPP component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_flush(void);
 
-/*
+/**
  * Cancel data that is not flushing
  */
 void spp_cancel(void);
 
-/* definition of iterated core element procedure function */
+/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
@@ -175,16 +232,28 @@ typedef int (*spp_iterate_core_element_proc)(
 		const int num_tx,
 		const struct spp_port_index *tx_ports);
 
-/* iterate core information  parameters */
+/** iterate core information parameters */
 struct spp_iterate_core_params {
+	/** Output buffer */
 	char *output;
+
+	/** The function for creating core information */
 	spp_iterate_core_element_proc element_proc;
 };
 
-/* Iterate core information */
+/**
+ * Iterate core information
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  The value for generating core information (status command).
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
+ */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/* definition of iterated classifier element procedure function */
+/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
@@ -192,105 +261,206 @@ typedef int (*spp_iterate_classifier_element_proc)(
 		const char *data,
 		const struct spp_port_index *port);
 
-/* iterate classifier table parameters */
+/** iterate classifier table parameters */
 struct spp_iterate_classifier_table_params {
 	void *output;
 	spp_iterate_classifier_element_proc element_proc;
 };
 
-/*
+/**
  * Iterate Classifier_table
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_classifier_table_params.@n
+ *  The value for generating classifier table.
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_iterate_classifier_table(
 		struct spp_iterate_classifier_table_params *params);
 
-/* Get core status */
+/**
+ * Get core status
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Status of specified logical core.
+ */
 enum spp_core_status spp_get_core_status(unsigned int lcore_id);
 
-/* Get component type of target core */
+/**
+ * Get component type of target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component executed on specified logical core
+ */
 enum spp_component_type spp_get_component_type(unsigned int lcore_id);
 
-/* Get component type being updated on target core */
+/**
+ * Get component type being updated on target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component that will be executed on
+ *  specified logical core after update.
+ */
 enum spp_component_type spp_get_component_type_update(unsigned int lcore_id);
 
-/*
+/**
  * Get core ID of target component
- * RETURN : core ID
+ *
+ * @param component_id
+ *  unique component ID.
+ *
+ * @return
+ *  Logical core id of specified component.
  */
 unsigned int spp_get_component_core(int component_id);
 
-/*
+/**
  * Check core index change
- * RETURN : True if index has changed.
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  True if index has changed.
  */
 int spp_check_core_index(unsigned int lcore_id);
 
-/*
+/**
  * Get name matching component ID
- * OK : component ID
- * NG : SPP_RET_NG
+ *
+ * @param name
+ *  Component name.
+ *
+ * @retval 0~127      Component ID.
+ * @retval SPP_RET_NG failed.
  */
 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.
+ *
+ * @param mac_addr
+ *  Mac address to be validated.
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if target MAC address matches MAC address of port.
  */
 int spp_check_mac_used_port(
 		uint64_t mac_addr,
 		enum port_type iface_type,
 		int iface_no);
 
-/*
+/**
  * Check if port has been added.
- * RETURN : True if port has been added.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been added.
  */
 int spp_check_added_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if port has been flushed.
- * RETURN : True if port has been flushed.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been flushed.
  */
 int spp_check_flush_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if component is using port.
- * OK : match component ID
- * NG : SPP_RET_NG
+ *
+ * @param iface_type
+ *  Interface type to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ * @param rxtx
+ *  tx/rx type to be validated.
+ *
+ * @retval 0~127      match component ID
+ * @retval SPP_RET_NG failed.
  */
 int spp_check_used_port(
 		enum port_type iface_type,
 		int iface_no,
 		enum spp_port_rxtx rxtx);
 
-/*
+/**
  * Change mac address string to int64
- * OK : int64 that store mac address
- * NG : -1
+ *
+ * @param mac
+ *  Character string of MAC address to be converted.
+ *
+ * @retval 0< int64 that store mac address
+ * @retval -1
  */
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
-/*
+/**
  * Extract if-type/if-number from port string
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_get_iface_index(
 		const char *port,
 		enum port_type *iface_type,
 		int *iface_no);
 
-/*
+/**
  * Format port string form if-type/if-number
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type.
+ * @param iface_no
+ *  Interface number.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Change component type from string to type value.
+ *
+ * @param type_str
+ *  Name string for each component
+ *
+ * @return
+ *  Component type corresponding to type_str.
  */
 enum spp_component_type spp_change_component_type(const char *type_str);
 
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 60645e9..947748e 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -2,6 +2,14 @@
 #define _STRING_BUFFER_H_
 
 /**
+ * @file
+ * SPP String buffer management
+ *
+ * Management features of string buffer which is used for communicating
+ * between spp_vf and controller.
+ */
+
+/**
  * allocate string buffer from heap memory.
  *
  * @attention allocated memory must free by spp_strbuf_free function.
@@ -28,10 +36,8 @@ void spp_strbuf_free(char *strbuf);
  * @param strbuf
  *  destination string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param append
  *  string to append. normal c-string.
- *
  * @param append_len
  *  length of append string.
  *
@@ -46,9 +52,11 @@ char *spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
  * @param strbuf
  *  target string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param remove_len
  *  length of remove.
+ *
+ * @return
+ *  The pointer to removed string.
  */
 char *spp_strbuf_remove_front(char *strbuf, size_t remove_len);
 
-- 
1.9.1

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

* [spp] [PATCH 4/7] spp_vf: add VLAN tag operate function to port
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
                         ` (2 preceding siblings ...)
  2018-02-09  3:39       ` [spp] [PATCH 3/7] spp_vf: change header file to doxygen format x-fn-spp
@ 2018-02-09  3:40       ` x-fn-spp
  2018-02-09  3:40       ` [spp] [PATCH 5/7] spp_vf: refactor struct and variable names x-fn-spp
                         ` (3 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:40 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Add VLAN tag operate function to port.
* Support set operation type of VLAN tag at port command.
* Support display information of VLAN tag at status command.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/Makefile         |   2 +-
 src/vf/classifier_mac.c |  23 +--
 src/vf/command_dec.c    | 104 ++++++++++++-
 src/vf/command_dec.h    |  26 +++-
 src/vf/command_proc.c   | 143 +++++++++++++++--
 src/vf/spp_forward.c    |  22 +--
 src/vf/spp_port.c       | 403 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/vf/spp_port.h       | 109 +++++++++++++
 src/vf/spp_vf.c         |  49 +++++-
 src/vf/spp_vf.h         |  58 ++++++-
 10 files changed, 876 insertions(+), 63 deletions(-)
 create mode 100644 src/vf/spp_port.c
 create mode 100644 src/vf/spp_port.h

diff --git a/src/vf/Makefile b/src/vf/Makefile
index d54af25..fe2ef2d 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -40,7 +40,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 APP = spp_vf
 
 # all source are stored in SRCS-y
-SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c ../shared/common.c
+SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c spp_port.c ../shared/common.c
 
 CFLAGS += $(WERROR_FLAGS) -O3
 CFLAGS += -I$(SRCDIR)/../shared
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index cd186a2..93cec8f 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -19,7 +19,7 @@
 #include <rte_hash.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "classifier_mac.h"
 
 #define RTE_LOGTYPE_SPP_CLASSIFIER_MAC RTE_LOGTYPE_USER1
@@ -333,16 +333,8 @@ transmit_packet(struct classified_data *classified_data)
 	int i;
 	uint16_t n_tx;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-	if (classified_data->iface_type == RING)
-		/* if tx-if is ring, set ringlatencystats */
-		spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
-				classified_data->pkts,
-				classified_data->num_pkt);
-#endif
-
 	/* transmit packets */
-	n_tx = rte_eth_tx_burst(classified_data->port, 0,
+	n_tx = spp_eth_tx_burst(classified_data->port, 0,
 			classified_data->pkts, classified_data->num_pkt);
 
 	/* free cannot transmit packets */
@@ -489,6 +481,8 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 {
 	if (unlikely(classifier_mng_info->ref_index ==
 			classifier_mng_info->upd_index)) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
 		transmit_all_packet(classifier_mng_info->info +
@@ -618,18 +612,11 @@ spp_classifier_mac_do(int id)
 			continue;
 
 		/* retrieve packets */
-		n_rx = rte_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (classified_data_rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->iface_no,
-					rx_pkts, n_rx);
-#endif
-
 		/* classify and transmit (filled) */
 		classify_packet(rx_pkts, n_rx, classifier_info,
 				classified_data_tx);
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 59e825c..9a4496f 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -1,6 +1,7 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <rte_ether.h>
 #include <rte_log.h>
 #include <rte_branch_prediction.h>
 
@@ -46,6 +47,18 @@ const char *PORT_RXTX_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STRINGS[] = {
+	"none",
+	"add_vlantag",
+	"del_vlantag",
+
+	/* termination */ "",
+};
+
 /* set decode error */
 inline int
 set_decode_error(struct spp_command_decode_error *error,
@@ -102,6 +115,27 @@ get_arrary_index(const char *match, const char *list[])
 	return -1;
 }
 
+/* Get int type value */
+static int
+get_int_value(
+		int *output,
+		const char *arg_val,
+		int min,
+		int max)
+{
+	int ret = 0;
+	char *endptr = NULL;
+	ret = strtol(arg_val, &endptr, 0);
+	if (unlikely(endptr == arg_val) || unlikely(*endptr != '\0'))
+		return -1;
+
+	if (unlikely(ret < min) || unlikely(ret > max))
+		return -1;
+
+	*output = ret;
+	return 0;
+}
+
 /* Get unsigned int type value */
 static int
 get_uint_value(
@@ -352,6 +386,59 @@ decode_port_name_value(void *output, const char *arg_val)
 	return decode_str_value(output, arg_val);
 }
 
+#/* decoding procedure of port ability for port command */
+static int
+decode_port_ability_value(void *output, const char *arg_val)
+{
+	int ret = 0;
+	struct spp_command_port *port = output;
+	struct spp_port_ability *ability = &port->ability;
+
+	switch (ability->ope) {
+	case SPP_PORT_ABILITY_OPE_NONE:
+		ret = get_arrary_index(arg_val, PORT_ABILITY_STRINGS);
+		if (unlikely(ret <= 0)) {
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Unknown port ability. val=%s\n",
+					arg_val);
+			return -1;
+		}
+		ability->ope  = ret;
+		ability->rxtx = port->rxtx;
+		break;
+	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		if (ability->data.vlantag.pcp == 0) {
+			ret = get_int_value(&ability->data.vlantag.vid,
+					arg_val, 0, ETH_VLAN_ID_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN ID. val=%s\n",
+						arg_val);
+				return -1;
+			}
+			ability->data.vlantag.pcp = -1;
+		} else {
+			ret = get_int_value(&ability->data.vlantag.pcp,
+					arg_val, 0, SPP_VLAN_PCP_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN PCP. val=%s\n",
+						arg_val);
+				return -1;
+			}
+		}
+		break;
+	case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		/* Nothing to do. */
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	return 0;
+}
+
 /* decoding procedure of mac address string */
 static int
 decode_mac_addr_str_value(void *output, const char *arg_val)
@@ -566,6 +653,21 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.offset = offsetof(struct spp_command, spec.port.name),
 			.func = decode_port_name_value
 		},
+		{
+			.name = "port ability 1",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 2",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 3",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
 		DECODE_PARAMETER_LIST_EMPTY,
 	},
 	{ DECODE_PARAMETER_LIST_EMPTY }, /* cancel           */
@@ -618,7 +720,7 @@ static struct decode_command_list command_list[] = {
 	{ "exit",             1, 1, NULL },     /* exit             */
 	{ "component",        3, 5, decode_command_parameter_in_list },
 						/* component        */
-	{ "port",             5, 5, decode_command_parameter_in_list },
+	{ "port",             5, 8, decode_command_parameter_in_list },
 						/* port             */
 	{ "cancel",           1, 1, NULL },     /* cancel           */
 	{ "",                 0, 0, NULL }      /* termination      */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 3eb4bc4..fc807f8 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -72,25 +72,35 @@ struct spp_command_flush {
 
 /** "component" command parameters */
 struct spp_command_component {
-	/**< Action identifier (start or stop) */
+	/** Action identifier (start or stop) */
 	enum spp_command_action action;
 
-	/**< Component name */
+	/** Component name */
 	char name[SPP_CMD_NAME_BUFSZ];
 
-	/**< Logical core number */
+	/** Logical core number */
 	unsigned int core;
 
-	/**< Component type */
+	/** Component type */
 	enum spp_component_type type;
 };
 
 /** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /**< Action identifier (add or del) */
-	struct spp_port_index port;     /**< Port type and number */
-	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
+	/** Action identifier (add or del) */
+	enum spp_command_action action;
+
+	/** Port type and number */
+	struct spp_port_index port;
+
+	/** rx/tx identifier */
+	enum spp_port_rxtx rxtx;
+
+	/** Attached component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/** Port ability */
+	struct spp_port_ability ability;
 };
 
 /** command parameters */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index f51c800..b76c586 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -5,6 +5,7 @@
 #include <rte_branch_prediction.h>
 
 #include "spp_vf.h"
+#include "spp_port.h"
 #include "string_buffer.h"
 #include "command_conn.h"
 #include "command_dec.h"
@@ -55,6 +56,18 @@ struct command_response_list {
 	int (*func)(const char *name, char **output, void *tmp);
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STATUS_STRINGS[] = {
+	"none",
+	"add",
+	"del",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -211,7 +224,8 @@ execute_command(const struct spp_command *command)
 				command->spec.port.action,
 				&command->spec.port.port,
 				command->spec.port.rxtx,
-				command->spec.port.name);
+				command->spec.port.name,
+				&command->spec.port.ability);
 		break;
 
 	case SPP_CMDTYPE_CANCEL:
@@ -422,15 +436,35 @@ append_interface_value(const char *name, char **output,
 	return ret;
 }
 
-/* append a list of port numbers for JSON format */
+/* append a value of vlan for JSON format */
+static int
+append_vlan_value(char **output, const int ope, const int vid, const int pcp)
+{
+	int ret = 0;
+	ret = append_json_str_value("operation", output,
+			PORT_ABILITY_STATUS_STRINGS[ope]);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("id", output, vid);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("pcp", output, pcp);
+	if (unlikely(ret < 0))
+		return -1;
+
+	return 0;
+}
+
+/* append a block of vlan for JSON format */
 static int
-apeend_port_array(const char *name, char **output,
-		const int num, const struct spp_port_index *ports)
+append_vlan_block(const char *name, char **output,
+		const int port_id, const enum spp_port_rxtx rxtx)
 {
 	int ret = -1;
 	int i = 0;
-	char port_str[CMD_TAG_APPEND_SIZE];
-	char append_str[CMD_TAG_APPEND_SIZE];
+	struct spp_port_ability *info = NULL;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -439,15 +473,90 @@ apeend_port_array(const char *name, char **output,
 		return -1;
 	}
 
-	for (i = 0; i < num; i++) {
-		spp_format_port_string(port_str, ports[i].iface_type,
-				ports[i].iface_no);
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	for (i = 0; i < SPP_PORT_ABILITY_MAX; i++) {
+		switch (info[i].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+			ret = append_vlan_value(&tmp_buff, info[i].ope,
+					info[i].data.vlantag.vid,
+					info[i].data.vlantag.pcp);
+			if (unlikely(ret < 0))
+				return -1;
+
+			/*
+			 * Change counter to "maximum+1" for exit the loop.
+			 * An if statement after loop termination is false
+			 * by "maximum+1 ".
+			 */
+			i = SPP_PORT_ABILITY_MAX + 1;
+			break;
+		default:
+			/* not used */
+			break;
+		}
+	}
+	if (i == SPP_PORT_ABILITY_MAX) {
+		ret = append_vlan_value(&tmp_buff, SPP_PORT_ABILITY_OPE_NONE,
+				0, 0);
+		if (unlikely(ret < 0))
+			return -1;
+	}
 
-		sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
+	ret = append_json_block_brackets(name, output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
 
-		tmp_buff = spp_strbuf_append(tmp_buff, append_str,
-				strlen(append_str));
-		if (unlikely(tmp_buff == NULL))
+/* append a block of port numbers for JSON format */
+static int
+append_port_block(char **output, const struct spp_port_index *port,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	char port_str[CMD_TAG_APPEND_SIZE];
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = port_block)\n");
+		return -1;
+	}
+
+	spp_format_port_string(port_str, port->iface_type, port->iface_no);
+	ret = append_json_str_value("port", &tmp_buff, port_str);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_vlan_block("vlan", &tmp_buff,
+			spp_get_dpdk_port(port->iface_type, port->iface_no),
+			rxtx);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_block_brackets("", output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
+
+/* append a list of port numbers for JSON format */
+static int
+append_port_array(const char *name, char **output, const int num,
+		const struct spp_port_index *ports,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	int i = 0;
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = %s)\n",
+				name);
+		return -1;
+	}
+
+	for (i = 0; i < num; i++) {
+		ret = append_port_block(&tmp_buff, &ports[i], rxtx);
+		if (unlikely(ret < 0))
 			return -1;
 	}
 
@@ -495,13 +604,13 @@ append_core_element_value(
 		return ret;
 
 	if (unuse_flg) {
-		ret = apeend_port_array("rx_port", &tmp_buff,
-				num_rx, rx_ports);
+		ret = append_port_array("rx_port", &tmp_buff,
+				num_rx, rx_ports, SPP_PORT_RXTX_RX);
 		if (unlikely(ret < 0))
 			return ret;
 
-		ret = apeend_port_array("tx_port", &tmp_buff,
-				num_tx, tx_ports);
+		ret = append_port_array("tx_port", &tmp_buff,
+				num_tx, tx_ports, SPP_PORT_RXTX_TX);
 		if (unlikely(ret < 0))
 			return ret;
 	}
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index c5c0e3c..2aebfd9 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -1,7 +1,7 @@
 #include <rte_cycles.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "spp_forward.h"
 
 #define RTE_LOGTYPE_FORWARD RTE_LOGTYPE_USER1
@@ -117,8 +117,12 @@ static inline void
 change_forward_index(int id)
 {
 	struct forward_info *info = &g_forward_info[id];
-	if (info->ref_index == info->upd_index)
+	if (info->ref_index == info->upd_index) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
+
 		info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+	}
 }
 /**
  * Forwarding packets as forwarder or merger
@@ -147,23 +151,13 @@ spp_forward(int id)
 		tx = &path->ports[cnt].tx;
 
 		/* Receive packets */
-		nb_rx = rte_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
+		nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
 		if (unlikely(nb_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(rx->iface_no,
-					bufs, nb_rx);
-
-		if (tx->iface_type == RING)
-			spp_ringlatencystats_add_time_stamp(tx->iface_no,
-					bufs, nb_rx);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
 		/* Send packets */
 		if (tx->dpdk_port >= 0)
-			nb_tx = rte_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
+			nb_tx = spp_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
 
 		/* Discard remained packets to release mbuf */
 		if (unlikely(nb_tx < nb_rx)) {
diff --git a/src/vf/spp_port.c b/src/vf/spp_port.c
new file mode 100644
index 0000000..a968459
--- /dev/null
+++ b/src/vf/spp_port.c
@@ -0,0 +1,403 @@
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_udp.h>
+#include <rte_tcp.h>
+#include <rte_net_crc.h>
+
+#include "spp_vf.h"
+#include "spp_port.h"
+#include "ringlatencystats.h"
+
+/* Port ability management information */
+struct port_ability_mng_info {
+	volatile int ref_index; /* Index to reference area */
+	volatile int upd_index; /* Index to update area    */
+	struct spp_port_ability ability[SPP_INFO_AREA_MAX]
+				[SPP_PORT_ABILITY_MAX];
+				/* Port ability information */
+};
+
+/* Port ability port information */
+struct port_ability_port_mng_info {
+	/* Interface type (phy/vhost/ring) */
+	enum port_type iface_type;
+
+	/* Interface number */
+	int            iface_no;
+
+	/* Management data of port ability for receiving */
+	struct port_ability_mng_info rx;
+
+	/* Management data of port ability for sending */
+	struct port_ability_mng_info tx;
+};
+
+/* Information for VLAN tag management. */
+struct port_ability_port_mng_info g_port_mng_info[RTE_MAX_ETHPORTS];
+
+/* TPID of VLAN. */
+static uint16_t g_vlan_tpid;
+
+/* Initialize port ability. */
+void
+spp_port_ability_init(void)
+{
+	int cnt = 0;
+	g_vlan_tpid = rte_cpu_to_be_16(ETHER_TYPE_VLAN);
+	memset(g_port_mng_info, 0x00, sizeof(g_port_mng_info));
+	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
+		g_port_mng_info[cnt].rx.ref_index = 0;
+		g_port_mng_info[cnt].rx.upd_index = 1;
+		g_port_mng_info[cnt].tx.ref_index = 0;
+		g_port_mng_info[cnt].tx.upd_index = 1;
+	}
+}
+
+/* Get information of port ability. */
+inline void
+spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info)
+{
+	struct port_ability_mng_info *mng = NULL;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &g_port_mng_info[port_id].rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &g_port_mng_info[port_id].tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+	*info = mng->ability[mng->ref_index];
+}
+
+/* Calculation and Setting of FCS. */
+static inline void
+set_fcs_packet(struct rte_mbuf *pkt)
+{
+	uint32_t *fcs = NULL;
+	fcs = rte_pktmbuf_mtod_offset(pkt, uint32_t *, pkt->data_len);
+	*fcs = rte_net_crc_calc(rte_pktmbuf_mtod(pkt, void *),
+			pkt->data_len, RTE_NET_CRC32_ETH);
+}
+
+/* Add VLAN tag to packet. */
+static inline int
+add_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data)
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	struct vlan_hdr  *vlan      = NULL;
+	const struct spp_vlantag_info *vlantag = &data->vlantag;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets with VLAN tags, only VLAN ID is updated */
+		new_ether = old_ether;
+		vlan = (struct vlan_hdr *)&new_ether[1];
+	} else {
+		/* For packets without VLAN tag, add VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_prepend(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to get additional header area.\n");
+			return -1;
+		}
+
+		rte_memcpy(new_ether, old_ether, sizeof(struct ether_hdr));
+		vlan = (struct vlan_hdr *)&new_ether[1];
+		vlan->eth_proto = new_ether->ether_type;
+		new_ether->ether_type = g_vlan_tpid;
+	}
+
+	vlan->vlan_tci = vlantag->tci;
+	set_fcs_packet(pkt);
+	return 0;
+}
+
+/* Add VLAN tag to all packets. */
+static inline int
+add_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = add_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to add VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Delete VLAN tag to packet. */
+static inline int
+del_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data __attribute__ ((unused)))
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	uint32_t *old, *new;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets without VLAN tag, delete VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_adj(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to delete unnecessary header area.\n");
+			return -1;
+		}
+
+		old = (uint32_t *)old_ether;
+		new = (uint32_t *)new_ether;
+		new[2] = old[2];
+		new[1] = old[1];
+		new[0] = old[0];
+		old[0] = 0;
+		set_fcs_packet(pkt);
+	}
+	return 0;
+}
+
+/* Delete VLAN tag to all packets. */
+static inline int
+del_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = del_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to del VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Change index of management information. */
+void
+spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx)
+{
+	int cnt;
+	static int num_rx;
+	static int rx_list[RTE_MAX_ETHPORTS];
+	static int num_tx;
+	static int tx_list[RTE_MAX_ETHPORTS];
+	struct port_ability_mng_info *mng = NULL;
+
+	if (type == PORT_ABILITY_CHG_INDEX_UPD) {
+		switch (rxtx) {
+		case SPP_PORT_RXTX_RX:
+			mng = &g_port_mng_info[port_id].rx;
+			mng->upd_index = mng->ref_index;
+			rx_list[num_rx++] = port_id;
+			break;
+		case SPP_PORT_RXTX_TX:
+			mng = &g_port_mng_info[port_id].tx;
+			mng->upd_index = mng->ref_index;
+			tx_list[num_tx++] = port_id;
+			break;
+		default:
+			/* Not used. */
+			break;
+		}
+		return;
+	}
+
+	for (cnt = 0; cnt < num_rx; cnt++) {
+		mng = &g_port_mng_info[rx_list[cnt]].rx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		rx_list[cnt] = 0;
+	}
+	for (cnt = 0; cnt < num_tx; cnt++) {
+		mng = &g_port_mng_info[tx_list[cnt]].tx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		tx_list[cnt] = 0;
+	}
+
+	num_rx = 0;
+	num_tx = 0;
+}
+
+/* Set ability data of port ability. */
+static void
+port_ability_set_ability(
+		struct spp_port_info *port,
+		enum spp_port_rxtx rxtx)
+{
+	int in_cnt, out_cnt = 0;
+	int port_id = port->dpdk_port;
+	struct port_ability_port_mng_info *port_mng = &g_port_mng_info[port_id];
+	struct port_ability_mng_info *mng         = NULL;
+	struct spp_port_ability      *in_ability  = port->ability;
+	struct spp_port_ability      *out_ability = NULL;
+	struct spp_vlantag_info      *tag         = NULL;
+
+	port_mng->iface_type = port->iface_type;
+	port_mng->iface_no   = port->iface_no;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &port_mng->rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &port_mng->tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	out_ability = mng->ability[mng->upd_index];
+	memset(out_ability, 0x00, sizeof(struct spp_port_ability)
+			* SPP_PORT_ABILITY_MAX);
+	for (in_cnt = 0; in_cnt < SPP_PORT_ABILITY_MAX; in_cnt++) {
+		if (in_ability[in_cnt].rxtx != rxtx)
+			continue;
+
+		memcpy(&out_ability[out_cnt], &in_ability[in_cnt],
+				sizeof(struct spp_port_ability));
+
+		switch (out_ability[out_cnt].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+			tag = &out_ability[out_cnt].data.vlantag;
+			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
+					tag->vid, tag->pcp));
+			break;
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		default:
+			/* Nothing to do. */
+			break;
+		}
+
+		out_cnt++;
+	}
+
+	spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_UPD,
+			port_id, rxtx);
+}
+
+/* Update port capability. */
+void
+spp_port_ability_update(const struct spp_component_info *component)
+{
+	int cnt;
+	struct spp_port_info *port = NULL;
+	for (cnt = 0; cnt < component->num_rx_port; cnt++) {
+		port = component->rx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_RX);
+	}
+
+	for (cnt = 0; cnt < component->num_tx_port; cnt++) {
+		port = component->tx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_TX);
+	}
+}
+
+/* Definition of functions that operate port abilities. */
+typedef int (*port_ability_func)(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data);
+
+/* List of functions per port ability. */
+port_ability_func port_ability_function_list[] = {
+	NULL,                    /* None */
+	add_vlantag_all_packets, /* Add VLAN tag */
+	del_vlantag_all_packets, /* Del VLAN tag */
+	NULL                     /* Termination */
+};
+
+/* Each packet operation of port capability. */
+static inline int
+port_ability_each_operation(uint16_t port_id,
+		struct rte_mbuf **pkts, const uint16_t nb_pkts,
+		enum spp_port_rxtx rxtx)
+{
+	int cnt, buf;
+	int ok_pkts = nb_pkts;
+	struct spp_port_ability *info = NULL;
+
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	if (unlikely(info[0].ope == SPP_PORT_ABILITY_OPE_NONE))
+		return nb_pkts;
+
+	for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+		if (info[cnt].ope == SPP_PORT_ABILITY_OPE_NONE)
+			break;
+
+		ok_pkts = port_ability_function_list[info[cnt].ope](
+				pkts, ok_pkts, &info->data);
+	}
+
+	/* Discard remained packets to release mbuf. */
+	if (unlikely(ok_pkts < nb_pkts)) {
+		for (buf = ok_pkts; buf < nb_pkts; buf++)
+			rte_pktmbuf_free(pkts[buf]);
+	}
+
+	return ok_pkts;
+}
+
+/* Wrapper function for rte_eth_rx_burst(). */
+inline uint16_t
+spp_eth_rx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+{
+	uint16_t nb_rx = 0;
+	nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
+	if (unlikely(nb_rx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_calculate_latency(
+				g_port_mng_info[port_id].iface_no,
+				rx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return port_ability_each_operation(port_id, rx_pkts, nb_rx,
+			SPP_PORT_RXTX_RX);
+}
+
+/* Wrapper function for rte_eth_tx_burst(). */
+inline uint16_t
+spp_eth_tx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	nb_tx = port_ability_each_operation(port_id, tx_pkts, nb_pkts,
+			SPP_PORT_RXTX_TX);
+	if (unlikely(nb_tx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_add_time_stamp(
+				g_port_mng_info[port_id].iface_no,
+				tx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return rte_eth_tx_burst(port_id, 0, tx_pkts, nb_tx);
+}
diff --git a/src/vf/spp_port.h b/src/vf/spp_port.h
new file mode 100644
index 0000000..bb1a39a
--- /dev/null
+++ b/src/vf/spp_port.h
@@ -0,0 +1,109 @@
+#ifndef __SPP_PORT_H__
+#define __SPP_PORT_H__
+
+/**
+ * @file
+ * SPP Port ability
+ *
+ * Provide about the ability per port.
+ */
+
+#include "spp_vf.h"
+
+/** Calculate TCI of VLAN tag. */
+#define SPP_VLANTAG_CALC_TCI(id, pcp) (((pcp & 0x07) << 13) | (id & 0x0fff))
+
+/** Type for changing index. */
+enum port_ability_chg_index_type {
+	/** Type for changing index to reference area. */
+	PORT_ABILITY_CHG_INDEX_REF,
+
+	/** Type for changing index to update area. */
+	PORT_ABILITY_CHG_INDEX_UPD,
+};
+
+/** Initialize port ability. */
+void spp_port_ability_init(void);
+
+/**
+ * Get information of port ability.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param info
+ *  Port ability information.
+ */
+void spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info);
+
+/**
+ * Change index of management information.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param type
+ *  Type for changing index.
+ */
+void spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx);
+
+/**
+ * Update port capability.
+ *
+ * @param component_info
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of port ability.
+ */
+void spp_port_ability_update(const struct spp_component_info *component);
+
+/**
+ * Wrapper function for rte_eth_rx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the receive queue from which to retrieve input packets.
+ *  SPP is fixed at 0.
+ * @param rx_pkts
+ *  The address of an array of pointers to *rte_mbuf* structures that
+ *  must be large enough to store *nb_pkts* pointers in it.
+ * @param nb_pkts
+ *  The maximum number of packets to retrieve.
+ *
+ * @return
+ *  The number of packets actually retrieved, which is the number
+ *  of pointers to *rte_mbuf* structures effectively supplied to the
+ *  *rx_pkts* array.
+ */
+uint16_t spp_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_tx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the transmit queue through which output packets must be sent.
+ *  SPP is fixed at 0.
+ * @param tx_pkts
+ *  The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
+ *  which contain the output packets.
+ * @param nb_pkts
+ *  The maximum number of packets to transmit.
+ *
+ * @return
+ *  The number of output packets actually stored in transmit descriptors of
+ *  the transmit ring. The return value can be less than the value of the
+ *  *tx_pkts* parameter when the transmit ring is full or has been filled up.
+ */
+uint16_t spp_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
+#endif /*  __SPP_PORT_H__ */
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 49c56e3..6fa0c22 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -12,6 +12,7 @@
 #include "classifier_mac.h"
 #include "spp_forward.h"
 #include "command_proc.h"
+#include "spp_port.h"
 
 /* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
@@ -965,6 +966,7 @@ main(int argc, char *argv[])
 			break;
 
 		spp_forward_init();
+		spp_port_ability_init();
 
 		/* Setup connection for accepting commands from controller */
 		int ret_command_init = spp_command_proc_init(
@@ -1404,12 +1406,14 @@ int
 spp_update_port(enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name)
+		const char *name,
+		const struct spp_port_ability *ability)
 {
 	int ret = SPP_RET_NG;
 	int ret_check = -1;
 	int ret_del = -1;
 	int component_id = 0;
+	int cnt = 0;
 	struct spp_component_info *component = NULL;
 	struct spp_port_info *port_info = NULL;
 	int *num = NULL;
@@ -1443,6 +1447,20 @@ spp_update_port(enum spp_command_action action,
 			break;
 		}
 
+		if (ability->ope != SPP_PORT_ABILITY_OPE_NONE) {
+			while ((cnt < SPP_PORT_ABILITY_MAX) &&
+					(port_info->ability[cnt].ope !=
+					SPP_PORT_ABILITY_OPE_NONE)) {
+				cnt++;
+			}
+			if (cnt >= SPP_PORT_ABILITY_MAX) {
+				RTE_LOG(ERR, APP, "No space of port ability.\n");
+				return SPP_RET_NG;
+			}
+			memcpy(&port_info->ability[cnt], ability,
+					sizeof(struct spp_port_ability));
+		}
+
 		port_info->iface_type = port->iface_type;
 		ports[*num] = port_info;
 		(*num)++;
@@ -1451,9 +1469,20 @@ spp_update_port(enum spp_command_action action,
 		break;
 
 	case SPP_CMD_ACTION_DEL:
+		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+			if (port_info->ability[cnt].ope ==
+					SPP_PORT_ABILITY_OPE_NONE)
+				continue;
+
+			if (port_info->ability[cnt].rxtx == rxtx)
+				memset(&port_info->ability[cnt], 0x00,
+					sizeof(struct spp_port_ability));
+		}
+
 		ret_del = get_del_port_element(port_info, *num, ports);
 		if (ret_del == 0)
 			(*num)--; /* If deleted, decrement number. */
+
 		ret = SPP_RET_OK;
 		break;
 	default:
@@ -1539,6 +1568,8 @@ flush_component(void)
 			continue;
 
 		component_info = &g_component_info[cnt];
+		spp_port_ability_update(component_info);
+
 		if (component_info->type == SPP_COMPONENT_CLASSIFIER_MAC)
 			ret = spp_classifier_mac_update(component_info);
 		else
@@ -1649,6 +1680,22 @@ spp_iterate_classifier_table(
 	return SPP_RET_OK;
 }
 
+/* Get the port number of DPDK. */
+int
+spp_get_dpdk_port(enum port_type iface_type, int iface_no)
+{
+	switch (iface_type) {
+	case PHY:
+		return g_iface_info.nic[iface_no].dpdk_port;
+	case RING:
+		return g_iface_info.ring[iface_no].dpdk_port;
+	case VHOST:
+		return g_iface_info.vhost[iface_no].dpdk_port;
+	default:
+		return -1;
+	}
+}
+
 /**
  * Separate port id of combination of iface type and number and
  * assign to given argument, iface_type and iface_no.
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 70e105b..539931c 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -48,6 +48,15 @@
 /** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
+/** Maximum number of port abilities available */
+#define SPP_PORT_ABILITY_MAX 4
+
+/** Maximum VLAN ID */
+#define SPP_VLAN_VID_MAX 4096
+
+/** Maximum VLAN PCP */
+#define SPP_VLAN_PCP_MAX 7
+
 /**
  * State on component
  */
@@ -103,6 +112,13 @@ enum spp_command_action {
 	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
+/** Port ability operation */
+enum spp_port_ability_ope {
+	SPP_PORT_ABILITY_OPE_NONE,        /**< none */
+	SPP_PORT_ABILITY_OPE_ADD_VLANTAG, /**< add VLAN tag */
+	SPP_PORT_ABILITY_OPE_DEL_VLANTAG, /**< delete VLAN tag */
+};
+
 /**
  * Interface information structure
  */
@@ -111,6 +127,26 @@ struct spp_port_index {
 	int             iface_no;   /**< Interface number */
 };
 
+/** VLAN tag information */
+struct spp_vlantag_info {
+	int vid; /**< VLAN ID */
+	int pcp; /**< Priority Code Point */
+	int tci; /**< Tag Control Information */
+};
+
+/** Data for each port ability */
+union spp_ability_data {
+	/** VLAN tag information */
+	struct spp_vlantag_info vlantag;
+};
+
+/** Port ability information */
+struct spp_port_ability {
+	enum spp_port_ability_ope ope; /**< Operation */
+	enum spp_port_rxtx rxtx;       /**< rx/tx identifier */
+	union spp_ability_data data;   /**< Port ability data */
+};
+
 /**
  * Port info
  */
@@ -120,6 +156,8 @@ struct spp_port_info {
 	int            dpdk_port;  /**< DPDK port number */
 	uint64_t       mac_addr;   /**< Mac address for classifying */
 	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
+					/**< Port ability */
 };
 
 /**
@@ -205,7 +243,8 @@ int spp_update_port(
 		enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name);
+		const char *name,
+		const struct spp_port_ability *ability);
 
 /**
  * Flush SPP component
@@ -220,8 +259,8 @@ int spp_flush(void);
  */
 void spp_cancel(void);
 
-/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
+/** definition of iterated core element procedure function */
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
 		const unsigned int lcore_id,
@@ -253,8 +292,8 @@ struct spp_iterate_core_params {
  */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
+/** definition of iterated classifier element procedure function */
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
@@ -421,6 +460,19 @@ int spp_check_used_port(
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
 /**
+ * Get the port number of DPDK.
+ *
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @return
+ *  Port id generated by DPDK.
+ */
+int spp_get_dpdk_port(enum port_type iface_type, int iface_no);
+
+/**
  * Extract if-type/if-number from port string
  *
  * @param port
-- 
1.9.1

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

* [spp] [PATCH 5/7] spp_vf: refactor struct and variable names
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
                         ` (3 preceding siblings ...)
  2018-02-09  3:40       ` [spp] [PATCH 4/7] spp_vf: add VLAN tag operate function to port x-fn-spp
@ 2018-02-09  3:40       ` x-fn-spp
  2018-02-09  3:40       ` [spp] [PATCH 6/7] spp_vf: add VID classification to the classifier x-fn-spp
                         ` (2 subsequent siblings)
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:40 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Change abbreviation of struct name, variable name and function name
  in classifier_mac.c.

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 314 +++++++++++++++++++++++-------------------------
 1 file changed, 152 insertions(+), 162 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 93cec8f..decc1f0 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -82,8 +82,8 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier information */
-struct classifier_mac_info {
+/* classifier component information */
+struct component_info {
 	/* component name */
 	char name[SPP_NAME_STR_LEN];
 
@@ -110,9 +110,9 @@ struct classifier_mac_info {
 };
 
 /* classifier management information */
-struct classifier_mac_mng_info {
+struct management_info {
 	/* classifier information */
-	struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+	struct component_info cmp_infos[NUM_CLASSIFIER_MAC_INFO];
 
 	/* Reference index number for classifier information */
 	volatile int ref_index;
@@ -122,7 +122,7 @@ struct classifier_mac_mng_info {
 };
 
 /* classifier information per lcore */
-static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
+static struct management_info g_mng_infos[RTE_MAX_LCORE];
 
 /**
  * Hash table count used for making a name of hash table
@@ -133,69 +133,70 @@ static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
 static inline int
-is_used_mng_info(const struct classifier_mac_mng_info *mng_info)
+is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL && mng_info->info[0].classifier_table != NULL);
+	return (mng_info != NULL &&
+			mng_info->cmp_infos[0].classifier_table != NULL);
 }
 
 /* initialize classifier information. */
 static int
-init_classifier_info(struct classifier_mac_info *classifier_info,
+init_component_info(struct component_info *cmp_info,
 		const struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &classifier_info->classifier_table;
+	struct rte_hash **classifier_table = &cmp_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 *clsd_data_rx =
+			&cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx =
+			cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
 
 	rte_hash_reset(*classifier_table);
-	classifier_info->num_active_classified = 0;
-	classifier_info->default_classified = -1;
-	classifier_info->n_classified_data_tx = component_info->num_tx_port;
+	cmp_info->num_active_classified = 0;
+	cmp_info->default_classified = -1;
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	if (component_info->num_rx_port == 0) {
-		classified_data_rx->iface_type      = UNDEF;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global = 0;
-		classified_data_rx->port         = 0;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->iface_type      = UNDEF;
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global = 0;
+		clsd_data_rx->port            = 0;
+		clsd_data_rx->num_pkt         = 0;
 	} else {
-		classified_data_rx->iface_type      =
+		clsd_data_rx->iface_type      =
 				component_info->rx_ports[0]->iface_type;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global =
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global =
 				component_info->rx_ports[0]->iface_no;
-		classified_data_rx->port         =
+		clsd_data_rx->port            =
 				component_info->rx_ports[0]->dpdk_port;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->num_pkt         = 0;
 	}
 
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
 
 		/* store ports information */
-		classified_data_tx[i].iface_type      = tx_port->iface_type;
-		classified_data_tx[i].iface_no        = i;
-		classified_data_tx[i].iface_no_global = tx_port->iface_no;
-		classified_data_tx[i].port         = tx_port->dpdk_port;
-		classified_data_tx[i].num_pkt      = 0;
+		clsd_data_tx[i].iface_type      = tx_port->iface_type;
+		clsd_data_tx[i].iface_no        = i;
+		clsd_data_tx[i].iface_no_global = tx_port->iface_no;
+		clsd_data_tx[i].port            = tx_port->dpdk_port;
+		clsd_data_tx[i].num_pkt         = 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->
+		cmp_info->active_classifieds[cmp_info->
 				num_active_classified++] = i;
 
 		/* store default classified */
 		if (unlikely(tx_port->mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			classifier_info->default_classified = i;
+			cmp_info->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
 					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
 					tx_port->iface_type,
@@ -234,7 +235,7 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 
 /* initialize classifier. */
 static int
-init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
 	int i;
@@ -243,15 +244,15 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
-	memset(classifier_mng_info, 0, sizeof(struct classifier_mac_mng_info));
+	memset(mng_info, 0, sizeof(struct management_info));
 	/*
 	 * Set the same value for "ref_index" and "upd_index"
 	 * so that it will not be changed from others during initialization,
 	 * and update "upd_index" after initialization is completed.
 	 * Therefore, this setting is consciously described.
 	 */
-	classifier_mng_info->ref_index = 0;
-	classifier_mng_info->upd_index = 0;
+	mng_info->ref_index = 0;
+	mng_info->upd_index = 0;
 	memset(&component_info, 0x00, sizeof(component_info));
 
 #ifdef RTE_MACHINE_CPUFLAG_SSE4_2
@@ -263,7 +264,7 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
 
 		classifier_mac_table =
-				&classifier_mng_info->info[i].classifier_table;
+				&mng_info->cmp_infos[i].classifier_table;
 
 		/* make hash table name(require uniqueness between processes) */
 		sprintf(hash_table_name, "cmtab_%07x%02hx%x",
@@ -294,8 +295,8 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* populate the classifier information at reference */
-	ret = init_classifier_info(&classifier_mng_info->
-			info[classifier_mng_info->ref_index], &component_info);
+	ret = init_component_info(&mng_info->
+			cmp_infos[mng_info->ref_index], &component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot initialize classifier mac table. ret=%d\n",
@@ -304,113 +305,112 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* updating side can be set by completion of initialization. */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index + 1;
+	mng_info->upd_index = mng_info->ref_index + 1;
 
 	return 0;
 }
 
 /* uninitialize classifier. */
 static void
-uninit_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+uninit_classifier(struct management_info *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].
+		if (mng_info->cmp_infos[i].classifier_table != NULL) {
+			rte_hash_free(mng_info->cmp_infos[i].
 					classifier_table);
-			classifier_mng_info->info[i].classifier_table = NULL;
-			classifier_mng_info->ref_index = 0;
-			classifier_mng_info->upd_index = 0;
+			mng_info->cmp_infos[i].classifier_table = NULL;
+			mng_info->ref_index = 0;
+			mng_info->upd_index = 0;
 		}
 	}
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_packet(struct classified_data *classified_data)
+transmit_packet(struct classified_data *clsd_data)
 {
 	int i;
 	uint16_t n_tx;
 
 	/* transmit packets */
-	n_tx = spp_eth_tx_burst(classified_data->port, 0,
-			classified_data->pkts, classified_data->num_pkt);
+	n_tx = spp_eth_tx_burst(clsd_data->port, 0,
+			clsd_data->pkts, clsd_data->num_pkt);
 
 	/* 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]);
+	if (unlikely(n_tx != clsd_data->num_pkt)) {
+		for (i = n_tx; i < clsd_data->num_pkt; i++)
+			rte_pktmbuf_free(clsd_data->pkts[i]);
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"drop packets(tx). num=%hu, dpdk_port=%hu\n",
-				(uint16_t)(classified_data->num_pkt - n_tx),
-				classified_data->port);
+				(uint16_t)(clsd_data->num_pkt - n_tx),
+				clsd_data->port);
 	}
 
-	classified_data->num_pkt = 0;
+	clsd_data->num_pkt = 0;
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_all_packet(struct classifier_mac_info *classifier_info)
+transmit_all_packet(struct component_info *cmp_info)
 {
 	int i;
-	struct classified_data *classified_data_tx =
-				classifier_info->classified_data_tx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 
-	for (i = 0; i < classifier_info->n_classified_data_tx; i++) {
-		if (unlikely(classified_data_tx[i].num_pkt != 0)) {
+	for (i = 0; i < cmp_info->n_classified_data_tx; i++) {
+		if (unlikely(clsd_data_tx[i].num_pkt != 0)) {
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 					"transmit all packets (drain). "
 					"index=%d, "
 					"num_pkt=%hu\n",
 					i,
-					classified_data_tx[i].num_pkt);
-			transmit_packet(&classified_data_tx[i]);
+					clsd_data_tx[i].num_pkt);
+			transmit_packet(&clsd_data_tx[i]);
 		}
 	}
 }
 
 /* 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)
+push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 {
-	classified_data->pkts[classified_data->num_pkt++] = pkt;
+	clsd_data->pkts[clsd_data->num_pkt++] = pkt;
 
 	/* transmit packet, if buffer is filled */
-	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
+	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
 				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
-				classified_data->iface_type,
-				classified_data->iface_no_global,
-				classified_data->iface_no,
-				classified_data->port,
-				classified_data->num_pkt);
-		transmit_packet(classified_data);
+				clsd_data->iface_type,
+				clsd_data->iface_no_global,
+				clsd_data->iface_no,
+				clsd_data->port,
+				clsd_data->num_pkt);
+		transmit_packet(clsd_data);
 	}
 }
 
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int i;
 
-	if (unlikely(classifier_info->num_active_classified == 0)) {
+	if (unlikely(cmp_info->num_active_classified == 0)) {
 		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));
+			(cmp_info->num_active_classified - 1));
 
-	for (i = 0; i < classifier_info->num_active_classified; i++) {
-		push_packet(pkt, classified_data +
-				(long)classifier_info->active_classifieds[i]);
+	for (i = 0; i < cmp_info->num_active_classified; i++) {
+		push_packet(pkt, clsd_data +
+				(long)cmp_info->active_classifieds[i]);
 	}
 }
 
@@ -420,8 +420,8 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
  */
 static inline void
 classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int ret;
 	int i;
@@ -433,7 +433,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
 
 		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(classifier_info->classifier_table,
+		ret = rte_hash_lookup_data(cmp_info->classifier_table,
 				(const void *)&eth->d_addr, &lookup_data);
 		if (ret < 0) {
 			/* L2 multicast(include broadcast) ? */
@@ -441,13 +441,13 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 						"multicast mac address.\n");
 				handle_l2multicast_packet(rx_pkts[i],
-						classifier_info,
-						classified_data);
+						cmp_info,
+						clsd_data);
 				continue;
 			}
 
 			/* if no default, drop packet */
-			if (unlikely(classifier_info->default_classified ==
+			if (unlikely(cmp_info->default_classified ==
 					-1)) {
 				ether_format_addr(mac_addr_str,
 						sizeof(mac_addr_str),
@@ -463,7 +463,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 			/* to default classified */
 			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 					"to default classified.\n");
-			lookup_data = (void *)(long)classifier_info->
+			lookup_data = (void *)(long)cmp_info->
 					default_classified;
 		}
 
@@ -471,27 +471,27 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		 * set mbuf pointer to tx buffer
 		 * and transmit packet, if buffer is filled
 		 */
-		push_packet(rx_pkts[i], classified_data + (long)lookup_data);
+		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
 /* change update index at classifier management information */
 static inline void
-change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
+change_update_index(struct management_info *mng_info, int id)
 {
-	if (unlikely(classifier_mng_info->ref_index ==
-			classifier_mng_info->upd_index)) {
+	if (unlikely(mng_info->ref_index ==
+			mng_info->upd_index)) {
 		/* Change reference index of port ability. */
 		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
-		transmit_all_packet(classifier_mng_info->info +
-				classifier_mng_info->ref_index);
+		transmit_all_packet(mng_info->cmp_infos +
+				mng_info->ref_index);
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"Core[%u] Change update index.\n", id);
-		classifier_mng_info->ref_index =
-				(classifier_mng_info->upd_index + 1) %
+		mng_info->ref_index =
+				(mng_info->upd_index + 1) %
 				NUM_CLASSIFIER_MAC_INFO;
 	}
 }
@@ -500,7 +500,7 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 int
 spp_classifier_mac_init(void)
 {
-	memset(g_classifier_mng_info, 0, sizeof(g_classifier_mng_info));
+	memset(g_mng_infos, 0, sizeof(g_mng_infos));
 
 	return 0;
 }
@@ -511,37 +511,34 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int id = component_info->component_id;
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
-	classifier_info = classifier_mng_info->info +
-				classifier_mng_info->upd_index;
+	cmp_info = mng_info->cmp_infos + mng_info->upd_index;
 
 	/* initialize update side classifier information */
-	ret = init_classifier_info(classifier_info, component_info);
+	ret = init_component_info(cmp_info, component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot update classifier mac. ret=%d\n", ret);
 		return ret;
 	}
-	memcpy(classifier_info->name, component_info->name, SPP_NAME_STR_LEN);
+	memcpy(cmp_info->name, component_info->name, SPP_NAME_STR_LEN);
 
 	/* change index of reference side */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index;
+	mng_info->upd_index = 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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
@@ -558,41 +555,38 @@ spp_classifier_mac_do(int id)
 	int i;
 	int n_rx;
 	unsigned int lcore_id = rte_lcore_id();
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 	struct rte_mbuf *rx_pkts[MAX_PKT_BURST];
 
-	struct classified_data *classified_data_rx = NULL;
-	struct classified_data *classified_data_tx = NULL;
+	struct classified_data *clsd_data_rx = NULL;
+	struct classified_data *clsd_data_tx = NULL;
 
 	uint64_t cur_tsc, prev_tsc = 0;
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 			US_PER_S * DRAIN_TX_PACKET_INTERVAL;
 
 	/* initialize */
-	ret = init_classifier(classifier_mng_info);
+	ret = init_classifier(mng_info);
 	if (unlikely(ret != 0))
 		return ret;
 
 	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);
+		change_update_index(mng_info, id);
 
 		/* 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;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+		clsd_data_rx = &cmp_info->classified_data_rx;
+		clsd_data_tx = cmp_info->classified_data_tx;
 
 		/* 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;
+			for (i = 0; i < cmp_info->n_classified_data_tx;
 					i++) {
-				if (likely(classified_data_tx[i].num_pkt == 0))
+				if (likely(clsd_data_tx[i].num_pkt == 0))
 					continue;
 
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
@@ -601,32 +595,31 @@ spp_classifier_mac_do(int id)
 						"num_pkt=%hu, "
 						"interval=%lu\n",
 						i,
-						classified_data_tx[i].num_pkt,
+						clsd_data_tx[i].num_pkt,
 						cur_tsc - prev_tsc);
-				transmit_packet(&classified_data_tx[i]);
+				transmit_packet(&clsd_data_tx[i]);
 			}
 			prev_tsc = cur_tsc;
 		}
 
-		if (classified_data_rx->iface_type == UNDEF)
+		if (clsd_data_rx->iface_type == UNDEF)
 			continue;
 
 		/* retrieve packets */
-		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(clsd_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
 		/* classify and transmit (filled) */
-		classify_packet(rx_pkts, n_rx, classifier_info,
-				classified_data_tx);
+		classify_packet(rx_pkts, n_rx, cmp_info, clsd_data_tx);
 	}
 
 	/* just in case */
-	change_update_index(classifier_mng_info, id);
+	change_update_index(mng_info, id);
 
 	/* uninitialize */
-	uninit_classifier(classifier_mng_info);
+	uninit_classifier(mng_info);
 
 	return 0;
 }
@@ -639,45 +632,43 @@ spp_classifier_get_component_status(
 {
 	int ret = -1;
 	int i, num_tx, num_rx = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index rx_ports[RTE_MAX_ETHPORTS];
 	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)) {
+	mng_info = g_mng_infos + id;
+	if (!is_used_mng_info(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_mng_info->ref_index;
-
-	classified_data = classifier_info->classified_data_tx;
+	cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+	clsd_data = cmp_info->classified_data_tx;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (classifier_info->classified_data_rx.iface_type != UNDEF) {
+	if (cmp_info->classified_data_rx.iface_type != UNDEF) {
 		num_rx = 1;
-		rx_ports[0].iface_type = classifier_info->
+		rx_ports[0].iface_type = cmp_info->
 				classified_data_rx.iface_type;
-		rx_ports[0].iface_no   = classifier_info->
+		rx_ports[0].iface_no   = cmp_info->
 				classified_data_rx.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
-	num_tx = classifier_info->n_classified_data_tx;
+	num_tx = cmp_info->n_classified_data_tx;
 	for (i = 0; i < num_tx; i++) {
-		tx_ports[i].iface_type = classified_data[i].iface_type;
-		tx_ports[i].iface_no   = classified_data[i].iface_no_global;
+		tx_ports[i].iface_type = clsd_data[i].iface_type;
+		tx_ports[i].iface_no   = clsd_data[i].iface_no_global;
 	}
 
 	/* Set the information with the function specified by the command. */
 	ret = (*params->element_proc)(
 		params, lcore_id,
-		classifier_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
+		cmp_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
 		num_rx, rx_ports, num_tx, tx_ports);
 	if (unlikely(ret != 0))
 		return -1;
@@ -694,31 +685,30 @@ spp_classifier_mac_iterate_table(
 	const void *key;
 	void *data;
 	uint32_t next = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index port;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
-		classifier_mng_info = g_classifier_mng_info + i;
-		if (!is_used_mng_info(classifier_mng_info))
+		mng_info = g_mng_infos + i;
+		if (!is_used_mng_info(mng_info))
 			continue;
 
-		classifier_info = classifier_mng_info->info +
-				classifier_mng_info->ref_index;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
 
-		classified_data = classifier_info->classified_data_tx;
+		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (classifier_info->default_classified >= 0) {
-			port.iface_type = (classified_data +
-					classifier_info->default_classified)->
+		if (cmp_info->default_classified >= 0) {
+			port.iface_type = (clsd_data +
+					cmp_info->default_classified)->
 					iface_type;
-			port.iface_no   = (classified_data +
-					classifier_info->default_classified)->
+			port.iface_no   = (clsd_data +
+					cmp_info->default_classified)->
 					iface_no_global;
 
 			(*params->element_proc)(
@@ -731,7 +721,7 @@ spp_classifier_mac_iterate_table(
 		next = 0;
 		while (1) {
 			ret = rte_hash_iterate(
-					classifier_info->classifier_table,
+					cmp_info->classifier_table,
 					&key, &data, &next);
 
 			if (unlikely(ret < 0))
@@ -740,9 +730,9 @@ spp_classifier_mac_iterate_table(
 			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 					(const struct ether_addr *)key);
 
-			port.iface_type = (classified_data + (long)data)->
+			port.iface_type = (clsd_data + (long)data)->
 					iface_type;
-			port.iface_no   = (classified_data + (long)data)->
+			port.iface_no   = (clsd_data + (long)data)->
 					iface_no_global;
 
 			(*params->element_proc)(
-- 
1.9.1

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

* [spp] [PATCH 6/7] spp_vf: add VID classification to the classifier
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
                         ` (4 preceding siblings ...)
  2018-02-09  3:40       ` [spp] [PATCH 5/7] spp_vf: refactor struct and variable names x-fn-spp
@ 2018-02-09  3:40       ` x-fn-spp
  2018-02-09  3:40       ` [spp] [PATCH 7/7] spp_vf: change log level setting x-fn-spp
  2018-02-09  7:16       ` [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license Yasufumi Ogawa
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:40 UTC (permalink / raw)
  To: spp

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

Existing classifier has table of virtual MAC address(A).
According to this table, classifier lookups L2 destination MAC address and
determines which port to be transferred to incoming packets.

This patch also supports vlan-tag(TPID:0x8100), and has the virtual
MAC tables for each VID(B).
If the TPID of incoming packet equals 0x8100,
then lookup these tables(B) and determines which port to be transferred.
Otherwise, incoming packet is transferred according to table(A).

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 656 +++++++++++++++++++++++++++++++++++-------------
 src/vf/command_dec.c    |  87 +++++--
 src/vf/command_dec.h    |  41 ++-
 src/vf/command_proc.c   |  41 ++-
 src/vf/spp_vf.c         | 150 ++++++-----
 src/vf/spp_vf.h         |  41 +--
 6 files changed, 728 insertions(+), 288 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index decc1f0..fdaa992 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -44,6 +44,9 @@
 /* interval that transmit burst packet, if buffer is not filled (nano second) */
 #define DRAIN_TX_PACKET_INTERVAL 100
 
+/* VID of VLAN untagged */
+#define VLAN_UNTAGGED_VID 0x0fff
+
 /*
  * hash table name buffer size
  *[reson for value]
@@ -82,13 +85,10 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier component information */
-struct component_info {
-	/* component name */
-	char name[SPP_NAME_STR_LEN];
-
-	/* hash table keeps classifier_table */
-	struct rte_hash *classifier_table;
+/* mac address classification */
+struct mac_classification {
+	/* hash table keeps classification */
+	struct rte_hash *classification_tab;
 
 	/* number of valid classification */
 	int num_active_classified;
@@ -98,6 +98,15 @@ struct component_info {
 
 	/* index of default classification */
 	int default_classified;
+};
+
+/* classifier component information */
+struct component_info {
+	/* component name */
+	char name[SPP_NAME_STR_LEN];
+
+	/* mac address classification per vlan-id */
+	struct mac_classification *mac_classifications[SPP_NUM_VLAN_VID];
 
 	/* number of transmission ports */
 	int n_classified_data_tx;
@@ -119,6 +128,9 @@ struct management_info {
 
 	/* Update index number for classifier information */
 	volatile int upd_index;
+
+	/* used flag */
+	volatile int is_used;
 };
 
 /* classifier information per lcore */
@@ -132,11 +144,200 @@ static struct management_info g_mng_infos[RTE_MAX_LCORE];
  */
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
+/* get vid from packet */
+static inline uint16_t
+get_vid(const struct rte_mbuf *pkt)
+{
+	struct ether_hdr *eth;
+	struct vlan_hdr *vh;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+		/* vlan tagged */
+		vh = (struct vlan_hdr *)(eth + 1);
+		return rte_be_to_cpu_16(vh->vlan_tci) & 0x0fff;
+	}
+
+	/* vlan untagged */
+	return VLAN_UNTAGGED_VID;
+}
+
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+
+#define LOG_DBG(name, fmt, ...)                                        \
+		RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,                  \
+				"[%s]Log(%s:%d):"fmt,                  \
+				name, __func__, __LINE__, __VA_ARGS__)
+
+static void
+log_packet(const char *name, struct rte_mbuf *pkt,
+		const char *func_name, int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u\n",
+			name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt));
+}
+
+#define LOG_PKT(name, pkt) \
+		log_packet(name, pkt, __func__, __LINE__)
+
+static void
+log_classification(
+		long clsd_idx,
+		struct rte_mbuf *pkt,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+	char iface_str[SPP_NAME_STR_LEN];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Classification(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u, tx_iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt),
+			iface_str);
+}
+
+#define LOG_CLS(clsd_idx, pkt, cmp_info, clsd_data)                    \
+		log_classification(clsd_idx, pkt, cmp_info, clsd_data, \
+				__func__, __LINE__)
+
+static void
+log_entry(
+		long clsd_idx,
+		uint16_t vid,
+		const char *mac_addr_str,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	char iface_str[SPP_NAME_STR_LEN];
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Entry(%s:%d). vid=%hu, mac_addr=%s, iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			vid,
+			mac_addr_str,
+			iface_str);
+}
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)           \
+		log_entry(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data, \
+				__func__, __LINE__)
+#else
+#define LOG_DBG(name, fmt, ...)
+#define LOG_PKT(name, pkt)
+#define LOG_CLS(pkt, clsd_idx, cmp_info, clsd_data)
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)
+#endif
+
+/* check if management information is used. */
 static inline int
 is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL &&
-			mng_info->cmp_infos[0].classifier_table != NULL);
+	return (mng_info != NULL && mng_info->is_used);
+}
+
+/* create mac classification instance. */
+static struct mac_classification *
+create_mac_classification(void)
+{
+	struct mac_classification *mac_cls;
+	char hash_tab_name[HASH_TABLE_NAME_BUF_SZ];
+	struct rte_hash **mac_cls_tab;
+
+	mac_cls = (struct mac_classification *)rte_zmalloc(
+			NULL, sizeof(struct mac_classification), 0);
+
+	if (unlikely(mac_cls == NULL))
+		return NULL;
+
+	mac_cls->num_active_classified = 0;
+	mac_cls->default_classified = -1;
+
+	mac_cls_tab = &mac_cls->classification_tab;
+
+	/* make hash table name(require uniqueness between processes) */
+	sprintf(hash_tab_name, "cmtab_%07x%02hx",
+			getpid(),
+			rte_atomic16_add_return(&g_hash_table_count, 1));
+
+	RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
+			hash_tab_name, HASH_TABLE_NAME_BUF_SZ);
+
+	/* set hash creating parameters */
+	struct rte_hash_parameters hash_params = {
+			.name      = hash_tab_name,
+			.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
+			.key_len   = sizeof(struct ether_addr),
+			.hash_func = DEFAULT_HASH_FUNC,
+			.hash_func_init_val = 0,
+			.socket_id = rte_socket_id(),
+	};
+
+	/* create classifier mac table (hash table) */
+	*mac_cls_tab = rte_hash_create(&hash_params);
+	if (unlikely(*mac_cls_tab == NULL)) {
+		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create mac classification table. "
+				"name=%s\n", hash_tab_name);
+		rte_free(mac_cls);
+		return NULL;
+	}
+
+	return mac_cls;
 }
 
 /* initialize classifier information. */
@@ -146,19 +347,15 @@ init_component_info(struct component_info *cmp_info,
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &cmp_info->classifier_table;
+	struct mac_classification *mac_cls;
 	struct ether_addr eth_addr;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	struct classified_data *clsd_data_rx =
-			&cmp_info->classified_data_rx;
-	struct classified_data *clsd_data_tx =
-			cmp_info->classified_data_tx;
+	struct classified_data *clsd_data_rx = &cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
+	uint16_t vid;
 
-	rte_hash_reset(*classifier_table);
-	cmp_info->num_active_classified = 0;
-	cmp_info->default_classified = -1;
-	cmp_info->n_classified_data_tx = component_info->num_tx_port;
+	/* set rx */
 	if (component_info->num_rx_port == 0) {
 		clsd_data_rx->iface_type      = UNDEF;
 		clsd_data_rx->iface_no        = 0;
@@ -176,8 +373,11 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_rx->num_pkt         = 0;
 	}
 
+	/* set tx */
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
+		vid = tx_port->class_id.vlantag.vid;
 
 		/* store ports information */
 		clsd_data_tx[i].iface_type      = tx_port->iface_type;
@@ -186,19 +386,33 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_tx[i].port            = tx_port->dpdk_port;
 		clsd_data_tx[i].num_pkt         = 0;
 
-		if (component_info->tx_ports[i]->mac_addr == 0)
+		if (tx_port->class_id.mac_addr == 0)
 			continue;
 
+		/* if mac classification is NULL, make instance */
+		if (unlikely(cmp_info->mac_classifications[vid] == NULL)) {
+			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
+					"Mac classification is not registered. create."
+					"vid=%hu\n", vid);
+			cmp_info->mac_classifications[vid] =
+					create_mac_classification();
+			if (unlikely(cmp_info->mac_classifications[vid] ==
+					NULL))
+				return -1;
+		}
+		mac_cls = cmp_info->mac_classifications[vid];
+
 		/* store active tx_port that associate with mac address */
-		cmp_info->active_classifieds[cmp_info->
-				num_active_classified++] = i;
+		mac_cls->active_classifieds[
+				mac_cls->num_active_classified++] = i;
 
 		/* store default classified */
-		if (unlikely(tx_port->mac_addr ==
+		if (unlikely(tx_port->class_id.mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			cmp_info->default_classified = i;
+			mac_cls->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
-					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					"vid=%hu, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					vid,
 					tx_port->iface_type,
 					tx_port->iface_no,
 					tx_port->dpdk_port);
@@ -206,24 +420,24 @@ init_component_info(struct component_info *cmp_info,
 		}
 
 		/* add entry to classifier mac table */
-		rte_memcpy(&eth_addr, &tx_port->mac_addr, ETHER_ADDR_LEN);
+		rte_memcpy(&eth_addr, &tx_port->class_id.mac_addr,
+				ETHER_ADDR_LEN);
 		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 				&eth_addr);
 
-		ret = rte_hash_add_key_data(*classifier_table,
+		ret = rte_hash_add_key_data(mac_cls->classification_tab,
 				(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);
-			rte_hash_free(*classifier_table);
-			*classifier_table = NULL;
+					"ret=%d, vid=%hu, mac_addr=%s\n",
+					ret, vid, mac_addr_str);
 			return -1;
 		}
 
 		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. "
-				"mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				"vid=%hu, mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				vid,
 				mac_addr_str,
 				tx_port->iface_type,
 				tx_port->iface_no,
@@ -238,10 +452,6 @@ static int
 init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
-	int i;
-	char hash_table_name[HASH_TABLE_NAME_BUF_SZ];
-
-	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
 	memset(mng_info, 0, sizeof(struct management_info));
@@ -261,39 +471,6 @@ init_classifier(struct management_info *mng_info)
 	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 =
-				&mng_info->cmp_infos[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);
-
-		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
-				hash_table_name, HASH_TABLE_NAME_BUF_SZ);
-
-		/* set hash creating parameters */
-		struct rte_hash_parameters hash_params = {
-				.name      = hash_table_name,
-				.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
-				.key_len   = sizeof(struct ether_addr),
-				.hash_func = DEFAULT_HASH_FUNC,
-				.hash_func_init_val = 0,
-				.socket_id = rte_socket_id(),
-		};
-
-		/* create classifier mac table (hash table) */
-		*classifier_mac_table = rte_hash_create(&hash_params);
-		if (unlikely(*classifier_mac_table == NULL)) {
-			RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create classifier mac table. "
-					"name=%s\n", hash_table_name);
-			return -1;
-		}
-	}
-
 	/* populate the classifier information at reference */
 	ret = init_component_info(&mng_info->
 			cmp_infos[mng_info->ref_index], &component_info);
@@ -306,25 +483,48 @@ init_classifier(struct management_info *mng_info)
 
 	/* updating side can be set by completion of initialization. */
 	mng_info->upd_index = mng_info->ref_index + 1;
+	mng_info->is_used = 1;
 
 	return 0;
 }
 
+/* free mac classification instance. */
+static inline void
+free_mac_classification(struct mac_classification *mac_cls)
+{
+	if (mac_cls == NULL)
+		return;
+
+	if (mac_cls->classification_tab != NULL)
+		rte_hash_free(mac_cls->classification_tab);
+
+	rte_free(mac_cls);
+}
+
+/* uninitialize classifier information. */
+static void
+uninit_component_info(struct component_info *cmp_info)
+{
+	int i;
+
+	for (i = 0; i < SPP_NUM_VLAN_VID; ++i)
+		free_mac_classification(cmp_info->mac_classifications[i]);
+
+	memset(cmp_info, 0, sizeof(struct component_info));
+}
+
 /* uninitialize classifier. */
 static void
 uninit_classifier(struct management_info *mng_info)
 {
 	int i;
 
-	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
-		if (mng_info->cmp_infos[i].classifier_table != NULL) {
-			rte_hash_free(mng_info->cmp_infos[i].
-					classifier_table);
-			mng_info->cmp_infos[i].classifier_table = NULL;
-			mng_info->ref_index = 0;
-			mng_info->upd_index = 0;
-		}
-	}
+	mng_info->is_used = 0;
+
+	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
+		uninit_component_info(mng_info->cmp_infos + (long)i);
+
+	memset(mng_info, 0, sizeof(struct management_info));
 }
 
 /* transmit packet to one destination. */
@@ -381,7 +581,8 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
-				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+				"iface_type=%d, iface_no={%d,%d}, "
+				"tx_port=%hu, num_pkt=%hu\n",
 				clsd_data->iface_type,
 				clsd_data->iface_no_global,
 				clsd_data->iface_no,
@@ -391,6 +592,22 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	}
 }
 
+/* get index of general default classified */
+static inline int
+get_general_default_classified_index(struct component_info *cmp_info)
+{
+	struct mac_classification *mac_cls;
+
+	mac_cls = cmp_info->mac_classifications[VLAN_UNTAGGED_VID];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Untagged's default is not set. vid=%d\n",
+				(int)VLAN_UNTAGGED_VID);
+		return -1;
+	}
+
+	return mac_cls->default_classified;
+}
+
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
@@ -398,20 +615,103 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
 		struct classified_data *clsd_data)
 {
 	int i;
+	struct mac_classification *mac_cls;
+	uint16_t vid = get_vid(pkt);
+	int gen_def_clsd_idx = get_general_default_classified_index(cmp_info);
+	int n_act_clsd;
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL ||
+			mac_cls->num_active_classified == 0)) {
+		/* specific vlan is not registered
+		 * use untagged's default(as general default)
+		 */
+		if (unlikely(gen_def_clsd_idx < 0)) {
+			/* untagged's default is not registered too */
+			RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
+					"No entry.(l2 multicast packet)\n");
+			rte_pktmbuf_free(pkt);
+			return;
+		}
 
-	if (unlikely(cmp_info->num_active_classified == 0)) {
-		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "No mac address.(l2 multicast packet)\n");
-		rte_pktmbuf_free(pkt);
+		/* transmit to untagged's default(as general default) */
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
 		return;
 	}
 
-	rte_mbuf_refcnt_update(pkt,
-			(cmp_info->num_active_classified - 1));
+	/* add to mbuf's refcnt */
+	n_act_clsd = mac_cls->num_active_classified;
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID)
+		++n_act_clsd;
 
-	for (i = 0; i < cmp_info->num_active_classified; i++) {
+	rte_mbuf_refcnt_update(pkt, (int16_t)(n_act_clsd - 1));
+
+	/* transmit to specific segment & general default */
+	for (i = 0; i < mac_cls->num_active_classified; i++) {
+		LOG_CLS((long)mac_cls->active_classifieds[i],
+				pkt, cmp_info, clsd_data);
 		push_packet(pkt, clsd_data +
-				(long)cmp_info->active_classifieds[i]);
+				(long)mac_cls->active_classifieds[i]);
+	}
+
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID) {
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
+	}
+}
+
+/* select index of classified */
+static inline int
+select_classified_index(const struct rte_mbuf *pkt,
+		struct component_info *cmp_info)
+{
+	int ret;
+	struct ether_hdr *eth;
+	void *lookup_data;
+	struct mac_classification *mac_cls;
+	uint16_t vid;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Mac classification is not registered. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
+	}
+
+	/* find in table (by destination mac address) */
+	ret = rte_hash_lookup_data(mac_cls->classification_tab,
+			(const void *)&eth->d_addr, &lookup_data);
+	if (ret >= 0) {
+		LOG_DBG(cmp_info->name, "Mac address is registered. ret=%d, vid=%hu\n",
+				ret, vid);
+		return (int)(long)lookup_data;
+	}
+
+	LOG_DBG(cmp_info->name,
+			"Mac address is not registered. ret=%d, (EINVAL=%d, ENOENT=%d)\n",
+			ret, EINVAL, ENOENT);
+
+	/* check if packet is l2 multicast */
+	if (unlikely(is_multicast_ether_addr(&eth->d_addr)))
+		return -2;
+
+	/* if default is not set, use untagged's default */
+	if (unlikely(mac_cls->default_classified < 0 &&
+			vid != VLAN_UNTAGGED_VID)) {
+		LOG_DBG(cmp_info->name, "Vid's default is not set. use general default. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
 	}
+
+	/* use default */
+	LOG_DBG(cmp_info->name, "Use vid's default. vid=%hu\n", vid);
+	return mac_cls->default_classified;
 }
 
 /*
@@ -423,55 +723,29 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		struct component_info *cmp_info,
 		struct classified_data *clsd_data)
 {
-	int ret;
 	int i;
-	struct ether_hdr *eth;
-	void *lookup_data;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	long clsd_idx;
 
 	for (i = 0; i < n_rx; i++) {
-		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
-
-		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(cmp_info->classifier_table,
-				(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],
-						cmp_info,
-						clsd_data);
-				continue;
-			}
-
-			/* if no default, drop packet */
-			if (unlikely(cmp_info->default_classified ==
-					-1)) {
-				ether_format_addr(mac_addr_str,
-						sizeof(mac_addr_str),
-						&eth->d_addr);
-				RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-						"unknown mac address. "
-						"ret=%d, mac_addr=%s\n",
-						ret, mac_addr_str);
-				rte_pktmbuf_free(rx_pkts[i]);
-				continue;
-			}
-
-			/* to default classified */
-			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-					"to default classified.\n");
-			lookup_data = (void *)(long)cmp_info->
-					default_classified;
+		LOG_PKT(cmp_info->name, rx_pkts[i]);
+
+		clsd_idx = select_classified_index(rx_pkts[i], cmp_info);
+		LOG_CLS(clsd_idx, rx_pkts[i], cmp_info, clsd_data);
+
+		if (likely(clsd_idx >= 0)) {
+			LOG_DBG(cmp_info->name, "as unicast packet. i=%d\n",
+					i);
+			push_packet(rx_pkts[i], clsd_data + clsd_idx);
+		} else if (unlikely(clsd_idx == -1)) {
+			LOG_DBG(cmp_info->name, "no destination. drop packet. i=%d\n",
+					i);
+			rte_pktmbuf_free(rx_pkts[i]);
+		} else if (unlikely(clsd_idx == -2)) {
+			LOG_DBG(cmp_info->name, "as multicast packet. i=%d\n",
+					i);
+			handle_l2multicast_packet(rx_pkts[i],
+					cmp_info, clsd_data);
 		}
-
-		/*
-		 * set mbuf pointer to tx buffer
-		 * and transmit packet, if buffer is filled
-		 */
-		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
@@ -541,6 +815,9 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
+	/* uninitialize old */
+	uninit_component_info(mng_info->cmp_infos + mng_info->upd_index);
+
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"Component[%u] Complete update component.\n", id);
 
@@ -568,8 +845,10 @@ spp_classifier_mac_do(int id)
 
 	/* initialize */
 	ret = init_classifier(mng_info);
-	if (unlikely(ret != 0))
+	if (unlikely(ret != 0)) {
+		uninit_classifier(mng_info);
 		return ret;
+	}
 
 	while (likely(spp_get_core_status(lcore_id) == SPP_CORE_FORWARD) &&
 			likely(spp_check_core_index(lcore_id) == 0)) {
@@ -676,20 +955,79 @@ spp_classifier_get_component_status(
 	return 0;
 }
 
+static void
+mac_classification_iterate_table(
+		struct spp_iterate_classifier_table_params *params,
+		uint16_t vid,
+		struct mac_classification *mac_cls,
+		__rte_unused struct component_info *cmp_info,
+		struct classified_data *clsd_data)
+{
+	int ret;
+	const void *key;
+	void *data;
+	uint32_t next;
+	struct spp_port_index port;
+	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	enum spp_classifier_type type;
+
+	type = SPP_CLASSIFIER_TYPE_VLAN;
+	if (unlikely(vid == VLAN_UNTAGGED_VID))
+		type = SPP_CLASSIFIER_TYPE_MAC;
+
+	if (mac_cls->default_classified >= 0) {
+		port.iface_type = (clsd_data +
+				mac_cls->default_classified)->iface_type;
+		port.iface_no   = (clsd_data +
+				mac_cls->default_classified)->iface_no_global;
+
+		LOG_ENT((long)mac_cls->default_classified,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				&port);
+	}
+
+	next = 0;
+	while (1) {
+		ret = rte_hash_iterate(mac_cls->classification_tab,
+				&key, &data, &next);
+
+		if (unlikely(ret < 0))
+			break;
+
+		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
+				(const struct ether_addr *)key);
+
+		port.iface_type = (clsd_data + (long)data)->iface_type;
+		port.iface_no   = (clsd_data + (long)data)->iface_no_global;
+
+		LOG_ENT((long)data, vid, mac_addr_str, cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				mac_addr_str,
+				&port);
+	}
+}
+
 /* classifier(mac address) iterate classifier table. */
 int
 spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params)
 {
-	int ret, i;
-	const void *key;
-	void *data;
-	uint32_t next = 0;
+	int i, n;
 	struct management_info *mng_info;
 	struct component_info *cmp_info;
 	struct classified_data *clsd_data;
-	struct spp_port_index port;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		mng_info = g_mng_infos + i;
@@ -697,49 +1035,21 @@ spp_classifier_mac_iterate_table(
 			continue;
 
 		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-
 		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (cmp_info->default_classified >= 0) {
-			port.iface_type = (clsd_data +
-					cmp_info->default_classified)->
-					iface_type;
-			port.iface_no   = (clsd_data +
-					cmp_info->default_classified)->
-					iface_no_global;
-
-			(*params->element_proc)(
-					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					SPP_DEFAULT_CLASSIFIED_SPEC_STR,
-					&port);
-		}
-
-		next = 0;
-		while (1) {
-			ret = rte_hash_iterate(
-					cmp_info->classifier_table,
-					&key, &data, &next);
-
-			if (unlikely(ret < 0))
-				break;
-
-			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
-					(const struct ether_addr *)key);
-
-			port.iface_type = (clsd_data + (long)data)->
-					iface_type;
-			port.iface_no   = (clsd_data + (long)data)->
-					iface_no_global;
+		for (n = 0; n < SPP_NUM_VLAN_VID; ++n) {
+			if (cmp_info->mac_classifications[n] == NULL)
+				continue;
 
-			(*params->element_proc)(
+			mac_classification_iterate_table(
 					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					mac_addr_str,
-					&port);
+					(uint16_t)n,
+					cmp_info->mac_classifications[n],
+					cmp_info,
+					clsd_data);
 		}
 	}
 
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 9a4496f..c5c5908 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -17,6 +17,7 @@
 const char *CLASSIFILER_TYPE_STRINGS[] = {
 	"none",
 	"mac",
+	"vlan",
 
 	/* termination */ "",
 };
@@ -501,21 +502,18 @@ decode_classifier_type_value(void *output, const char *arg_val)
 	return 0;
 }
 
-/* decoding procedure of value for classifier_table command */
+/* decoding procedure of vlan id for classifier_table command */
 static int
-decode_classifier_value_value(void *output, const char *arg_val)
+decode_classifier_vid_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,
+	ret = get_int_value(output, arg_val, 0, ETH_VLAN_ID_MAX);
+	if (unlikely(ret < 0)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad VLAN ID. val=%s\n",
 				arg_val);
-		break;
-	default:
-		break;
+		return -1;
 	}
-	return ret;
+	return 0;
 }
 
 /* decoding procedure of port for classifier_table command */
@@ -537,20 +535,24 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		return -1;
 	}
 
+	if (classifier_table->type == SPP_CLASSIFIER_TYPE_MAC)
+		classifier_table->vid = ETH_VLAN_ID_MAX;
+
 	if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) {
-		if (!spp_check_mac_used_port(0, tmp_port.iface_type,
-				tmp_port.iface_no)) {
+		if (!spp_check_classid_used_port(ETH_VLAN_ID_MAX, 0,
+				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
 			return -1;
 		}
 	} else if (unlikely(classifier_table->action == SPP_CMD_ACTION_DEL)) {
-		mac_addr = spp_change_mac_str_to_int64(classifier_table->value);
+		mac_addr = spp_change_mac_str_to_int64(classifier_table->mac);
 		if (mac_addr < 0)
 			return -1;
 
-		if (!spp_check_mac_used_port((uint64_t)mac_addr,
+		if (!spp_check_classid_used_port(classifier_table->vid,
+				(uint64_t)mac_addr,
 				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
@@ -576,7 +578,7 @@ struct decode_parameter_list {
 
 /* parameter list for each command */
 static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
-	{                                /* classifier_table */
+	{                                /* classifier_table(mac) */
 		{
 			.name = "action",
 			.offset = offsetof(struct spp_command,
@@ -590,10 +592,43 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.func = decode_classifier_type_value
 		},
 		{
-			.name = "value",
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
+		},
+		{
+			.name = "port",
 			.offset = offsetof(struct spp_command,
 					spec.classifier_table),
-			.func = decode_classifier_value_value
+			.func = decode_classifier_port_value
+		},
+		DECODE_PARAMETER_LIST_EMPTY,
+	},
+	{                                /* classifier_table(VLAN) */
+		{
+			.name = "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),
+			.func = decode_classifier_type_value
+		},
+		{
+			.name = "vlan id",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.vid),
+			.func = decode_classifier_vid_value
+		},
+		{
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
 		},
 		{
 			.name = "port",
@@ -713,7 +748,9 @@ struct decode_command_list {
 /* command list */
 static struct decode_command_list command_list[] = {
 	{ "classifier_table", 5, 5, decode_command_parameter_in_list },
-						/* classifier_table */
+						/* classifier_table(mac) */
+	{ "classifier_table", 6, 6, decode_command_parameter_in_list },
+						/* classifier_table(vlan) */
 	{ "flush",            1, 1, NULL },     /* flush            */
 	{ "_get_client_id",   1, 1, NULL },     /* _get_client_id   */
 	{ "status",           1, 1, NULL },     /* status           */
@@ -733,6 +770,7 @@ decode_command_in_list(struct spp_command_request *request,
 			struct spp_command_decode_error *error)
 {
 	int ret = 0;
+	int command_name_check = 0;
 	struct decode_command_list *list = NULL;
 	int i = 0;
 	int argc = 0;
@@ -758,11 +796,8 @@ decode_command_in_list(struct spp_command_request *request,
 
 		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);
+			command_name_check = 1;
+			continue;
 		}
 
 		request->commands[0].type = i;
@@ -772,6 +807,12 @@ decode_command_in_list(struct spp_command_request *request,
 		return 0;
 	}
 
+	if (command_name_check != 0) {
+		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);
+	}
+
 	RTE_LOG(ERR, SPP_COMMAND_PROC,
 			"Unknown command. command=%s, request_str=%s\n",
 			argv[0], request_str);
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index fc807f8..91a6ff5 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -40,14 +40,32 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
-	SPP_CMDTYPE_FLUSH,            /**< flush command */
-	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
-	SPP_CMDTYPE_STATUS,           /**< status command */
-	SPP_CMDTYPE_EXIT,             /**< exit command */
-	SPP_CMDTYPE_COMPONENT,        /**< component command */
-	SPP_CMDTYPE_PORT,             /**< port command */
-	SPP_CMDTYPE_CANCEL,           /**< cancel command */
+	/** classifier_table command(mac) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_MAC,
+
+	/** classifier_table command(VLAN) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN,
+
+	/** flush command */
+	SPP_CMDTYPE_FLUSH,
+
+	/** get_client_id command */
+	SPP_CMDTYPE_CLIENT_ID,
+
+	/** status command */
+	SPP_CMDTYPE_STATUS,
+
+	/** exit command */
+	SPP_CMDTYPE_EXIT,
+
+	/** component command */
+	SPP_CMDTYPE_COMPONENT,
+
+	/** port command */
+	SPP_CMDTYPE_PORT,
+
+	/** cancel command */
+	SPP_CMDTYPE_CANCEL,
 };
 
 /** "classifier_table" command specific parameters */
@@ -58,8 +76,11 @@ struct spp_command_classifier_table {
 	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/** Value to be classified */
-	char value[SPP_CMD_VALUE_BUFSZ];
+	/** VLAN ID to be classified */
+	int vid;
+
+	/** MAC address to be classified */
+	char mac[SPP_CMD_VALUE_BUFSZ];
 
 	/** Destination port type and number */
 	struct spp_port_index port;
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index b76c586..7c16be8 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -68,6 +68,18 @@ const char *PORT_ABILITY_STATUS_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * classifier type string list
+ * do it same as the order of enum spp_classifier_type (spp_vf.h)
+ */
+const char *CLASSIFILER_TYPE_STATUS_STRINGS[] = {
+	"none",
+	"mac",
+	"vlan",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -192,13 +204,15 @@ execute_command(const struct spp_command *command)
 	int ret = 0;
 
 	switch (command->type) {
-	case SPP_CMDTYPE_CLASSIFIER_TABLE:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_MAC:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN:
 		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,
-				command->spec.classifier_table.value,
+				command->spec.classifier_table.vid,
+				command->spec.classifier_table.mac,
 				&command->spec.classifier_table.port);
 		break;
 
@@ -654,13 +668,14 @@ append_core_value(const char *name, char **output,
 static int
 append_classifier_element_value(
 		struct spp_iterate_classifier_table_params *params,
-		__rte_unused enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type,
+		int vid, const char *mac,
 		const struct spp_port_index *port)
 {
 	int ret = -1;
 	char *buff, *tmp_buff;
 	char port_str[CMD_TAG_APPEND_SIZE];
+	char value_str[SPP_MIN_STR_LEN];
 	buff = params->output;
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
@@ -671,11 +686,25 @@ append_classifier_element_value(
 
 	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
-	ret = append_json_str_value("type", &tmp_buff, "mac");
+	ret = append_json_str_value("type", &tmp_buff,
+			CLASSIFILER_TYPE_STATUS_STRINGS[type]);
 	if (unlikely(ret < 0))
 		return ret;
 
-	ret = append_json_str_value("value", &tmp_buff, data);
+	memset(value_str, 0x00, SPP_MIN_STR_LEN);
+	switch (type) {
+	case SPP_CLASSIFIER_TYPE_MAC:
+		sprintf(value_str, "%s", mac);
+		break;
+	case SPP_CLASSIFIER_TYPE_VLAN:
+		sprintf(value_str, "%d/%s", vid, mac);
+		break;
+	default:
+		/* not used */
+		break;
+	}
+
+	ret = append_json_str_value("value", &tmp_buff, value_str);
 	if (unlikely(ret < 0))
 		return ret;
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 6fa0c22..b9fea14 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -557,10 +557,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->vhost[cnt];
@@ -568,10 +570,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->ring[cnt];
@@ -579,10 +583,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 }
 
@@ -678,15 +684,21 @@ init_iface_info(void)
 	int port_cnt;  /* increment ether ports */
 	memset(&g_iface_info, 0x00, sizeof(g_iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
-		g_iface_info.nic[port_cnt].iface_type   = UNDEF;
-		g_iface_info.nic[port_cnt].iface_no     = port_cnt;
-		g_iface_info.nic[port_cnt].dpdk_port = -1;
-		g_iface_info.vhost[port_cnt].iface_type   = UNDEF;
-		g_iface_info.vhost[port_cnt].iface_no     = port_cnt;
-		g_iface_info.vhost[port_cnt].dpdk_port = -1;
-		g_iface_info.ring[port_cnt].iface_type   = UNDEF;
-		g_iface_info.ring[port_cnt].iface_no     = port_cnt;
-		g_iface_info.ring[port_cnt].dpdk_port = -1;
+		g_iface_info.nic[port_cnt].iface_type = UNDEF;
+		g_iface_info.nic[port_cnt].iface_no   = port_cnt;
+		g_iface_info.nic[port_cnt].dpdk_port  = -1;
+		g_iface_info.nic[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.vhost[port_cnt].iface_type = UNDEF;
+		g_iface_info.vhost[port_cnt].iface_no   = port_cnt;
+		g_iface_info.vhost[port_cnt].dpdk_port  = -1;
+		g_iface_info.vhost[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.ring[port_cnt].iface_type = UNDEF;
+		g_iface_info.ring[port_cnt].iface_no   = port_cnt;
+		g_iface_info.ring[port_cnt].dpdk_port  = -1;
+		g_iface_info.ring[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
 	}
 }
 
@@ -1064,13 +1076,13 @@ spp_get_client_id(void)
  * Check mac address used on the port for registering or removing
  */
 int
-spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no)
+spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no)
 {
 	struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
-	return (mac_addr == port_info->mac_addr);
+	return ((mac_addr == port_info->class_id.mac_addr) &&
+			(vid == port_info->class_id.vlantag.vid));
 }
 
 /*
@@ -1156,62 +1168,78 @@ set_component_change_port(struct spp_port_info *port, enum spp_port_rxtx rxtx)
 int
 spp_update_classifier_table(
 		enum spp_command_action action,
-		enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type __attribute__ ((unused)),
+		int vid,
+		const char *mac_addr_str,
 		const struct spp_port_index *port)
 {
 	struct spp_port_info *port_info = NULL;
 	int64_t ret_mac = 0;
 	uint64_t mac_addr = 0;
 
-	if (type == SPP_CLASSIFIER_TYPE_MAC) {
-		RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
-				data, port->iface_type, port->iface_no);
+	RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, mac addr = %s, port = %d:%d )\n",
+			mac_addr_str, port->iface_type, port->iface_no);
+
+	ret_mac = spp_change_mac_str_to_int64(mac_addr_str);
+	if (unlikely(ret_mac == -1)) {
+		RTE_LOG(ERR, APP, "MAC address format error. ( mac = %s )\n",
+				mac_addr_str);
+		return SPP_RET_NG;
+	}
+	mac_addr = (uint64_t)ret_mac;
+
+	port_info = get_iface_info(port->iface_type, port->iface_no);
+	if (unlikely(port_info == NULL)) {
+		RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
+	if (unlikely(port_info->iface_type == UNDEF)) {
+		RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
 
-		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);
+	if (action == SPP_CMD_ACTION_DEL) {
+		/* Delete */
+		if ((port_info->class_id.vlantag.vid != 0) &&
+				unlikely(port_info->class_id.vlantag.vid !=
+				vid)) {
+			RTE_LOG(ERR, APP, "VLAN ID is different. ( vid = %d )\n",
+					vid);
+			return SPP_RET_NG;
+		}
+		if ((port_info->class_id.mac_addr != 0) &&
+				unlikely(port_info->class_id.mac_addr !=
+						mac_addr)) {
+			RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
-		mac_addr = (uint64_t)ret_mac;
 
-		port_info = get_iface_info(port->iface_type, port->iface_no);
-		if (unlikely(port_info == NULL)) {
-			RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		port_info->class_id.vlantag.vid = ETH_VLAN_ID_MAX;
+		port_info->class_id.mac_addr    = 0;
+		memset(port_info->class_id.mac_addr_str, 0x00, SPP_MIN_STR_LEN);
+	} else if (action == SPP_CMD_ACTION_ADD) {
+		/* Setting */
+		if (unlikely(port_info->class_id.vlantag.vid !=
+				ETH_VLAN_ID_MAX)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, vlan = %d != %d )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.vlantag.vid, vid);
 			return SPP_RET_NG;
 		}
-		if (unlikely(port_info->iface_type == UNDEF)) {
-			RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		if (unlikely(port_info->class_id.mac_addr != 0)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, mac = %s != %s )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.mac_addr_str,
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
 
-		if (action == SPP_CMD_ACTION_DEL) {
-			/* Delete */
-			if ((port_info->mac_addr != 0) &&
-					unlikely(port_info->mac_addr !=
-							mac_addr)) {
-				RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
-						data);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = 0;
-			memset(port_info->mac_addr_str, 0x00, SPP_MIN_STR_LEN);
-		} 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",
-						port->iface_type,
-						port->iface_no);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = mac_addr;
-			strcpy(port_info->mac_addr_str, data);
-		}
+		port_info->class_id.vlantag.vid = vid;
+		port_info->class_id.mac_addr    = mac_addr;
+		strcpy(port_info->class_id.mac_addr_str, mac_addr_str);
 	}
 
 	set_component_change_port(port_info, SPP_PORT_RXTX_TX);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 539931c..7165fac 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -51,8 +51,8 @@
 /** Maximum number of port abilities available */
 #define SPP_PORT_ABILITY_MAX 4
 
-/** Maximum VLAN ID */
-#define SPP_VLAN_VID_MAX 4096
+/** Number of VLAN ID */
+#define SPP_NUM_VLAN_VID 4096
 
 /** Maximum VLAN PCP */
 #define SPP_VLAN_PCP_MAX 7
@@ -84,7 +84,8 @@ enum spp_component_type {
  */
 enum spp_classifier_type {
 	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
-	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
+	SPP_CLASSIFIER_TYPE_MAC,  /**< MAC address */
+	SPP_CLASSIFIER_TYPE_VLAN  /**< VLAN ID */
 };
 
 /**
@@ -147,15 +148,22 @@ struct spp_port_ability {
 	union spp_ability_data data;   /**< Port ability data */
 };
 
+/** Port class identifier for classifying */
+struct spp_port_class_identifier {
+	uint64_t mac_addr;                      /**< Mac address (binary) */
+	char     mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address (text) */
+	struct spp_vlantag_info vlantag;        /**< VLAN tag information */
+};
+
 /**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
-	int            iface_no;   /**< Interface number */
-	int            dpdk_port;  /**< DPDK port number */
-	uint64_t       mac_addr;   /**< Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	enum port_type iface_type;      /**< Interface type (phy/vhost/ring) */
+	int            iface_no;        /**< Interface number */
+	int            dpdk_port;       /**< DPDK port number */
+	struct spp_port_class_identifier class_id;
+					/**< Port class identifier */
 	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
 					/**< Port ability */
 };
@@ -201,7 +209,8 @@ int spp_get_client_id(void);
 int spp_update_classifier_table(
 		enum spp_command_action action,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid,
+		const char *mac,
 		const struct spp_port_index *port);
 
 /**
@@ -297,7 +306,7 @@ struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid, const char *mac,
 		const struct spp_port_index *port);
 
 /** iterate classifier table parameters */
@@ -389,6 +398,8 @@ int spp_get_component_id(const char *name);
 /**
  * Check mac address used on the port for registering or removing
  *
+ * @param vid
+ *  VLAN ID to be validated.
  * @param mac_addr
  *  Mac address to be validated.
  * @param iface_type
@@ -397,12 +408,12 @@ int spp_get_component_id(const char *name);
  *  Interface number to be validated.
  *
  * @return
- *  True if target MAC address matches MAC address of port.
+ *  True if target identifier(VLAN ID, MAC address)
+ *  matches identifier(VLAN ID, MAC address) of port.
  */
-int spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no);
+int spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no);
 
 /**
  * Check if port has been added.
-- 
1.9.1

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

* [spp] [PATCH 7/7] spp_vf: change log level setting
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
                         ` (5 preceding siblings ...)
  2018-02-09  3:40       ` [spp] [PATCH 6/7] spp_vf: add VID classification to the classifier x-fn-spp
@ 2018-02-09  3:40       ` x-fn-spp
  2018-02-09  7:16       ` [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license Yasufumi Ogawa
  7 siblings, 0 replies; 40+ messages in thread
From: x-fn-spp @ 2018-02-09  3:40 UTC (permalink / raw)
  To: spp

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

Change for "CONFIG_RTE_LOG_LEVEL" deleted at "DPDK18.02".
After "DPDK18.02", log level can be changed by "--log-level".

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/spp_vf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index b9fea14..afeed94 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -958,9 +958,6 @@ main(int argc, char *argv[])
 		argc -= ret_dpdk;
 		argv += ret_dpdk;
 
-		/* Set log level  */
-		rte_log_set_global_level(RTE_LOG_LEVEL);
-
 		/* Parse spp_vf specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != 0))
-- 
1.9.1

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
                         ` (6 preceding siblings ...)
  2018-02-09  3:40       ` [spp] [PATCH 7/7] spp_vf: change log level setting x-fn-spp
@ 2018-02-09  7:16       ` Yasufumi Ogawa
  2018-02-15 10:22         ` Ferruh Yigit
  7 siblings, 1 reply; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-09  7:16 UTC (permalink / raw)
  To: Nakamura Hioryuki, Ferruh Yigit; +Cc: spp, Hemant Agrawal

On 2018/02/09 12:03, Nakamura Hioryuki wrote:
> Thank you for reviewing and pointing out.
> 
> Revised patches are posted in the following emails.
> 
>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>> think about same thing for spp. Not for this patchset, but for future.
> 
> Ok, Thank you for information.
> "spp_vf: add BSD license" is deleted from revised patchset, we will make
> change license header for future.
> 
> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
> deleted, because this will conflict with Yasufumi’s patch
> "[PATCH 2/2] spp_vf: update to improve usability"
> 

Hi Hiroyuki, Ferruh

Thank you for comments for licensing. I did not be aware switching SPDX.  
I think we should add this topic in next TODOs.

Hiroyuki, thanks for contribution. However, I think it is not needed to  
revise license only for spp_vf at this time. We should revise all of spp.

Ferruh, If you find Hiroyuki's reply after merged previous patches,  
could you do not re-merge revised patches to avoid to waste your time? I  
would like to update all of files and send another patches later.

Thanks,
Yasufumi

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-09  7:16       ` [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license Yasufumi Ogawa
@ 2018-02-15 10:22         ` Ferruh Yigit
  2018-02-16  9:01           ` Yasufumi Ogawa
  0 siblings, 1 reply; 40+ messages in thread
From: Ferruh Yigit @ 2018-02-15 10:22 UTC (permalink / raw)
  To: Yasufumi Ogawa, Nakamura Hioryuki; +Cc: spp, Hemant Agrawal

On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>> Thank you for reviewing and pointing out.
>>
>> Revised patches are posted in the following emails.
>>
>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>> think about same thing for spp. Not for this patchset, but for future.
>>
>> Ok, Thank you for information.
>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>> change license header for future.
>>
>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>> deleted, because this will conflict with Yasufumi’s patch
>> "[PATCH 2/2] spp_vf: update to improve usability"
>>
> 
> Hi Hiroyuki, Ferruh
> 
> Thank you for comments for licensing. I did not be aware switching SPDX.  
> I think we should add this topic in next TODOs.
> 
> Hiroyuki, thanks for contribution. However, I think it is not needed to  
> revise license only for spp_vf at this time. We should revise all of spp.
> 
> Ferruh, If you find Hiroyuki's reply after merged previous patches,  
> could you do not re-merge revised patches to avoid to waste your time? I  
> would like to update all of files and send another patches later.

Hi Yasufumi,

Sure, I will wait for your patchset.

btw, DPDK v18.02 is out now and available for testing with spp.

Thanks,
ferruh


> 
> Thanks,
> Yasufumi
> 

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-15 10:22         ` Ferruh Yigit
@ 2018-02-16  9:01           ` Yasufumi Ogawa
  2018-02-16 14:40             ` Ferruh Yigit
  0 siblings, 1 reply; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-16  9:01 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Nakamura Hioryuki, spp

On 2018/02/15 19:22, Ferruh Yigit wrote:
> On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
>> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>>> Thank you for reviewing and pointing out.
>>>
>>> Revised patches are posted in the following emails.
>>>
>>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>>> think about same thing for spp. Not for this patchset, but for future.
>>>
>>> Ok, Thank you for information.
>>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>>> change license header for future.
>>>
>>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>>> deleted, because this will conflict with Yasufumi’s patch
>>> "[PATCH 2/2] spp_vf: update to improve usability"
>>>
>>
>> Hi Hiroyuki, Ferruh
>>
>> Thank you for comments for licensing. I did not be aware switching SPDX.
>> I think we should add this topic in next TODOs.
>>
>> Hiroyuki, thanks for contribution. However, I think it is not needed to
>> revise license only for spp_vf at this time. We should revise all of spp.
>>
>> Ferruh, If you find Hiroyuki's reply after merged previous patches,
>> could you do not re-merge revised patches to avoid to waste your time? I
>> would like to update all of files and send another patches later.
> 
> Hi Yasufumi,
> 
> Sure, I will wait for your patchset.
> 
> btw, DPDK v18.02 is out now and available for testing with spp.
> 
> Thanks,
> ferruh

Thanks Ferruh! I will try SPP with latest DPDK v18.02!

Before update the version of SPP, I would like to merge patches from 
Kentaro and me. Could you check and merge it ?

Kentaro sent 9 patches
[spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
...
[spp] [PATCH 9/9] spp_vf: change log level setting

and I sent 5 patches.
[spp] [PATCH 1/3] spp_nfv: enable to patch ports with resource ID
[spp] [PATCH 2/3] spp: add validation for patch command
[spp] [PATCH 3/3] spp_vm: enable to patch ports with resource ID
[spp] [PATCH 1/2] spp: update to improve usability
[spp] [PATCH 2/2] spp_vf: update to improve usability

Thanks,
Yasufumi

> 
> 
>>
>> Thanks,
>> Yasufumi
>>
> 
> 
> 


-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-16  9:01           ` Yasufumi Ogawa
@ 2018-02-16 14:40             ` Ferruh Yigit
  2018-02-19  1:59               ` Yasufumi Ogawa
  2018-02-22  8:10               ` Yasufumi Ogawa
  0 siblings, 2 replies; 40+ messages in thread
From: Ferruh Yigit @ 2018-02-16 14:40 UTC (permalink / raw)
  To: Yasufumi Ogawa; +Cc: Nakamura Hioryuki, spp

On 2/16/2018 9:01 AM, Yasufumi Ogawa wrote:
> On 2018/02/15 19:22, Ferruh Yigit wrote:
>> On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
>>> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>>>> Thank you for reviewing and pointing out.
>>>>
>>>> Revised patches are posted in the following emails.
>>>>
>>>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>>>> think about same thing for spp. Not for this patchset, but for future.
>>>>
>>>> Ok, Thank you for information.
>>>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>>>> change license header for future.
>>>>
>>>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>>>> deleted, because this will conflict with Yasufumi’s patch
>>>> "[PATCH 2/2] spp_vf: update to improve usability"
>>>>
>>>
>>> Hi Hiroyuki, Ferruh
>>>
>>> Thank you for comments for licensing. I did not be aware switching SPDX.
>>> I think we should add this topic in next TODOs.
>>>
>>> Hiroyuki, thanks for contribution. However, I think it is not needed to
>>> revise license only for spp_vf at this time. We should revise all of spp.
>>>
>>> Ferruh, If you find Hiroyuki's reply after merged previous patches,
>>> could you do not re-merge revised patches to avoid to waste your time? I
>>> would like to update all of files and send another patches later.
>>
>> Hi Yasufumi,
>>
>> Sure, I will wait for your patchset.
>>
>> btw, DPDK v18.02 is out now and available for testing with spp.
>>
>> Thanks,
>> ferruh
> 
> Thanks Ferruh! I will try SPP with latest DPDK v18.02!
> 
> Before update the version of SPP, I would like to merge patches from 
> Kentaro and me. Could you check and merge it ?
> 
> Kentaro sent 9 patches
> [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
> ...
> [spp] [PATCH 9/9] spp_vf: change log level setting

I believe a new version of this series sent, a set with 7 patches [1].
Missing version information in the patchset and missing patchwork support makes
it hard to trace.

[1]
[PATCH 1/7] spp_vf: refactor to comply with coding rule
[PATCH 2/7] spp_vf: refactor comments and variable names
[PATCH 3/7] spp_vf: change header file to doxygen format
[PATCH 4/7] spp_vf: add VLAN tag operate function to port
[PATCH 5/7] spp_vf: refactor struct and variable names
[PATCH 6/7] spp_vf: add VID classification to the classifier
[PATCH 7/7] spp_vf: change log level setting


> 
> and I sent 5 patches.
> [spp] [PATCH 1/3] spp_nfv: enable to patch ports with resource ID
> [spp] [PATCH 2/3] spp: add validation for patch command
> [spp] [PATCH 3/3] spp_vm: enable to patch ports with resource ID
> [spp] [PATCH 1/2] spp: update to improve usability
> [spp] [PATCH 2/2] spp_vf: update to improve usability

Sure I will get these.

Thanks,
ferruh

> 
> Thanks,
> Yasufumi
> 
>>
>>
>>>
>>> Thanks,
>>> Yasufumi
>>>
>>
>>
>>
> 
> 

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-16 14:40             ` Ferruh Yigit
@ 2018-02-19  1:59               ` Yasufumi Ogawa
  2018-02-22  8:10               ` Yasufumi Ogawa
  1 sibling, 0 replies; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-19  1:59 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Nakamura Hioryuki, spp

On 2018/02/16 23:40, Ferruh Yigit wrote:
> On 2/16/2018 9:01 AM, Yasufumi Ogawa wrote:
>> On 2018/02/15 19:22, Ferruh Yigit wrote:
>>> On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
>>>> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>>>>> Thank you for reviewing and pointing out.
>>>>>
>>>>> Revised patches are posted in the following emails.
>>>>>
>>>>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>>>>> think about same thing for spp. Not for this patchset, but for future.
>>>>>
>>>>> Ok, Thank you for information.
>>>>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>>>>> change license header for future.
>>>>>
>>>>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>>>>> deleted, because this will conflict with Yasufumi’s patch
>>>>> "[PATCH 2/2] spp_vf: update to improve usability"
>>>>>
>>>>
>>>> Hi Hiroyuki, Ferruh
>>>>
>>>> Thank you for comments for licensing. I did not be aware switching SPDX.
>>>> I think we should add this topic in next TODOs.
>>>>
>>>> Hiroyuki, thanks for contribution. However, I think it is not needed to
>>>> revise license only for spp_vf at this time. We should revise all of spp.
>>>>
>>>> Ferruh, If you find Hiroyuki's reply after merged previous patches,
>>>> could you do not re-merge revised patches to avoid to waste your time? I
>>>> would like to update all of files and send another patches later.
>>>
>>> Hi Yasufumi,
>>>
>>> Sure, I will wait for your patchset.
>>>
>>> btw, DPDK v18.02 is out now and available for testing with spp.
>>>
>>> Thanks,
>>> ferruh
>>
>> Thanks Ferruh! I will try SPP with latest DPDK v18.02!
>>
>> Before update the version of SPP, I would like to merge patches from
>> Kentaro and me. Could you check and merge it ?
>>
>> Kentaro sent 9 patches
>> [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
>> ...
>> [spp] [PATCH 9/9] spp_vf: change log level setting
> 
> I believe a new version of this series sent, a set with 7 patches [1].
> Missing version information in the patchset and missing patchwork support makes
> it hard to trace.
I'm very sorry for such a complicated situation. They might not care 
about versioning rule for sending patches. I have to tell him to follow 
the rule and how to.

Actually, latest 7 patches for modifying license are not needed to be 
merged now. In addition, one of patches causes a conflict.

I would like to update license all of SPP in later patches.

Thanks
> 
> [1]
> [PATCH 1/7] spp_vf: refactor to comply with coding rule
> [PATCH 2/7] spp_vf: refactor comments and variable names
> [PATCH 3/7] spp_vf: change header file to doxygen format
> [PATCH 4/7] spp_vf: add VLAN tag operate function to port
> [PATCH 5/7] spp_vf: refactor struct and variable names
> [PATCH 6/7] spp_vf: add VID classification to the classifier
> [PATCH 7/7] spp_vf: change log level setting
> 
> 
>>
>> and I sent 5 patches.
>> [spp] [PATCH 1/3] spp_nfv: enable to patch ports with resource ID
>> [spp] [PATCH 2/3] spp: add validation for patch command
>> [spp] [PATCH 3/3] spp_vm: enable to patch ports with resource ID
>> [spp] [PATCH 1/2] spp: update to improve usability
>> [spp] [PATCH 2/2] spp_vf: update to improve usability
> 
> Sure I will get these.
> 
> Thanks,
> ferruh
> 
>>
>> Thanks,
>> Yasufumi
>>
>>>
>>>
>>>>
>>>> Thanks,
>>>> Yasufumi
>>>>
>>>
>>>
>>>
>>
>>
> 
> 
> 


-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-16 14:40             ` Ferruh Yigit
  2018-02-19  1:59               ` Yasufumi Ogawa
@ 2018-02-22  8:10               ` Yasufumi Ogawa
  2018-02-22 10:13                 ` Ferruh Yigit
  1 sibling, 1 reply; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-22  8:10 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Nakamura Hioryuki, spp

On 2018/02/16 23:40, Ferruh Yigit wrote:
> On 2/16/2018 9:01 AM, Yasufumi Ogawa wrote:
>> On 2018/02/15 19:22, Ferruh Yigit wrote:
>>> On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
>>>> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>>>>> Thank you for reviewing and pointing out.
>>>>>
>>>>> Revised patches are posted in the following emails.
>>>>>
>>>>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>>>>> think about same thing for spp. Not for this patchset, but for future.
>>>>>
>>>>> Ok, Thank you for information.
>>>>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>>>>> change license header for future.
>>>>>
>>>>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>>>>> deleted, because this will conflict with Yasufumi’s patch
>>>>> "[PATCH 2/2] spp_vf: update to improve usability"
>>>>>
>>>>
>>>> Hi Hiroyuki, Ferruh
>>>>
>>>> Thank you for comments for licensing. I did not be aware switching SPDX.
>>>> I think we should add this topic in next TODOs.
>>>>
>>>> Hiroyuki, thanks for contribution. However, I think it is not needed to
>>>> revise license only for spp_vf at this time. We should revise all of spp.
>>>>
>>>> Ferruh, If you find Hiroyuki's reply after merged previous patches,
>>>> could you do not re-merge revised patches to avoid to waste your time? I
>>>> would like to update all of files and send another patches later.
>>>
>>> Hi Yasufumi,
>>>
>>> Sure, I will wait for your patchset.
>>>
>>> btw, DPDK v18.02 is out now and available for testing with spp.
>>>
>>> Thanks,
>>> ferruh
>>
>> Thanks Ferruh! I will try SPP with latest DPDK v18.02!
>>
>> Before update the version of SPP, I would like to merge patches from
>> Kentaro and me. Could you check and merge it ?
>>
>> Kentaro sent 9 patches
>> [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
>> ...
>> [spp] [PATCH 9/9] spp_vf: change log level setting
> 
> I believe a new version of this series sent, a set with 7 patches [1].
> Missing version information in the patchset and missing patchwork support makes
> it hard to trace.
Hi Ferruh,

I did not think of patchwork. I think it is good idea if SPP can use 
patchwork for patch management.

Although I am not sure if it is possible to use patchwork on dpdk.org, 
do you have any idea for using it for SPP, or allowed only for 'dev'?

Thanks,
Yasufumi

> 
> [1]
> [PATCH 1/7] spp_vf: refactor to comply with coding rule
> [PATCH 2/7] spp_vf: refactor comments and variable names
> [PATCH 3/7] spp_vf: change header file to doxygen format
> [PATCH 4/7] spp_vf: add VLAN tag operate function to port
> [PATCH 5/7] spp_vf: refactor struct and variable names
> [PATCH 6/7] spp_vf: add VID classification to the classifier
> [PATCH 7/7] spp_vf: change log level setting
> 
> 
>>
>> and I sent 5 patches.
>> [spp] [PATCH 1/3] spp_nfv: enable to patch ports with resource ID
>> [spp] [PATCH 2/3] spp: add validation for patch command
>> [spp] [PATCH 3/3] spp_vm: enable to patch ports with resource ID
>> [spp] [PATCH 1/2] spp: update to improve usability
>> [spp] [PATCH 2/2] spp_vf: update to improve usability
> 
> Sure I will get these.
> 
> Thanks,
> ferruh
> 
>>
>> Thanks,
>> Yasufumi
>>
>>>
>>>
>>>>
>>>> Thanks,
>>>> Yasufumi
>>>>
>>>
>>>
>>>
>>
>>
> 
> 
> 


-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-22  8:10               ` Yasufumi Ogawa
@ 2018-02-22 10:13                 ` Ferruh Yigit
  2018-02-22 10:19                   ` Thomas Monjalon
  0 siblings, 1 reply; 40+ messages in thread
From: Ferruh Yigit @ 2018-02-22 10:13 UTC (permalink / raw)
  To: Yasufumi Ogawa, Thomas Monjalon; +Cc: Nakamura Hioryuki, spp

On 2/22/2018 8:10 AM, Yasufumi Ogawa wrote:
> On 2018/02/16 23:40, Ferruh Yigit wrote:
>> On 2/16/2018 9:01 AM, Yasufumi Ogawa wrote:
>>> On 2018/02/15 19:22, Ferruh Yigit wrote:
>>>> On 2/9/2018 7:16 AM, Yasufumi Ogawa wrote:
>>>>> On 2018/02/09 12:03, Nakamura Hioryuki wrote:
>>>>>> Thank you for reviewing and pointing out.
>>>>>>
>>>>>> Revised patches are posted in the following emails.
>>>>>>
>>>>>>> Also DPDK is switching to SPDX tags, that makes license headers easy, we can
>>>>>>> think about same thing for spp. Not for this patchset, but for future.
>>>>>>
>>>>>> Ok, Thank you for information.
>>>>>> "spp_vf: add BSD license" is deleted from revised patchset, we will make
>>>>>> change license header for future.
>>>>>>
>>>>>> Also, "[PATCH 8/9] spp_vf: refactor to comply with coding style" is
>>>>>> deleted, because this will conflict with Yasufumi’s patch
>>>>>> "[PATCH 2/2] spp_vf: update to improve usability"
>>>>>>
>>>>>
>>>>> Hi Hiroyuki, Ferruh
>>>>>
>>>>> Thank you for comments for licensing. I did not be aware switching SPDX.
>>>>> I think we should add this topic in next TODOs.
>>>>>
>>>>> Hiroyuki, thanks for contribution. However, I think it is not needed to
>>>>> revise license only for spp_vf at this time. We should revise all of spp.
>>>>>
>>>>> Ferruh, If you find Hiroyuki's reply after merged previous patches,
>>>>> could you do not re-merge revised patches to avoid to waste your time? I
>>>>> would like to update all of files and send another patches later.
>>>>
>>>> Hi Yasufumi,
>>>>
>>>> Sure, I will wait for your patchset.
>>>>
>>>> btw, DPDK v18.02 is out now and available for testing with spp.
>>>>
>>>> Thanks,
>>>> ferruh
>>>
>>> Thanks Ferruh! I will try SPP with latest DPDK v18.02!
>>>
>>> Before update the version of SPP, I would like to merge patches from
>>> Kentaro and me. Could you check and merge it ?
>>>
>>> Kentaro sent 9 patches
>>> [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule
>>> ...
>>> [spp] [PATCH 9/9] spp_vf: change log level setting
>>
>> I believe a new version of this series sent, a set with 7 patches [1].
>> Missing version information in the patchset and missing patchwork support makes
>> it hard to trace.
> Hi Ferruh,
> 
> I did not think of patchwork. I think it is good idea if SPP can use 
> patchwork for patch management.
> 
> Although I am not sure if it is possible to use patchwork on dpdk.org, 
> do you have any idea for using it for SPP, or allowed only for 'dev'?

I know from other projects, it is technically possible to share single patchwork
for multiple mail list. But not sure how difficult to setup or maintain that model.

cc'ed Thomas for comment.

> 
> Thanks,
> Yasufumi
> 
>>
>> [1]
>> [PATCH 1/7] spp_vf: refactor to comply with coding rule
>> [PATCH 2/7] spp_vf: refactor comments and variable names
>> [PATCH 3/7] spp_vf: change header file to doxygen format
>> [PATCH 4/7] spp_vf: add VLAN tag operate function to port
>> [PATCH 5/7] spp_vf: refactor struct and variable names
>> [PATCH 6/7] spp_vf: add VID classification to the classifier
>> [PATCH 7/7] spp_vf: change log level setting
>>
>>
>>>
>>> and I sent 5 patches.
>>> [spp] [PATCH 1/3] spp_nfv: enable to patch ports with resource ID
>>> [spp] [PATCH 2/3] spp: add validation for patch command
>>> [spp] [PATCH 3/3] spp_vm: enable to patch ports with resource ID
>>> [spp] [PATCH 1/2] spp: update to improve usability
>>> [spp] [PATCH 2/2] spp_vf: update to improve usability
>>
>> Sure I will get these.
>>
>> Thanks,
>> ferruh
>>
>>>
>>> Thanks,
>>> Yasufumi
>>>
>>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>> Yasufumi
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
> 
> 

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-22 10:13                 ` Ferruh Yigit
@ 2018-02-22 10:19                   ` Thomas Monjalon
  2018-02-22 10:26                     ` Ferruh Yigit
  0 siblings, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2018-02-22 10:19 UTC (permalink / raw)
  To: Ferruh Yigit, Yasufumi Ogawa; +Cc: Nakamura Hioryuki, spp

22/02/2018 11:13, Ferruh Yigit:
> On 2/22/2018 8:10 AM, Yasufumi Ogawa wrote:
> > I did not think of patchwork. I think it is good idea if SPP can use 
> > patchwork for patch management.
> > 
> > Although I am not sure if it is possible to use patchwork on dpdk.org, 
> > do you have any idea for using it for SPP, or allowed only for 'dev'?
> 
> I know from other projects, it is technically possible to share single patchwork
> for multiple mail list. But not sure how difficult to setup or maintain that model.
> 
> cc'ed Thomas for comment.

Yes we could do it.
But honestly, it is not the right timing.
We should migrate to a new server with a new patchwork version first.
I can add this requirement in the migration task.
It may take few months before it is done. Is it OK?

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-22 10:19                   ` Thomas Monjalon
@ 2018-02-22 10:26                     ` Ferruh Yigit
  2018-02-22 11:02                       ` Yasufumi Ogawa
  0 siblings, 1 reply; 40+ messages in thread
From: Ferruh Yigit @ 2018-02-22 10:26 UTC (permalink / raw)
  To: Thomas Monjalon, Yasufumi Ogawa; +Cc: Nakamura Hioryuki, spp

On 2/22/2018 10:19 AM, Thomas Monjalon wrote:
> 22/02/2018 11:13, Ferruh Yigit:
>> On 2/22/2018 8:10 AM, Yasufumi Ogawa wrote:
>>> I did not think of patchwork. I think it is good idea if SPP can use 
>>> patchwork for patch management.
>>>
>>> Although I am not sure if it is possible to use patchwork on dpdk.org, 
>>> do you have any idea for using it for SPP, or allowed only for 'dev'?
>>
>> I know from other projects, it is technically possible to share single patchwork
>> for multiple mail list. But not sure how difficult to setup or maintain that model.
>>
>> cc'ed Thomas for comment.
> 
> Yes we could do it.
> But honestly, it is not the right timing.
> We should migrate to a new server with a new patchwork version first.
> I can add this requirement in the migration task.
> It may take few months before it is done. Is it OK?

I believe it is not urgent, doing this while migrating to new server makes sense
to me.

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

* Re: [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license
  2018-02-22 10:26                     ` Ferruh Yigit
@ 2018-02-22 11:02                       ` Yasufumi Ogawa
  0 siblings, 0 replies; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-02-22 11:02 UTC (permalink / raw)
  To: Ferruh Yigit, Thomas Monjalon; +Cc: Nakamura Hioryuki, spp

On 2018/02/22 19:26, Ferruh Yigit wrote:
> On 2/22/2018 10:19 AM, Thomas Monjalon wrote:
>> 22/02/2018 11:13, Ferruh Yigit:
>>> On 2/22/2018 8:10 AM, Yasufumi Ogawa wrote:
>>>> I did not think of patchwork. I think it is good idea if SPP can use
>>>> patchwork for patch management.
>>>>
>>>> Although I am not sure if it is possible to use patchwork on dpdk.org,
>>>> do you have any idea for using it for SPP, or allowed only for 'dev'?
>>>
>>> I know from other projects, it is technically possible to share single patchwork
>>> for multiple mail list. But not sure how difficult to setup or maintain that model.
>>>
>>> cc'ed Thomas for comment.
>>
>> Yes we could do it.
>> But honestly, it is not the right timing.
>> We should migrate to a new server with a new patchwork version first.
>> I can add this requirement in the migration task.
>> It may take few months before it is done. Is it OK?
> 
> I believe it is not urgent, doing this while migrating to new server makes sense
> to me.
Hi Thomas, Ferruh,

I understand. It is OK to wait for migration.

Thanks,
Yasufumi
> 
> 


-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

* [spp] [PATCH v2 0/9] Update for spp_vf
  2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
                   ` (8 preceding siblings ...)
  2018-02-08  7:45 ` [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule Yasufumi Ogawa
@ 2018-02-27 12:34 ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 1/9] spp_vf: add vlan feature ogawa.yasufumi
                     ` (8 more replies)
  9 siblings, 9 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Yasufumi Ogawa

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

Hi,

It is 2nd version for updating spp_vf.

This update includes vlan support as a new feature, bug fix
and refactoring remained as TODO.

Hiroyuki Nakamura (3):
  spp_vf: add VLAN tag operate function to port
  spp_vf: refactor struct and variable names
  spp_vf: add VID classification to the classifier

Kentaro Watanabe (5):
  spp_vf: add vlan feature
  spp_vf: refactor comments and variable names
  spp_vf: change header file to doxygen format
  spp_vf: add BSD license
  spp_vf: change log level setting

Yasufumi Ogawa (1):
  spp_vf: refactor to comply with coding style

 src/spp_vf.py             |  147 ++++---
 src/vf/Makefile           |   13 +-
 src/vf/classifier_mac.c   | 1054 +++++++++++++++++++++++++++++++--------------
 src/vf/classifier_mac.h   |   83 +++-
 src/vf/command_conn.c     |   60 ++-
 src/vf/command_conn.h     |   68 ++-
 src/vf/command_dec.c      |  410 ++++++++++++++----
 src/vf/command_dec.h      |  178 ++++++--
 src/vf/command_proc.c     |  289 +++++++++++--
 src/vf/command_proc.h     |   49 ++-
 src/vf/ringlatencystats.c |   71 ++-
 src/vf/ringlatencystats.h |   82 +++-
 src/vf/spp_forward.c      |   99 +++--
 src/vf/spp_forward.h      |   89 +++-
 src/vf/spp_port.c         |  436 +++++++++++++++++++
 src/vf/spp_port.h         |  141 ++++++
 src/vf/spp_vf.c           |  674 +++++++++++++++++------------
 src/vf/spp_vf.h           |  498 ++++++++++++++++-----
 src/vf/string_buffer.c    |   38 +-
 src/vf/string_buffer.h    |   63 ++-
 20 files changed, 3473 insertions(+), 1069 deletions(-)
 create mode 100644 src/vf/spp_port.c
 create mode 100644 src/vf/spp_port.h

-- 
2.7.4

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

* [spp] [PATCH v2 1/9] spp_vf: add vlan feature
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 3/9] spp_vf: change header file to doxygen format ogawa.yasufumi
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Kentaro Watanabe, Yasufumi Ogawa

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

This patch is updating vlan feature to spp_vf and removing deprecated
RTE_LOG_LEVEL to comply with DPDK18.02.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@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_ */
-- 
2.7.4

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

* [spp] [PATCH v2 3/9] spp_vf: change header file to doxygen format
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 1/9] spp_vf: add vlan feature ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 4/9] spp_vf: add BSD license ogawa.yasufumi
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Kentaro Watanabe, Naoki Takada

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

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.h   |  49 ++++++-
 src/vf/command_conn.h     |  26 ++--
 src/vf/command_dec.h      | 134 ++++++++++-------
 src/vf/command_proc.h     |  13 +-
 src/vf/ringlatencystats.h |  39 ++++-
 src/vf/spp_forward.h      |  55 ++++++-
 src/vf/spp_vf.h           | 362 ++++++++++++++++++++++++++++++++++------------
 src/vf/string_buffer.h    |  14 +-
 8 files changed, 510 insertions(+), 182 deletions(-)

diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index b4e6715..b947bf7 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,12 +1,25 @@
 #ifndef _CLASSIFIER_MAC_H_
 #define _CLASSIFIER_MAC_H_
 
+/**
+ * @file
+ * SPP Classifier
+ *
+ * Classifier component provides packet forwarding function from
+ * one port to one port. Classifier has table of virtual MAC address.
+ * According to this table, classifier lookups L2 destination MAC address
+ * and determines which port to be transferred to incoming packets.
+ */
+
 /* forward declaration */
 struct spp_component_info;
 struct spp_iterate_classifier_table_params;
 
 /**
  * classifier(mac address) initialize globals.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_init(void);
 
@@ -14,10 +27,11 @@ int spp_classifier_mac_init(void);
  * classifier(mac address) update component info.
  *
  * @param component_info
- *  point to struct spp_component_info.
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of classifier.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_update(struct spp_component_info *component_info);
 
@@ -25,15 +39,27 @@ int spp_classifier_mac_update(struct spp_component_info *component_info);
  * classifier(mac address) thread function.
  *
  * @param id
- *  unique component ID.
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_do(int id);
 
-/*
- * classifier get component status
+/**
+ * classifier get component status.
+ *
+ *
+ * @param lcore_id
+ *  The logical core ID for classifier.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of classifier status.
  *
- * @ret_val 0  succeeded.
- * @ret_val -1 failed.
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int
 spp_classifier_get_component_status(unsigned int lcore_id, int id,
@@ -41,6 +67,13 @@ spp_classifier_get_component_status(unsigned int lcore_id, int id,
 
 /**
  * classifier(mac address) iterate classifier table.
+ *
+ * @param params
+ *  Point to struct spp_iterate_classifier_table_params.@n
+ *  Detailed data of classifier table.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params);
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index 8f3b9cf..b52ab32 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -1,6 +1,13 @@
 #ifndef _COMMAND_CONN_H_
 #define _COMMAND_CONN_H_
 
+/**
+ * @file
+ * SPP Connection
+ *
+ * Command connection management.
+ */
+
 /** result code - temporary error. please retry */
 #define SPP_CONNERR_TEMPORARY -1
 /** result code - fatal error occurred. should terminate process. */
@@ -10,10 +17,9 @@
  * initialize command connection.
  *
  * @param controller_ip
- *  controller listen ip address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
@@ -26,7 +32,7 @@ int spp_command_conn_init(const char *controller_ip, int controller_port);
  * @note bocking.
  *
  * @param sock
- *  socket that connect to controller.
+ *  Socket number for connecting to controller.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please retry.
@@ -39,7 +45,9 @@ int spp_connect_to_controller(int *sock);
  * @note non-blocking.
  *
  * @param sock
- *  socket that read data.
+ *  The socket number for the connection.
+ * @param msgbuf
+ *  The pointer to command message buffer.
  *
  * @retval 0 <                   succeeded. number of bytes received.
  * @retval 0                     no receive message.
@@ -54,13 +62,11 @@ int spp_receive_message(int *sock, char **msgbuf);
  * @note non-blocking.
  *
  * @param sock
- *  socket that write data.
- *
+ *  The socket number to be sent.
  * @param message
- *  send data.
- *
+ *  The pointer to the message to be sent.
  * @param message_len
- *  send data length.
+ *  The length of message.
  *
  * @retval 0                     succeeded.
  * @retval SPP_CONNERR_TEMPORARY temporary error. please reconnect.
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 77cae87..3eb4bc4 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,29 +1,36 @@
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
-/* max number of command per request */
+/**
+ * @file
+ * SPP command decode
+ *
+ * Decode and validate the command message string.
+ */
+
+/** max number of command per request */
 #define SPP_CMD_MAX_COMMANDS 32
 
-/* maximum number of parameters per command */
+/** maximum number of parameters per command */
 #define SPP_CMD_MAX_PARAMETERS 8
 
-/* command name string buffer size (include null char) */
+/** command name string buffer size (include null char) */
 #define SPP_CMD_NAME_BUFSZ  32
 
-/* command value string buffer size (include null char) */
+/** command value string buffer size (include null char) */
 #define SPP_CMD_VALUE_BUFSZ 128
 
-/* string that specify unused */
+/** string that specify unused */
 #define SPP_CMD_UNUSE "unuse"
 
-/* decode error code */
+/** decode error code */
 enum spp_command_decode_error_code {
 	/* not use 0, in general 0 is OK */
-	SPP_CMD_DERR_BAD_FORMAT = 1,
-	SPP_CMD_DERR_UNKNOWN_COMMAND,
-	SPP_CMD_DERR_NO_PARAM,
-	SPP_CMD_DERR_BAD_TYPE,
-	SPP_CMD_DERR_BAD_VALUE,
+	SPP_CMD_DERR_BAD_FORMAT = 1,  /**< Wrong format */
+	SPP_CMD_DERR_UNKNOWN_COMMAND, /**< Unknown command */
+	SPP_CMD_DERR_NO_PARAM,        /**< No parameters */
+	SPP_CMD_DERR_BAD_TYPE,        /**< Wrong data type */
+	SPP_CMD_DERR_BAD_VALUE,       /**< Wrong value */
 };
 
 /**
@@ -33,28 +40,28 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE,
-	SPP_CMDTYPE_FLUSH,
-	SPP_CMDTYPE_CLIENT_ID,
-	SPP_CMDTYPE_STATUS,
-	SPP_CMDTYPE_EXIT,
-	SPP_CMDTYPE_COMPONENT,
-	SPP_CMDTYPE_PORT,
-	SPP_CMDTYPE_CANCEL,
+	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
+	SPP_CMDTYPE_FLUSH,            /**< flush command */
+	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
+	SPP_CMDTYPE_STATUS,           /**< status command */
+	SPP_CMDTYPE_EXIT,             /**< exit command */
+	SPP_CMDTYPE_COMPONENT,        /**< component command */
+	SPP_CMDTYPE_PORT,             /**< port command */
+	SPP_CMDTYPE_CANCEL,           /**< cancel command */
 };
 
-/* "classifier_table" command specific parameters */
+/** "classifier_table" command specific parameters */
 struct spp_command_classifier_table {
-	/* Action identifier (add or del) */
+	/** Action identifier (add or del) */
 	enum spp_command_action action;
 
-	/* Classify type (currently only for mac) */
+	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/* Value to be classified */
+	/** Value to be classified */
 	char value[SPP_CMD_VALUE_BUFSZ];
 
-	/* Destination port type and number */
+	/** Destination port type and number */
 	struct spp_port_index port;
 };
 
@@ -63,61 +70,84 @@ struct spp_command_flush {
 	/* nothing specific */
 };
 
-/* "component" command parameters */
+/** "component" command parameters */
 struct spp_command_component {
-	enum spp_command_action action; /* Action identifier (start or stop) */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Component name */
-	unsigned int core;              /* Logical core number */
-	enum spp_component_type type;   /* Component type */
+	/**< Action identifier (start or stop) */
+	enum spp_command_action action;
+
+	/**< Component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/**< Logical core number */
+	unsigned int core;
+
+	/**< Component type */
+	enum spp_component_type type;
 };
 
-/* "port" command parameters */
+/** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /* Action identifier (add or del) */
-	struct spp_port_index port;     /* Port type and number */
-	enum spp_port_rxtx rxtx;        /* rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /* Attached component name */
+	enum spp_command_action action; /**< Action identifier (add or del) */
+	struct spp_port_index port;     /**< Port type and number */
+	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
+	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
 };
 
-/* command parameters */
+/** command parameters */
 struct spp_command {
-	enum spp_command_type type; /* Command type */
+	enum spp_command_type type; /**< Command type */
 
 	union {
-		/* Structured data for classifier_table command  */
+		/** Structured data for classifier_table command  */
 		struct spp_command_classifier_table classifier_table;
 
-		/* Structured data for flush command  */
+		/** Structured data for flush command  */
 		struct spp_command_flush flush;
 
-		/* Structured data for component command  */
+		/** Structured data for component command  */
 		struct spp_command_component component;
 
-		/* Structured data for port command  */
+		/** Structured data for port command  */
 		struct spp_command_port port;
 	} spec;
 };
 
-/* request parameters */
+/** request parameters */
 struct spp_command_request {
-	int num_command;                /* Number of accepted commands */
-	int num_valid_command;          /* Number of executed commands */
+	int num_command;                /**< Number of accepted commands */
+	int num_valid_command;          /**< Number of executed commands */
 	struct spp_command commands[SPP_CMD_MAX_COMMANDS];
-					/* Information of executed commands */
+					/**< Information of executed commands */
 
-	int is_requested_client_id;     /* Id for get_client_id command */
-	int is_requested_status;        /* Id for status command */
-	int is_requested_exit;          /* Id for exit command */
+	int is_requested_client_id;     /**< Id for get_client_id command */
+	int is_requested_status;        /**< Id for status command */
+	int is_requested_exit;          /**< Id for exit command */
 };
 
-/* decode error information */
+/** decode error information */
 struct spp_command_decode_error {
-	int code;                            /* Error code */
-	char value_name[SPP_CMD_NAME_BUFSZ]; /* Error value name */
-	char value[SPP_CMD_VALUE_BUFSZ];     /* Error value */
+	int code;                            /**< Error code */
+	char value_name[SPP_CMD_NAME_BUFSZ]; /**< Error value name */
+	char value[SPP_CMD_VALUE_BUFSZ];     /**< Error value */
 };
 
-/* decode request from no-null-terminated string */
+/**
+ * decode request from no-null-terminated string
+ *
+ * @param request
+ *  The pointer to struct spp_command_request.@n
+ *  The result value of decoding the command message.
+ * @param request_str
+ *  The pointer to requested command message.
+ * @param request_str_len
+ *  The length of requested command message.
+ * @param error
+ *  The pointer to struct spp_command_decode_error.@n
+ *  Detailed error information will be stored.
+ *
+ * @retval 0  succeeded.
+ * @retval !0 failed.
+ */
 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);
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 6b88da7..04296de 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -2,13 +2,20 @@
 #define _COMMAND_PROC_H_
 
 /**
+ * @file
+ * SPP Command processing
+ *
+ * Receive and process the command message, then send back the
+ * result JSON formatted data.
+ */
+
+/**
  * initialize command processor.
  *
  * @param controller_ip
- *  controller listen IP address.
- *
+ *  The controller's ip address.
  * @param controller_port
- *  controller listen port number.
+ *  The controller's port number.
  *
  * @retval 0  succeeded.
  * @retval -1 failed.
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index 2e64d63..5bc230d 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -1,6 +1,13 @@
 #ifndef _RINGLATENCYSTATS_H_
 #define _RINGLATENCYSTATS_H_
 
+/**
+ * @file
+ * SPP RING latency statistics
+ *
+ * Measure the latency through ring-PMD.
+ */
+
 #include <rte_mbuf.h>
 
 /** number of slots to save latency. 0ns~99ns and 100ns over */
@@ -8,7 +15,7 @@
 
 /** ring latency statistics */
 struct spp_ringlatencystats_ring_latency_stats {
-	/**< slots to save latency */
+	/** slots to save latency */
 	uint64_t slot[SPP_RINGLATENCYSTATS_STATS_SLOT_COUNT];
 };
 
@@ -17,6 +24,11 @@ struct spp_ringlatencystats_ring_latency_stats {
 /**
  * initialize ring latency statistics.
  *
+ * @param samp_intvl
+ *  The interval timer(ns) to refer the counter.
+ * @param stats_count
+ *  The number of ring to be measured.
+ *
  * @retval 0: succeeded.
  * @retval -1: failed.
  */
@@ -30,7 +42,15 @@ void spp_ringlatencystats_uninit(void);
 /**
  * add time-stamp to mbuf's member.
  *
- * call at enqueue.
+ * @note call at enqueue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_add_time_stamp(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -38,7 +58,15 @@ void spp_ringlatencystats_add_time_stamp(int ring_id,
 /**
  * calculate latency.
  *
- * call at dequeue.
+ * @note call at dequeue.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param pkts
+ *  The address of an array of nb_pkts pointers to rte_mbuf structures
+ *  which contain the packets to be measured.
+ * @param nb_pkts
+ *  The maximum number of packets to be measured.
  */
 void spp_ringlatencystats_calculate_latency(int ring_id,
 			struct rte_mbuf **pkts, uint16_t nb_pkts);
@@ -52,6 +80,11 @@ int spp_ringlatencystats_get_count(void);
 
 /**
  *get specific ring latency statistics.
+ *
+ * @param ring_id
+ *  The ring id.
+ * @param stats
+ *  The statistics values.
  */
 void spp_ringlatencystats_get_stats(int ring_id,
 		struct spp_ringlatencystats_ring_latency_stats *stats);
diff --git a/src/vf/spp_forward.h b/src/vf/spp_forward.h
index 5e5cf0f..b2965a6 100644
--- a/src/vf/spp_forward.h
+++ b/src/vf/spp_forward.h
@@ -1,21 +1,62 @@
 #ifndef __SPP_FORWARD_H__
 #define __SPP_FORWARD_H__
 
-/* Clear info */
-void spp_forward_init(void);
+/**
+ * @file
+ * SPP Forwarder and Merger
+ *
+ * Forwarder
+ * This component provides function for packet processing from one port
+ * to one port. Incoming packets from port are to be transferred to
+ * specific one port. The direction of this transferring is specified
+ * by port command.
+ * Merger
+ * This component provides packet forwarding function from multiple
+ * ports to one port. Incoming packets from multiple ports are to be
+ * transferred to one specific port. The flow of this merging process
+ * is specified by port command.
+ */
 
-/* Clear info for one element. */
-void spp_forward_init_info(int id);
+/** Clear info */
+void spp_forward_init(void);
 
-/* Update forward info */
+/**
+ * Update forward info
+ *
+ * @param component
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of forwarder and merger.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_update(struct spp_component_info *component);
 
-/*
+/**
  * Merge/Forward
+ *
+ * @param id
+ *  The unique component ID.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_forward(int id);
 
-/* Merge/Forward get component status */
+/**
+ * Merge/Forward get component status
+ *
+ * @param lcore_id
+ *  The logical core ID for forwarder and merger.
+ * @param id
+ *  The unique component ID.
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  Detailed data of forwarder/merger status.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
+ */
 int spp_forward_get_component_status(
 		unsigned int lcore_id, int id,
 		struct spp_iterate_core_params *params);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 07f2e2a..70e105b 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -1,128 +1,164 @@
 #ifndef __SPP_VF_H__
 #define __SPP_VF_H__
 
+/**
+ * @file
+ * SPP_VF main
+ *
+ * Main function of spp_vf.
+ * This provides the function for initializing and starting the threads.
+ */
+
 #include "common.h"
 
+/** Identifier string for each component (status command) @{*/
 #define SPP_TYPE_CLASSIFIER_MAC_STR "classifier_mac"
 #define SPP_TYPE_MERGE_STR          "merge"
 #define SPP_TYPE_FORWARD_STR        "forward"
 #define SPP_TYPE_UNUSE_STR          "unuse"
+/**@}*/
 
+/** Identifier string for each interface @{*/
 #define SPP_IFTYPE_NIC_STR   "phy"
 #define SPP_IFTYPE_VHOST_STR "vhost"
 #define SPP_IFTYPE_RING_STR  "ring"
+/**@}*/
 
+/** The max number of client ID */
 #define SPP_CLIENT_MAX    128
+
+/** The max number of buffer for management */
 #define SPP_INFO_AREA_MAX 2
+
+/** The length of shortest character string */
 #define SPP_MIN_STR_LEN   32
+
+/** The length of NAME string */
 #define SPP_NAME_STR_LEN  128
 
+/** Update wait timer (micro sec) */
 #define SPP_CHANGE_UPDATE_INTERVAL 10
 
+/** Character sting for default port of classifier */
 #define SPP_DEFAULT_CLASSIFIED_SPEC_STR     "default"
+
+/** Character sting for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR "00:00:00:00:00:01"
+
+/** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
-/*
+/**
  * State on component
  */
 enum spp_core_status {
-	SPP_CORE_UNUSE,
-	SPP_CORE_STOP,
-	SPP_CORE_IDLE,
-	SPP_CORE_FORWARD,
-	SPP_CORE_STOP_REQUEST,
-	SPP_CORE_IDLE_REQUEST
+	SPP_CORE_UNUSE,        /**< Not used */
+	SPP_CORE_STOP,         /**< Stopped */
+	SPP_CORE_IDLE,         /**< Idling */
+	SPP_CORE_FORWARD,      /**< Forwarding  */
+	SPP_CORE_STOP_REQUEST, /**< Request stopping */
+	SPP_CORE_IDLE_REQUEST  /**< Request idling */
 };
 
-/*
+/**
  * Process type for each component
  */
 enum spp_component_type {
-	SPP_COMPONENT_UNUSE,
-	SPP_COMPONENT_CLASSIFIER_MAC,
-	SPP_COMPONENT_MERGE,
-	SPP_COMPONENT_FORWARD,
+	SPP_COMPONENT_UNUSE,          /**< Not used */
+	SPP_COMPONENT_CLASSIFIER_MAC, /**< Classifier_mac */
+	SPP_COMPONENT_MERGE,          /**< Merger */
+	SPP_COMPONENT_FORWARD,        /**< Forwarder */
 };
 
-/*
+/**
  * Classifier Type
  */
 enum spp_classifier_type {
-	SPP_CLASSIFIER_TYPE_NONE,
-	SPP_CLASSIFIER_TYPE_MAC
+	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
+	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
 };
 
-/*
+/**
  * API Return value
  */
 enum spp_return_value {
-	SPP_RET_OK = 0,
-	SPP_RET_NG = -1,
+	SPP_RET_OK = 0,  /**< succeeded */
+	SPP_RET_NG = -1, /**< failed */
 };
 
-/* Port type (rx or tx) */
+/** Port type (rx or tx) */
 enum spp_port_rxtx {
-	SPP_PORT_RXTX_NONE,
-	SPP_PORT_RXTX_RX,
-	SPP_PORT_RXTX_TX,
-	SPP_PORT_RXTX_ALL,
+	SPP_PORT_RXTX_NONE, /**< none */
+	SPP_PORT_RXTX_RX,   /**< rx port */
+	SPP_PORT_RXTX_TX,   /**< tx port */
+	SPP_PORT_RXTX_ALL,  /**< rx/tx port */
 };
 
-/* command setting type */
+/** command setting type */
 enum spp_command_action {
-	SPP_CMD_ACTION_NONE,
-	SPP_CMD_ACTION_START,
-	SPP_CMD_ACTION_STOP,
-	SPP_CMD_ACTION_ADD,
-	SPP_CMD_ACTION_DEL,
+	SPP_CMD_ACTION_NONE,  /**< none */
+	SPP_CMD_ACTION_START, /**< start */
+	SPP_CMD_ACTION_STOP,  /**< stop */
+	SPP_CMD_ACTION_ADD,   /**< add */
+	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
-/*
+/**
  * Interface information structure
  */
 struct spp_port_index {
-	enum port_type  iface_type; /* Interface type (phy/vhost/ring) */
-	int             iface_no;   /* Interface number */
+	enum port_type  iface_type; /**< Interface type (phy/vhost/ring) */
+	int             iface_no;   /**< Interface number */
 };
 
-/*
+/**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /* Interface type (phy/vhost/ring) */
-	int            iface_no;   /* Interface number */
-	int            dpdk_port;  /* DPDK port number */
-	uint64_t       mac_addr;   /* Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /* Mac address */
+	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
+	int            iface_no;   /**< Interface number */
+	int            dpdk_port;  /**< DPDK port number */
+	uint64_t       mac_addr;   /**< Mac address for classifying */
+	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
 };
 
-/*
+/**
  * 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 */
+	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 */
+					/**< Array of pointers to rx ports */
 	struct spp_port_info *tx_ports[RTE_MAX_ETHPORTS];
-					/* Array of pointers to tx ports */
+					/**< Array of pointers to tx ports */
 };
 
-/*
+/**
  * Get client ID
- * RETURN : CLIENT ID(0~127)
+ *
+ * @return Client ID(0~127)
  */
 int spp_get_client_id(void);
 
-/*
+/**
  * Update Classifier_table
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param type
+ *  Classify type (currently only for mac)
+ * @param data
+ *  Value to be classified
+ * @param port
+ *  Destination port type and number
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_classifier_table(
 		enum spp_command_action action,
@@ -130,20 +166,40 @@ int spp_update_classifier_table(
 		const char *data,
 		const struct spp_port_index *port);
 
-/*
+/**
  * Update component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (start or stop)
+ * @param name
+ *  Component name
+ * @param lcore_id
+ *  Logical core number
+ * @param type
+ *  Component type
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_component(
 		enum spp_command_action action,
 		const char *name, unsigned int lcore_id,
 		enum spp_component_type type);
 
-/*
+/**
  * Update port
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @param action
+ *  Action identifier (add or del)
+ * @param port
+ *  Port type and number
+ * @param rxtx
+ *  rx/tx identifier
+ * @param name
+ *  Attached component name
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_update_port(
 		enum spp_command_action action,
@@ -151,19 +207,20 @@ int spp_update_port(
 		enum spp_port_rxtx rxtx,
 		const char *name);
 
-/*
+/**
  * Flush SPP component
- * OK : SPP_RET_OK(0)
- * NG : SPP_RET_NG(-1)
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_flush(void);
 
-/*
+/**
  * Cancel data that is not flushing
  */
 void spp_cancel(void);
 
-/* definition of iterated core element procedure function */
+/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
@@ -175,16 +232,28 @@ typedef int (*spp_iterate_core_element_proc)(
 		const int num_tx,
 		const struct spp_port_index *tx_ports);
 
-/* iterate core information  parameters */
+/** iterate core information parameters */
 struct spp_iterate_core_params {
+	/** Output buffer */
 	char *output;
+
+	/** The function for creating core information */
 	spp_iterate_core_element_proc element_proc;
 };
 
-/* Iterate core information */
+/**
+ * Iterate core information
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_core_params.@n
+ *  The value for generating core information (status command).
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
+ */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/* definition of iterated classifier element procedure function */
+/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
@@ -192,105 +261,206 @@ typedef int (*spp_iterate_classifier_element_proc)(
 		const char *data,
 		const struct spp_port_index *port);
 
-/* iterate classifier table parameters */
+/** iterate classifier table parameters */
 struct spp_iterate_classifier_table_params {
 	void *output;
 	spp_iterate_classifier_element_proc element_proc;
 };
 
-/*
+/**
  * Iterate Classifier_table
+ *
+ * @param params
+ *  The pointer to struct spp_iterate_classifier_table_params.@n
+ *  The value for generating classifier table.
+ *
+ * @retval SPP_RET_OK succeeded.
+ * @retval SPP_RET_NG failed.
  */
 int spp_iterate_classifier_table(
 		struct spp_iterate_classifier_table_params *params);
 
-/* Get core status */
+/**
+ * Get core status
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Status of specified logical core.
+ */
 enum spp_core_status spp_get_core_status(unsigned int lcore_id);
 
-/* Get component type of target core */
+/**
+ * Get component type of target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component executed on specified logical core
+ */
 enum spp_component_type spp_get_component_type(unsigned int lcore_id);
 
-/* Get component type being updated on target core */
+/**
+ * Get component type being updated on target core
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  Type of component that will be executed on
+ *  specified logical core after update.
+ */
 enum spp_component_type spp_get_component_type_update(unsigned int lcore_id);
 
-/*
+/**
  * Get core ID of target component
- * RETURN : core ID
+ *
+ * @param component_id
+ *  unique component ID.
+ *
+ * @return
+ *  Logical core id of specified component.
  */
 unsigned int spp_get_component_core(int component_id);
 
-/*
+/**
  * Check core index change
- * RETURN : True if index has changed.
+ *
+ * @param lcore_id
+ *  Logical core ID.
+ *
+ * @return
+ *  True if index has changed.
  */
 int spp_check_core_index(unsigned int lcore_id);
 
-/*
+/**
  * Get name matching component ID
- * OK : component ID
- * NG : SPP_RET_NG
+ *
+ * @param name
+ *  Component name.
+ *
+ * @retval 0~127      Component ID.
+ * @retval SPP_RET_NG failed.
  */
 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.
+ *
+ * @param mac_addr
+ *  Mac address to be validated.
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if target MAC address matches MAC address of port.
  */
 int spp_check_mac_used_port(
 		uint64_t mac_addr,
 		enum port_type iface_type,
 		int iface_no);
 
-/*
+/**
  * Check if port has been added.
- * RETURN : True if port has been added.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been added.
  */
 int spp_check_added_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if port has been flushed.
- * RETURN : True if port has been flushed.
+ *
+ * @param iface_type
+ *  Interface to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ *
+ * @return
+ *  True if port has been flushed.
  */
 int spp_check_flush_port(enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Check if component is using port.
- * OK : match component ID
- * NG : SPP_RET_NG
+ *
+ * @param iface_type
+ *  Interface type to be validated.
+ * @param iface_no
+ *  Interface number to be validated.
+ * @param rxtx
+ *  tx/rx type to be validated.
+ *
+ * @retval 0~127      match component ID
+ * @retval SPP_RET_NG failed.
  */
 int spp_check_used_port(
 		enum port_type iface_type,
 		int iface_no,
 		enum spp_port_rxtx rxtx);
 
-/*
+/**
  * Change mac address string to int64
- * OK : int64 that store mac address
- * NG : -1
+ *
+ * @param mac
+ *  Character string of MAC address to be converted.
+ *
+ * @retval 0< int64 that store mac address
+ * @retval -1
  */
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
-/*
+/**
  * Extract if-type/if-number from port string
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_get_iface_index(
 		const char *port,
 		enum port_type *iface_type,
 		int *iface_no);
 
-/*
+/**
  * Format port string form if-type/if-number
  *
- * OK : 0
- * NG : -1
+ * @param port
+ *  Character string expressing the port, e.g. "phy:0","ring:1"
+ * @param iface_type
+ *  Interface type.
+ * @param iface_no
+ *  Interface number.
+ *
+ * @retval 0  succeeded.
+ * @retval -1 failed.
  */
 int spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
-/*
+/**
  * Change component type from string to type value.
+ *
+ * @param type_str
+ *  Name string for each component
+ *
+ * @return
+ *  Component type corresponding to type_str.
  */
 enum spp_component_type spp_change_component_type(const char *type_str);
 
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 60645e9..947748e 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -2,6 +2,14 @@
 #define _STRING_BUFFER_H_
 
 /**
+ * @file
+ * SPP String buffer management
+ *
+ * Management features of string buffer which is used for communicating
+ * between spp_vf and controller.
+ */
+
+/**
  * allocate string buffer from heap memory.
  *
  * @attention allocated memory must free by spp_strbuf_free function.
@@ -28,10 +36,8 @@ void spp_strbuf_free(char *strbuf);
  * @param strbuf
  *  destination string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param append
  *  string to append. normal c-string.
- *
  * @param append_len
  *  length of append string.
  *
@@ -46,9 +52,11 @@ char *spp_strbuf_append(char *strbuf, const char *append, size_t append_len);
  * @param strbuf
  *  target string buffer.
  *  spp_strbuf_allocate/spp_strbuf_append return value.
- *
  * @param remove_len
  *  length of remove.
+ *
+ * @return
+ *  The pointer to removed string.
  */
 char *spp_strbuf_remove_front(char *strbuf, size_t remove_len);
 
-- 
2.7.4

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

* [spp] [PATCH v2 4/9] spp_vf: add BSD license
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 1/9] spp_vf: add vlan feature ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 3/9] spp_vf: change header file to doxygen format ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 5/9] spp_vf: add VLAN tag operate function to port ogawa.yasufumi
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Kentaro Watanabe, Yasufumi Ogawa

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

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/vf/Makefile           |  9 +++++----
 src/vf/classifier_mac.c   | 34 ++++++++++++++++++++++++++++++++++
 src/vf/classifier_mac.h   | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_conn.c     | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_conn.h     | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_dec.c      | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_dec.h      | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_proc.c     | 34 ++++++++++++++++++++++++++++++++++
 src/vf/command_proc.h     | 34 ++++++++++++++++++++++++++++++++++
 src/vf/ringlatencystats.c | 34 ++++++++++++++++++++++++++++++++++
 src/vf/ringlatencystats.h | 34 ++++++++++++++++++++++++++++++++++
 src/vf/spp_forward.c      | 34 ++++++++++++++++++++++++++++++++++
 src/vf/spp_forward.h      | 34 ++++++++++++++++++++++++++++++++++
 src/vf/spp_vf.c           | 34 ++++++++++++++++++++++++++++++++++
 src/vf/spp_vf.h           | 34 ++++++++++++++++++++++++++++++++++
 src/vf/string_buffer.c    | 34 ++++++++++++++++++++++++++++++++++
 src/vf/string_buffer.h    | 34 ++++++++++++++++++++++++++++++++++
 17 files changed, 549 insertions(+), 4 deletions(-)

diff --git a/src/vf/Makefile b/src/vf/Makefile
index d54af25..4a34ac0 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+#   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -13,9 +13,10 @@
 #       notice, this list of conditions and the following disclaimer in
 #       the documentation and/or other materials provided with the
 #       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
+#     * Neither the name of Nippon Telegraph and Telephone Corporation
+#       nor the names of its contributors may be used to endorse or
+#       promote products derived from this software without specific
+#       prior written permission.
 #
 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index cd186a2..7bb7c70 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <stdio.h>
diff --git a/src/vf/classifier_mac.h b/src/vf/classifier_mac.h
index b947bf7..af1f212 100644
--- a/src/vf/classifier_mac.h
+++ b/src/vf/classifier_mac.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _CLASSIFIER_MAC_H_
 #define _CLASSIFIER_MAC_H_
 
diff --git a/src/vf/command_conn.c b/src/vf/command_conn.c
index 9d4659b..d964ade 100644
--- a/src/vf/command_conn.c
+++ b/src/vf/command_conn.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
diff --git a/src/vf/command_conn.h b/src/vf/command_conn.h
index b52ab32..22e616e 100644
--- a/src/vf/command_conn.h
+++ b/src/vf/command_conn.h
@@ -1,3 +1,37 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_CONN_H_
 #define _COMMAND_CONN_H_
 
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 59e825c..23e818e 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 3eb4bc4..a6130bc 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_DEC_H_
 #define _COMMAND_DEC_H_
 
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index f51c800..76fb3ec 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <string.h>
 
diff --git a/src/vf/command_proc.h b/src/vf/command_proc.h
index 04296de..d0e5672 100644
--- a/src/vf/command_proc.h
+++ b/src/vf/command_proc.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _COMMAND_PROC_H_
 #define _COMMAND_PROC_H_
 
diff --git a/src/vf/ringlatencystats.c b/src/vf/ringlatencystats.c
index a866485..f7af5d6 100644
--- a/src/vf/ringlatencystats.c
+++ b/src/vf/ringlatencystats.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <stdio.h>
diff --git a/src/vf/ringlatencystats.h b/src/vf/ringlatencystats.h
index 5bc230d..3cb3c67 100644
--- a/src/vf/ringlatencystats.h
+++ b/src/vf/ringlatencystats.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _RINGLATENCYSTATS_H_
 #define _RINGLATENCYSTATS_H_
 
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index c5c0e3c..1ada73e 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <rte_cycles.h>
 
 #include "spp_vf.h"
diff --git a/src/vf/spp_forward.h b/src/vf/spp_forward.h
index b2965a6..4f8b5d2 100644
--- a/src/vf/spp_forward.h
+++ b/src/vf/spp_forward.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef __SPP_FORWARD_H__
 #define __SPP_FORWARD_H__
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 49c56e3..6d69e3d 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <getopt.h>
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 70e105b..10742bc 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef __SPP_VF_H__
 #define __SPP_VF_H__
 
diff --git a/src/vf/string_buffer.c b/src/vf/string_buffer.c
index 28df6ae..605fdc5 100644
--- a/src/vf/string_buffer.c
+++ b/src/vf/string_buffer.c
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/vf/string_buffer.h b/src/vf/string_buffer.h
index 947748e..3f7444f 100644
--- a/src/vf/string_buffer.h
+++ b/src/vf/string_buffer.h
@@ -1,3 +1,37 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2017 Nippon Telegraph and Telephone Corporation
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Nippon Telegraph and Telephone Corporation
+ *       nor the names of its contributors may be used to endorse or
+ *       promote products derived from this software without specific
+ *       prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #ifndef _STRING_BUFFER_H_
 #define _STRING_BUFFER_H_
 
-- 
2.7.4

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

* [spp] [PATCH v2 5/9] spp_vf: add VLAN tag operate function to port
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (2 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 4/9] spp_vf: add BSD license ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 6/9] spp_vf: refactor struct and variable names ogawa.yasufumi
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp
  Cc: Hiroyuki Nakamura, Kentaro Watanabe, Naoki Takada

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

* Add VLAN tag operate function to port.

* Support set operation type of VLAN tag at port command.

* Support display information of VLAN tag at status command.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/Makefile         |   2 +-
 src/vf/classifier_mac.c |  23 +--
 src/vf/command_dec.c    | 104 +++++++++++-
 src/vf/command_dec.h    |  26 ++-
 src/vf/command_proc.c   | 143 ++++++++++++++--
 src/vf/spp_forward.c    |  22 +--
 src/vf/spp_port.c       | 436 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/vf/spp_port.h       | 141 ++++++++++++++++
 src/vf/spp_vf.c         |  49 +++++-
 src/vf/spp_vf.h         |  58 ++++++-
 10 files changed, 941 insertions(+), 63 deletions(-)
 create mode 100644 src/vf/spp_port.c
 create mode 100644 src/vf/spp_port.h

diff --git a/src/vf/Makefile b/src/vf/Makefile
index 4a34ac0..f1a1325 100644
--- a/src/vf/Makefile
+++ b/src/vf/Makefile
@@ -41,7 +41,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 APP = spp_vf
 
 # all source are stored in SRCS-y
-SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c ../shared/common.c
+SRCS-y := spp_vf.c classifier_mac.c spp_forward.c string_buffer.c command_conn.c command_dec.c command_proc.c ringlatencystats.c spp_port.c ../shared/common.c
 
 CFLAGS += $(WERROR_FLAGS) -O3
 CFLAGS += -I$(SRCDIR)/../shared
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 7bb7c70..57262a9 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -53,7 +53,7 @@
 #include <rte_hash.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "classifier_mac.h"
 
 #define RTE_LOGTYPE_SPP_CLASSIFIER_MAC RTE_LOGTYPE_USER1
@@ -367,16 +367,8 @@ transmit_packet(struct classified_data *classified_data)
 	int i;
 	uint16_t n_tx;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-	if (classified_data->iface_type == RING)
-		/* if tx-if is ring, set ringlatencystats */
-		spp_ringlatencystats_add_time_stamp(classified_data->iface_no,
-				classified_data->pkts,
-				classified_data->num_pkt);
-#endif
-
 	/* transmit packets */
-	n_tx = rte_eth_tx_burst(classified_data->port, 0,
+	n_tx = spp_eth_tx_burst(classified_data->port, 0,
 			classified_data->pkts, classified_data->num_pkt);
 
 	/* free cannot transmit packets */
@@ -523,6 +515,8 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 {
 	if (unlikely(classifier_mng_info->ref_index ==
 			classifier_mng_info->upd_index)) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
 		transmit_all_packet(classifier_mng_info->info +
@@ -652,18 +646,11 @@ spp_classifier_mac_do(int id)
 			continue;
 
 		/* retrieve packets */
-		n_rx = rte_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (classified_data_rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(
-					classified_data_rx->iface_no,
-					rx_pkts, n_rx);
-#endif
-
 		/* classify and transmit (filled) */
 		classify_packet(rx_pkts, n_rx, classifier_info,
 				classified_data_tx);
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 23e818e..374a105 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -35,6 +35,7 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <rte_ether.h>
 #include <rte_log.h>
 #include <rte_branch_prediction.h>
 
@@ -80,6 +81,18 @@ const char *PORT_RXTX_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STRINGS[] = {
+	"none",
+	"add_vlantag",
+	"del_vlantag",
+
+	/* termination */ "",
+};
+
 /* set decode error */
 inline int
 set_decode_error(struct spp_command_decode_error *error,
@@ -136,6 +149,27 @@ get_arrary_index(const char *match, const char *list[])
 	return -1;
 }
 
+/* Get int type value */
+static int
+get_int_value(
+		int *output,
+		const char *arg_val,
+		int min,
+		int max)
+{
+	int ret = 0;
+	char *endptr = NULL;
+	ret = strtol(arg_val, &endptr, 0);
+	if (unlikely(endptr == arg_val) || unlikely(*endptr != '\0'))
+		return -1;
+
+	if (unlikely(ret < min) || unlikely(ret > max))
+		return -1;
+
+	*output = ret;
+	return 0;
+}
+
 /* Get unsigned int type value */
 static int
 get_uint_value(
@@ -386,6 +420,59 @@ decode_port_name_value(void *output, const char *arg_val)
 	return decode_str_value(output, arg_val);
 }
 
+#/* decoding procedure of port ability for port command */
+static int
+decode_port_ability_value(void *output, const char *arg_val)
+{
+	int ret = 0;
+	struct spp_command_port *port = output;
+	struct spp_port_ability *ability = &port->ability;
+
+	switch (ability->ope) {
+	case SPP_PORT_ABILITY_OPE_NONE:
+		ret = get_arrary_index(arg_val, PORT_ABILITY_STRINGS);
+		if (unlikely(ret <= 0)) {
+			RTE_LOG(ERR, SPP_COMMAND_PROC,
+					"Unknown port ability. val=%s\n",
+					arg_val);
+			return -1;
+		}
+		ability->ope  = ret;
+		ability->rxtx = port->rxtx;
+		break;
+	case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		if (ability->data.vlantag.pcp == 0) {
+			ret = get_int_value(&ability->data.vlantag.vid,
+					arg_val, 0, ETH_VLAN_ID_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN ID. val=%s\n",
+						arg_val);
+				return -1;
+			}
+			ability->data.vlantag.pcp = -1;
+		} else {
+			ret = get_int_value(&ability->data.vlantag.pcp,
+					arg_val, 0, SPP_VLAN_PCP_MAX);
+			if (unlikely(ret < 0)) {
+				RTE_LOG(ERR, SPP_COMMAND_PROC,
+						"Bad VLAN PCP. val=%s\n",
+						arg_val);
+				return -1;
+			}
+		}
+		break;
+	case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		/* Nothing to do. */
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	return 0;
+}
+
 /* decoding procedure of mac address string */
 static int
 decode_mac_addr_str_value(void *output, const char *arg_val)
@@ -600,6 +687,21 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.offset = offsetof(struct spp_command, spec.port.name),
 			.func = decode_port_name_value
 		},
+		{
+			.name = "port ability 1",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 2",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
+		{
+			.name = "port ability 3",
+			.offset = offsetof(struct spp_command, spec.port),
+			.func = decode_port_ability_value
+		},
 		DECODE_PARAMETER_LIST_EMPTY,
 	},
 	{ DECODE_PARAMETER_LIST_EMPTY }, /* cancel           */
@@ -652,7 +754,7 @@ static struct decode_command_list command_list[] = {
 	{ "exit",             1, 1, NULL },     /* exit             */
 	{ "component",        3, 5, decode_command_parameter_in_list },
 						/* component        */
-	{ "port",             5, 5, decode_command_parameter_in_list },
+	{ "port",             5, 8, decode_command_parameter_in_list },
 						/* port             */
 	{ "cancel",           1, 1, NULL },     /* cancel           */
 	{ "",                 0, 0, NULL }      /* termination      */
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index a6130bc..f919b16 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -106,25 +106,35 @@ struct spp_command_flush {
 
 /** "component" command parameters */
 struct spp_command_component {
-	/**< Action identifier (start or stop) */
+	/** Action identifier (start or stop) */
 	enum spp_command_action action;
 
-	/**< Component name */
+	/** Component name */
 	char name[SPP_CMD_NAME_BUFSZ];
 
-	/**< Logical core number */
+	/** Logical core number */
 	unsigned int core;
 
-	/**< Component type */
+	/** Component type */
 	enum spp_component_type type;
 };
 
 /** "port" command parameters */
 struct spp_command_port {
-	enum spp_command_action action; /**< Action identifier (add or del) */
-	struct spp_port_index port;     /**< Port type and number */
-	enum spp_port_rxtx rxtx;        /**< rx/tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /**< Attached component name */
+	/** Action identifier (add or del) */
+	enum spp_command_action action;
+
+	/** Port type and number */
+	struct spp_port_index port;
+
+	/** rx/tx identifier */
+	enum spp_port_rxtx rxtx;
+
+	/** Attached component name */
+	char name[SPP_CMD_NAME_BUFSZ];
+
+	/** Port ability */
+	struct spp_port_ability ability;
 };
 
 /** command parameters */
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index 76fb3ec..a00181b 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -39,6 +39,7 @@
 #include <rte_branch_prediction.h>
 
 #include "spp_vf.h"
+#include "spp_port.h"
 #include "string_buffer.h"
 #include "command_conn.h"
 #include "command_dec.h"
@@ -89,6 +90,18 @@ struct command_response_list {
 	int (*func)(const char *name, char **output, void *tmp);
 };
 
+/*
+ * port ability string list
+ * do it same as the order of enum spp_port_ability_type (spp_vf.h)
+ */
+const char *PORT_ABILITY_STATUS_STRINGS[] = {
+	"none",
+	"add",
+	"del",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -245,7 +258,8 @@ execute_command(const struct spp_command *command)
 				command->spec.port.action,
 				&command->spec.port.port,
 				command->spec.port.rxtx,
-				command->spec.port.name);
+				command->spec.port.name,
+				&command->spec.port.ability);
 		break;
 
 	case SPP_CMDTYPE_CANCEL:
@@ -456,15 +470,35 @@ append_interface_value(const char *name, char **output,
 	return ret;
 }
 
-/* append a list of port numbers for JSON format */
+/* append a value of vlan for JSON format */
 static int
-apeend_port_array(const char *name, char **output,
-		const int num, const struct spp_port_index *ports)
+append_vlan_value(char **output, const int ope, const int vid, const int pcp)
+{
+	int ret = 0;
+	ret = append_json_str_value("operation", output,
+			PORT_ABILITY_STATUS_STRINGS[ope]);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("id", output, vid);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_int_value("pcp", output, pcp);
+	if (unlikely(ret < 0))
+		return -1;
+
+	return 0;
+}
+
+/* append a block of vlan for JSON format */
+static int
+append_vlan_block(const char *name, char **output,
+		const int port_id, const enum spp_port_rxtx rxtx)
 {
 	int ret = -1;
 	int i = 0;
-	char port_str[CMD_TAG_APPEND_SIZE];
-	char append_str[CMD_TAG_APPEND_SIZE];
+	struct spp_port_ability *info = NULL;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
 		RTE_LOG(ERR, SPP_COMMAND_PROC,
@@ -473,15 +507,90 @@ apeend_port_array(const char *name, char **output,
 		return -1;
 	}
 
-	for (i = 0; i < num; i++) {
-		spp_format_port_string(port_str, ports[i].iface_type,
-				ports[i].iface_no);
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	for (i = 0; i < SPP_PORT_ABILITY_MAX; i++) {
+		switch (info[i].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+			ret = append_vlan_value(&tmp_buff, info[i].ope,
+					info[i].data.vlantag.vid,
+					info[i].data.vlantag.pcp);
+			if (unlikely(ret < 0))
+				return -1;
+
+			/*
+			 * Change counter to "maximum+1" for exit the loop.
+			 * An if statement after loop termination is false
+			 * by "maximum+1 ".
+			 */
+			i = SPP_PORT_ABILITY_MAX + 1;
+			break;
+		default:
+			/* not used */
+			break;
+		}
+	}
+	if (i == SPP_PORT_ABILITY_MAX) {
+		ret = append_vlan_value(&tmp_buff, SPP_PORT_ABILITY_OPE_NONE,
+				0, 0);
+		if (unlikely(ret < 0))
+			return -1;
+	}
 
-		sprintf(append_str, "%s\"%s\"", JSON_APPEND_COMMA(i), port_str);
+	ret = append_json_block_brackets(name, output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
 
-		tmp_buff = spp_strbuf_append(tmp_buff, append_str,
-				strlen(append_str));
-		if (unlikely(tmp_buff == NULL))
+/* append a block of port numbers for JSON format */
+static int
+append_port_block(char **output, const struct spp_port_index *port,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	char port_str[CMD_TAG_APPEND_SIZE];
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = port_block)\n");
+		return -1;
+	}
+
+	spp_format_port_string(port_str, port->iface_type, port->iface_no);
+	ret = append_json_str_value("port", &tmp_buff, port_str);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_vlan_block("vlan", &tmp_buff,
+			spp_get_dpdk_port(port->iface_type, port->iface_no),
+			rxtx);
+	if (unlikely(ret < 0))
+		return -1;
+
+	ret = append_json_block_brackets("", output, tmp_buff);
+	spp_strbuf_free(tmp_buff);
+	return ret;
+}
+
+/* append a list of port numbers for JSON format */
+static int
+append_port_array(const char *name, char **output, const int num,
+		const struct spp_port_index *ports,
+		const enum spp_port_rxtx rxtx)
+{
+	int ret = -1;
+	int i = 0;
+	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
+	if (unlikely(tmp_buff == NULL)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC,
+				"allocate error. (name = %s)\n",
+				name);
+		return -1;
+	}
+
+	for (i = 0; i < num; i++) {
+		ret = append_port_block(&tmp_buff, &ports[i], rxtx);
+		if (unlikely(ret < 0))
 			return -1;
 	}
 
@@ -529,13 +638,13 @@ append_core_element_value(
 		return ret;
 
 	if (unuse_flg) {
-		ret = apeend_port_array("rx_port", &tmp_buff,
-				num_rx, rx_ports);
+		ret = append_port_array("rx_port", &tmp_buff,
+				num_rx, rx_ports, SPP_PORT_RXTX_RX);
 		if (unlikely(ret < 0))
 			return ret;
 
-		ret = apeend_port_array("tx_port", &tmp_buff,
-				num_tx, tx_ports);
+		ret = append_port_array("tx_port", &tmp_buff,
+				num_tx, tx_ports, SPP_PORT_RXTX_TX);
 		if (unlikely(ret < 0))
 			return ret;
 	}
diff --git a/src/vf/spp_forward.c b/src/vf/spp_forward.c
index 1ada73e..bad965e 100644
--- a/src/vf/spp_forward.c
+++ b/src/vf/spp_forward.c
@@ -35,7 +35,7 @@
 #include <rte_cycles.h>
 
 #include "spp_vf.h"
-#include "ringlatencystats.h"
+#include "spp_port.h"
 #include "spp_forward.h"
 
 #define RTE_LOGTYPE_FORWARD RTE_LOGTYPE_USER1
@@ -151,8 +151,12 @@ static inline void
 change_forward_index(int id)
 {
 	struct forward_info *info = &g_forward_info[id];
-	if (info->ref_index == info->upd_index)
+	if (info->ref_index == info->upd_index) {
+		/* Change reference index of port ability. */
+		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
+
 		info->ref_index = (info->upd_index+1)%SPP_INFO_AREA_MAX;
+	}
 }
 /**
  * Forwarding packets as forwarder or merger
@@ -181,23 +185,13 @@ spp_forward(int id)
 		tx = &path->ports[cnt].tx;
 
 		/* Receive packets */
-		nb_rx = rte_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
+		nb_rx = spp_eth_rx_burst(rx->dpdk_port, 0, bufs, MAX_PKT_BURST);
 		if (unlikely(nb_rx == 0))
 			continue;
 
-#ifdef SPP_RINGLATENCYSTATS_ENABLE
-		if (rx->iface_type == RING)
-			spp_ringlatencystats_calculate_latency(rx->iface_no,
-					bufs, nb_rx);
-
-		if (tx->iface_type == RING)
-			spp_ringlatencystats_add_time_stamp(tx->iface_no,
-					bufs, nb_rx);
-#endif /* SPP_RINGLATENCYSTATS_ENABLE */
-
 		/* Send packets */
 		if (tx->dpdk_port >= 0)
-			nb_tx = rte_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
+			nb_tx = spp_eth_tx_burst(tx->dpdk_port, 0, bufs, nb_rx);
 
 		/* Discard remained packets to release mbuf */
 		if (unlikely(nb_tx < nb_rx)) {
diff --git a/src/vf/spp_port.c b/src/vf/spp_port.c
new file mode 100644
index 0000000..3c6a87c
--- /dev/null
+++ b/src/vf/spp_port.c
@@ -0,0 +1,436 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_ether.h>
+#include <rte_ip.h>
+#include <rte_udp.h>
+#include <rte_tcp.h>
+#include <rte_net_crc.h>
+
+#include "spp_vf.h"
+#include "spp_port.h"
+#include "ringlatencystats.h"
+
+/* Port ability management information */
+struct port_ability_mng_info {
+	volatile int ref_index; /* Index to reference area */
+	volatile int upd_index; /* Index to update area    */
+	struct spp_port_ability ability[SPP_INFO_AREA_MAX]
+				[SPP_PORT_ABILITY_MAX];
+				/* Port ability information */
+};
+
+/* Port ability port information */
+struct port_ability_port_mng_info {
+	/* Interface type (phy/vhost/ring) */
+	enum port_type iface_type;
+
+	/* Interface number */
+	int            iface_no;
+
+	/* Management data of port ability for receiving */
+	struct port_ability_mng_info rx;
+
+	/* Management data of port ability for sending */
+	struct port_ability_mng_info tx;
+};
+
+/* Information for VLAN tag management. */
+struct port_ability_port_mng_info g_port_mng_info[RTE_MAX_ETHPORTS];
+
+/* TPID of VLAN. */
+static uint16_t g_vlan_tpid;
+
+/* Initialize port ability. */
+void
+spp_port_ability_init(void)
+{
+	int cnt = 0;
+	g_vlan_tpid = rte_cpu_to_be_16(ETHER_TYPE_VLAN);
+	memset(g_port_mng_info, 0x00, sizeof(g_port_mng_info));
+	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
+		g_port_mng_info[cnt].rx.ref_index = 0;
+		g_port_mng_info[cnt].rx.upd_index = 1;
+		g_port_mng_info[cnt].tx.ref_index = 0;
+		g_port_mng_info[cnt].tx.upd_index = 1;
+	}
+}
+
+/* Get information of port ability. */
+inline void
+spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info)
+{
+	struct port_ability_mng_info *mng = NULL;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &g_port_mng_info[port_id].rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &g_port_mng_info[port_id].tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+	*info = mng->ability[mng->ref_index];
+}
+
+/* Calculation and Setting of FCS. */
+static inline void
+set_fcs_packet(struct rte_mbuf *pkt)
+{
+	uint32_t *fcs = NULL;
+	fcs = rte_pktmbuf_mtod_offset(pkt, uint32_t *, pkt->data_len);
+	*fcs = rte_net_crc_calc(rte_pktmbuf_mtod(pkt, void *),
+			pkt->data_len, RTE_NET_CRC32_ETH);
+}
+
+/* Add VLAN tag to packet. */
+static inline int
+add_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data)
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	struct vlan_hdr  *vlan      = NULL;
+	const struct spp_vlantag_info *vlantag = &data->vlantag;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets with VLAN tags, only VLAN ID is updated */
+		new_ether = old_ether;
+		vlan = (struct vlan_hdr *)&new_ether[1];
+	} else {
+		/* For packets without VLAN tag, add VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_prepend(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to get additional header area.\n");
+			return -1;
+		}
+
+		rte_memcpy(new_ether, old_ether, sizeof(struct ether_hdr));
+		vlan = (struct vlan_hdr *)&new_ether[1];
+		vlan->eth_proto = new_ether->ether_type;
+		new_ether->ether_type = g_vlan_tpid;
+	}
+
+	vlan->vlan_tci = vlantag->tci;
+	set_fcs_packet(pkt);
+	return 0;
+}
+
+/* Add VLAN tag to all packets. */
+static inline int
+add_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = add_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to add VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Delete VLAN tag to packet. */
+static inline int
+del_vlantag_packet(
+		struct rte_mbuf *pkt,
+		const union spp_ability_data *data __attribute__ ((unused)))
+{
+	struct ether_hdr *old_ether = NULL;
+	struct ether_hdr *new_ether = NULL;
+	uint32_t *old, *new;
+
+	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (old_ether->ether_type == g_vlan_tpid) {
+		/* For packets without VLAN tag, delete VLAN tag. */
+		new_ether = (struct ether_hdr *)rte_pktmbuf_adj(pkt,
+				sizeof(struct vlan_hdr));
+		if (unlikely(new_ether == NULL)) {
+			RTE_LOG(ERR, PORT, "Failed to delete unnecessary header area.\n");
+			return -1;
+		}
+
+		old = (uint32_t *)old_ether;
+		new = (uint32_t *)new_ether;
+		new[2] = old[2];
+		new[1] = old[1];
+		new[0] = old[0];
+		old[0] = 0;
+		set_fcs_packet(pkt);
+	}
+	return 0;
+}
+
+/* Delete VLAN tag to all packets. */
+static inline int
+del_vlantag_all_packets(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data)
+{
+	int ret = 0;
+	int cnt = 0;
+	for (cnt = 0; cnt < nb_pkts; cnt++) {
+		ret = del_vlantag_packet(pkts[cnt], data);
+		if (unlikely(ret < 0)) {
+			RTE_LOG(ERR, PORT,
+					"Failed to del VLAN tag.(pkts %d/%d)\n",
+					cnt, nb_pkts);
+			break;
+		}
+	}
+	return cnt;
+}
+
+/* Change index of management information. */
+void
+spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx)
+{
+	int cnt;
+	static int num_rx;
+	static int rx_list[RTE_MAX_ETHPORTS];
+	static int num_tx;
+	static int tx_list[RTE_MAX_ETHPORTS];
+	struct port_ability_mng_info *mng = NULL;
+
+	if (type == PORT_ABILITY_CHG_INDEX_UPD) {
+		switch (rxtx) {
+		case SPP_PORT_RXTX_RX:
+			mng = &g_port_mng_info[port_id].rx;
+			mng->upd_index = mng->ref_index;
+			rx_list[num_rx++] = port_id;
+			break;
+		case SPP_PORT_RXTX_TX:
+			mng = &g_port_mng_info[port_id].tx;
+			mng->upd_index = mng->ref_index;
+			tx_list[num_tx++] = port_id;
+			break;
+		default:
+			/* Not used. */
+			break;
+		}
+		return;
+	}
+
+	for (cnt = 0; cnt < num_rx; cnt++) {
+		mng = &g_port_mng_info[rx_list[cnt]].rx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		rx_list[cnt] = 0;
+	}
+	for (cnt = 0; cnt < num_tx; cnt++) {
+		mng = &g_port_mng_info[tx_list[cnt]].tx;
+		mng->ref_index = (mng->upd_index+1)%SPP_INFO_AREA_MAX;
+		tx_list[cnt] = 0;
+	}
+
+	num_rx = 0;
+	num_tx = 0;
+}
+
+/* Set ability data of port ability. */
+static void
+port_ability_set_ability(
+		struct spp_port_info *port,
+		enum spp_port_rxtx rxtx)
+{
+	int in_cnt, out_cnt = 0;
+	int port_id = port->dpdk_port;
+	struct port_ability_port_mng_info *port_mng = &g_port_mng_info[port_id];
+	struct port_ability_mng_info *mng         = NULL;
+	struct spp_port_ability      *in_ability  = port->ability;
+	struct spp_port_ability      *out_ability = NULL;
+	struct spp_vlantag_info      *tag         = NULL;
+
+	port_mng->iface_type = port->iface_type;
+	port_mng->iface_no   = port->iface_no;
+
+	switch (rxtx) {
+	case SPP_PORT_RXTX_RX:
+		mng = &port_mng->rx;
+		break;
+	case SPP_PORT_RXTX_TX:
+		mng = &port_mng->tx;
+		break;
+	default:
+		/* Not used. */
+		break;
+	}
+
+	out_ability = mng->ability[mng->upd_index];
+	memset(out_ability, 0x00, sizeof(struct spp_port_ability)
+			* SPP_PORT_ABILITY_MAX);
+	for (in_cnt = 0; in_cnt < SPP_PORT_ABILITY_MAX; in_cnt++) {
+		if (in_ability[in_cnt].rxtx != rxtx)
+			continue;
+
+		memcpy(&out_ability[out_cnt], &in_ability[in_cnt],
+				sizeof(struct spp_port_ability));
+
+		switch (out_ability[out_cnt].ope) {
+		case SPP_PORT_ABILITY_OPE_ADD_VLANTAG:
+			tag = &out_ability[out_cnt].data.vlantag;
+			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
+					tag->vid, tag->pcp));
+			break;
+		case SPP_PORT_ABILITY_OPE_DEL_VLANTAG:
+		default:
+			/* Nothing to do. */
+			break;
+		}
+
+		out_cnt++;
+	}
+
+	spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_UPD,
+			port_id, rxtx);
+}
+
+/* Update port capability. */
+void
+spp_port_ability_update(const struct spp_component_info *component)
+{
+	int cnt;
+	struct spp_port_info *port = NULL;
+	for (cnt = 0; cnt < component->num_rx_port; cnt++) {
+		port = component->rx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_RX);
+	}
+
+	for (cnt = 0; cnt < component->num_tx_port; cnt++) {
+		port = component->tx_ports[cnt];
+		port_ability_set_ability(port, SPP_PORT_RXTX_TX);
+	}
+}
+
+/* Definition of functions that operate port abilities. */
+typedef int (*port_ability_func)(
+		struct rte_mbuf **pkts, int nb_pkts,
+		const union spp_ability_data *data);
+
+/* List of functions per port ability. */
+port_ability_func port_ability_function_list[] = {
+	NULL,                    /* None */
+	add_vlantag_all_packets, /* Add VLAN tag */
+	del_vlantag_all_packets, /* Del VLAN tag */
+	NULL                     /* Termination */
+};
+
+/* Each packet operation of port capability. */
+static inline int
+port_ability_each_operation(uint16_t port_id,
+		struct rte_mbuf **pkts, const uint16_t nb_pkts,
+		enum spp_port_rxtx rxtx)
+{
+	int cnt, buf;
+	int ok_pkts = nb_pkts;
+	struct spp_port_ability *info = NULL;
+
+	spp_port_ability_get_info(port_id, rxtx, &info);
+	if (unlikely(info[0].ope == SPP_PORT_ABILITY_OPE_NONE))
+		return nb_pkts;
+
+	for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+		if (info[cnt].ope == SPP_PORT_ABILITY_OPE_NONE)
+			break;
+
+		ok_pkts = port_ability_function_list[info[cnt].ope](
+				pkts, ok_pkts, &info->data);
+	}
+
+	/* Discard remained packets to release mbuf. */
+	if (unlikely(ok_pkts < nb_pkts)) {
+		for (buf = ok_pkts; buf < nb_pkts; buf++)
+			rte_pktmbuf_free(pkts[buf]);
+	}
+
+	return ok_pkts;
+}
+
+/* Wrapper function for rte_eth_rx_burst(). */
+inline uint16_t
+spp_eth_rx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
+{
+	uint16_t nb_rx = 0;
+	nb_rx = rte_eth_rx_burst(port_id, 0, rx_pkts, nb_pkts);
+	if (unlikely(nb_rx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_calculate_latency(
+				g_port_mng_info[port_id].iface_no,
+				rx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return port_ability_each_operation(port_id, rx_pkts, nb_rx,
+			SPP_PORT_RXTX_RX);
+}
+
+/* Wrapper function for rte_eth_tx_burst(). */
+inline uint16_t
+spp_eth_tx_burst(
+		uint16_t port_id, uint16_t queue_id  __attribute__ ((unused)),
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	nb_tx = port_ability_each_operation(port_id, tx_pkts, nb_pkts,
+			SPP_PORT_RXTX_TX);
+	if (unlikely(nb_tx == 0))
+		return 0;
+
+#ifdef SPP_RINGLATENCYSTATS_ENABLE
+	if (g_port_mng_info[port_id].iface_type == RING)
+		spp_ringlatencystats_add_time_stamp(
+				g_port_mng_info[port_id].iface_no,
+				tx_pkts, nb_pkts);
+#endif /* SPP_RINGLATENCYSTATS_ENABLE */
+
+	return rte_eth_tx_burst(port_id, 0, tx_pkts, nb_tx);
+}
diff --git a/src/vf/spp_port.h b/src/vf/spp_port.h
new file mode 100644
index 0000000..85ba5f3
--- /dev/null
+++ b/src/vf/spp_port.h
@@ -0,0 +1,141 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __SPP_PORT_H__
+#define __SPP_PORT_H__
+
+/**
+ * @file
+ * SPP Port ability
+ *
+ * Provide about the ability per port.
+ */
+
+#include "spp_vf.h"
+
+/** Calculate TCI of VLAN tag. */
+#define SPP_VLANTAG_CALC_TCI(id, pcp) (((pcp & 0x07) << 13) | (id & 0x0fff))
+
+/** Type for changing index. */
+enum port_ability_chg_index_type {
+	/** Type for changing index to reference area. */
+	PORT_ABILITY_CHG_INDEX_REF,
+
+	/** Type for changing index to update area. */
+	PORT_ABILITY_CHG_INDEX_UPD,
+};
+
+/** Initialize port ability. */
+void spp_port_ability_init(void);
+
+/**
+ * Get information of port ability.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param info
+ *  Port ability information.
+ */
+void spp_port_ability_get_info(
+		int port_id, enum spp_port_rxtx rxtx,
+		struct spp_port_ability **info);
+
+/**
+ * Change index of management information.
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param rxtx
+ *  rx/tx identifier of port_id.
+ * @param type
+ *  Type for changing index.
+ */
+void spp_port_ability_change_index(
+		enum port_ability_chg_index_type type,
+		int port_id, enum spp_port_rxtx rxtx);
+
+/**
+ * Update port capability.
+ *
+ * @param component_info
+ *  The pointer to struct spp_component_info.@n
+ *  The data for updating the internal data of port ability.
+ */
+void spp_port_ability_update(const struct spp_component_info *component);
+
+/**
+ * Wrapper function for rte_eth_rx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the receive queue from which to retrieve input packets.
+ *  SPP is fixed at 0.
+ * @param rx_pkts
+ *  The address of an array of pointers to *rte_mbuf* structures that
+ *  must be large enough to store *nb_pkts* pointers in it.
+ * @param nb_pkts
+ *  The maximum number of packets to retrieve.
+ *
+ * @return
+ *  The number of packets actually retrieved, which is the number
+ *  of pointers to *rte_mbuf* structures effectively supplied to the
+ *  *rx_pkts* array.
+ */
+uint16_t spp_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **rx_pkts, const uint16_t nb_pkts);
+
+/**
+ * Wrapper function for rte_eth_tx_burst().
+ *
+ * @param port_id
+ *  The port identifier of the Ethernet device.
+ * @param queue_id
+ *  The index of the transmit queue through which output packets must be sent.
+ *  SPP is fixed at 0.
+ * @param tx_pkts
+ *  The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
+ *  which contain the output packets.
+ * @param nb_pkts
+ *  The maximum number of packets to transmit.
+ *
+ * @return
+ *  The number of output packets actually stored in transmit descriptors of
+ *  the transmit ring. The return value can be less than the value of the
+ *  *tx_pkts* parameter when the transmit ring is full or has been filled up.
+ */
+uint16_t spp_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
+		struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
+
+#endif /*  __SPP_PORT_H__ */
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 6d69e3d..4463d41 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -46,6 +46,7 @@
 #include "classifier_mac.h"
 #include "spp_forward.h"
 #include "command_proc.h"
+#include "spp_port.h"
 
 /* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
@@ -999,6 +1000,7 @@ main(int argc, char *argv[])
 			break;
 
 		spp_forward_init();
+		spp_port_ability_init();
 
 		/* Setup connection for accepting commands from controller */
 		int ret_command_init = spp_command_proc_init(
@@ -1438,12 +1440,14 @@ int
 spp_update_port(enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name)
+		const char *name,
+		const struct spp_port_ability *ability)
 {
 	int ret = SPP_RET_NG;
 	int ret_check = -1;
 	int ret_del = -1;
 	int component_id = 0;
+	int cnt = 0;
 	struct spp_component_info *component = NULL;
 	struct spp_port_info *port_info = NULL;
 	int *num = NULL;
@@ -1477,6 +1481,20 @@ spp_update_port(enum spp_command_action action,
 			break;
 		}
 
+		if (ability->ope != SPP_PORT_ABILITY_OPE_NONE) {
+			while ((cnt < SPP_PORT_ABILITY_MAX) &&
+					(port_info->ability[cnt].ope !=
+					SPP_PORT_ABILITY_OPE_NONE)) {
+				cnt++;
+			}
+			if (cnt >= SPP_PORT_ABILITY_MAX) {
+				RTE_LOG(ERR, APP, "No space of port ability.\n");
+				return SPP_RET_NG;
+			}
+			memcpy(&port_info->ability[cnt], ability,
+					sizeof(struct spp_port_ability));
+		}
+
 		port_info->iface_type = port->iface_type;
 		ports[*num] = port_info;
 		(*num)++;
@@ -1485,9 +1503,20 @@ spp_update_port(enum spp_command_action action,
 		break;
 
 	case SPP_CMD_ACTION_DEL:
+		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+			if (port_info->ability[cnt].ope ==
+					SPP_PORT_ABILITY_OPE_NONE)
+				continue;
+
+			if (port_info->ability[cnt].rxtx == rxtx)
+				memset(&port_info->ability[cnt], 0x00,
+					sizeof(struct spp_port_ability));
+		}
+
 		ret_del = get_del_port_element(port_info, *num, ports);
 		if (ret_del == 0)
 			(*num)--; /* If deleted, decrement number. */
+
 		ret = SPP_RET_OK;
 		break;
 	default:
@@ -1573,6 +1602,8 @@ flush_component(void)
 			continue;
 
 		component_info = &g_component_info[cnt];
+		spp_port_ability_update(component_info);
+
 		if (component_info->type == SPP_COMPONENT_CLASSIFIER_MAC)
 			ret = spp_classifier_mac_update(component_info);
 		else
@@ -1683,6 +1714,22 @@ spp_iterate_classifier_table(
 	return SPP_RET_OK;
 }
 
+/* Get the port number of DPDK. */
+int
+spp_get_dpdk_port(enum port_type iface_type, int iface_no)
+{
+	switch (iface_type) {
+	case PHY:
+		return g_iface_info.nic[iface_no].dpdk_port;
+	case RING:
+		return g_iface_info.ring[iface_no].dpdk_port;
+	case VHOST:
+		return g_iface_info.vhost[iface_no].dpdk_port;
+	default:
+		return -1;
+	}
+}
+
 /**
  * Separate port id of combination of iface type and number and
  * assign to given argument, iface_type and iface_no.
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index 10742bc..e51cd1a 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -82,6 +82,15 @@
 /** Value for default MAC address of classifier */
 #define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
 
+/** Maximum number of port abilities available */
+#define SPP_PORT_ABILITY_MAX 4
+
+/** Maximum VLAN ID */
+#define SPP_VLAN_VID_MAX 4096
+
+/** Maximum VLAN PCP */
+#define SPP_VLAN_PCP_MAX 7
+
 /**
  * State on component
  */
@@ -137,6 +146,13 @@ enum spp_command_action {
 	SPP_CMD_ACTION_DEL,   /**< delete */
 };
 
+/** Port ability operation */
+enum spp_port_ability_ope {
+	SPP_PORT_ABILITY_OPE_NONE,        /**< none */
+	SPP_PORT_ABILITY_OPE_ADD_VLANTAG, /**< add VLAN tag */
+	SPP_PORT_ABILITY_OPE_DEL_VLANTAG, /**< delete VLAN tag */
+};
+
 /**
  * Interface information structure
  */
@@ -145,6 +161,26 @@ struct spp_port_index {
 	int             iface_no;   /**< Interface number */
 };
 
+/** VLAN tag information */
+struct spp_vlantag_info {
+	int vid; /**< VLAN ID */
+	int pcp; /**< Priority Code Point */
+	int tci; /**< Tag Control Information */
+};
+
+/** Data for each port ability */
+union spp_ability_data {
+	/** VLAN tag information */
+	struct spp_vlantag_info vlantag;
+};
+
+/** Port ability information */
+struct spp_port_ability {
+	enum spp_port_ability_ope ope; /**< Operation */
+	enum spp_port_rxtx rxtx;       /**< rx/tx identifier */
+	union spp_ability_data data;   /**< Port ability data */
+};
+
 /**
  * Port info
  */
@@ -154,6 +190,8 @@ struct spp_port_info {
 	int            dpdk_port;  /**< DPDK port number */
 	uint64_t       mac_addr;   /**< Mac address for classifying */
 	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
+					/**< Port ability */
 };
 
 /**
@@ -239,7 +277,8 @@ int spp_update_port(
 		enum spp_command_action action,
 		const struct spp_port_index *port,
 		enum spp_port_rxtx rxtx,
-		const char *name);
+		const char *name,
+		const struct spp_port_ability *ability);
 
 /**
  * Flush SPP component
@@ -254,8 +293,8 @@ int spp_flush(void);
  */
 void spp_cancel(void);
 
-/** definition of iterated core element procedure function */
 struct spp_iterate_core_params;
+/** definition of iterated core element procedure function */
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
 		const unsigned int lcore_id,
@@ -287,8 +326,8 @@ struct spp_iterate_core_params {
  */
 int spp_iterate_core_info(struct spp_iterate_core_params *params);
 
-/** definition of iterated classifier element procedure function */
 struct spp_iterate_classifier_table_params;
+/** definition of iterated classifier element procedure function */
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
@@ -455,6 +494,19 @@ int spp_check_used_port(
 int64_t spp_change_mac_str_to_int64(const char *mac);
 
 /**
+ * Get the port number of DPDK.
+ *
+ * @param iface_type
+ *  Interface type obtained from port.
+ * @param iface_no
+ *  Interface number obtained from port.
+ *
+ * @return
+ *  Port id generated by DPDK.
+ */
+int spp_get_dpdk_port(enum port_type iface_type, int iface_no);
+
+/**
  * Extract if-type/if-number from port string
  *
  * @param port
-- 
2.7.4

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

* [spp] [PATCH v2 6/9] spp_vf: refactor struct and variable names
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (3 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 5/9] spp_vf: add VLAN tag operate function to port ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 7/9] spp_vf: add VID classification to the classifier ogawa.yasufumi
                     ` (3 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp
  Cc: Hiroyuki Nakamura, Daiki Yamashita, Naoki Takada

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

Change abbreviation of struct name, variable name and function name
in classifier_mac.c.

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 314 +++++++++++++++++++++++-------------------------
 1 file changed, 152 insertions(+), 162 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 57262a9..1719889 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -116,8 +116,8 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier information */
-struct classifier_mac_info {
+/* classifier component information */
+struct component_info {
 	/* component name */
 	char name[SPP_NAME_STR_LEN];
 
@@ -144,9 +144,9 @@ struct classifier_mac_info {
 };
 
 /* classifier management information */
-struct classifier_mac_mng_info {
+struct management_info {
 	/* classifier information */
-	struct classifier_mac_info info[NUM_CLASSIFIER_MAC_INFO];
+	struct component_info cmp_infos[NUM_CLASSIFIER_MAC_INFO];
 
 	/* Reference index number for classifier information */
 	volatile int ref_index;
@@ -156,7 +156,7 @@ struct classifier_mac_mng_info {
 };
 
 /* classifier information per lcore */
-static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
+static struct management_info g_mng_infos[RTE_MAX_LCORE];
 
 /**
  * Hash table count used for making a name of hash table
@@ -167,69 +167,70 @@ static struct classifier_mac_mng_info g_classifier_mng_info[RTE_MAX_LCORE];
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
 static inline int
-is_used_mng_info(const struct classifier_mac_mng_info *mng_info)
+is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL && mng_info->info[0].classifier_table != NULL);
+	return (mng_info != NULL &&
+			mng_info->cmp_infos[0].classifier_table != NULL);
 }
 
 /* initialize classifier information. */
 static int
-init_classifier_info(struct classifier_mac_info *classifier_info,
+init_component_info(struct component_info *cmp_info,
 		const struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &classifier_info->classifier_table;
+	struct rte_hash **classifier_table = &cmp_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 *clsd_data_rx =
+			&cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx =
+			cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
 
 	rte_hash_reset(*classifier_table);
-	classifier_info->num_active_classified = 0;
-	classifier_info->default_classified = -1;
-	classifier_info->n_classified_data_tx = component_info->num_tx_port;
+	cmp_info->num_active_classified = 0;
+	cmp_info->default_classified = -1;
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	if (component_info->num_rx_port == 0) {
-		classified_data_rx->iface_type      = UNDEF;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global = 0;
-		classified_data_rx->port         = 0;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->iface_type      = UNDEF;
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global = 0;
+		clsd_data_rx->port            = 0;
+		clsd_data_rx->num_pkt         = 0;
 	} else {
-		classified_data_rx->iface_type      =
+		clsd_data_rx->iface_type      =
 				component_info->rx_ports[0]->iface_type;
-		classified_data_rx->iface_no        = 0;
-		classified_data_rx->iface_no_global =
+		clsd_data_rx->iface_no        = 0;
+		clsd_data_rx->iface_no_global =
 				component_info->rx_ports[0]->iface_no;
-		classified_data_rx->port         =
+		clsd_data_rx->port            =
 				component_info->rx_ports[0]->dpdk_port;
-		classified_data_rx->num_pkt      = 0;
+		clsd_data_rx->num_pkt         = 0;
 	}
 
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
 
 		/* store ports information */
-		classified_data_tx[i].iface_type      = tx_port->iface_type;
-		classified_data_tx[i].iface_no        = i;
-		classified_data_tx[i].iface_no_global = tx_port->iface_no;
-		classified_data_tx[i].port         = tx_port->dpdk_port;
-		classified_data_tx[i].num_pkt      = 0;
+		clsd_data_tx[i].iface_type      = tx_port->iface_type;
+		clsd_data_tx[i].iface_no        = i;
+		clsd_data_tx[i].iface_no_global = tx_port->iface_no;
+		clsd_data_tx[i].port            = tx_port->dpdk_port;
+		clsd_data_tx[i].num_pkt         = 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->
+		cmp_info->active_classifieds[cmp_info->
 				num_active_classified++] = i;
 
 		/* store default classified */
 		if (unlikely(tx_port->mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			classifier_info->default_classified = i;
+			cmp_info->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
 					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
 					tx_port->iface_type,
@@ -268,7 +269,7 @@ init_classifier_info(struct classifier_mac_info *classifier_info,
 
 /* initialize classifier. */
 static int
-init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
 	int i;
@@ -277,15 +278,15 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
-	memset(classifier_mng_info, 0, sizeof(struct classifier_mac_mng_info));
+	memset(mng_info, 0, sizeof(struct management_info));
 	/*
 	 * Set the same value for "ref_index" and "upd_index"
 	 * so that it will not be changed from others during initialization,
 	 * and update "upd_index" after initialization is completed.
 	 * Therefore, this setting is consciously described.
 	 */
-	classifier_mng_info->ref_index = 0;
-	classifier_mng_info->upd_index = 0;
+	mng_info->ref_index = 0;
+	mng_info->upd_index = 0;
 	memset(&component_info, 0x00, sizeof(component_info));
 
 #ifdef RTE_MACHINE_CPUFLAG_SSE4_2
@@ -297,7 +298,7 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
 
 		classifier_mac_table =
-				&classifier_mng_info->info[i].classifier_table;
+				&mng_info->cmp_infos[i].classifier_table;
 
 		/* make hash table name(require uniqueness between processes) */
 		sprintf(hash_table_name, "cmtab_%07x%02hx%x",
@@ -328,8 +329,8 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* populate the classifier information at reference */
-	ret = init_classifier_info(&classifier_mng_info->
-			info[classifier_mng_info->ref_index], &component_info);
+	ret = init_component_info(&mng_info->
+			cmp_infos[mng_info->ref_index], &component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot initialize classifier mac table. ret=%d\n",
@@ -338,113 +339,112 @@ init_classifier(struct classifier_mac_mng_info *classifier_mng_info)
 	}
 
 	/* updating side can be set by completion of initialization. */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index + 1;
+	mng_info->upd_index = mng_info->ref_index + 1;
 
 	return 0;
 }
 
 /* uninitialize classifier. */
 static void
-uninit_classifier(struct classifier_mac_mng_info *classifier_mng_info)
+uninit_classifier(struct management_info *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].
+		if (mng_info->cmp_infos[i].classifier_table != NULL) {
+			rte_hash_free(mng_info->cmp_infos[i].
 					classifier_table);
-			classifier_mng_info->info[i].classifier_table = NULL;
-			classifier_mng_info->ref_index = 0;
-			classifier_mng_info->upd_index = 0;
+			mng_info->cmp_infos[i].classifier_table = NULL;
+			mng_info->ref_index = 0;
+			mng_info->upd_index = 0;
 		}
 	}
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_packet(struct classified_data *classified_data)
+transmit_packet(struct classified_data *clsd_data)
 {
 	int i;
 	uint16_t n_tx;
 
 	/* transmit packets */
-	n_tx = spp_eth_tx_burst(classified_data->port, 0,
-			classified_data->pkts, classified_data->num_pkt);
+	n_tx = spp_eth_tx_burst(clsd_data->port, 0,
+			clsd_data->pkts, clsd_data->num_pkt);
 
 	/* 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]);
+	if (unlikely(n_tx != clsd_data->num_pkt)) {
+		for (i = n_tx; i < clsd_data->num_pkt; i++)
+			rte_pktmbuf_free(clsd_data->pkts[i]);
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"drop packets(tx). num=%hu, dpdk_port=%hu\n",
-				(uint16_t)(classified_data->num_pkt - n_tx),
-				classified_data->port);
+				(uint16_t)(clsd_data->num_pkt - n_tx),
+				clsd_data->port);
 	}
 
-	classified_data->num_pkt = 0;
+	clsd_data->num_pkt = 0;
 }
 
 /* transmit packet to one destination. */
 static inline void
-transmit_all_packet(struct classifier_mac_info *classifier_info)
+transmit_all_packet(struct component_info *cmp_info)
 {
 	int i;
-	struct classified_data *classified_data_tx =
-				classifier_info->classified_data_tx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 
-	for (i = 0; i < classifier_info->n_classified_data_tx; i++) {
-		if (unlikely(classified_data_tx[i].num_pkt != 0)) {
+	for (i = 0; i < cmp_info->n_classified_data_tx; i++) {
+		if (unlikely(clsd_data_tx[i].num_pkt != 0)) {
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 					"transmit all packets (drain). "
 					"index=%d, "
 					"num_pkt=%hu\n",
 					i,
-					classified_data_tx[i].num_pkt);
-			transmit_packet(&classified_data_tx[i]);
+					clsd_data_tx[i].num_pkt);
+			transmit_packet(&clsd_data_tx[i]);
 		}
 	}
 }
 
 /* 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)
+push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 {
-	classified_data->pkts[classified_data->num_pkt++] = pkt;
+	clsd_data->pkts[clsd_data->num_pkt++] = pkt;
 
 	/* transmit packet, if buffer is filled */
-	if (unlikely(classified_data->num_pkt == MAX_PKT_BURST)) {
+	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
 				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
-				classified_data->iface_type,
-				classified_data->iface_no_global,
-				classified_data->iface_no,
-				classified_data->port,
-				classified_data->num_pkt);
-		transmit_packet(classified_data);
+				clsd_data->iface_type,
+				clsd_data->iface_no_global,
+				clsd_data->iface_no,
+				clsd_data->port,
+				clsd_data->num_pkt);
+		transmit_packet(clsd_data);
 	}
 }
 
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int i;
 
-	if (unlikely(classifier_info->num_active_classified == 0)) {
+	if (unlikely(cmp_info->num_active_classified == 0)) {
 		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));
+			(cmp_info->num_active_classified - 1));
 
-	for (i = 0; i < classifier_info->num_active_classified; i++) {
-		push_packet(pkt, classified_data +
-				(long)classifier_info->active_classifieds[i]);
+	for (i = 0; i < cmp_info->num_active_classified; i++) {
+		push_packet(pkt, clsd_data +
+				(long)cmp_info->active_classifieds[i]);
 	}
 }
 
@@ -454,8 +454,8 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
  */
 static inline void
 classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
-		struct classifier_mac_info *classifier_info,
-		struct classified_data *classified_data)
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data)
 {
 	int ret;
 	int i;
@@ -467,7 +467,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
 
 		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(classifier_info->classifier_table,
+		ret = rte_hash_lookup_data(cmp_info->classifier_table,
 				(const void *)&eth->d_addr, &lookup_data);
 		if (ret < 0) {
 			/* L2 multicast(include broadcast) ? */
@@ -475,13 +475,13 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 						"multicast mac address.\n");
 				handle_l2multicast_packet(rx_pkts[i],
-						classifier_info,
-						classified_data);
+						cmp_info,
+						clsd_data);
 				continue;
 			}
 
 			/* if no default, drop packet */
-			if (unlikely(classifier_info->default_classified ==
+			if (unlikely(cmp_info->default_classified ==
 					-1)) {
 				ether_format_addr(mac_addr_str,
 						sizeof(mac_addr_str),
@@ -497,7 +497,7 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 			/* to default classified */
 			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 					"to default classified.\n");
-			lookup_data = (void *)(long)classifier_info->
+			lookup_data = (void *)(long)cmp_info->
 					default_classified;
 		}
 
@@ -505,27 +505,27 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		 * set mbuf pointer to tx buffer
 		 * and transmit packet, if buffer is filled
 		 */
-		push_packet(rx_pkts[i], classified_data + (long)lookup_data);
+		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
 /* change update index at classifier management information */
 static inline void
-change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
+change_update_index(struct management_info *mng_info, int id)
 {
-	if (unlikely(classifier_mng_info->ref_index ==
-			classifier_mng_info->upd_index)) {
+	if (unlikely(mng_info->ref_index ==
+			mng_info->upd_index)) {
 		/* Change reference index of port ability. */
 		spp_port_ability_change_index(PORT_ABILITY_CHG_INDEX_REF, 0, 0);
 
 		/* Transmit all packets for switching the using data. */
-		transmit_all_packet(classifier_mng_info->info +
-				classifier_mng_info->ref_index);
+		transmit_all_packet(mng_info->cmp_infos +
+				mng_info->ref_index);
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"Core[%u] Change update index.\n", id);
-		classifier_mng_info->ref_index =
-				(classifier_mng_info->upd_index + 1) %
+		mng_info->ref_index =
+				(mng_info->upd_index + 1) %
 				NUM_CLASSIFIER_MAC_INFO;
 	}
 }
@@ -534,7 +534,7 @@ change_update_index(struct classifier_mac_mng_info *classifier_mng_info, int id)
 int
 spp_classifier_mac_init(void)
 {
-	memset(g_classifier_mng_info, 0, sizeof(g_classifier_mng_info));
+	memset(g_mng_infos, 0, sizeof(g_mng_infos));
 
 	return 0;
 }
@@ -545,37 +545,34 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 {
 	int ret = -1;
 	int id = component_info->component_id;
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
-	classifier_info = classifier_mng_info->info +
-				classifier_mng_info->upd_index;
+	cmp_info = mng_info->cmp_infos + mng_info->upd_index;
 
 	/* initialize update side classifier information */
-	ret = init_classifier_info(classifier_info, component_info);
+	ret = init_component_info(cmp_info, component_info);
 	if (unlikely(ret != 0)) {
 		RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
 				"Cannot update classifier mac. ret=%d\n", ret);
 		return ret;
 	}
-	memcpy(classifier_info->name, component_info->name, SPP_NAME_STR_LEN);
+	memcpy(cmp_info->name, component_info->name, SPP_NAME_STR_LEN);
 
 	/* change index of reference side */
-	classifier_mng_info->upd_index = classifier_mng_info->ref_index;
+	mng_info->upd_index = 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(mng_info->ref_index ==
+			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
@@ -592,41 +589,38 @@ spp_classifier_mac_do(int id)
 	int i;
 	int n_rx;
 	unsigned int lcore_id = rte_lcore_id();
-	struct classifier_mac_mng_info *classifier_mng_info =
-			g_classifier_mng_info + id;
-
-	struct classifier_mac_info *classifier_info = NULL;
+	struct management_info *mng_info = g_mng_infos + id;
+	struct component_info *cmp_info = NULL;
 	struct rte_mbuf *rx_pkts[MAX_PKT_BURST];
 
-	struct classified_data *classified_data_rx = NULL;
-	struct classified_data *classified_data_tx = NULL;
+	struct classified_data *clsd_data_rx = NULL;
+	struct classified_data *clsd_data_tx = NULL;
 
 	uint64_t cur_tsc, prev_tsc = 0;
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 			US_PER_S * DRAIN_TX_PACKET_INTERVAL;
 
 	/* initialize */
-	ret = init_classifier(classifier_mng_info);
+	ret = init_classifier(mng_info);
 	if (unlikely(ret != 0))
 		return ret;
 
 	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);
+		change_update_index(mng_info, id);
 
 		/* 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;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+		clsd_data_rx = &cmp_info->classified_data_rx;
+		clsd_data_tx = cmp_info->classified_data_tx;
 
 		/* 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;
+			for (i = 0; i < cmp_info->n_classified_data_tx;
 					i++) {
-				if (likely(classified_data_tx[i].num_pkt == 0))
+				if (likely(clsd_data_tx[i].num_pkt == 0))
 					continue;
 
 				RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
@@ -635,32 +629,31 @@ spp_classifier_mac_do(int id)
 						"num_pkt=%hu, "
 						"interval=%lu\n",
 						i,
-						classified_data_tx[i].num_pkt,
+						clsd_data_tx[i].num_pkt,
 						cur_tsc - prev_tsc);
-				transmit_packet(&classified_data_tx[i]);
+				transmit_packet(&clsd_data_tx[i]);
 			}
 			prev_tsc = cur_tsc;
 		}
 
-		if (classified_data_rx->iface_type == UNDEF)
+		if (clsd_data_rx->iface_type == UNDEF)
 			continue;
 
 		/* retrieve packets */
-		n_rx = spp_eth_rx_burst(classified_data_rx->port, 0,
+		n_rx = spp_eth_rx_burst(clsd_data_rx->port, 0,
 				rx_pkts, MAX_PKT_BURST);
 		if (unlikely(n_rx == 0))
 			continue;
 
 		/* classify and transmit (filled) */
-		classify_packet(rx_pkts, n_rx, classifier_info,
-				classified_data_tx);
+		classify_packet(rx_pkts, n_rx, cmp_info, clsd_data_tx);
 	}
 
 	/* just in case */
-	change_update_index(classifier_mng_info, id);
+	change_update_index(mng_info, id);
 
 	/* uninitialize */
-	uninit_classifier(classifier_mng_info);
+	uninit_classifier(mng_info);
 
 	return 0;
 }
@@ -673,45 +666,43 @@ spp_classifier_get_component_status(
 {
 	int ret = -1;
 	int i, num_tx, num_rx = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index rx_ports[RTE_MAX_ETHPORTS];
 	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)) {
+	mng_info = g_mng_infos + id;
+	if (!is_used_mng_info(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_mng_info->ref_index;
-
-	classified_data = classifier_info->classified_data_tx;
+	cmp_info = mng_info->cmp_infos + mng_info->ref_index;
+	clsd_data = cmp_info->classified_data_tx;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (classifier_info->classified_data_rx.iface_type != UNDEF) {
+	if (cmp_info->classified_data_rx.iface_type != UNDEF) {
 		num_rx = 1;
-		rx_ports[0].iface_type = classifier_info->
+		rx_ports[0].iface_type = cmp_info->
 				classified_data_rx.iface_type;
-		rx_ports[0].iface_no   = classifier_info->
+		rx_ports[0].iface_no   = cmp_info->
 				classified_data_rx.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
-	num_tx = classifier_info->n_classified_data_tx;
+	num_tx = cmp_info->n_classified_data_tx;
 	for (i = 0; i < num_tx; i++) {
-		tx_ports[i].iface_type = classified_data[i].iface_type;
-		tx_ports[i].iface_no   = classified_data[i].iface_no_global;
+		tx_ports[i].iface_type = clsd_data[i].iface_type;
+		tx_ports[i].iface_no   = clsd_data[i].iface_no_global;
 	}
 
 	/* Set the information with the function specified by the command. */
 	ret = (*params->element_proc)(
 		params, lcore_id,
-		classifier_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
+		cmp_info->name, SPP_TYPE_CLASSIFIER_MAC_STR,
 		num_rx, rx_ports, num_tx, tx_ports);
 	if (unlikely(ret != 0))
 		return -1;
@@ -728,31 +719,30 @@ spp_classifier_mac_iterate_table(
 	const void *key;
 	void *data;
 	uint32_t next = 0;
-	struct classifier_mac_mng_info *classifier_mng_info;
-	struct classifier_mac_info *classifier_info;
-	struct classified_data *classified_data;
+	struct management_info *mng_info;
+	struct component_info *cmp_info;
+	struct classified_data *clsd_data;
 	struct spp_port_index port;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
-		classifier_mng_info = g_classifier_mng_info + i;
-		if (!is_used_mng_info(classifier_mng_info))
+		mng_info = g_mng_infos + i;
+		if (!is_used_mng_info(mng_info))
 			continue;
 
-		classifier_info = classifier_mng_info->info +
-				classifier_mng_info->ref_index;
+		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
 
-		classified_data = classifier_info->classified_data_tx;
+		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (classifier_info->default_classified >= 0) {
-			port.iface_type = (classified_data +
-					classifier_info->default_classified)->
+		if (cmp_info->default_classified >= 0) {
+			port.iface_type = (clsd_data +
+					cmp_info->default_classified)->
 					iface_type;
-			port.iface_no   = (classified_data +
-					classifier_info->default_classified)->
+			port.iface_no   = (clsd_data +
+					cmp_info->default_classified)->
 					iface_no_global;
 
 			(*params->element_proc)(
@@ -765,7 +755,7 @@ spp_classifier_mac_iterate_table(
 		next = 0;
 		while (1) {
 			ret = rte_hash_iterate(
-					classifier_info->classifier_table,
+					cmp_info->classifier_table,
 					&key, &data, &next);
 
 			if (unlikely(ret < 0))
@@ -774,9 +764,9 @@ spp_classifier_mac_iterate_table(
 			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 					(const struct ether_addr *)key);
 
-			port.iface_type = (classified_data + (long)data)->
+			port.iface_type = (clsd_data + (long)data)->
 					iface_type;
-			port.iface_no   = (classified_data + (long)data)->
+			port.iface_no   = (clsd_data + (long)data)->
 					iface_no_global;
 
 			(*params->element_proc)(
-- 
2.7.4

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

* [spp] [PATCH v2 7/9] spp_vf: add VID classification to the classifier
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (4 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 6/9] spp_vf: refactor struct and variable names ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 8/9] spp_vf: refactor to comply with coding style ogawa.yasufumi
                     ` (2 subsequent siblings)
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp
  Cc: Hiroyuki Nakamura, Daiki Yamashita, Naoki Takada

From: Hiroyuki Nakamura <nakamura.hioryuki@po.ntt-tx.co.jp>

Classifier has a table for virtual MAC address for resolving the
destination MAC address and port incoming packets are sent to.

This patch for adding another type of table to support vlan-tag
(TPID:0x8100). If TPID of an incoming packet equals to 0x8100,
classifier looks up the new table.

Signed-off-by: Daiki Yamashita <yamashita.daiki.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/classifier_mac.c | 656 +++++++++++++++++++++++++++++++++++-------------
 src/vf/command_dec.c    |  87 +++++--
 src/vf/command_dec.h    |  41 ++-
 src/vf/command_proc.c   |  41 ++-
 src/vf/spp_vf.c         | 150 ++++++-----
 src/vf/spp_vf.h         |  41 +--
 6 files changed, 728 insertions(+), 288 deletions(-)

diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 1719889..d07870d 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -78,6 +78,9 @@
 /* interval that transmit burst packet, if buffer is not filled (nano second) */
 #define DRAIN_TX_PACKET_INTERVAL 100
 
+/* VID of VLAN untagged */
+#define VLAN_UNTAGGED_VID 0x0fff
+
 /*
  * hash table name buffer size
  *[reson for value]
@@ -116,13 +119,10 @@ struct classified_data {
 	struct rte_mbuf *pkts[MAX_PKT_BURST];
 };
 
-/* classifier component information */
-struct component_info {
-	/* component name */
-	char name[SPP_NAME_STR_LEN];
-
-	/* hash table keeps classifier_table */
-	struct rte_hash *classifier_table;
+/* mac address classification */
+struct mac_classification {
+	/* hash table keeps classification */
+	struct rte_hash *classification_tab;
 
 	/* number of valid classification */
 	int num_active_classified;
@@ -132,6 +132,15 @@ struct component_info {
 
 	/* index of default classification */
 	int default_classified;
+};
+
+/* classifier component information */
+struct component_info {
+	/* component name */
+	char name[SPP_NAME_STR_LEN];
+
+	/* mac address classification per vlan-id */
+	struct mac_classification *mac_classifications[SPP_NUM_VLAN_VID];
 
 	/* number of transmission ports */
 	int n_classified_data_tx;
@@ -153,6 +162,9 @@ struct management_info {
 
 	/* Update index number for classifier information */
 	volatile int upd_index;
+
+	/* used flag */
+	volatile int is_used;
 };
 
 /* classifier information per lcore */
@@ -166,11 +178,200 @@ static struct management_info g_mng_infos[RTE_MAX_LCORE];
  */
 static rte_atomic16_t g_hash_table_count = RTE_ATOMIC16_INIT(0xff);
 
+/* get vid from packet */
+static inline uint16_t
+get_vid(const struct rte_mbuf *pkt)
+{
+	struct ether_hdr *eth;
+	struct vlan_hdr *vh;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+		/* vlan tagged */
+		vh = (struct vlan_hdr *)(eth + 1);
+		return rte_be_to_cpu_16(vh->vlan_tci) & 0x0fff;
+	}
+
+	/* vlan untagged */
+	return VLAN_UNTAGGED_VID;
+}
+
+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
+
+#define LOG_DBG(name, fmt, ...)                                        \
+		RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,                  \
+				"[%s]Log(%s:%d):"fmt,                  \
+				name, __func__, __LINE__, __VA_ARGS__)
+
+static void
+log_packet(const char *name, struct rte_mbuf *pkt,
+		const char *func_name, int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Packet(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u\n",
+			name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt));
+}
+
+#define LOG_PKT(name, pkt) \
+		log_packet(name, pkt, __func__, __LINE__)
+
+static void
+log_classification(
+		long clsd_idx,
+		struct rte_mbuf *pkt,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	struct ether_hdr *eth;
+	uint16_t vid;
+	char mac_addr_str[2][ETHER_ADDR_STR_BUF_SZ];
+	char iface_str[SPP_NAME_STR_LEN];
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	ether_format_addr(mac_addr_str[0], sizeof(mac_addr_str),
+			&eth->d_addr);
+	ether_format_addr(mac_addr_str[1], sizeof(mac_addr_str),
+			&eth->s_addr);
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Classification(%s:%d). d_addr=%s, s_addr=%s, vid=%hu, pktlen=%u, tx_iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			mac_addr_str[0],
+			mac_addr_str[1],
+			vid,
+			rte_pktmbuf_pkt_len(pkt),
+			iface_str);
+}
+
+#define LOG_CLS(clsd_idx, pkt, cmp_info, clsd_data)                    \
+		log_classification(clsd_idx, pkt, cmp_info, clsd_data, \
+				__func__, __LINE__)
+
+static void
+log_entry(
+		long clsd_idx,
+		uint16_t vid,
+		const char *mac_addr_str,
+		struct component_info *cmp_info,
+		struct classified_data *clsd_data,
+		const char *func_name,
+		int line_num)
+{
+	char iface_str[SPP_NAME_STR_LEN];
+
+	if (clsd_idx < 0)
+		snprintf(iface_str, sizeof(iface_str), "%ld", clsd_idx);
+	else
+		spp_format_port_string(
+				iface_str,
+				clsd_data[clsd_idx].iface_type,
+				clsd_data[clsd_idx].iface_no_global);
+
+	RTE_LOG_DP(DEBUG, SPP_CLASSIFIER_MAC,
+			"[%s]Entry(%s:%d). vid=%hu, mac_addr=%s, iface=%s\n",
+			cmp_info->name,
+			func_name,
+			line_num,
+			vid,
+			mac_addr_str,
+			iface_str);
+}
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)           \
+		log_entry(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data, \
+				__func__, __LINE__)
+#else
+#define LOG_DBG(name, fmt, ...)
+#define LOG_PKT(name, pkt)
+#define LOG_CLS(pkt, clsd_idx, cmp_info, clsd_data)
+#define LOG_ENT(clsd_idx, vid, mac_addr_str, cmp_info, clsd_data)
+#endif
+
+/* check if management information is used. */
 static inline int
 is_used_mng_info(const struct management_info *mng_info)
 {
-	return (mng_info != NULL &&
-			mng_info->cmp_infos[0].classifier_table != NULL);
+	return (mng_info != NULL && mng_info->is_used);
+}
+
+/* create mac classification instance. */
+static struct mac_classification *
+create_mac_classification(void)
+{
+	struct mac_classification *mac_cls;
+	char hash_tab_name[HASH_TABLE_NAME_BUF_SZ];
+	struct rte_hash **mac_cls_tab;
+
+	mac_cls = (struct mac_classification *)rte_zmalloc(
+			NULL, sizeof(struct mac_classification), 0);
+
+	if (unlikely(mac_cls == NULL))
+		return NULL;
+
+	mac_cls->num_active_classified = 0;
+	mac_cls->default_classified = -1;
+
+	mac_cls_tab = &mac_cls->classification_tab;
+
+	/* make hash table name(require uniqueness between processes) */
+	sprintf(hash_tab_name, "cmtab_%07x%02hx",
+			getpid(),
+			rte_atomic16_add_return(&g_hash_table_count, 1));
+
+	RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
+			hash_tab_name, HASH_TABLE_NAME_BUF_SZ);
+
+	/* set hash creating parameters */
+	struct rte_hash_parameters hash_params = {
+			.name      = hash_tab_name,
+			.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
+			.key_len   = sizeof(struct ether_addr),
+			.hash_func = DEFAULT_HASH_FUNC,
+			.hash_func_init_val = 0,
+			.socket_id = rte_socket_id(),
+	};
+
+	/* create classifier mac table (hash table) */
+	*mac_cls_tab = rte_hash_create(&hash_params);
+	if (unlikely(*mac_cls_tab == NULL)) {
+		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create mac classification table. "
+				"name=%s\n", hash_tab_name);
+		rte_free(mac_cls);
+		return NULL;
+	}
+
+	return mac_cls;
 }
 
 /* initialize classifier information. */
@@ -180,19 +381,15 @@ init_component_info(struct component_info *cmp_info,
 {
 	int ret = -1;
 	int i;
-	struct rte_hash **classifier_table = &cmp_info->classifier_table;
+	struct mac_classification *mac_cls;
 	struct ether_addr eth_addr;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	struct classified_data *clsd_data_rx =
-			&cmp_info->classified_data_rx;
-	struct classified_data *clsd_data_tx =
-			cmp_info->classified_data_tx;
+	struct classified_data *clsd_data_rx = &cmp_info->classified_data_rx;
+	struct classified_data *clsd_data_tx = cmp_info->classified_data_tx;
 	struct spp_port_info *tx_port = NULL;
+	uint16_t vid;
 
-	rte_hash_reset(*classifier_table);
-	cmp_info->num_active_classified = 0;
-	cmp_info->default_classified = -1;
-	cmp_info->n_classified_data_tx = component_info->num_tx_port;
+	/* set rx */
 	if (component_info->num_rx_port == 0) {
 		clsd_data_rx->iface_type      = UNDEF;
 		clsd_data_rx->iface_no        = 0;
@@ -210,8 +407,11 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_rx->num_pkt         = 0;
 	}
 
+	/* set tx */
+	cmp_info->n_classified_data_tx = component_info->num_tx_port;
 	for (i = 0; i < component_info->num_tx_port; i++) {
 		tx_port = component_info->tx_ports[i];
+		vid = tx_port->class_id.vlantag.vid;
 
 		/* store ports information */
 		clsd_data_tx[i].iface_type      = tx_port->iface_type;
@@ -220,19 +420,33 @@ init_component_info(struct component_info *cmp_info,
 		clsd_data_tx[i].port            = tx_port->dpdk_port;
 		clsd_data_tx[i].num_pkt         = 0;
 
-		if (component_info->tx_ports[i]->mac_addr == 0)
+		if (tx_port->class_id.mac_addr == 0)
 			continue;
 
+		/* if mac classification is NULL, make instance */
+		if (unlikely(cmp_info->mac_classifications[vid] == NULL)) {
+			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
+					"Mac classification is not registered. create."
+					"vid=%hu\n", vid);
+			cmp_info->mac_classifications[vid] =
+					create_mac_classification();
+			if (unlikely(cmp_info->mac_classifications[vid] ==
+					NULL))
+				return -1;
+		}
+		mac_cls = cmp_info->mac_classifications[vid];
+
 		/* store active tx_port that associate with mac address */
-		cmp_info->active_classifieds[cmp_info->
-				num_active_classified++] = i;
+		mac_cls->active_classifieds[
+				mac_cls->num_active_classified++] = i;
 
 		/* store default classified */
-		if (unlikely(tx_port->mac_addr ==
+		if (unlikely(tx_port->class_id.mac_addr ==
 				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
-			cmp_info->default_classified = i;
+			mac_cls->default_classified = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "default classified. "
-					"iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					"vid=%hu, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+					vid,
 					tx_port->iface_type,
 					tx_port->iface_no,
 					tx_port->dpdk_port);
@@ -240,24 +454,24 @@ init_component_info(struct component_info *cmp_info,
 		}
 
 		/* add entry to classifier mac table */
-		rte_memcpy(&eth_addr, &tx_port->mac_addr, ETHER_ADDR_LEN);
+		rte_memcpy(&eth_addr, &tx_port->class_id.mac_addr,
+				ETHER_ADDR_LEN);
 		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
 				&eth_addr);
 
-		ret = rte_hash_add_key_data(*classifier_table,
+		ret = rte_hash_add_key_data(mac_cls->classification_tab,
 				(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);
-			rte_hash_free(*classifier_table);
-			*classifier_table = NULL;
+					"ret=%d, vid=%hu, mac_addr=%s\n",
+					ret, vid, mac_addr_str);
 			return -1;
 		}
 
 		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Add entry to classifier mac table. "
-				"mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				"vid=%hu, mac_addr=%s, iface_type=%d, iface_no=%d, dpdk_port=%d\n",
+				vid,
 				mac_addr_str,
 				tx_port->iface_type,
 				tx_port->iface_no,
@@ -272,10 +486,6 @@ static int
 init_classifier(struct management_info *mng_info)
 {
 	int ret = -1;
-	int i;
-	char hash_table_name[HASH_TABLE_NAME_BUF_SZ];
-
-	struct rte_hash **classifier_mac_table = NULL;
 	struct spp_component_info component_info;
 
 	memset(mng_info, 0, sizeof(struct management_info));
@@ -295,39 +505,6 @@ init_classifier(struct management_info *mng_info)
 	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 =
-				&mng_info->cmp_infos[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);
-
-		RTE_LOG(INFO, SPP_CLASSIFIER_MAC, "Create table. name=%s, bufsz=%lu\n",
-				hash_table_name, HASH_TABLE_NAME_BUF_SZ);
-
-		/* set hash creating parameters */
-		struct rte_hash_parameters hash_params = {
-				.name      = hash_table_name,
-				.entries   = NUM_CLASSIFIER_MAC_TABLE_ENTRY,
-				.key_len   = sizeof(struct ether_addr),
-				.hash_func = DEFAULT_HASH_FUNC,
-				.hash_func_init_val = 0,
-				.socket_id = rte_socket_id(),
-		};
-
-		/* create classifier mac table (hash table) */
-		*classifier_mac_table = rte_hash_create(&hash_params);
-		if (unlikely(*classifier_mac_table == NULL)) {
-			RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "Cannot create classifier mac table. "
-					"name=%s\n", hash_table_name);
-			return -1;
-		}
-	}
-
 	/* populate the classifier information at reference */
 	ret = init_component_info(&mng_info->
 			cmp_infos[mng_info->ref_index], &component_info);
@@ -340,25 +517,48 @@ init_classifier(struct management_info *mng_info)
 
 	/* updating side can be set by completion of initialization. */
 	mng_info->upd_index = mng_info->ref_index + 1;
+	mng_info->is_used = 1;
 
 	return 0;
 }
 
+/* free mac classification instance. */
+static inline void
+free_mac_classification(struct mac_classification *mac_cls)
+{
+	if (mac_cls == NULL)
+		return;
+
+	if (mac_cls->classification_tab != NULL)
+		rte_hash_free(mac_cls->classification_tab);
+
+	rte_free(mac_cls);
+}
+
+/* uninitialize classifier information. */
+static void
+uninit_component_info(struct component_info *cmp_info)
+{
+	int i;
+
+	for (i = 0; i < SPP_NUM_VLAN_VID; ++i)
+		free_mac_classification(cmp_info->mac_classifications[i]);
+
+	memset(cmp_info, 0, sizeof(struct component_info));
+}
+
 /* uninitialize classifier. */
 static void
 uninit_classifier(struct management_info *mng_info)
 {
 	int i;
 
-	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i) {
-		if (mng_info->cmp_infos[i].classifier_table != NULL) {
-			rte_hash_free(mng_info->cmp_infos[i].
-					classifier_table);
-			mng_info->cmp_infos[i].classifier_table = NULL;
-			mng_info->ref_index = 0;
-			mng_info->upd_index = 0;
-		}
-	}
+	mng_info->is_used = 0;
+
+	for (i = 0; i < NUM_CLASSIFIER_MAC_INFO; ++i)
+		uninit_component_info(mng_info->cmp_infos + (long)i);
+
+	memset(mng_info, 0, sizeof(struct management_info));
 }
 
 /* transmit packet to one destination. */
@@ -415,7 +615,8 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	if (unlikely(clsd_data->num_pkt == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 				"transmit packets (buffer is filled). "
-				"iface_type=%d, iface_no={%d,%d}, tx_port=%hu, num_pkt=%hu\n",
+				"iface_type=%d, iface_no={%d,%d}, "
+				"tx_port=%hu, num_pkt=%hu\n",
 				clsd_data->iface_type,
 				clsd_data->iface_no_global,
 				clsd_data->iface_no,
@@ -425,6 +626,22 @@ push_packet(struct rte_mbuf *pkt, struct classified_data *clsd_data)
 	}
 }
 
+/* get index of general default classified */
+static inline int
+get_general_default_classified_index(struct component_info *cmp_info)
+{
+	struct mac_classification *mac_cls;
+
+	mac_cls = cmp_info->mac_classifications[VLAN_UNTAGGED_VID];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Untagged's default is not set. vid=%d\n",
+				(int)VLAN_UNTAGGED_VID);
+		return -1;
+	}
+
+	return mac_cls->default_classified;
+}
+
 /* handle L2 multicast(include broadcast) packet */
 static inline void
 handle_l2multicast_packet(struct rte_mbuf *pkt,
@@ -432,20 +649,103 @@ handle_l2multicast_packet(struct rte_mbuf *pkt,
 		struct classified_data *clsd_data)
 {
 	int i;
+	struct mac_classification *mac_cls;
+	uint16_t vid = get_vid(pkt);
+	int gen_def_clsd_idx = get_general_default_classified_index(cmp_info);
+	int n_act_clsd;
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL ||
+			mac_cls->num_active_classified == 0)) {
+		/* specific vlan is not registered
+		 * use untagged's default(as general default)
+		 */
+		if (unlikely(gen_def_clsd_idx < 0)) {
+			/* untagged's default is not registered too */
+			RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
+					"No entry.(l2 multicast packet)\n");
+			rte_pktmbuf_free(pkt);
+			return;
+		}
 
-	if (unlikely(cmp_info->num_active_classified == 0)) {
-		RTE_LOG(ERR, SPP_CLASSIFIER_MAC, "No mac address.(l2 multicast packet)\n");
-		rte_pktmbuf_free(pkt);
+		/* transmit to untagged's default(as general default) */
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
 		return;
 	}
 
-	rte_mbuf_refcnt_update(pkt,
-			(cmp_info->num_active_classified - 1));
+	/* add to mbuf's refcnt */
+	n_act_clsd = mac_cls->num_active_classified;
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID)
+		++n_act_clsd;
 
-	for (i = 0; i < cmp_info->num_active_classified; i++) {
+	rte_mbuf_refcnt_update(pkt, (int16_t)(n_act_clsd - 1));
+
+	/* transmit to specific segment & general default */
+	for (i = 0; i < mac_cls->num_active_classified; i++) {
+		LOG_CLS((long)mac_cls->active_classifieds[i],
+				pkt, cmp_info, clsd_data);
 		push_packet(pkt, clsd_data +
-				(long)cmp_info->active_classifieds[i]);
+				(long)mac_cls->active_classifieds[i]);
+	}
+
+	if (gen_def_clsd_idx >= 0 && vid != VLAN_UNTAGGED_VID) {
+		LOG_CLS((long)gen_def_clsd_idx, pkt, cmp_info, clsd_data);
+		push_packet(pkt, clsd_data + (long)gen_def_clsd_idx);
+	}
+}
+
+/* select index of classified */
+static inline int
+select_classified_index(const struct rte_mbuf *pkt,
+		struct component_info *cmp_info)
+{
+	int ret;
+	struct ether_hdr *eth;
+	void *lookup_data;
+	struct mac_classification *mac_cls;
+	uint16_t vid;
+
+	eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+	vid = get_vid(pkt);
+
+	/* select mac address classification by vid */
+	mac_cls = cmp_info->mac_classifications[vid];
+	if (unlikely(mac_cls == NULL)) {
+		LOG_DBG(cmp_info->name, "Mac classification is not registered. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
+	}
+
+	/* find in table (by destination mac address) */
+	ret = rte_hash_lookup_data(mac_cls->classification_tab,
+			(const void *)&eth->d_addr, &lookup_data);
+	if (ret >= 0) {
+		LOG_DBG(cmp_info->name, "Mac address is registered. ret=%d, vid=%hu\n",
+				ret, vid);
+		return (int)(long)lookup_data;
+	}
+
+	LOG_DBG(cmp_info->name,
+			"Mac address is not registered. ret=%d, (EINVAL=%d, ENOENT=%d)\n",
+			ret, EINVAL, ENOENT);
+
+	/* check if packet is l2 multicast */
+	if (unlikely(is_multicast_ether_addr(&eth->d_addr)))
+		return -2;
+
+	/* if default is not set, use untagged's default */
+	if (unlikely(mac_cls->default_classified < 0 &&
+			vid != VLAN_UNTAGGED_VID)) {
+		LOG_DBG(cmp_info->name, "Vid's default is not set. use general default. vid=%hu\n",
+				vid);
+		return get_general_default_classified_index(cmp_info);
 	}
+
+	/* use default */
+	LOG_DBG(cmp_info->name, "Use vid's default. vid=%hu\n", vid);
+	return mac_cls->default_classified;
 }
 
 /*
@@ -457,55 +757,29 @@ classify_packet(struct rte_mbuf **rx_pkts, uint16_t n_rx,
 		struct component_info *cmp_info,
 		struct classified_data *clsd_data)
 {
-	int ret;
 	int i;
-	struct ether_hdr *eth;
-	void *lookup_data;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	long clsd_idx;
 
 	for (i = 0; i < n_rx; i++) {
-		eth = rte_pktmbuf_mtod(rx_pkts[i], struct ether_hdr *);
-
-		/* find in table (by destination mac address)*/
-		ret = rte_hash_lookup_data(cmp_info->classifier_table,
-				(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],
-						cmp_info,
-						clsd_data);
-				continue;
-			}
-
-			/* if no default, drop packet */
-			if (unlikely(cmp_info->default_classified ==
-					-1)) {
-				ether_format_addr(mac_addr_str,
-						sizeof(mac_addr_str),
-						&eth->d_addr);
-				RTE_LOG(ERR, SPP_CLASSIFIER_MAC,
-						"unknown mac address. "
-						"ret=%d, mac_addr=%s\n",
-						ret, mac_addr_str);
-				rte_pktmbuf_free(rx_pkts[i]);
-				continue;
-			}
-
-			/* to default classified */
-			RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
-					"to default classified.\n");
-			lookup_data = (void *)(long)cmp_info->
-					default_classified;
+		LOG_PKT(cmp_info->name, rx_pkts[i]);
+
+		clsd_idx = select_classified_index(rx_pkts[i], cmp_info);
+		LOG_CLS(clsd_idx, rx_pkts[i], cmp_info, clsd_data);
+
+		if (likely(clsd_idx >= 0)) {
+			LOG_DBG(cmp_info->name, "as unicast packet. i=%d\n",
+					i);
+			push_packet(rx_pkts[i], clsd_data + clsd_idx);
+		} else if (unlikely(clsd_idx == -1)) {
+			LOG_DBG(cmp_info->name, "no destination. drop packet. i=%d\n",
+					i);
+			rte_pktmbuf_free(rx_pkts[i]);
+		} else if (unlikely(clsd_idx == -2)) {
+			LOG_DBG(cmp_info->name, "as multicast packet. i=%d\n",
+					i);
+			handle_l2multicast_packet(rx_pkts[i],
+					cmp_info, clsd_data);
 		}
-
-		/*
-		 * set mbuf pointer to tx buffer
-		 * and transmit packet, if buffer is filled
-		 */
-		push_packet(rx_pkts[i], clsd_data + (long)lookup_data);
 	}
 }
 
@@ -575,6 +849,9 @@ spp_classifier_mac_update(struct spp_component_info *component_info)
 			mng_info->upd_index))
 		rte_delay_us_block(CHANGE_UPDATE_INDEX_WAIT_INTERVAL);
 
+	/* uninitialize old */
+	uninit_component_info(mng_info->cmp_infos + mng_info->upd_index);
+
 	RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 			"Component[%u] Complete update component.\n", id);
 
@@ -602,8 +879,10 @@ spp_classifier_mac_do(int id)
 
 	/* initialize */
 	ret = init_classifier(mng_info);
-	if (unlikely(ret != 0))
+	if (unlikely(ret != 0)) {
+		uninit_classifier(mng_info);
 		return ret;
+	}
 
 	while (likely(spp_get_core_status(lcore_id) == SPP_CORE_FORWARD) &&
 			likely(spp_check_core_index(lcore_id) == 0)) {
@@ -710,20 +989,79 @@ spp_classifier_get_component_status(
 	return 0;
 }
 
+static void
+mac_classification_iterate_table(
+		struct spp_iterate_classifier_table_params *params,
+		uint16_t vid,
+		struct mac_classification *mac_cls,
+		__rte_unused struct component_info *cmp_info,
+		struct classified_data *clsd_data)
+{
+	int ret;
+	const void *key;
+	void *data;
+	uint32_t next;
+	struct spp_port_index port;
+	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
+	enum spp_classifier_type type;
+
+	type = SPP_CLASSIFIER_TYPE_VLAN;
+	if (unlikely(vid == VLAN_UNTAGGED_VID))
+		type = SPP_CLASSIFIER_TYPE_MAC;
+
+	if (mac_cls->default_classified >= 0) {
+		port.iface_type = (clsd_data +
+				mac_cls->default_classified)->iface_type;
+		port.iface_no   = (clsd_data +
+				mac_cls->default_classified)->iface_no_global;
+
+		LOG_ENT((long)mac_cls->default_classified,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				SPP_DEFAULT_CLASSIFIED_SPEC_STR,
+				&port);
+	}
+
+	next = 0;
+	while (1) {
+		ret = rte_hash_iterate(mac_cls->classification_tab,
+				&key, &data, &next);
+
+		if (unlikely(ret < 0))
+			break;
+
+		ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
+				(const struct ether_addr *)key);
+
+		port.iface_type = (clsd_data + (long)data)->iface_type;
+		port.iface_no   = (clsd_data + (long)data)->iface_no_global;
+
+		LOG_ENT((long)data, vid, mac_addr_str, cmp_info, clsd_data);
+
+		(*params->element_proc)(
+				params,
+				type,
+				vid,
+				mac_addr_str,
+				&port);
+	}
+}
+
 /* classifier(mac address) iterate classifier table. */
 int
 spp_classifier_mac_iterate_table(
 		struct spp_iterate_classifier_table_params *params)
 {
-	int ret, i;
-	const void *key;
-	void *data;
-	uint32_t next = 0;
+	int i, n;
 	struct management_info *mng_info;
 	struct component_info *cmp_info;
 	struct classified_data *clsd_data;
-	struct spp_port_index port;
-	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
 
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		mng_info = g_mng_infos + i;
@@ -731,49 +1069,21 @@ spp_classifier_mac_iterate_table(
 			continue;
 
 		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-
 		clsd_data = cmp_info->classified_data_tx;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
 
-		if (cmp_info->default_classified >= 0) {
-			port.iface_type = (clsd_data +
-					cmp_info->default_classified)->
-					iface_type;
-			port.iface_no   = (clsd_data +
-					cmp_info->default_classified)->
-					iface_no_global;
-
-			(*params->element_proc)(
-					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					SPP_DEFAULT_CLASSIFIED_SPEC_STR,
-					&port);
-		}
-
-		next = 0;
-		while (1) {
-			ret = rte_hash_iterate(
-					cmp_info->classifier_table,
-					&key, &data, &next);
-
-			if (unlikely(ret < 0))
-				break;
-
-			ether_format_addr(mac_addr_str, sizeof(mac_addr_str),
-					(const struct ether_addr *)key);
-
-			port.iface_type = (clsd_data + (long)data)->
-					iface_type;
-			port.iface_no   = (clsd_data + (long)data)->
-					iface_no_global;
+		for (n = 0; n < SPP_NUM_VLAN_VID; ++n) {
+			if (cmp_info->mac_classifications[n] == NULL)
+				continue;
 
-			(*params->element_proc)(
+			mac_classification_iterate_table(
 					params,
-					SPP_CLASSIFIER_TYPE_MAC,
-					mac_addr_str,
-					&port);
+					(uint16_t)n,
+					cmp_info->mac_classifications[n],
+					cmp_info,
+					clsd_data);
 		}
 	}
 
diff --git a/src/vf/command_dec.c b/src/vf/command_dec.c
index 374a105..35d421a 100644
--- a/src/vf/command_dec.c
+++ b/src/vf/command_dec.c
@@ -51,6 +51,7 @@
 const char *CLASSIFILER_TYPE_STRINGS[] = {
 	"none",
 	"mac",
+	"vlan",
 
 	/* termination */ "",
 };
@@ -535,21 +536,18 @@ decode_classifier_type_value(void *output, const char *arg_val)
 	return 0;
 }
 
-/* decoding procedure of value for classifier_table command */
+/* decoding procedure of vlan id for classifier_table command */
 static int
-decode_classifier_value_value(void *output, const char *arg_val)
+decode_classifier_vid_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,
+	ret = get_int_value(output, arg_val, 0, ETH_VLAN_ID_MAX);
+	if (unlikely(ret < 0)) {
+		RTE_LOG(ERR, SPP_COMMAND_PROC, "Bad VLAN ID. val=%s\n",
 				arg_val);
-		break;
-	default:
-		break;
+		return -1;
 	}
-	return ret;
+	return 0;
 }
 
 /* decoding procedure of port for classifier_table command */
@@ -571,20 +569,24 @@ decode_classifier_port_value(void *output, const char *arg_val)
 		return -1;
 	}
 
+	if (classifier_table->type == SPP_CLASSIFIER_TYPE_MAC)
+		classifier_table->vid = ETH_VLAN_ID_MAX;
+
 	if (unlikely(classifier_table->action == SPP_CMD_ACTION_ADD)) {
-		if (!spp_check_mac_used_port(0, tmp_port.iface_type,
-				tmp_port.iface_no)) {
+		if (!spp_check_classid_used_port(ETH_VLAN_ID_MAX, 0,
+				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
 					arg_val);
 			return -1;
 		}
 	} else if (unlikely(classifier_table->action == SPP_CMD_ACTION_DEL)) {
-		mac_addr = spp_change_mac_str_to_int64(classifier_table->value);
+		mac_addr = spp_change_mac_str_to_int64(classifier_table->mac);
 		if (mac_addr < 0)
 			return -1;
 
-		if (!spp_check_mac_used_port((uint64_t)mac_addr,
+		if (!spp_check_classid_used_port(classifier_table->vid,
+				(uint64_t)mac_addr,
 				tmp_port.iface_type, tmp_port.iface_no)) {
 			RTE_LOG(ERR, SPP_COMMAND_PROC,
 					"Port in used. (classifier_table command) val=%s\n",
@@ -610,7 +612,7 @@ struct decode_parameter_list {
 
 /* parameter list for each command */
 static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
-	{                                /* classifier_table */
+	{                                /* classifier_table(mac) */
 		{
 			.name = "action",
 			.offset = offsetof(struct spp_command,
@@ -624,10 +626,43 @@ static struct decode_parameter_list parameter_list[][SPP_CMD_MAX_PARAMETERS] = {
 			.func = decode_classifier_type_value
 		},
 		{
-			.name = "value",
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
+		},
+		{
+			.name = "port",
 			.offset = offsetof(struct spp_command,
 					spec.classifier_table),
-			.func = decode_classifier_value_value
+			.func = decode_classifier_port_value
+		},
+		DECODE_PARAMETER_LIST_EMPTY,
+	},
+	{                                /* classifier_table(VLAN) */
+		{
+			.name = "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),
+			.func = decode_classifier_type_value
+		},
+		{
+			.name = "vlan id",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.vid),
+			.func = decode_classifier_vid_value
+		},
+		{
+			.name = "mac address",
+			.offset = offsetof(struct spp_command,
+					spec.classifier_table.mac),
+			.func = decode_mac_addr_str_value
 		},
 		{
 			.name = "port",
@@ -747,7 +782,9 @@ struct decode_command_list {
 /* command list */
 static struct decode_command_list command_list[] = {
 	{ "classifier_table", 5, 5, decode_command_parameter_in_list },
-						/* classifier_table */
+						/* classifier_table(mac) */
+	{ "classifier_table", 6, 6, decode_command_parameter_in_list },
+						/* classifier_table(vlan) */
 	{ "flush",            1, 1, NULL },     /* flush            */
 	{ "_get_client_id",   1, 1, NULL },     /* _get_client_id   */
 	{ "status",           1, 1, NULL },     /* status           */
@@ -767,6 +804,7 @@ decode_command_in_list(struct spp_command_request *request,
 			struct spp_command_decode_error *error)
 {
 	int ret = 0;
+	int command_name_check = 0;
 	struct decode_command_list *list = NULL;
 	int i = 0;
 	int argc = 0;
@@ -792,11 +830,8 @@ decode_command_in_list(struct spp_command_request *request,
 
 		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);
+			command_name_check = 1;
+			continue;
 		}
 
 		request->commands[0].type = i;
@@ -806,6 +841,12 @@ decode_command_in_list(struct spp_command_request *request,
 		return 0;
 	}
 
+	if (command_name_check != 0) {
+		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);
+	}
+
 	RTE_LOG(ERR, SPP_COMMAND_PROC,
 			"Unknown command. command=%s, request_str=%s\n",
 			argv[0], request_str);
diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index f919b16..9f7bada 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -74,14 +74,32 @@ enum spp_command_decode_error_code {
  *            defined in command_dec.c
  */
 enum spp_command_type {
-	SPP_CMDTYPE_CLASSIFIER_TABLE, /**< classifier_table command */
-	SPP_CMDTYPE_FLUSH,            /**< flush command */
-	SPP_CMDTYPE_CLIENT_ID,        /**< get_client_id command */
-	SPP_CMDTYPE_STATUS,           /**< status command */
-	SPP_CMDTYPE_EXIT,             /**< exit command */
-	SPP_CMDTYPE_COMPONENT,        /**< component command */
-	SPP_CMDTYPE_PORT,             /**< port command */
-	SPP_CMDTYPE_CANCEL,           /**< cancel command */
+	/** classifier_table command(mac) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_MAC,
+
+	/** classifier_table command(VLAN) */
+	SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN,
+
+	/** flush command */
+	SPP_CMDTYPE_FLUSH,
+
+	/** get_client_id command */
+	SPP_CMDTYPE_CLIENT_ID,
+
+	/** status command */
+	SPP_CMDTYPE_STATUS,
+
+	/** exit command */
+	SPP_CMDTYPE_EXIT,
+
+	/** component command */
+	SPP_CMDTYPE_COMPONENT,
+
+	/** port command */
+	SPP_CMDTYPE_PORT,
+
+	/** cancel command */
+	SPP_CMDTYPE_CANCEL,
 };
 
 /** "classifier_table" command specific parameters */
@@ -92,8 +110,11 @@ struct spp_command_classifier_table {
 	/** Classify type (currently only for mac) */
 	enum spp_classifier_type type;
 
-	/** Value to be classified */
-	char value[SPP_CMD_VALUE_BUFSZ];
+	/** VLAN ID to be classified */
+	int vid;
+
+	/** MAC address to be classified */
+	char mac[SPP_CMD_VALUE_BUFSZ];
 
 	/** Destination port type and number */
 	struct spp_port_index port;
diff --git a/src/vf/command_proc.c b/src/vf/command_proc.c
index a00181b..11c7cc3 100644
--- a/src/vf/command_proc.c
+++ b/src/vf/command_proc.c
@@ -102,6 +102,18 @@ const char *PORT_ABILITY_STATUS_STRINGS[] = {
 	/* termination */ "",
 };
 
+/*
+ * classifier type string list
+ * do it same as the order of enum spp_classifier_type (spp_vf.h)
+ */
+const char *CLASSIFILER_TYPE_STATUS_STRINGS[] = {
+	"none",
+	"mac",
+	"vlan",
+
+	/* termination */ "",
+};
+
 /* append a comma for JSON format */
 static int
 append_json_comma(char **output)
@@ -226,13 +238,15 @@ execute_command(const struct spp_command *command)
 	int ret = 0;
 
 	switch (command->type) {
-	case SPP_CMDTYPE_CLASSIFIER_TABLE:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_MAC:
+	case SPP_CMDTYPE_CLASSIFIER_TABLE_VLAN:
 		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,
-				command->spec.classifier_table.value,
+				command->spec.classifier_table.vid,
+				command->spec.classifier_table.mac,
 				&command->spec.classifier_table.port);
 		break;
 
@@ -688,13 +702,14 @@ append_core_value(const char *name, char **output,
 static int
 append_classifier_element_value(
 		struct spp_iterate_classifier_table_params *params,
-		__rte_unused enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type,
+		int vid, const char *mac,
 		const struct spp_port_index *port)
 {
 	int ret = -1;
 	char *buff, *tmp_buff;
 	char port_str[CMD_TAG_APPEND_SIZE];
+	char value_str[SPP_MIN_STR_LEN];
 	buff = params->output;
 	tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
@@ -705,11 +720,25 @@ append_classifier_element_value(
 
 	spp_format_port_string(port_str, port->iface_type, port->iface_no);
 
-	ret = append_json_str_value("type", &tmp_buff, "mac");
+	ret = append_json_str_value("type", &tmp_buff,
+			CLASSIFILER_TYPE_STATUS_STRINGS[type]);
 	if (unlikely(ret < 0))
 		return ret;
 
-	ret = append_json_str_value("value", &tmp_buff, data);
+	memset(value_str, 0x00, SPP_MIN_STR_LEN);
+	switch (type) {
+	case SPP_CLASSIFIER_TYPE_MAC:
+		sprintf(value_str, "%s", mac);
+		break;
+	case SPP_CLASSIFIER_TYPE_VLAN:
+		sprintf(value_str, "%d/%s", vid, mac);
+		break;
+	default:
+		/* not used */
+		break;
+	}
+
+	ret = append_json_str_value("value", &tmp_buff, value_str);
 	if (unlikely(ret < 0))
 		return ret;
 
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index 4463d41..ef75159 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -591,10 +591,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "phy  [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->vhost[cnt];
@@ -602,10 +604,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "vhost[%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 	for (cnt = 0; cnt < RTE_MAX_ETHPORTS; cnt++) {
 		port = &iface_info->ring[cnt];
@@ -613,10 +617,12 @@ dump_interface_info(const struct iface_info *iface_info)
 			continue;
 
 		RTE_LOG(DEBUG, APP, "ring [%d] type=%d, no=%d, port=%d, "
-				"mac=%08lx(%s)\n",
+				"vid = %u, mac=%08lx(%s)\n",
 				cnt, port->iface_type, port->iface_no,
 				port->dpdk_port,
-				port->mac_addr, port->mac_addr_str);
+				port->class_id.vlantag.vid,
+				port->class_id.mac_addr,
+				port->class_id.mac_addr_str);
 	}
 }
 
@@ -712,15 +718,21 @@ init_iface_info(void)
 	int port_cnt;  /* increment ether ports */
 	memset(&g_iface_info, 0x00, sizeof(g_iface_info));
 	for (port_cnt = 0; port_cnt < RTE_MAX_ETHPORTS; port_cnt++) {
-		g_iface_info.nic[port_cnt].iface_type   = UNDEF;
-		g_iface_info.nic[port_cnt].iface_no     = port_cnt;
-		g_iface_info.nic[port_cnt].dpdk_port = -1;
-		g_iface_info.vhost[port_cnt].iface_type   = UNDEF;
-		g_iface_info.vhost[port_cnt].iface_no     = port_cnt;
-		g_iface_info.vhost[port_cnt].dpdk_port = -1;
-		g_iface_info.ring[port_cnt].iface_type   = UNDEF;
-		g_iface_info.ring[port_cnt].iface_no     = port_cnt;
-		g_iface_info.ring[port_cnt].dpdk_port = -1;
+		g_iface_info.nic[port_cnt].iface_type = UNDEF;
+		g_iface_info.nic[port_cnt].iface_no   = port_cnt;
+		g_iface_info.nic[port_cnt].dpdk_port  = -1;
+		g_iface_info.nic[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.vhost[port_cnt].iface_type = UNDEF;
+		g_iface_info.vhost[port_cnt].iface_no   = port_cnt;
+		g_iface_info.vhost[port_cnt].dpdk_port  = -1;
+		g_iface_info.vhost[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
+		g_iface_info.ring[port_cnt].iface_type = UNDEF;
+		g_iface_info.ring[port_cnt].iface_no   = port_cnt;
+		g_iface_info.ring[port_cnt].dpdk_port  = -1;
+		g_iface_info.ring[port_cnt].class_id.vlantag.vid =
+				ETH_VLAN_ID_MAX;
 	}
 }
 
@@ -1098,13 +1110,13 @@ spp_get_client_id(void)
  * Check mac address used on the port for registering or removing
  */
 int
-spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no)
+spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no)
 {
 	struct spp_port_info *port_info = get_iface_info(iface_type, iface_no);
-	return (mac_addr == port_info->mac_addr);
+	return ((mac_addr == port_info->class_id.mac_addr) &&
+			(vid == port_info->class_id.vlantag.vid));
 }
 
 /*
@@ -1190,62 +1202,78 @@ set_component_change_port(struct spp_port_info *port, enum spp_port_rxtx rxtx)
 int
 spp_update_classifier_table(
 		enum spp_command_action action,
-		enum spp_classifier_type type,
-		const char *data,
+		enum spp_classifier_type type __attribute__ ((unused)),
+		int vid,
+		const char *mac_addr_str,
 		const struct spp_port_index *port)
 {
 	struct spp_port_info *port_info = NULL;
 	int64_t ret_mac = 0;
 	uint64_t mac_addr = 0;
 
-	if (type == SPP_CLASSIFIER_TYPE_MAC) {
-		RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, data = %s, port = %d:%d )\n",
-				data, port->iface_type, port->iface_no);
+	RTE_LOG(DEBUG, APP, "update_classifier_table ( type = mac, mac addr = %s, port = %d:%d )\n",
+			mac_addr_str, port->iface_type, port->iface_no);
+
+	ret_mac = spp_change_mac_str_to_int64(mac_addr_str);
+	if (unlikely(ret_mac == -1)) {
+		RTE_LOG(ERR, APP, "MAC address format error. ( mac = %s )\n",
+				mac_addr_str);
+		return SPP_RET_NG;
+	}
+	mac_addr = (uint64_t)ret_mac;
+
+	port_info = get_iface_info(port->iface_type, port->iface_no);
+	if (unlikely(port_info == NULL)) {
+		RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
+	if (unlikely(port_info->iface_type == UNDEF)) {
+		RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
+				port->iface_type, port->iface_no);
+		return SPP_RET_NG;
+	}
 
-		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);
+	if (action == SPP_CMD_ACTION_DEL) {
+		/* Delete */
+		if ((port_info->class_id.vlantag.vid != 0) &&
+				unlikely(port_info->class_id.vlantag.vid !=
+				vid)) {
+			RTE_LOG(ERR, APP, "VLAN ID is different. ( vid = %d )\n",
+					vid);
+			return SPP_RET_NG;
+		}
+		if ((port_info->class_id.mac_addr != 0) &&
+				unlikely(port_info->class_id.mac_addr !=
+						mac_addr)) {
+			RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
-		mac_addr = (uint64_t)ret_mac;
 
-		port_info = get_iface_info(port->iface_type, port->iface_no);
-		if (unlikely(port_info == NULL)) {
-			RTE_LOG(ERR, APP, "No port. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		port_info->class_id.vlantag.vid = ETH_VLAN_ID_MAX;
+		port_info->class_id.mac_addr    = 0;
+		memset(port_info->class_id.mac_addr_str, 0x00, SPP_MIN_STR_LEN);
+	} else if (action == SPP_CMD_ACTION_ADD) {
+		/* Setting */
+		if (unlikely(port_info->class_id.vlantag.vid !=
+				ETH_VLAN_ID_MAX)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, vlan = %d != %d )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.vlantag.vid, vid);
 			return SPP_RET_NG;
 		}
-		if (unlikely(port_info->iface_type == UNDEF)) {
-			RTE_LOG(ERR, APP, "Port not added. ( port = %d:%d )\n",
-					port->iface_type, port->iface_no);
+		if (unlikely(port_info->class_id.mac_addr != 0)) {
+			RTE_LOG(ERR, APP, "Port in used. ( port = %d:%d, mac = %s != %s )\n",
+					port->iface_type, port->iface_no,
+					port_info->class_id.mac_addr_str,
+					mac_addr_str);
 			return SPP_RET_NG;
 		}
 
-		if (action == SPP_CMD_ACTION_DEL) {
-			/* Delete */
-			if ((port_info->mac_addr != 0) &&
-					unlikely(port_info->mac_addr !=
-							mac_addr)) {
-				RTE_LOG(ERR, APP, "MAC address is different. ( mac = %s )\n",
-						data);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = 0;
-			memset(port_info->mac_addr_str, 0x00, SPP_MIN_STR_LEN);
-		} 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",
-						port->iface_type,
-						port->iface_no);
-				return SPP_RET_NG;
-			}
-
-			port_info->mac_addr = mac_addr;
-			strcpy(port_info->mac_addr_str, data);
-		}
+		port_info->class_id.vlantag.vid = vid;
+		port_info->class_id.mac_addr    = mac_addr;
+		strcpy(port_info->class_id.mac_addr_str, mac_addr_str);
 	}
 
 	set_component_change_port(port_info, SPP_PORT_RXTX_TX);
diff --git a/src/vf/spp_vf.h b/src/vf/spp_vf.h
index e51cd1a..fa01b85 100644
--- a/src/vf/spp_vf.h
+++ b/src/vf/spp_vf.h
@@ -85,8 +85,8 @@
 /** Maximum number of port abilities available */
 #define SPP_PORT_ABILITY_MAX 4
 
-/** Maximum VLAN ID */
-#define SPP_VLAN_VID_MAX 4096
+/** Number of VLAN ID */
+#define SPP_NUM_VLAN_VID 4096
 
 /** Maximum VLAN PCP */
 #define SPP_VLAN_PCP_MAX 7
@@ -118,7 +118,8 @@ enum spp_component_type {
  */
 enum spp_classifier_type {
 	SPP_CLASSIFIER_TYPE_NONE, /**< Type none */
-	SPP_CLASSIFIER_TYPE_MAC   /**< MAC address */
+	SPP_CLASSIFIER_TYPE_MAC,  /**< MAC address */
+	SPP_CLASSIFIER_TYPE_VLAN  /**< VLAN ID */
 };
 
 /**
@@ -181,15 +182,22 @@ struct spp_port_ability {
 	union spp_ability_data data;   /**< Port ability data */
 };
 
+/** Port class identifier for classifying */
+struct spp_port_class_identifier {
+	uint64_t mac_addr;                      /**< Mac address (binary) */
+	char     mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address (text) */
+	struct spp_vlantag_info vlantag;        /**< VLAN tag information */
+};
+
 /**
  * Port info
  */
 struct spp_port_info {
-	enum port_type iface_type; /**< Interface type (phy/vhost/ring) */
-	int            iface_no;   /**< Interface number */
-	int            dpdk_port;  /**< DPDK port number */
-	uint64_t       mac_addr;   /**< Mac address for classifying */
-	char           mac_addr_str[SPP_MIN_STR_LEN]; /**< Mac address */
+	enum port_type iface_type;      /**< Interface type (phy/vhost/ring) */
+	int            iface_no;        /**< Interface number */
+	int            dpdk_port;       /**< DPDK port number */
+	struct spp_port_class_identifier class_id;
+					/**< Port class identifier */
 	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
 					/**< Port ability */
 };
@@ -235,7 +243,8 @@ int spp_get_client_id(void);
 int spp_update_classifier_table(
 		enum spp_command_action action,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid,
+		const char *mac,
 		const struct spp_port_index *port);
 
 /**
@@ -331,7 +340,7 @@ struct spp_iterate_classifier_table_params;
 typedef int (*spp_iterate_classifier_element_proc)(
 		struct spp_iterate_classifier_table_params *params,
 		enum spp_classifier_type type,
-		const char *data,
+		int vid, const char *mac,
 		const struct spp_port_index *port);
 
 /** iterate classifier table parameters */
@@ -423,6 +432,8 @@ int spp_get_component_id(const char *name);
 /**
  * Check mac address used on the port for registering or removing
  *
+ * @param vid
+ *  VLAN ID to be validated.
  * @param mac_addr
  *  Mac address to be validated.
  * @param iface_type
@@ -431,12 +442,12 @@ int spp_get_component_id(const char *name);
  *  Interface number to be validated.
  *
  * @return
- *  True if target MAC address matches MAC address of port.
+ *  True if target identifier(VLAN ID, MAC address)
+ *  matches identifier(VLAN ID, MAC address) of port.
  */
-int spp_check_mac_used_port(
-		uint64_t mac_addr,
-		enum port_type iface_type,
-		int iface_no);
+int spp_check_classid_used_port(
+		int vid, uint64_t mac_addr,
+		enum port_type iface_type, int iface_no);
 
 /**
  * Check if port has been added.
-- 
2.7.4

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

* [spp] [PATCH v2 8/9] spp_vf: refactor to comply with coding style
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (5 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 7/9] spp_vf: add VID classification to the classifier ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-02-27 12:34   ` [spp] [PATCH v2 9/9] spp_vf: change log level setting ogawa.yasufumi
  2018-03-02 17:20   ` [spp] [PATCH v2 0/9] Update for spp_vf Ferruh Yigit
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Yasufumi Ogawa, Kentaro Watanabe

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

Refactoring has been made for spp_vf.py to comply with pep8.

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/spp_vf.py | 147 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 84 insertions(+), 63 deletions(-)

diff --git a/src/spp_vf.py b/src/spp_vf.py
index df1ae47..8c2c002 100755
--- a/src/spp_vf.py
+++ b/src/spp_vf.py
@@ -13,6 +13,7 @@ import sys
 
 import json
 
+
 class GrowingList(list):
     """GrowingList"""
 
@@ -21,6 +22,7 @@ class GrowingList(list):
             self.extend([None]*(index + 1 - len(self)))
         list.__setitem__(self, index, value)
 
+
 MAX_SECONDARY = 16
 
 # init
@@ -28,14 +30,15 @@ PRIMARY = ''
 SECONDARY_LIST = []
 SECONDARY_COUNT = 0
 
-#init primary comm channel
+# init primary comm channel
 MAIN2PRIMARY = Queue()
 PRIMARY2MAIN = Queue()
 
-#init secondary comm channel list
+# init secondary comm channel list
 MAIN2SEC = GrowingList()
 SEC2MAIN = GrowingList()
 
+
 def connectionthread(name, client_id, conn, m2s, s2m):
     """Manage secondary process connections"""
 
@@ -43,28 +46,29 @@ def connectionthread(name, client_id, conn, m2s, s2m):
     recv_str = 'recv'
     recv_json = None
 
-    #infinite loop so that function do not terminate and thread do not end.
+    # infinite loop so that function do not terminate and thread do not end.
     while True:
         try:
-            _, _, _ = select.select([conn,], [conn,], [], 5)
+            _, _, _ = select.select([conn, ], [conn, ], [], 5)
         except select.error:
             break
 
-        #Sending message to connected secondary
+        # Sending message to connected secondary
         try:
             cmd_str = m2s.get(True)
-            conn.send(cmd_str) #send only takes string
+            conn.send(cmd_str)  # send only takes string
         except KeyError:
             break
         except Exception, excep:
-            print (str(excep))
+            print(str(excep))
             break
 
-        #Receiving from secondary
+        # Receiving from secondary
         try:
             recv_str = ""
             while True:
-                data = conn.recv(1024) # 1024 stands for bytes of data to be received
+                # 1024 stands for bytes of data to be received
+                data = conn.recv(1024)
                 if data:
                     recv_str = recv_str + data
                     if len(data) < 1024:
@@ -73,42 +77,45 @@ def connectionthread(name, client_id, conn, m2s, s2m):
                     break
             if len(recv_str) > 0:
                 recv_json = json.loads(recv_str)
-                recv_str = "recv:" + str(conn.fileno()) + ":len:" + str(len(recv_str)) + ":\n" + json.dumps(recv_json, indent=4) + "\n"
+                recv_str = "recv:%d:len:%d:\n%s\n" % (
+                    conn.fileno(), len(recv_str),
+                    json.dumps(recv_json, indent=4))
 
             if not data:
                 s2m.put(recv_str + "closing:" + str(conn))
                 break
 
-            #s2m.put("recv:" + str(conn.fileno()) + ":{" + recv_str + "}")
+            # s2m.put("recv:" + str(conn.fileno()) + ":{" + recv_str + "}")
             s2m.put(recv_str)
         except Exception, excep:
-            print (str(excep))
+            print(str(excep))
             break
 
     SECONDARY_LIST.remove(client_id)
     conn.close()
 
+
 def getclientid(conn):
     """Get client_id from client"""
 
     try:
         conn.send("_get_client_id")
-        #conn.send("{\"commands\":[{\"command\":\"process\"}]}")
+        # conn.send("{\"commands\":[{\"command\":\"process\"}]}")
     except KeyError:
         return -1
 
     data = conn.recv(1024)
-    if data == None:
+    if data is None:
         return -1
 
-    #client_id = int(data.strip('\0'))
+    # client_id = int(data.strip('\0'))
     json_dict = json.loads(data)
     client_id = int(json_dict['client_id'])
 
     if client_id < 0 or client_id > MAX_SECONDARY:
         return -1
 
-    print ("secondary id %d" % client_id)
+    print("secondary id %d" % client_id)
     return client_id
 
     found = 0
@@ -140,6 +147,7 @@ def getclientid(conn):
 
     return free_client_id
 
+
 def acceptthread(sock, main2sec, sec2main):
     """Listen for secondary processes"""
 
@@ -147,16 +155,16 @@ def acceptthread(sock, main2sec, sec2main):
 
     try:
         while True:
-            #Accepting incoming connections
+            # Accepting incoming connections
             conn, _ = sock.accept()
 
             client_id = getclientid(conn)
             if client_id < 0:
                 break
 
-            #Creating new thread.
-            #Calling secondarythread function for this function and passing
-            #conn as argument.
+            # Creating new thread.
+            # Calling secondarythread function for this function and passing
+            # conn as argument.
 
             SECONDARY_LIST.append(client_id)
             main2sec[client_id] = Queue()
@@ -167,35 +175,39 @@ def acceptthread(sock, main2sec, sec2main):
                               sec2main[client_id], ))
             SECONDARY_COUNT += 1
     except Exception, excep:
-        print (str(excep))
+        print(str(excep))
         sock.close()
 
+
 def command_primary(command):
     """Send command to primary process"""
 
     if PRIMARY:
         MAIN2PRIMARY.put(command)
-        print (PRIMARY2MAIN.get(True))
+        print(PRIMARY2MAIN.get(True))
     else:
-        print ("primary not started")
+        print("primary not started")
+
 
 def command_secondary(sec_id, command):
     """Send command to secondary process with sec_id"""
 
     if sec_id in SECONDARY_LIST:
         MAIN2SEC[sec_id].put(command)
-        print (SEC2MAIN[sec_id].get(True))
+        print(SEC2MAIN[sec_id].get(True))
     else:
-        print ("secondary id %d not exist" % sec_id)
+        print("secondary id %d not exist" % sec_id)
+
 
 def print_status():
     """Display information about connected clients"""
 
-    print ("Soft Patch Panel Status :")
-    print ("primary: %d" % PRIMARY)
-    print ("secondary count: %d" % len(SECONDARY_LIST))
+    print("Soft Patch Panel Status :")
+    print("primary: %d" % PRIMARY)
+    print("secondary count: %d" % len(SECONDARY_LIST))
     for i in SECONDARY_LIST:
-        print ("Connected secondary id: %d" % i)
+        print("Connected secondary id: %d" % i)
+
 
 def primarythread(sock, main2primary, primary2main):
     """Manage primary process connection"""
@@ -204,41 +216,43 @@ def primarythread(sock, main2primary, primary2main):
     cmd_str = ''
 
     while True:
-        #waiting for connection
+        # waiting for connection
         PRIMARY = False
         conn, addr = sock.accept()
         PRIMARY = True
 
         while conn:
             try:
-                _, _, _ = select.select([conn,], [conn,], [], 5)
+                _, _, _ = select.select([conn, ], [conn, ], [], 5)
             except select.error:
                 break
 
-            #Sending message to connected primary
+            # Sending message to connected primary
             try:
                 cmd_str = main2primary.get(True)
-                conn.send(cmd_str) #send only takes string
+                conn.send(cmd_str)  # send only takes string
             except KeyError:
                 break
             except Exception, excep:
-                print (str(excep))
+                print(str(excep))
                 break
 
-            #Receiving from primary
+            # Receiving from primary
             try:
-                data = conn.recv(1024) # 1024 stands for bytes of data to be received
+                # 1024 stands for bytes of data to be received
+                data = conn.recv(1024)
                 if data:
-                    primary2main.put("recv:" + str(addr) + ":" + "{" + data + "}")
+                    primary2main.put("recv:%s:{%s}" % (str(addr), data))
                 else:
-                    primary2main.put("closing:" + str(addr))
+                    primary2main.put("closing:%s" % str(addr))
                     conn.close()
                     break
             except Exception, excep:
-                print (str(excep))
+                print(str(excep))
                 break
 
-    print ("primary communication thread end")
+    print("primary communication thread end")
+
 
 def close_all_secondary():
     """Exit all secondary processes"""
@@ -252,6 +266,7 @@ def close_all_secondary():
         command_secondary(i, 'exit')
     SECONDARY_COUNT = 0
 
+
 def check_sec_cmds(cmds):
     """Validate secondary commands before sending"""
 
@@ -284,6 +299,7 @@ def check_sec_cmds(cmds):
 
     return valid
 
+
 class Shell(cmd.Cmd, object):
     """SPP command prompt"""
 
@@ -332,8 +348,8 @@ class Shell(cmd.Cmd, object):
         else:
             completions = [p
                            for p in self.COMMANDS
-                           if p.startswith(text)
-                          ]
+                           if p.startswith(text)]
+
         return completions
 
     def complete_sec(self, text, line, begidx, endidx):
@@ -344,8 +360,8 @@ class Shell(cmd.Cmd, object):
         else:
             completions = [p
                            for p in self.COMMANDS
-                           if p.startswith(text)
-                          ]
+                           if p.startswith(text)]
+
         return completions
 
     def do_status(self, _):
@@ -359,23 +375,23 @@ class Shell(cmd.Cmd, object):
         if command and command in self.COMMANDS:
             command_primary(command)
         else:
-            print ("primary invalid command")
+            print("primary invalid command")
 
     def do_sec(self, arg):
         """Send command to secondary process"""
 
         cmds = arg.split(';')
         if len(cmds) < 2:
-            print ("error")
+            print("error")
         elif str.isdigit(cmds[0]):
             sec_id = int(cmds[0])
             if check_sec_cmds(cmds[1]):
                 command_secondary(sec_id, cmds[1])
             else:
-                print ("invalid cmd")
+                print("invalid cmd")
         else:
-            print (cmds[0])
-            print ("first %s" % cmds[1])
+            print(cmds[0])
+            print("first %s" % cmds[1])
 
     def do_record(self, arg):
         """Save future commands to filename:  RECORD filename.cmd"""
@@ -395,7 +411,7 @@ class Shell(cmd.Cmd, object):
                     lines.append(line)
                 self.cmdqueue.extend(lines)
         except IOError:
-            print ("Error: File does not exist.")
+            print("Error: File does not exist.")
 
     def precmd(self, line):
         if self.recorded_file and 'playback' not in line:
@@ -424,49 +440,53 @@ class Shell(cmd.Cmd, object):
             self.close()
             return True
 
+
 def main(argv):
     """main"""
 
     # Defining server address and port
-    host = ''  #'localhost' or '127.0.0.1' or '' are all same
+    host = ''  # 'localhost' or '127.0.0.1' or '' are all same
 
     try:
-        opts, _ = getopt.getopt(argv, "p:s:h", ["help", "primary = ", "secondary"])
+        opts, _ = getopt.getopt(
+            argv, "p:s:h", ["help", "primary = ", "secondary"])
     except getopt.GetoptError:
-        print ('spp.py -p <primary__port_number> -s <secondary_port_number>')
+        print('spp.py -p <primary__port_number> -s <secondary_port_number>')
         sys.exit(2)
     for opt, arg in opts:
         if opt in ("-h", "--help"):
-            print ('spp.py -p <primary__port_number> -s <secondary_port_number>')
+            print(
+                'spp.py -p <primary__port_number> -s <secondary_port_number>')
             sys.exit()
         elif opt in ("-p", "--primary"):
             primary_port = int(arg)
-            print ("primary port : %d" % primary_port)
+            print("primary port : %d" % primary_port)
         elif opt in ("-s", "--secondary"):
             secondary_port = int(arg)
-            print ('secondary port : %d' % secondary_port)
+            print('secondary port : %d' % secondary_port)
 
-    #Creating primary socket object
+    # Creating primary socket object
     primary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
-    #Binding primary socket to a address. bind() takes tuple of host and port.
+    # Binding primary socket to a address. bind() takes tuple of host and port.
     primary_sock.bind((host, primary_port))
 
-    #Listening primary at the address
-    primary_sock.listen(1) #5 denotes the number of clients can queue
+    # Listening primary at the address
+    primary_sock.listen(1)  # 5 denotes the number of clients can queue
 
     primary_thread = Thread(target=primarythread,
                             args=(primary_sock, MAIN2PRIMARY, PRIMARY2MAIN,))
     primary_thread.daemon = True
     primary_thread.start()
 
-    #Creating secondary socket object
+    # Creating secondary socket object
     secondary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
-    #Binding secondary socket to a address. bind() takes tuple of host and port.
+    # Binding secondary socket to a address. bind() takes tuple of host
+    # and port.
     secondary_sock.bind((host, secondary_port))
 
-    #Listening secondary at the address
+    # Listening secondary at the address
     secondary_sock.listen(MAX_SECONDARY)
 
     # secondary process handling thread
@@ -481,5 +501,6 @@ def main(argv):
     secondary_sock.shutdown(socket.SHUT_RDWR)
     secondary_sock.close()
 
+
 if __name__ == "__main__":
     main(sys.argv[1:])
-- 
2.7.4

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

* [spp] [PATCH v2 9/9] spp_vf: change log level setting
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (6 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 8/9] spp_vf: refactor to comply with coding style ogawa.yasufumi
@ 2018-02-27 12:34   ` ogawa.yasufumi
  2018-03-02 17:20   ` [spp] [PATCH v2 0/9] Update for spp_vf Ferruh Yigit
  8 siblings, 0 replies; 40+ messages in thread
From: ogawa.yasufumi @ 2018-02-27 12:34 UTC (permalink / raw)
  To: spp, ferruh.yigit, x-fn-spp; +Cc: Kentaro Watanabe, Naoki Takada

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

Change for "CONFIG_RTE_LOG_LEVEL" deleted at "DPDK18.02".
After "DPDK18.02", log level can be changed by "--log-level".

Signed-off-by: Kentaro Watanabe <watanabe.kentaro.z01@as.ntt-tx.co.jp>
Signed-off-by: Naoki Takada <takada.naoki@lab.ntt.co.jp>
---
 src/vf/spp_vf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index ef75159..fb45b83 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -992,9 +992,6 @@ main(int argc, char *argv[])
 		argc -= ret_dpdk;
 		argv += ret_dpdk;
 
-		/* Set log level  */
-		rte_log_set_global_level(RTE_LOG_LEVEL);
-
 		/* Parse spp_vf specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != 0))
-- 
2.7.4

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

* Re: [spp] [PATCH v2 0/9] Update for spp_vf
  2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
                     ` (7 preceding siblings ...)
  2018-02-27 12:34   ` [spp] [PATCH v2 9/9] spp_vf: change log level setting ogawa.yasufumi
@ 2018-03-02 17:20   ` Ferruh Yigit
  2018-03-03 13:39     ` Yasufumi Ogawa
  8 siblings, 1 reply; 40+ messages in thread
From: Ferruh Yigit @ 2018-03-02 17:20 UTC (permalink / raw)
  To: spp

On 2/27/2018 12:34 PM, ogawa.yasufumi@lab.ntt.co.jp wrote:
> From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
> 
> Hi,
> 
> It is 2nd version for updating spp_vf.
> 
> This update includes vlan support as a new feature, bug fix
> and refactoring remained as TODO.
> 
> Hiroyuki Nakamura (3):
>   spp_vf: add VLAN tag operate function to port
>   spp_vf: refactor struct and variable names
>   spp_vf: add VID classification to the classifier
> 
> Kentaro Watanabe (5):
>   spp_vf: add vlan feature
>   spp_vf: refactor comments and variable names
>   spp_vf: change header file to doxygen format
>   spp_vf: add BSD license
>   spp_vf: change log level setting
> 
> Yasufumi Ogawa (1):
>   spp_vf: refactor to comply with coding style

Series applied to dpdk-next-net/master, thanks.

Only updated sub-system prefix from "spp_vf:" to "vf:". To prevent confusion
between spp_vf.py which also uses same "spp_vf:" prefix.

And spp is not adding much context here indeed, I think after this we can
continue without "spp_" part, like "vf: ", "vm: ", "nfv: " ...

Thanks,
ferruh

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

* Re: [spp] [PATCH v2 0/9] Update for spp_vf
  2018-03-02 17:20   ` [spp] [PATCH v2 0/9] Update for spp_vf Ferruh Yigit
@ 2018-03-03 13:39     ` Yasufumi Ogawa
  0 siblings, 0 replies; 40+ messages in thread
From: Yasufumi Ogawa @ 2018-03-03 13:39 UTC (permalink / raw)
  To: Ferruh Yigit, spp

On 2018/03/03 2:20, Ferruh Yigit wrote:
> On 2/27/2018 12:34 PM, ogawa.yasufumi@lab.ntt.co.jp wrote:
>> From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
>>
>> Hi,
>>
>> It is 2nd version for updating spp_vf.
>>
>> This update includes vlan support as a new feature, bug fix
>> and refactoring remained as TODO.
>>
>> Hiroyuki Nakamura (3):
>>    spp_vf: add VLAN tag operate function to port
>>    spp_vf: refactor struct and variable names
>>    spp_vf: add VID classification to the classifier
>>
>> Kentaro Watanabe (5):
>>    spp_vf: add vlan feature
>>    spp_vf: refactor comments and variable names
>>    spp_vf: change header file to doxygen format
>>    spp_vf: add BSD license
>>    spp_vf: change log level setting
>>
>> Yasufumi Ogawa (1):
>>    spp_vf: refactor to comply with coding style
> 
> Series applied to dpdk-next-net/master, thanks.
> 
> Only updated sub-system prefix from "spp_vf:" to "vf:". To prevent confusion
> between spp_vf.py which also uses same "spp_vf:" prefix.
> 
> And spp is not adding much context here indeed, I think after this we can
> continue without "spp_" part, like "vf: ", "vm: ", "nfv: " ...
Thank you for your suggestion! I would like to refine name conventions.

Yasufumi
> 
> Thanks,
> ferruh
> 
> 


-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

end of thread, other threads:[~2018-03-03 13:40 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08  5:51 [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule x-fn-spp
2018-02-08  5:55 ` [spp] [PATCH 2/9] spp_vf: refactor comments and variable names x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 3/9] spp_vf: change header file to doxygen format x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 4/9] spp_vf: add BSD license x-fn-spp
2018-02-08 15:14   ` Ferruh Yigit
2018-02-09  3:03     ` [spp] [spp 02181] " Nakamura Hioryuki
2018-02-09  3:39       ` [spp] [PATCH 1/7] spp_vf: refactor to comply with coding rule x-fn-spp
2018-02-09  3:39       ` [spp] [PATCH 2/7] spp_vf: refactor comments and variable names x-fn-spp
2018-02-09  3:39       ` [spp] [PATCH 3/7] spp_vf: change header file to doxygen format x-fn-spp
2018-02-09  3:40       ` [spp] [PATCH 4/7] spp_vf: add VLAN tag operate function to port x-fn-spp
2018-02-09  3:40       ` [spp] [PATCH 5/7] spp_vf: refactor struct and variable names x-fn-spp
2018-02-09  3:40       ` [spp] [PATCH 6/7] spp_vf: add VID classification to the classifier x-fn-spp
2018-02-09  3:40       ` [spp] [PATCH 7/7] spp_vf: change log level setting x-fn-spp
2018-02-09  7:16       ` [spp] [spp 02181] Re: [PATCH 4/9] spp_vf: add BSD license Yasufumi Ogawa
2018-02-15 10:22         ` Ferruh Yigit
2018-02-16  9:01           ` Yasufumi Ogawa
2018-02-16 14:40             ` Ferruh Yigit
2018-02-19  1:59               ` Yasufumi Ogawa
2018-02-22  8:10               ` Yasufumi Ogawa
2018-02-22 10:13                 ` Ferruh Yigit
2018-02-22 10:19                   ` Thomas Monjalon
2018-02-22 10:26                     ` Ferruh Yigit
2018-02-22 11:02                       ` Yasufumi Ogawa
2018-02-08  5:56 ` [spp] [PATCH 5/9] spp_vf: add VLAN tag operate function to port x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 6/9] spp_vf: refactor struct and variable names x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 7/9] spp_vf: add VID classification to the classifier x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 8/9] spp_vf: refactor to comply with coding style x-fn-spp
2018-02-08  5:56 ` [spp] [PATCH 9/9] spp_vf: change log level setting x-fn-spp
2018-02-08  7:45 ` [spp] [PATCH 1/9] spp_vf: refactor to comply with coding rule Yasufumi Ogawa
2018-02-27 12:34 ` [spp] [PATCH v2 0/9] Update for spp_vf ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 1/9] spp_vf: add vlan feature ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 3/9] spp_vf: change header file to doxygen format ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 4/9] spp_vf: add BSD license ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 5/9] spp_vf: add VLAN tag operate function to port ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 6/9] spp_vf: refactor struct and variable names ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 7/9] spp_vf: add VID classification to the classifier ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 8/9] spp_vf: refactor to comply with coding style ogawa.yasufumi
2018-02-27 12:34   ` [spp] [PATCH v2 9/9] spp_vf: change log level setting ogawa.yasufumi
2018-03-02 17:20   ` [spp] [PATCH v2 0/9] Update for spp_vf Ferruh Yigit
2018-03-03 13:39     ` Yasufumi Ogawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).