DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] all: refactor coding style
@ 2017-07-19  9:06 Tiwei Bie
  2017-07-19  9:24 ` Van Haaren, Harry
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tiwei Bie @ 2017-07-19  9:06 UTC (permalink / raw)
  To: dev; +Cc: thomas

Remove the unwanted spaces before `;' across DPDK source code
by below one-liner with some minor manual refinements.

find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'

The fixes for cmdline library are skipped, because it has a
different coding style. It deserves a separate cleanup if
necessary. The fixes for drivers' base code are also skipped
to keep the base code intact.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 app/test-pmd/testpmd.h                             |  4 ++--
 drivers/crypto/qat/qat_adf/icp_qat_fw.h            |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c               |  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c           |  2 +-
 drivers/net/bnx2x/bnx2x.c                          |  3 ++-
 drivers/net/bnx2x/elink.h                          |  2 +-
 drivers/net/e1000/igb_pf.c                         |  2 +-
 drivers/net/ena/ena_ethdev.c                       |  4 ++--
 drivers/net/qede/qede_ethdev.c                     |  2 +-
 drivers/net/vhost/rte_eth_vhost.c                  |  2 +-
 drivers/net/virtio/virtio_rxtx.c                   |  4 ++--
 drivers/net/xenvirt/rte_eth_xenvirt.c              |  4 ++--
 drivers/net/xenvirt/rte_xen_lib.c                  |  2 +-
 drivers/net/xenvirt/virtqueue.h                    |  2 +-
 examples/ip_pipeline/cpu_core_map.c                |  4 ++--
 examples/multi_process/l2fwd_fork/main.c           |  2 +-
 examples/netmap_compat/lib/compat_netmap.c         |  2 +-
 examples/performance-thread/l3fwd-thread/main.c    |  2 +-
 examples/qos_sched/app_thread.c                    |  2 +-
 examples/quota_watermark/qw/main.c                 |  2 +-
 examples/vhost_xen/xenstore_parse.c                |  3 +--
 lib/librte_distributor/rte_distributor.c           | 12 +++++-----
 lib/librte_eal/linuxapp/eal/eal_memory.c           |  2 +-
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c       |  2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |  4 ++--
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |  2 +-
 .../linuxapp/kni/ethtool/ixgbe/kcompat.c           |  2 +-
 lib/librte_ether/rte_ethdev.c                      |  2 +-
 lib/librte_sched/rte_approx.c                      |  8 +++----
 lib/librte_sched/rte_bitmap.h                      |  3 ++-
 test/test/test_cryptodev.c                         |  2 +-
 test/test/test_cryptodev_perf.c                    | 26 +++++++++++-----------
 test/test/test_eventdev_sw.c                       |  2 +-
 test/test/test_malloc.c                            |  4 ++--
 test/test/test_memory.c                            |  2 +-
 test/test/test_mempool.c                           |  2 +-
 test/test/test_ring.c                              |  6 ++---
 test/test/test_table_acl.c                         |  2 +-
 test/test/test_table_pipeline.c                    |  2 +-
 39 files changed, 69 insertions(+), 70 deletions(-)

diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c9d7739..8f88d70 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -118,8 +118,8 @@ struct fwd_stream {
 	unsigned int rx_packets;  /**< received packets */
 	unsigned int tx_packets;  /**< received packets transmitted */
 	unsigned int fwd_dropped; /**< received packets not forwarded */
-	unsigned int rx_bad_ip_csum ; /**< received packets has bad ip checksum */
-	unsigned int rx_bad_l4_csum ; /**< received packets has bad l4 checksum */
+	unsigned int rx_bad_ip_csum; /**< received packets has bad ip checksum */
+	unsigned int rx_bad_l4_csum; /**< received packets has bad l4 checksum */
 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	uint64_t     core_cycles; /**< used for RX and TX processing */
 #endif
diff --git a/drivers/crypto/qat/qat_adf/icp_qat_fw.h b/drivers/crypto/qat/qat_adf/icp_qat_fw.h
index 5de34d5..c80989b 100644
--- a/drivers/crypto/qat/qat_adf/icp_qat_fw.h
+++ b/drivers/crypto/qat/qat_adf/icp_qat_fw.h
@@ -51,7 +51,7 @@
 
 #define QAT_FIELD_SET(flags, val, bitpos, mask) \
 { (flags) = (((flags) & (~((mask) << (bitpos)))) | \
-		(((val) & (mask)) << (bitpos))) ; }
+		(((val) & (mask)) << (bitpos))); }
 
 #define QAT_FIELD_GET(flags, bitpos, mask) \
 	(((flags) >> (bitpos)) & (mask))
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ed57376..89bc1ce 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -587,7 +587,7 @@ dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
 	dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb =
 		dpaa2_eventdev_process_atomic;
 
-	for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
+	for (i = 0; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) {
 		rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->queue[i]);
 		ret = dpci_set_rx_queue(&dpci_dev->dpci,
 					CMD_PRI_LOW,
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 3b2e5a9..31e0fe0 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -204,7 +204,7 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
 		goto aligned;
 
 	/* convert mbuf to buffers for the remainder */
-	for (i = 0; i < n ; i++) {
+	for (i = 0; i < n; i++) {
 #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
 		bufs[i] = (uint64_t)rte_mempool_virt2phy(pool, obj_table[i])
 				+ meta_data_size;
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 06733d1..51989aa 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -11535,7 +11535,8 @@ static int cut_gzip_prefix(const uint8_t * zbuf, int len)
 	}
 	/* file name is present */
 	if (zbuf[3] & 0x8) {
-		while ((zbuf[n++] != 0) && (n < len)) ;
+		while ((zbuf[n++] != 0) && (n < len))
+			;
 	}
 
 	return n;
diff --git a/drivers/net/bnx2x/elink.h b/drivers/net/bnx2x/elink.h
index 9401b7c..8f34177 100644
--- a/drivers/net/bnx2x/elink.h
+++ b/drivers/net/bnx2x/elink.h
@@ -552,7 +552,7 @@ enum elink_cos_state {
 };
 
 struct elink_ets_cos_params {
-	enum elink_cos_state state ;
+	enum elink_cos_state state;
 	union {
 		struct elink_ets_bw_params bw_params;
 		struct elink_ets_sp_params sp_params;
diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c
index 6809d30..52dab47 100644
--- a/drivers/net/e1000/igb_pf.c
+++ b/drivers/net/e1000/igb_pf.c
@@ -203,7 +203,7 @@ int igb_pf_host_configure(struct rte_eth_dev *eth_dev)
 	 * enable vlan filtering and allow all vlan tags through
 	 */
 	vlanctrl = E1000_READ_REG(hw, E1000_RCTL);
-	vlanctrl |= E1000_RCTL_VFE ; /* enable vlan filters */
+	vlanctrl |= E1000_RCTL_VFE; /* enable vlan filters */
 	E1000_WRITE_REG(hw, E1000_RCTL, vlanctrl);
 
 	/* VFTA - enable all vlan filters */
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 80ce1f3..fde9c7e 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -466,7 +466,7 @@ static int ena_rss_reta_update(struct rte_eth_dev *dev,
 		goto err;
 	}
 
-	for (i = 0 ; i < reta_size ; i++) {
+	for (i = 0; i < reta_size; i++) {
 		/* each reta_conf is for 64 entries.
 		 * to support 128 we use 2 conf of 64
 		 */
@@ -525,7 +525,7 @@ static int ena_rss_reta_query(struct rte_eth_dev *dev,
 		goto err;
 	}
 
-	for (i = 0 ; i < reta_size ; i++) {
+	for (i = 0; i < reta_size; i++) {
 		reta_conf_idx = i / RTE_RETA_GROUP_SIZE;
 		reta_idx = i % RTE_RETA_GROUP_SIZE;
 		if (TEST_BIT(reta_conf[reta_conf_idx].mask, reta_idx))
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a0616a4..e6f772d 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1774,7 +1774,7 @@ int qede_rss_hash_update(struct rte_eth_dev *eth_dev,
 	rss_params.rss_table_size_log = 7;
 	vport_update_params.vport_id = 0;
 	/* pass the L2 handles instead of qids */
-	for (i = 0 ; i < ECORE_RSS_IND_TABLE_SIZE ; i++) {
+	for (i = 0; i < ECORE_RSS_IND_TABLE_SIZE; i++) {
 		idx = qdev->rss_ind_table[i];
 		rss_params.rss_ind_table[i] = qdev->fp_array[idx].rxq->handle;
 	}
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 0dac5e6..a8c7173 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -364,7 +364,7 @@ vhost_update_packet_xstats(struct vhost_queue *vq,
 	uint64_t index;
 	struct vhost_stats *pstats = &vq->stats;
 
-	for (i = 0; i < count ; i++) {
+	for (i = 0; i < count; i++) {
 		pkt_len = bufs[i]->pkt_len;
 		if (pkt_len == 64) {
 			pstats->xstats[VHOST_64_PKT]++;
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index fbc96df..1eb1fea 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -125,7 +125,7 @@ virtqueue_dequeue_burst_rx(struct virtqueue *vq, struct rte_mbuf **rx_pkts,
 	uint16_t i;
 
 	/*  Caller does the check */
-	for (i = 0; i < num ; i++) {
+	for (i = 0; i < num; i++) {
 		used_idx = (uint16_t)(vq->vq_used_cons_idx & (vq->vq_nentries - 1));
 		uep = &vq->vq_ring.used->ring[used_idx];
 		desc_idx = (uint16_t) uep->id;
@@ -756,7 +756,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	hdr_size = hw->vtnet_hdr_size;
 	offload = rx_offload_enabled(hw);
 
-	for (i = 0; i < num ; i++) {
+	for (i = 0; i < num; i++) {
 		rxm = rcv_pkts[i];
 
 		PMD_RX_LOG(DEBUG, "packet len:%d", len[i]);
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c
index e404b77..e5e2eed 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -99,7 +99,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 	num = virtqueue_dequeue_burst(rxvq, rx_pkts, len, num);
 	PMD_RX_LOG(DEBUG, "used:%d dequeue:%d\n", nb_used, num);
-	for (i = 0; i < num ; i ++) {
+	for (i = 0; i < num; i++) {
 		rxm = rx_pkts[i];
 		PMD_RX_LOG(DEBUG, "packet len:%d\n", len[i]);
 		rxm->next = NULL;
@@ -148,7 +148,7 @@ eth_xenvirt_tx(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	num = (uint16_t)(likely(nb_used <= VIRTIO_MBUF_BURST_SZ) ? nb_used : VIRTIO_MBUF_BURST_SZ);
 	num = virtqueue_dequeue_burst(txvq, snd_pkts, len, num);
 
-	for (i = 0; i < num ; i ++) {
+	for (i = 0; i < num; i++) {
 		/* mergable not supported, one segment only */
 		rte_pktmbuf_free_seg(snd_pkts[i]);
 	}
diff --git a/drivers/net/xenvirt/rte_xen_lib.c b/drivers/net/xenvirt/rte_xen_lib.c
index 6c9a1d4..4524b3b 100644
--- a/drivers/net/xenvirt/rte_xen_lib.c
+++ b/drivers/net/xenvirt/rte_xen_lib.c
@@ -402,7 +402,7 @@ grant_node_create(uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, char
 		if (rv == -1)
 			break;
 
-		for (i = 0; i < entries_per_pg && j < pg_num ; i++) {
+		for (i = 0; i < entries_per_pg && j < pg_num; i++) {
 			((struct grant_node_item *)ptr)->gref = gref_arr[j];
 			((struct grant_node_item *)ptr)->pfn =  pa_arr[j] >> pg_shift;
 			ptr = RTE_PTR_ADD(ptr, sizeof(struct grant_node_item));
diff --git a/drivers/net/xenvirt/virtqueue.h b/drivers/net/xenvirt/virtqueue.h
index 1bb6877..9473eca 100644
--- a/drivers/net/xenvirt/virtqueue.h
+++ b/drivers/net/xenvirt/virtqueue.h
@@ -250,7 +250,7 @@ virtqueue_dequeue_burst(struct virtqueue *vq, struct rte_mbuf **rx_pkts, uint32_
 	uint16_t used_idx, desc_idx;
 	uint16_t i;
 	/*  Caller does the check */
-	for (i = 0; i < num ; i ++) {
+	for (i = 0; i < num; i++) {
 		used_idx = (uint16_t)(vq->vq_used_cons_idx & (vq->vq_nentries - 1));
 		uep = &vq->vq_ring.used->ring[used_idx];
 		desc_idx = (uint16_t) uep->id;
diff --git a/examples/ip_pipeline/cpu_core_map.c b/examples/ip_pipeline/cpu_core_map.c
index dd8f678..38c5786 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -141,7 +141,7 @@ cpu_core_map_compute_eal(struct cpu_core_map *map)
 
 		core_id_contig = 0;
 
-		for (core_id = 0; n_detected ; core_id++) {
+		for (core_id = 0; n_detected; core_id++) {
 			ht_id = 0;
 
 			for (lcore_id = 0;
@@ -362,7 +362,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
 
 		core_id_contig = 0;
 
-		for (core_id = 0; n_detected ; core_id++) {
+		for (core_id = 0; n_detected; core_id++) {
 			ht_id = 0;
 
 			for (lcore_id = 0; lcore_id < n_lcores; lcore_id++) {
diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c
index f8a626b..c98b719 100644
--- a/examples/multi_process/l2fwd_fork/main.c
+++ b/examples/multi_process/l2fwd_fork/main.c
@@ -307,7 +307,7 @@ l2fwd_malloc_shared_struct(void)
 		if (mapping_id == NULL)
 			return -1;
 
-		for (i = 0 ;i < RTE_MAX_LCORE; i++)
+		for (i = 0; i < RTE_MAX_LCORE; i++)
 			mapping_id[i] = INVALID_MAPPING_ID;
 	}
 	return 0;
diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c
index af2d9f3..fc1a32b 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -485,7 +485,7 @@ rx_sync_ring(struct netmap_ring *ring, uint8_t port, uint16_t ring_number,
 			return -1;
 
 		/* Put those n_rx packets in the Netmap structures */
-		for (i = 0; i < n_rx ; i++) {
+		for (i = 0; i < n_rx; i++) {
 			mbuf_to_slot(rx_mbufs[i], ring, cur_slot);
 			rte_pktmbuf_free(rx_mbufs[i]);
 			cur_slot = NETMAP_RING_NEXT(ring, cur_slot);
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 7954b97..eb4f6e5 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -1767,7 +1767,7 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
 				l3fwd_simple_forward(pkts_burst[j+7], portid);
 			}
 		}
-		for (; j < nb_rx ; j++)
+		for (; j < nb_rx; j++)
 			l3fwd_simple_forward(pkts_burst[j], portid);
 	}
 #elif (APP_LOOKUP_METHOD == APP_LOOKUP_LPM)
diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c
index 15f117f..a3cdceb 100644
--- a/examples/qos_sched/app_thread.c
+++ b/examples/qos_sched/app_thread.c
@@ -72,7 +72,7 @@ get_pkt_sched(struct rte_mbuf *m, uint32_t *subport, uint32_t *pipe,
 	*traffic_class = (pdata[QUEUE_OFFSET] & 0x0F) &
 			(RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1); /* Destination IP */
 	*queue = ((pdata[QUEUE_OFFSET] >> 8) & 0x0F) &
-			(RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1) ; /* Destination IP */
+			(RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1); /* Destination IP */
 	*color = pdata[COLOR_OFFSET] & 0x03; 	/* Destination IP */
 
 	return 0;
diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c
index d4fcfde..2785d96 100644
--- a/examples/quota_watermark/qw/main.c
+++ b/examples/quota_watermark/qw/main.c
@@ -367,7 +367,7 @@ main(int argc, char **argv)
 	 * Start pipeline_connect() on all the available slave lcores
 	 * but the last
 	 */
-	for (lcore_id = 0 ; lcore_id < last_lcore_id; lcore_id++) {
+	for (lcore_id = 0; lcore_id < last_lcore_id; lcore_id++) {
 		if (rte_lcore_is_enabled(lcore_id) &&
 				lcore_id != master_lcore_id) {
 
diff --git a/examples/vhost_xen/xenstore_parse.c b/examples/vhost_xen/xenstore_parse.c
index ab089f1..9e2ff81 100644
--- a/examples/vhost_xen/xenstore_parse.c
+++ b/examples/vhost_xen/xenstore_parse.c
@@ -516,9 +516,8 @@ parse_mempoolnode(struct xen_guest *guest)
 err:
 	if (gntnode)
 		xen_free_gntnode(gntnode);
-	for (i = 0; i <  MAX_XENVIRT_MEMPOOL ; i++) {
+	for (i = 0; i < MAX_XENVIRT_MEMPOOL; i++)
 		cleanup_mempool(&guest->mempool[i]);
-	}
 	/* reinitialise mempool */
 	bzero(&guest->mempool, MAX_XENVIRT_MEMPOOL * sizeof(guest->mempool[0]));
 	return -1;
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 20ba9ff..4c09e25 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -257,13 +257,13 @@ find_match_scalar(struct rte_distributor *d,
 	 * 4. Add any matches to the output
 	 */
 
-	for (j = 0 ; j < RTE_DIST_BURST_SIZE; j++)
+	for (j = 0; j < RTE_DIST_BURST_SIZE; j++)
 		output_ptr[j] = 0;
 
 	for (i = 0; i < d->num_workers; i++) {
 		bl = &d->backlog[i];
 
-		for (j = 0; j < RTE_DIST_BURST_SIZE ; j++)
+		for (j = 0; j < RTE_DIST_BURST_SIZE; j++)
 			for (w = 0; w < RTE_DIST_BURST_SIZE; w++)
 				if (d->in_flight_tags[i][j] == data_ptr[w]) {
 					output_ptr[j] = i+1;
@@ -347,7 +347,7 @@ release(struct rte_distributor *d, unsigned int wkr)
 		d->in_flight_tags[wkr][i] = d->backlog[wkr].tags[i];
 	}
 	buf->count = i;
-	for ( ; i < RTE_DIST_BURST_SIZE ; i++) {
+	for ( ; i < RTE_DIST_BURST_SIZE; i++) {
 		buf->bufptr64[i] = RTE_DISTRIB_GET_BUF;
 		d->in_flight_tags[wkr][i] = 0;
 	}
@@ -381,7 +381,7 @@ rte_distributor_process_v1705(struct rte_distributor *d,
 
 	if (unlikely(num_mbufs == 0)) {
 		/* Flush out all non-full cache-lines to workers. */
-		for (wid = 0 ; wid < d->num_workers; wid++) {
+		for (wid = 0; wid < d->num_workers; wid++) {
 			if ((d->bufs[wid].bufptr64[0] & RTE_DISTRIB_GET_BUF)) {
 				release(d, wid);
 				handle_returns(d, wid);
@@ -491,7 +491,7 @@ rte_distributor_process_v1705(struct rte_distributor *d,
 	}
 
 	/* Flush out all non-full cache-lines to workers. */
-	for (wid = 0 ; wid < d->num_workers; wid++)
+	for (wid = 0; wid < d->num_workers; wid++)
 		if ((d->bufs[wid].bufptr64[0] & RTE_DISTRIB_GET_BUF))
 			release(d, wid);
 
@@ -666,7 +666,7 @@ rte_distributor_create_v1705(const char *name,
 	 * Set up the backog tags so they're pointing at the second cache
 	 * line for performance during flow matching
 	 */
-	for (i = 0 ; i < num_workers ; i++)
+	for (i = 0; i < num_workers; i++)
 		d->backlog[i].tags = &d->in_flight_tags[i][RTE_DIST_BURST_SIZE];
 
 	dist_burst_list = RTE_TAILQ_CAST(rte_dist_burst_tailq.head,
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index daead31..6b41341 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -470,7 +470,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 			/* reserve a virtual area for next contiguous
 			 * physical block: count the number of
 			 * contiguous physical pages. */
-			for (j = i+1; j < hpi->num_pages[0] ; j++) {
+			for (j = i+1; j < hpi->num_pages[0]; j++) {
 #ifdef RTE_ARCH_PPC_64
 				/* The physical addresses are sorted in
 				 * descending order on PPC64 */
diff --git a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
index 19db1cb..1549c69 100644
--- a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
@@ -287,7 +287,7 @@ rte_xen_dom0_memory_init(void)
 
 		memseg[memseg_idx].addr = vir_addr;
 		memseg[memseg_idx].phys_addr = page_size *
-			seginfo[memseg_idx].pfn ;
+			seginfo[memseg_idx].pfn;
 		memseg[memseg_idx].len = seginfo[memseg_idx].size;
 		for ( i = 0; i < seginfo[memseg_idx].size / RTE_PGSIZE_2M; i++)
 			memseg[memseg_idx].mfn[i] = seginfo[memseg_idx].mfn[i];
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index 99338c5..1812830 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -1989,7 +1989,7 @@ void igb_reset(struct igb_adapter *adapter)
 		 * Clear all flags except indication that the PF has set
 		 * the VF MAC addresses administratively
 		 */
-		for (i = 0 ; i < adapter->vfs_allocated_count; i++)
+		for (i = 0; i < adapter->vfs_allocated_count; i++)
 			adapter->vf_data[i].flags &= IGB_VF_FLAG_PF_SET_MAC;
 
 		/* ping all the active vfs to let them know we are going down */
@@ -6140,7 +6140,7 @@ static void igb_ping_all_vfs(struct igb_adapter *adapter)
 	u32 ping;
 	int i;
 
-	for (i = 0 ; i < adapter->vfs_allocated_count; i++) {
+	for (i = 0; i < adapter->vfs_allocated_count; i++) {
 		ping = E1000_PF_CONTROL_MSG;
 		if (adapter->vf_data[i].flags & IGB_VF_FLAG_CTS)
 			ping |= E1000_VT_MSGTYPE_CTS;
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index d26016c..3a018c3 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -1033,7 +1033,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 		IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITRSEL, 0);
 
 		/* Mark all the VFs as inactive */
-		for (i = 0 ; i < adapter->num_vfs; i++)
+		for (i = 0; i < adapter->num_vfs; i++)
 			adapter->vfinfo[i].clear_to_send = 0;
 
 		/* ping all the active vfs to let them know we are going down */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.c
index d84c7cc..1aa7899 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.c
@@ -168,7 +168,7 @@ int _kc_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 		size = end - buf + 1;
 	}
 
-	for (; *fmt ; ++fmt) {
+	for (; *fmt; ++fmt) {
 		if (*fmt != '%') {
 			if (str <= end)
 				*str = *fmt;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a1b7447..937f30b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1670,7 +1670,7 @@ rte_eth_xstats_get_by_id(uint8_t port_id, const uint64_t *ids, uint64_t *values,
 				return xcount;
 
 			if (values != NULL)
-				for (i = 0 ; i < (unsigned int)xcount; i++)
+				for (i = 0; i < (unsigned int)xcount; i++)
 					values[i + count] = xstats[i].value;
 		}
 
diff --git a/lib/librte_sched/rte_approx.c b/lib/librte_sched/rte_approx.c
index 739f37d..ff6bdf9 100644
--- a/lib/librte_sched/rte_approx.c
+++ b/lib/librte_sched/rte_approx.c
@@ -132,14 +132,14 @@ find_best_rational_approximation(uint32_t alpha_num, uint32_t d_num, uint32_t de
 		}
 
 		/* update the interval */
-		new_p_a = p_b + (x - 1) * p_a ;
+		new_p_a = p_b + (x - 1) * p_a;
 		new_q_a = q_b + (x - 1) * q_a;
-		new_p_b = p_b + x * p_a ;
+		new_p_b = p_b + x * p_a;
 		new_q_b = q_b + x * q_a;
 
-		p_a = new_p_a ;
+		p_a = new_p_a;
 		q_a = new_q_a;
-		p_b = new_p_b ;
+		p_b = new_p_b;
 		q_b = new_q_b;
 
 		/* compute the number of steps to the right */
diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
index 010d752..e487b58 100644
--- a/lib/librte_sched/rte_bitmap.h
+++ b/lib/librte_sched/rte_bitmap.h
@@ -500,7 +500,8 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)
 	uint64_t *slab2;
 
 	slab2 = bmp->array2 + bmp->index2;
-	for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
+	for ( ; bmp->go2; bmp->index2++, slab2++,
+			  bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
 		if (*slab2) {
 			*pos = bmp->index2 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
 			*slab = *slab2;
diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index b068609..12dabc2 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -463,7 +463,7 @@ ut_setup(void)
 			"Failed to configure cryptodev %u",
 			ts_params->valid_devs[0]);
 
-	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
+	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->valid_devs[0], qp_id,
 			&ts_params->qp_conf,
diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c
index 8cddaa7..4200611 100644
--- a/test/test/test_cryptodev_perf.c
+++ b/test/test/test_cryptodev_perf.c
@@ -428,7 +428,7 @@ testsuite_setup(void)
 			ts_params->dev_id);
 
 	ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT;
-	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
+	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
 
 		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
 			ts_params->dev_id, qp_id,
@@ -1983,7 +1983,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
 	TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed");
 
 	/* Generate Crypto op data structure(s) */
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		struct rte_mbuf *m = setup_test_string(ts_params->mbuf_mp,
 				data_params[0].expected.ciphertext,
 				data_params[0].length, 0);
@@ -2030,7 +2030,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
 	printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst");
 	printf("\tRetries (Device Busy)\tAverage IA cycle cost "
 			"(assuming 0 retries)");
-	for (i = 2; i <= 128 ; i *= 2) {
+	for (i = 2; i <= 128; i *= 2) {
 		num_sent = 0;
 		num_received = 0;
 		retries = 0;
@@ -2087,7 +2087,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
 	}
 	printf("\n");
 
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
@@ -2122,7 +2122,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate Crypto op data structure(s)*/
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		struct rte_mbuf *m = test_perf_create_pktmbuf(
 						ts_params->mbuf_mp,
 						pparams->buf_size);
@@ -2159,7 +2159,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 	printf("\nOps Tx\tOps Rx\tOps/burst  ");
 	printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
 
-	for (i = 2; i <= 128 ; i *= 2) {
+	for (i = 2; i <= 128; i *= 2) {
 		num_sent = 0;
 		num_ops_received = 0;
 		retries = 0;
@@ -2218,7 +2218,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 	printf("\n");
 
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
@@ -2314,7 +2314,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 	TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
 	/* Generate Crypto op data structure(s)*/
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		struct rte_mbuf *m = test_perf_create_pktmbuf(
 						ts_params->mbuf_mp,
 						pparams->buf_size);
@@ -2373,7 +2373,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 	printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t"
 			"IACycles/Byte");
 
-	for (i = 2; i <= 128 ; i *= 2) {
+	for (i = 2; i <= 128; i *= 2) {
 		num_sent = 0;
 		num_ops_received = 0;
 		retries = 0;
@@ -2438,7 +2438,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 	printf("\n");
 
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
@@ -2479,7 +2479,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 		sess = NULL;
 
 	/* Generate Crypto op data structure(s)*/
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		struct rte_mbuf *m = test_perf_create_pktmbuf(
 						ts_params->mbuf_mp,
 						pparams->buf_size);
@@ -2510,7 +2510,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 	printf("Retries  "
 		"EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
 
-	for (i = 2; i <= 128 ; i *= 2) {
+	for (i = 2; i <= 128; i *= 2) {
 		num_sent = 0;
 		num_ops_received = 0;
 		retries = 0;
@@ -2574,7 +2574,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 	}
 	printf("\n");
 
-	for (i = 0; i < num_to_submit ; i++) {
+	for (i = 0; i < num_to_submit; i++) {
 		rte_pktmbuf_free(c_ops[i]->sym->m_src);
 		rte_crypto_op_free(c_ops[i]);
 	}
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index ba8c053..8e7829f 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -2696,7 +2696,7 @@ parallel_basic(struct test *t, int check_order)
 
 	/* Check to see if the sequence numbers are in expected order */
 	if (check_order) {
-		for (j = 0 ; j < deq_pkts ; j++) {
+		for (j = 0; j < deq_pkts; j++) {
 			if (deq_ev[j].mbuf->seqn != MAGIC_SEQN + j) {
 				printf(
 					"%d: Incorrect sequence number(%d) from port %d\n",
diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c
index 013fd44..d813d4d 100644
--- a/test/test/test_malloc.c
+++ b/test/test/test_malloc.c
@@ -106,7 +106,7 @@ test_align_overlap_per_lcore(__attribute__((unused)) void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
+		for (j = 0; j < 1000; j++) {
 			if( *(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero"
 				       "the allocated memory\n");
@@ -178,7 +178,7 @@ test_reordered_free_per_lcore(__attribute__((unused)) void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
+		for (j = 0; j < 1000; j++) {
 			if( *(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero"
 				       "the allocated memory\n");
diff --git a/test/test/test_memory.c b/test/test/test_memory.c
index 921bdc8..8e01f0f 100644
--- a/test/test/test_memory.c
+++ b/test/test/test_memory.c
@@ -75,7 +75,7 @@ test_memory(void)
 
 	/* try to read memory (should not segfault) */
 	mem = rte_eal_get_physmem_layout();
-	for (i = 0; i < RTE_MAX_MEMSEG && mem[i].addr != NULL ; i++) {
+	for (i = 0; i < RTE_MAX_MEMSEG && mem[i].addr != NULL; i++) {
 
 		/* check memory */
 		for (j = 0; j<mem[i].len; j++) {
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 0a44239..4284dbc 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -329,7 +329,7 @@ my_mp_init(struct rte_mempool *mp, __attribute__((unused)) void *arg)
 {
 	printf("mempool name is %s\n", mp->name);
 	/* nothing to be implemented here*/
-	return ;
+	return;
 }
 
 /*
diff --git a/test/test/test_ring.c b/test/test/test_ring.c
index d664b04..5adc13c 100644
--- a/test/test/test_ring.c
+++ b/test/test/test_ring.c
@@ -155,9 +155,8 @@ test_ring_basic(void)
 	if (src == NULL)
 		goto fail;
 
-	for (i = 0; i < RING_SIZE*2 ; i++) {
+	for (i = 0; i < RING_SIZE*2; i++)
 		src[i] = (void *)(unsigned long)i;
-	}
 	cur_src = src;
 
 	/* alloc some room for copied objects */
@@ -358,9 +357,8 @@ test_ring_burst_basic(void)
 	if (src == NULL)
 		goto fail;
 
-	for (i = 0; i < RING_SIZE*2 ; i++) {
+	for (i = 0; i < RING_SIZE*2; i++)
 		src[i] = (void *)(unsigned long)i;
-	}
 	cur_src = src;
 
 	/* alloc some room for copied objects */
diff --git a/test/test/test_table_acl.c b/test/test/test_table_acl.c
index 08c100f..fefcbfa 100644
--- a/test/test/test_table_acl.c
+++ b/test/test/test_table_acl.c
@@ -650,7 +650,7 @@ setup_acl_pipeline(void)
 	}
 
 	/* Enable input ports */
-	for (i = 0; i < N_PORTS ; i++)
+	for (i = 0; i < N_PORTS; i++)
 		if (rte_pipeline_port_in_enable(p, port_in_id[i]))
 			rte_panic("Unable to enable input port %u\n",
 				port_in_id[i]);
diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
index a6fef72..121caa3 100644
--- a/test/test/test_table_pipeline.c
+++ b/test/test/test_table_pipeline.c
@@ -410,7 +410,7 @@ setup_pipeline(int test_type)
 	}
 
 	/* Enable input ports */
-	for (i = 0; i < N_PORTS ; i++)
+	for (i = 0; i < N_PORTS; i++)
 		if (rte_pipeline_port_in_enable(p, port_in_id[i]))
 			rte_panic("Unable to enable input port %u\n",
 				port_in_id[i]);
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-19  9:06 [dpdk-dev] [PATCH] all: refactor coding style Tiwei Bie
@ 2017-07-19  9:24 ` Van Haaren, Harry
  2017-07-19 10:23   ` Tiwei Bie
  2017-07-19 10:45 ` Trahe, Fiona
  2017-07-20  5:04 ` Shreyansh Jain
  2 siblings, 1 reply; 10+ messages in thread
From: Van Haaren, Harry @ 2017-07-19  9:24 UTC (permalink / raw)
  To: Bie, Tiwei; +Cc: thomas, dev

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tiwei Bie
> Sent: Wednesday, July 19, 2017 10:07 AM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net
> Subject: [dpdk-dev] [PATCH] all: refactor coding style
> 
> Remove the unwanted spaces before `;' across DPDK source code
> by below one-liner with some minor manual refinements.
> 
> find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
> 
> The fixes for cmdline library are skipped, because it has a
> different coding style. It deserves a separate cleanup if
> necessary. The fixes for drivers' base code are also skipped
> to keep the base code intact.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

Hi Tiwei,

Although the idea and motivation for code-cleanup are good, performing
large cleanup across a code-base is not a good solution. The reason that
these types of cleanups (or even re-formatting the entire codebase) are not
performed often is that it "invalidates" any currently-in-progress patch-sets.
As a result, more work is required from many contributors to rebase useful
features due to across-the-board white-space cleanups.

Just expressing concern that we need to think carefully about the impacts
of such a patch.

Regards, -Harry

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-19  9:24 ` Van Haaren, Harry
@ 2017-07-19 10:23   ` Tiwei Bie
  2017-07-20  7:56     ` Jens Freimann
  0 siblings, 1 reply; 10+ messages in thread
From: Tiwei Bie @ 2017-07-19 10:23 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: thomas, dev

On Wed, Jul 19, 2017 at 05:24:38PM +0800, Van Haaren, Harry wrote:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tiwei Bie
> > Sent: Wednesday, July 19, 2017 10:07 AM
> > To: dev@dpdk.org
> > Cc: thomas@monjalon.net
> > Subject: [dpdk-dev] [PATCH] all: refactor coding style
> > 
> > Remove the unwanted spaces before `;' across DPDK source code
> > by below one-liner with some minor manual refinements.
> > 
> > find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
> > 
> > The fixes for cmdline library are skipped, because it has a
> > different coding style. It deserves a separate cleanup if
> > necessary. The fixes for drivers' base code are also skipped
> > to keep the base code intact.
> > 
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> Hi Tiwei,
> 
> Although the idea and motivation for code-cleanup are good, performing
> large cleanup across a code-base is not a good solution. The reason that
> these types of cleanups (or even re-formatting the entire codebase) are not
> performed often is that it "invalidates" any currently-in-progress patch-sets.
> As a result, more work is required from many contributors to rebase useful
> features due to across-the-board white-space cleanups.
> 
> Just expressing concern that we need to think carefully about the impacts
> of such a patch.
> 

Yeah, I agree. Such patch may cause many conflicts. But this patch
is almost generated automatically, that is to say, it's a quick work.
And it's more like some fixes (for the bad coding style) rather than
silly re-formatting done by `indent'. So I just want to share it with
the community, and see the potential feedbacks. Thank you for your
comments! :)

Best regards,
Tiwei Bie

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-19  9:06 [dpdk-dev] [PATCH] all: refactor coding style Tiwei Bie
  2017-07-19  9:24 ` Van Haaren, Harry
@ 2017-07-19 10:45 ` Trahe, Fiona
  2017-07-20  5:04 ` Shreyansh Jain
  2 siblings, 0 replies; 10+ messages in thread
From: Trahe, Fiona @ 2017-07-19 10:45 UTC (permalink / raw)
  To: Bie, Tiwei, dev; +Cc: thomas



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tiwei Bie
> Sent: Wednesday, July 19, 2017 10:07 AM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net
> Subject: [dpdk-dev] [PATCH] all: refactor coding style
> 
> Remove the unwanted spaces before `;' across DPDK source code
> by below one-liner with some minor manual refinements.
> 
> find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
> 
> The fixes for cmdline library are skipped, because it has a
> different coding style. It deserves a separate cleanup if
> necessary. The fixes for drivers' base code are also skipped
> to keep the base code intact.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-19  9:06 [dpdk-dev] [PATCH] all: refactor coding style Tiwei Bie
  2017-07-19  9:24 ` Van Haaren, Harry
  2017-07-19 10:45 ` Trahe, Fiona
@ 2017-07-20  5:04 ` Shreyansh Jain
  2017-07-20  5:53   ` Tiwei Bie
  2 siblings, 1 reply; 10+ messages in thread
From: Shreyansh Jain @ 2017-07-20  5:04 UTC (permalink / raw)
  To: Tiwei Bie, dev; +Cc: thomas, Van Haaren, Harry

On Wednesday 19 July 2017 02:36 PM, Tiwei Bie wrote:
> Remove the unwanted spaces before `;' across DPDK source code
> by below one-liner with some minor manual refinements.
> 
> find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
> 
> The fixes for cmdline library are skipped, because it has a
> different coding style. It deserves a separate cleanup if
> necessary. The fixes for drivers' base code are also skipped
> to keep the base code intact.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   app/test-pmd/testpmd.h                             |  4 ++--
>   drivers/crypto/qat/qat_adf/icp_qat_fw.h            |  2 +-
>   drivers/event/dpaa2/dpaa2_eventdev.c               |  2 +-
>   drivers/mempool/dpaa2/dpaa2_hw_mempool.c           |  2 +-
>   drivers/net/bnx2x/bnx2x.c                          |  3 ++-
>   drivers/net/bnx2x/elink.h                          |  2 +-
>   drivers/net/e1000/igb_pf.c                         |  2 +-
>   drivers/net/ena/ena_ethdev.c                       |  4 ++--
>   drivers/net/qede/qede_ethdev.c                     |  2 +-
>   drivers/net/vhost/rte_eth_vhost.c                  |  2 +-
>   drivers/net/virtio/virtio_rxtx.c                   |  4 ++--
>   drivers/net/xenvirt/rte_eth_xenvirt.c              |  4 ++--
>   drivers/net/xenvirt/rte_xen_lib.c                  |  2 +-
>   drivers/net/xenvirt/virtqueue.h                    |  2 +-
>   examples/ip_pipeline/cpu_core_map.c                |  4 ++--
>   examples/multi_process/l2fwd_fork/main.c           |  2 +-
>   examples/netmap_compat/lib/compat_netmap.c         |  2 +-
>   examples/performance-thread/l3fwd-thread/main.c    |  2 +-
>   examples/qos_sched/app_thread.c                    |  2 +-
>   examples/quota_watermark/qw/main.c                 |  2 +-
>   examples/vhost_xen/xenstore_parse.c                |  3 +--
>   lib/librte_distributor/rte_distributor.c           | 12 +++++-----
>   lib/librte_eal/linuxapp/eal/eal_memory.c           |  2 +-
>   lib/librte_eal/linuxapp/eal/eal_xen_memory.c       |  2 +-
>   lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |  4 ++--
>   .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |  2 +-
>   .../linuxapp/kni/ethtool/ixgbe/kcompat.c           |  2 +-
>   lib/librte_ether/rte_ethdev.c                      |  2 +-
>   lib/librte_sched/rte_approx.c                      |  8 +++----
>   lib/librte_sched/rte_bitmap.h                      |  3 ++-
>   test/test/test_cryptodev.c                         |  2 +-
>   test/test/test_cryptodev_perf.c                    | 26 +++++++++++-----------
>   test/test/test_eventdev_sw.c                       |  2 +-
>   test/test/test_malloc.c                            |  4 ++--
>   test/test/test_memory.c                            |  2 +-
>   test/test/test_mempool.c                           |  2 +-
>   test/test/test_ring.c                              |  6 ++---
>   test/test/test_table_acl.c                         |  2 +-
>   test/test/test_table_pipeline.c                    |  2 +-
>   39 files changed, 69 insertions(+), 70 deletions(-)
> 

[...]

I agree with Harry's comments (in another reply to this thread) that 
such patches might impact other pending patch series, quite late in 
merge window. But, this is a good-to-have set, probably early in 1711 
window.

>   		/* compute the number of steps to the right */
> diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
> index 010d752..e487b58 100644
> --- a/lib/librte_sched/rte_bitmap.h
> +++ b/lib/librte_sched/rte_bitmap.h
> @@ -500,7 +500,8 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)
>   	uint64_t *slab2;
>   
>   	slab2 = bmp->array2 + bmp->index2;
> -	for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
> +	for ( ; bmp->go2; bmp->index2++, slab2++,
> +			  bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {

            ^^^^
Trivial: space before ';' in 'for' here should also be removed.

[...]

Other than the above (and also from dpaa2 code change perspective):

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-20  5:04 ` Shreyansh Jain
@ 2017-07-20  5:53   ` Tiwei Bie
  2017-07-20  7:13     ` Shreyansh Jain
  0 siblings, 1 reply; 10+ messages in thread
From: Tiwei Bie @ 2017-07-20  5:53 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: dev, thomas, Van Haaren, Harry

On Thu, Jul 20, 2017 at 10:34:39AM +0530, Shreyansh Jain wrote:
> On Wednesday 19 July 2017 02:36 PM, Tiwei Bie wrote:
> > Remove the unwanted spaces before `;' across DPDK source code
> > by below one-liner with some minor manual refinements.
> > 
> > find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
> > 
> > The fixes for cmdline library are skipped, because it has a
> > different coding style. It deserves a separate cleanup if
> > necessary. The fixes for drivers' base code are also skipped
> > to keep the base code intact.
> > 
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> > ---
[...]
> >   		/* compute the number of steps to the right */
> > diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
> > index 010d752..e487b58 100644
> > --- a/lib/librte_sched/rte_bitmap.h
> > +++ b/lib/librte_sched/rte_bitmap.h
> > @@ -500,7 +500,8 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)
> >   	uint64_t *slab2;
> >   	slab2 = bmp->array2 + bmp->index2;
> > -	for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
> > +	for ( ; bmp->go2; bmp->index2++, slab2++,
> > +			  bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
> 
>            ^^^^
> Trivial: space before ';' in 'for' here should also be removed.
> 

Thank you for your feedbacks! :-)

Hmm.. Actually the space between `(' and `;' was kept intentionally
when I wrote this 's/\([^;(]\) \+;/\1;/g' sed script. There are many
other such cases. It's acceptable to me, and I thought we like it:

diff --git i/app/test-eventdev/parser.h w/app/test-eventdev/parser.h
index 75a5a3b..372b85f 100644
--- i/app/test-eventdev/parser.h
+++ w/app/test-eventdev/parser.h
@@ -41,7 +41,7 @@
 #define skip_white_spaces(pos)			\
 ({						\
 	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
+	for (; isspace(*_p); _p++)		\
 		;				\
 	_p;					\
 })
diff --git i/app/test-eventdev/test_perf_common.c w/app/test-eventdev/test_perf_common.c
index a5b768c..36b78bf 100644
--- i/app/test-eventdev/test_perf_common.c
+++ w/app/test-eventdev/test_perf_common.c
@@ -284,7 +284,7 @@ perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt,
 			.new_event_threshold = 1200,
 	};
 	prod = 0;
-	for ( ; port < perf_nb_event_ports(opt); port++) {
+	for (; port < perf_nb_event_ports(opt); port++) {
 		struct prod_data *p = &t->prod[port];
 
 		p->dev_id = opt->dev_id;
diff --git i/drivers/net/bonding/rte_eth_bond_pmd.c w/drivers/net/bonding/rte_eth_bond_pmd.c
index 383e27c..5d8e068 100644
--- i/drivers/net/bonding/rte_eth_bond_pmd.c
+++ w/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -371,7 +371,7 @@ bond_ethdev_tx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
 		/* If tx burst fails move packets to end of bufs */
 		if (unlikely(num_tx_slave < slave_nb_pkts[i])) {
 			uint16_t j = nb_pkts - num_tx_fail_total;
-			for ( ; num_tx_slave < slave_nb_pkts[i]; j++,
+			for (; num_tx_slave < slave_nb_pkts[i]; j++,
 					num_tx_slave++)
 				bufs[j] = slave_bufs[i][num_tx_slave];
 		}
@@ -1308,7 +1308,7 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 				slave_bufs[i], slave_nb_pkts[i]);
 
 		/* If tx burst fails drop slow packets */
-		for ( ; num_tx_slave < slave_slow_nb_pkts[i]; num_tx_slave++)
+		for (; num_tx_slave < slave_slow_nb_pkts[i]; num_tx_slave++)
 			rte_pktmbuf_free(slave_bufs[i][num_tx_slave]);
 
 		num_tx_total += num_tx_slave - slave_slow_nb_pkts[i];
@@ -1317,7 +1317,7 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 		/* If tx burst fails move packets to end of bufs */
 		if (unlikely(num_tx_slave < slave_nb_pkts[i])) {
 			uint16_t j = nb_pkts - num_tx_fail_total;
-			for ( ; num_tx_slave < slave_nb_pkts[i]; j++, num_tx_slave++)
+			for (; num_tx_slave < slave_nb_pkts[i]; j++, num_tx_slave++)
 				bufs[j] = slave_bufs[i][num_tx_slave];
 		}
 	}
diff --git i/drivers/net/cxgbe/base/t4_hw.c w/drivers/net/cxgbe/base/t4_hw.c
index a8ccea0..ed26f71 100644
--- i/drivers/net/cxgbe/base/t4_hw.c
+++ w/drivers/net/cxgbe/base/t4_hw.c
@@ -277,7 +277,7 @@ static void t4_report_fw_error(struct adapter *adap)
 static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
 			 u32 mbox_addr)
 {
-	for ( ; nflit; nflit--, mbox_addr += 8)
+	for (; nflit; nflit--, mbox_addr += 8)
 		*rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
 }
 
@@ -2483,7 +2483,7 @@ int t4_read_flash(struct adapter *adapter, unsigned int addr,
 	if (ret != 0)
 		return ret;
 
-	for ( ; nwords; nwords--, data++) {
+	for (; nwords; nwords--, data++) {
 		ret = sf1_read(adapter, 4, nwords > 1, nwords == 1, data);
 		if (nwords == 1)
 			t4_write_reg(adapter, A_SF_OP, 0);    /* unlock SF */
diff --git i/drivers/net/e1000/igb_flow.c w/drivers/net/e1000/igb_flow.c
index db73b18..f9b32ca 100644
--- i/drivers/net/e1000/igb_flow.c
+++ w/drivers/net/e1000/igb_flow.c
@@ -1160,7 +1160,7 @@ cons_parse_flex_filter(const struct rte_flow_attr *attr,
 
 	i = 0;
 
-	for ( ; shift < CHAR_BIT; shift++) {
+	for (; shift < CHAR_BIT; shift++) {
 		filter->mask[j] |= (0x80 >> shift);
 		i++;
 		if (i == raw_spec->length)
diff --git i/examples/ip_pipeline/cpu_core_map.c w/examples/ip_pipeline/cpu_core_map.c
index 38c5786..45752f7 100644
--- i/examples/ip_pipeline/cpu_core_map.c
+++ w/examples/ip_pipeline/cpu_core_map.c
@@ -235,7 +235,7 @@ cpu_core_map_compute_and_check(struct cpu_core_map *map)
 					return -1;
 			}
 
-		for ( ; core_id < map->n_max_cores_per_socket; core_id++)
+		for (; core_id < map->n_max_cores_per_socket; core_id++)
 			for (ht_id = 0;
 				ht_id < map->n_max_ht_per_core;
 				ht_id++) {
diff --git i/examples/ip_pipeline/parser.c w/examples/ip_pipeline/parser.c
index 689e206..c57d161 100644
--- i/examples/ip_pipeline/parser.c
+++ w/examples/ip_pipeline/parser.c
@@ -380,7 +380,7 @@ parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels)
 	}
 
 	/* At least one label should be present */
-	for ( ; (*string != '\0'); ) {
+	for (; (*string != '\0'); ) {
 		char *next;
 		int value;
 
diff --git i/examples/ip_pipeline/parser.h w/examples/ip_pipeline/parser.h
index 9bd36af..2aa232e 100644
--- i/examples/ip_pipeline/parser.h
+++ w/examples/ip_pipeline/parser.h
@@ -44,7 +44,7 @@
 #define skip_white_spaces(pos)			\
 ({						\
 	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
+	for (; isspace(*_p); _p++)		\
 		;				\
 	_p;					\
 })
diff --git i/examples/ip_pipeline/pipeline/pipeline_actions_common.h w/examples/ip_pipeline/pipeline/pipeline_actions_common.h
index ab08612..aa4c682 100644
--- i/examples/ip_pipeline/pipeline/pipeline_actions_common.h
+++ w/examples/ip_pipeline/pipeline/pipeline_actions_common.h
@@ -53,7 +53,7 @@ f_ah(									\
 	for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)			\
 		f_pkt4_work(&pkts[i], arg);				\
 									\
-	for ( ; i < n_pkts; i++)					\
+	for (; i < n_pkts; i++)					\
 		f_pkt_work(pkts[i], arg);				\
 									\
 	return 0;							\
@@ -75,7 +75,7 @@ f_ah(									\
 	for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)	\
 		f_pkt4_work(&pkts[i], arg);				\
 									\
-	for ( ; i < n_pkts; i++)				\
+	for (; i < n_pkts; i++)				\
 		f_pkt_work(pkts[i], arg);			\
 									\
 	return 0;							\
@@ -97,10 +97,10 @@ f_ah(									\
 		for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)		\
 			f_pkt4_work(&pkts[i], &entries[i], arg);	\
 									\
-		for ( ; i < n_pkts; i++)				\
+		for (; i < n_pkts; i++)				\
 			f_pkt_work(pkts[i], entries[i], arg);		\
 	} else								\
-		for ( ; pkts_in_mask; ) {				\
+		for (; pkts_in_mask; ) {				\
 			uint32_t pos = __builtin_ctzll(pkts_in_mask);	\
 			uint64_t pkt_mask = 1LLU << pos;		\
 									\
@@ -127,10 +127,10 @@ f_ah(									\
 		for (i = 0; i < (n_pkts & (~0x3LLU)); i += 4)		\
 			f_pkt4_work(&pkts[i], entry, arg);		\
 									\
-		for ( ; i < n_pkts; i++)				\
+		for (; i < n_pkts; i++)				\
 			f_pkt_work(pkts[i], entry, arg);		\
 	} else								\
-		for ( ; pkts_in_mask; ) {				\
+		for (; pkts_in_mask; ) {				\
 			uint32_t pos = __builtin_ctzll(pkts_in_mask);	\
 			uint64_t pkt_mask = 1LLU << pos;		\
 									\
@@ -164,13 +164,13 @@ f_ah(									\
 			pkts_out_mask ^= mask << i;			\
 		}							\
 									\
-		for ( ; i < n_pkts; i++) {				\
+		for (; i < n_pkts; i++) {				\
 			uint64_t mask = f_pkt_work(pkts[i],		\
 				entries[i], arg, time);			\
 			pkts_out_mask ^= mask << i;			\
 		}							\
 	} else								\
-		for ( ; pkts_in_mask; ) {				\
+		for (; pkts_in_mask; ) {				\
 			uint32_t pos = __builtin_ctzll(pkts_in_mask);	\
 			uint64_t pkt_mask = 1LLU << pos;		\
 			uint64_t mask = f_pkt_work(pkts[pos],		\
@@ -208,12 +208,12 @@ f_ah(									\
 			pkts_out_mask ^= mask << i;			\
 		}							\
 									\
-		for ( ; i < n_pkts; i++) {				\
+		for (; i < n_pkts; i++) {				\
 			uint64_t mask = f_pkt_work(pkts[i], entry, arg, time);\
 			pkts_out_mask ^= mask << i;			\
 		}							\
 	} else								\
-		for ( ; pkts_in_mask; ) {				\
+		for (; pkts_in_mask; ) {				\
 			uint32_t pos = __builtin_ctzll(pkts_in_mask);	\
 			uint64_t pkt_mask = 1LLU << pos;		\
 			uint64_t mask = f_pkt_work(pkts[pos],		\
diff --git i/examples/ip_pipeline/pipeline/pipeline_common_be.c w/examples/ip_pipeline/pipeline/pipeline_common_be.c
index 347e72b..4831713 100644
--- i/examples/ip_pipeline/pipeline/pipeline_common_be.c
+++ w/examples/ip_pipeline/pipeline/pipeline_common_be.c
@@ -180,7 +180,7 @@ pipeline_msg_req_handle(struct pipeline *p)
 	uint32_t msgq_id;
 
 	for (msgq_id = 0; msgq_id < p->n_msgq; msgq_id++) {
-		for ( ; ; ) {
+		for (; ; ) {
 			struct pipeline_msg_req *req;
 			pipeline_msg_req_handler f_handle;
 
diff --git i/examples/ip_pipeline/pipeline/pipeline_common_fe.c w/examples/ip_pipeline/pipeline/pipeline_common_fe.c
index 7521187..d800911 100644
--- i/examples/ip_pipeline/pipeline/pipeline_common_fe.c
+++ w/examples/ip_pipeline/pipeline/pipeline_common_fe.c
@@ -61,7 +61,7 @@ app_pipeline_track_pktq_out_to_link(struct app_params *app,
 	if (p == NULL)
 		return NULL;
 
-	for ( ; ; ) {
+	for (; ; ) {
 		struct app_pktq_out_params *pktq_out =
 			&p->pktq_out[pktq_out_id];
 
diff --git i/examples/load_balancer/runtime.c w/examples/load_balancer/runtime.c
index e54b785..3983b17 100644
--- i/examples/load_balancer/runtime.c
+++ w/examples/load_balancer/runtime.c
@@ -272,7 +272,7 @@ app_lcore_io_rx(
 		}
 
 		/* Handle the last 1, 2 (when n_mbufs is even) or 3 (when n_mbufs is odd) packets  */
-		for ( ; j < n_mbufs; j += 1) {
+		for (; j < n_mbufs; j += 1) {
 			struct rte_mbuf *mbuf;
 			uint8_t *data;
 			uint32_t worker;
@@ -465,7 +465,7 @@ app_lcore_main_loop_io(void)
 
 	uint8_t pos_lb = app.pos_lb;
 
-	for ( ; ; ) {
+	for (; ; ) {
 		if (APP_LCORE_IO_FLUSH && (unlikely(i == APP_LCORE_IO_FLUSH))) {
 			if (likely(lp->rx.n_nic_queues > 0)) {
 				app_lcore_io_rx_flush(lp, n_workers);
@@ -636,7 +636,7 @@ app_lcore_main_loop_worker(void) {
 	uint32_t bsz_rd = app.burst_size_worker_read;
 	uint32_t bsz_wr = app.burst_size_worker_write;
 
-	for ( ; ; ) {
+	for (; ; ) {
 		if (APP_LCORE_WORKER_FLUSH && (unlikely(i == APP_LCORE_WORKER_FLUSH))) {
 			app_lcore_worker_flush(lp);
 			i = 0;
diff --git i/lib/librte_distributor/rte_distributor.c w/lib/librte_distributor/rte_distributor.c
index 4c09e25..9992e00 100644
--- i/lib/librte_distributor/rte_distributor.c
+++ w/lib/librte_distributor/rte_distributor.c
@@ -347,7 +347,7 @@ release(struct rte_distributor *d, unsigned int wkr)
 		d->in_flight_tags[wkr][i] = d->backlog[wkr].tags[i];
 	}
 	buf->count = i;
-	for ( ; i < RTE_DIST_BURST_SIZE; i++) {
+	for (; i < RTE_DIST_BURST_SIZE; i++) {
 		buf->bufptr64[i] = RTE_DISTRIB_GET_BUF;
 		d->in_flight_tags[wkr][i] = 0;
 	}
diff --git i/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h w/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
index c3a2619..e93c915 100644
--- i/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
+++ w/lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h
@@ -215,7 +215,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n)
 	 * copies was found to be faster than doing 128 and 32 byte copies as
 	 * well.
 	 */
-	for ( ; n >= 256; n -= 256) {
+	for (; n >= 256; n -= 256) {
 		rte_mov256((uint8_t *)dst, (const uint8_t *)src);
 		dst = (uint8_t *)dst + 256;
 		src = (const uint8_t *)src + 256;
diff --git i/lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h w/lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h
index ca9d1dc..e763589 100644
--- i/lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h
+++ w/lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h
@@ -154,7 +154,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n)
 	 * copies was found to be faster than doing 128 and 32 byte copies as
 	 * well.
 	 */
-	for ( ; n >= 256; n -= 256) {
+	for (; n >= 256; n -= 256) {
 		rte_mov256((uint8_t *)dst, (const uint8_t *)src);
 		dst = (uint8_t *)dst + 256;
 		src = (const uint8_t *)src + 256;
diff --git i/lib/librte_ether/rte_ethdev.c w/lib/librte_ether/rte_ethdev.c
index 937f30b..fbd28e5 100644
--- i/lib/librte_ether/rte_ethdev.c
+++ w/lib/librte_ether/rte_ethdev.c
@@ -1817,7 +1817,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
 	for (i = 0; i < count; i++)
 		xstats[i].id = i;
 	/* add an offset to driver-specific stats */
-	for ( ; i < count + xcount; i++)
+	for (; i < count + xcount; i++)
 		xstats[i].id += count;
 
 	return count + xcount;
diff --git i/lib/librte_port/rte_port_ethdev.c w/lib/librte_port/rte_port_ethdev.c
index d5c5fba..8fdb75f 100644
--- i/lib/librte_port/rte_port_ethdev.c
+++ w/lib/librte_port/rte_port_ethdev.c
@@ -202,7 +202,7 @@ send_burst(struct rte_port_ethdev_writer *p)
 			 p->tx_buf, p->tx_buf_count);
 
 	RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -246,13 +246,13 @@ rte_port_ethdev_writer_tx_bulk(void *port,
 			n_pkts);
 
 		RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok);
-		for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
+		for (; n_pkts_ok < n_pkts; n_pkts_ok++) {
 			struct rte_mbuf *pkt = pkts[n_pkts_ok];
 
 			rte_pktmbuf_free(pkt);
 		}
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
@@ -408,7 +408,7 @@ send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p)
 
 	/* We didn't send the packets in maximum allowed attempts */
 	RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -465,7 +465,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port,
 		}
 		send_burst_nodrop(p);
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_fd.c w/lib/librte_port/rte_port_fd.c
index b5b3729..58364cf 100644
--- i/lib/librte_port/rte_port_fd.c
+++ w/lib/librte_port/rte_port_fd.c
@@ -275,7 +275,7 @@ rte_port_fd_writer_tx_bulk(void *port,
 			p->tx_buf[tx_buf_count++] = pkts[i];
 		RTE_PORT_FD_WRITER_STATS_PKTS_IN_ADD(p, n_pkts);
 	} else
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
@@ -412,7 +412,7 @@ send_burst_nodrop(struct rte_port_fd_writer_nodrop *p)
 		void *pkt_data = rte_pktmbuf_mtod(pkt, void*);
 		size_t n_bytes = rte_pktmbuf_data_len(pkt);
 
-		for ( ; n_retries < p->n_retries; n_retries++) {
+		for (; n_retries < p->n_retries; n_retries++) {
 			ssize_t ret;
 
 			ret = write(p->fd, pkt_data, n_bytes);
@@ -460,7 +460,7 @@ rte_port_fd_writer_nodrop_tx_bulk(void *port,
 			p->tx_buf[tx_buf_count++] = pkts[i];
 		RTE_PORT_FD_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts);
 	} else
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_frag.c w/lib/librte_port/rte_port_frag.c
index a00c9ae..a0c1339 100644
--- i/lib/librte_port/rte_port_frag.c
+++ w/lib/librte_port/rte_port_frag.c
@@ -178,7 +178,7 @@ rte_port_ring_reader_frag_rx(void *port,
 	p->n_frags = 0;
 
 	/* Look to "pkts" buffer to get more packets */
-	for ( ; ; ) {
+	for (; ; ) {
 		struct rte_mbuf *pkt;
 		uint32_t n_pkts_to_provide, i;
 		int status;
diff --git i/lib/librte_port/rte_port_kni.c w/lib/librte_port/rte_port_kni.c
index 2515fb2..1aac316 100644
--- i/lib/librte_port/rte_port_kni.c
+++ w/lib/librte_port/rte_port_kni.c
@@ -400,7 +400,7 @@ send_burst_nodrop(struct rte_port_kni_writer_nodrop *p)
 
 	/* We didn't send the packets in maximum allowed attempts */
 	RTE_PORT_KNI_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -456,7 +456,7 @@ rte_port_kni_writer_nodrop_tx_bulk(void *port,
 		}
 		send_burst_nodrop(p);
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_ras.c w/lib/librte_port/rte_port_ras.c
index 415fadd..beee7d7 100644
--- i/lib/librte_port/rte_port_ras.c
+++ w/lib/librte_port/rte_port_ras.c
@@ -170,7 +170,7 @@ send_burst(struct rte_port_ring_writer_ras *p)
 			p->tx_buf_count, NULL);
 
 	RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -274,7 +274,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port,
 				send_burst(p);
 		}
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_ring.c w/lib/librte_port/rte_port_ring.c
index a4e709c..2c62dea 100644
--- i/lib/librte_port/rte_port_ring.c
+++ w/lib/librte_port/rte_port_ring.c
@@ -246,7 +246,7 @@ send_burst(struct rte_port_ring_writer *p)
 			p->tx_buf_count, NULL);
 
 	RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -261,7 +261,7 @@ send_burst_mp(struct rte_port_ring_writer *p)
 			p->tx_buf_count, NULL);
 
 	RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -327,13 +327,13 @@ rte_port_ring_writer_tx_bulk_internal(void *port,
 					(void **)pkts, n_pkts, NULL);
 
 		RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok);
-		for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) {
+		for (; n_pkts_ok < n_pkts; n_pkts_ok++) {
 			struct rte_mbuf *pkt = pkts[n_pkts_ok];
 
 			rte_pktmbuf_free(pkt);
 		}
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
@@ -541,7 +541,7 @@ send_burst_nodrop(struct rte_port_ring_writer_nodrop *p)
 
 	/* We didn't send the packets in maximum allowed attempts */
 	RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -575,7 +575,7 @@ send_burst_mp_nodrop(struct rte_port_ring_writer_nodrop *p)
 
 	/* We didn't send the packets in maximum allowed attempts */
 	RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx);
-	for ( ; nb_tx < p->tx_buf_count; nb_tx++)
+	for (; nb_tx < p->tx_buf_count; nb_tx++)
 		rte_pktmbuf_free(p->tx_buf[nb_tx]);
 
 	p->tx_buf_count = 0;
@@ -661,7 +661,7 @@ rte_port_ring_writer_nodrop_tx_bulk_internal(void *port,
 		else
 			send_burst_nodrop(p);
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_sched.c w/lib/librte_port/rte_port_sched.c
index 9100a19..5b0d3e1 100644
--- i/lib/librte_port/rte_port_sched.c
+++ w/lib/librte_port/rte_port_sched.c
@@ -233,7 +233,7 @@ rte_port_sched_writer_tx_bulk(void *port,
 		nb_tx = rte_sched_port_enqueue(p->sched, pkts, n_pkts);
 		RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - nb_tx);
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_port/rte_port_source_sink.c w/lib/librte_port/rte_port_source_sink.c
index a79f2f6..947174f 100644
--- i/lib/librte_port/rte_port_source_sink.c
+++ w/lib/librte_port/rte_port_source_sink.c
@@ -559,7 +559,7 @@ rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts,
 			uint64_t dump_pkts_mask = pkts_mask;
 			uint32_t pkt_index;
 
-			for ( ; dump_pkts_mask; ) {
+			for (; dump_pkts_mask; ) {
 				pkt_index = __builtin_ctzll(
 					dump_pkts_mask);
 				PCAP_SINK_WRITE_PKT(p, pkts[pkt_index]);
@@ -567,7 +567,7 @@ rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts,
 			}
 		}
 
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_sched/rte_bitmap.h w/lib/librte_sched/rte_bitmap.h
index e487b58..c1a0ac3 100644
--- i/lib/librte_sched/rte_bitmap.h
+++ w/lib/librte_sched/rte_bitmap.h
@@ -500,7 +500,7 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)
 	uint64_t *slab2;
 
 	slab2 = bmp->array2 + bmp->index2;
-	for ( ; bmp->go2; bmp->index2++, slab2++,
+	for (; bmp->go2; bmp->index2++, slab2++,
 			  bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
 		if (*slab2) {
 			*pos = bmp->index2 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2;
diff --git i/lib/librte_table/rte_table_array.c w/lib/librte_table/rte_table_array.c
index cf7be88..0f61da2 100644
--- i/lib/librte_table/rte_table_array.c
+++ w/lib/librte_table/rte_table_array.c
@@ -194,7 +194,7 @@ rte_table_array_lookup(
 				t->entry_size];
 		}
 	} else {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			uint32_t pkt_index = __builtin_ctzll(pkts_mask);
 			uint64_t pkt_mask = 1LLU << pkt_index;
 			struct rte_mbuf *pkt = pkts[pkt_index];
diff --git i/lib/librte_table/rte_table_hash_ext.c w/lib/librte_table/rte_table_hash_ext.c
index e718102..bc6c105 100644
--- i/lib/librte_table/rte_table_hash_ext.c
+++ w/lib/librte_table/rte_table_hash_ext.c
@@ -445,7 +445,7 @@ static int rte_table_hash_ext_lookup_unoptimized(
 
 	__rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
 
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		struct bucket *bkt0, *bkt;
 		struct rte_mbuf *pkt;
 		uint8_t *key;
@@ -912,7 +912,7 @@ static int rte_table_hash_ext_lookup(
 	* Pipeline run
 	*
 	*/
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		pkt30_index = pkt20_index;
 		pkt31_index = pkt21_index;
@@ -1049,7 +1049,7 @@ static int rte_table_hash_ext_lookup_dosig(
 	* Pipeline run
 	*
 	*/
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		pkt30_index = pkt20_index;
 		pkt31_index = pkt21_index;
diff --git i/lib/librte_table/rte_table_hash_key16.c w/lib/librte_table/rte_table_hash_key16.c
index ce057b7..3bc5f76 100644
--- i/lib/librte_table/rte_table_hash_key16.c
+++ w/lib/librte_table/rte_table_hash_key16.c
@@ -920,7 +920,7 @@ rte_table_hash_lookup_key16_lru(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_16 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -962,7 +962,7 @@ rte_table_hash_lookup_key16_lru(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1049,7 +1049,7 @@ rte_table_hash_lookup_key16_lru_dosig(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_16 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1091,7 +1091,7 @@ rte_table_hash_lookup_key16_lru_dosig(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1179,7 +1179,7 @@ rte_table_hash_lookup_key16_ext(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_16 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1219,7 +1219,7 @@ rte_table_hash_lookup_key16_ext(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1284,10 +1284,10 @@ rte_table_hash_lookup_key16_ext(
 
 grind_next_buckets:
 	/* Grind next buckets */
-	for ( ; buckets_mask; ) {
+	for (; buckets_mask; ) {
 		uint64_t buckets_mask_next = 0;
 
-		for ( ; buckets_mask; ) {
+		for (; buckets_mask; ) {
 			uint64_t pkt_mask;
 			uint32_t pkt_index;
 
@@ -1331,7 +1331,7 @@ rte_table_hash_lookup_key16_ext_dosig(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_16 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1371,7 +1371,7 @@ rte_table_hash_lookup_key16_ext_dosig(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1436,10 +1436,10 @@ rte_table_hash_lookup_key16_ext_dosig(
 
 grind_next_buckets:
 	/* Grind next buckets */
-	for ( ; buckets_mask; ) {
+	for (; buckets_mask; ) {
 		uint64_t buckets_mask_next = 0;
 
-		for ( ; buckets_mask; ) {
+		for (; buckets_mask; ) {
 			uint64_t pkt_mask;
 			uint32_t pkt_index;
 
diff --git i/lib/librte_table/rte_table_hash_key32.c w/lib/librte_table/rte_table_hash_key32.c
index 31fe6fd..4b3330a 100644
--- i/lib/librte_table/rte_table_hash_key32.c
+++ w/lib/librte_table/rte_table_hash_key32.c
@@ -850,7 +850,7 @@ rte_table_hash_lookup_key32_lru(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_32 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -891,7 +891,7 @@ rte_table_hash_lookup_key32_lru(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -979,7 +979,7 @@ rte_table_hash_lookup_key32_ext(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_32 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1019,7 +1019,7 @@ rte_table_hash_lookup_key32_ext(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1084,10 +1084,10 @@ rte_table_hash_lookup_key32_ext(
 
 grind_next_buckets:
 	/* Grind next buckets */
-	for ( ; buckets_mask; ) {
+	for (; buckets_mask; ) {
 		uint64_t buckets_mask_next = 0;
 
-		for ( ; buckets_mask; ) {
+		for (; buckets_mask; ) {
 			uint64_t pkt_mask;
 			uint32_t pkt_index;
 
diff --git i/lib/librte_table/rte_table_hash_key8.c w/lib/librte_table/rte_table_hash_key8.c
index 5f0c656..5a61e3d 100644
--- i/lib/librte_table/rte_table_hash_key8.c
+++ w/lib/librte_table/rte_table_hash_key8.c
@@ -880,7 +880,7 @@ rte_table_hash_lookup_key8_lru(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_8 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -921,7 +921,7 @@ rte_table_hash_lookup_key8_lru(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1006,7 +1006,7 @@ rte_table_hash_lookup_key8_lru_dosig(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_8 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1047,7 +1047,7 @@ rte_table_hash_lookup_key8_lru_dosig(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1134,7 +1134,7 @@ rte_table_hash_lookup_key8_ext(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_8 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1174,7 +1174,7 @@ rte_table_hash_lookup_key8_ext(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1239,10 +1239,10 @@ rte_table_hash_lookup_key8_ext(
 
 grind_next_buckets:
 	/* Grind next buckets */
-	for ( ; buckets_mask; ) {
+	for (; buckets_mask; ) {
 		uint64_t buckets_mask_next = 0;
 
-		for ( ; buckets_mask; ) {
+		for (; buckets_mask; ) {
 			uint64_t pkt_mask;
 			uint32_t pkt_index;
 
@@ -1284,7 +1284,7 @@ rte_table_hash_lookup_key8_ext_dosig(
 
 	/* Cannot run the pipeline with less than 5 packets */
 	if (__builtin_popcountll(pkts_mask) < 5) {
-		for ( ; pkts_mask; ) {
+		for (; pkts_mask; ) {
 			struct rte_bucket_4_8 *bucket;
 			struct rte_mbuf *mbuf;
 			uint32_t pkt_index;
@@ -1324,7 +1324,7 @@ rte_table_hash_lookup_key8_ext_dosig(
 	 * Pipeline run
 	 *
 	 */
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		bucket20 = bucket10;
 		bucket21 = bucket11;
@@ -1389,10 +1389,10 @@ rte_table_hash_lookup_key8_ext_dosig(
 
 grind_next_buckets:
 	/* Grind next buckets */
-	for ( ; buckets_mask; ) {
+	for (; buckets_mask; ) {
 		uint64_t buckets_mask_next = 0;
 
-		for ( ; buckets_mask; ) {
+		for (; buckets_mask; ) {
 			uint64_t pkt_mask;
 			uint32_t pkt_index;
 
diff --git i/lib/librte_table/rte_table_hash_lru.c w/lib/librte_table/rte_table_hash_lru.c
index 5a4864e..b24fceb 100644
--- i/lib/librte_table/rte_table_hash_lru.c
+++ w/lib/librte_table/rte_table_hash_lru.c
@@ -374,7 +374,7 @@ static int rte_table_hash_lru_lookup_unoptimized(
 	__rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask);
 	RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(t, n_pkts_in);
 
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		struct bucket *bkt;
 		struct rte_mbuf *pkt;
 		uint8_t *key;
@@ -853,7 +853,7 @@ static int rte_table_hash_lru_lookup(
 	* Pipeline run
 	*
 	*/
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		pkt30_index = pkt20_index;
 		pkt31_index = pkt21_index;
@@ -986,7 +986,7 @@ static int rte_table_hash_lru_lookup_dosig(
 	* Pipeline run
 	*
 	*/
-	for ( ; pkts_mask; ) {
+	for (; pkts_mask; ) {
 		/* Pipeline feed */
 		pkt30_index = pkt20_index;
 		pkt31_index = pkt21_index;
diff --git i/lib/librte_timer/rte_timer.c w/lib/librte_timer/rte_timer.c
index 5ee0840..c21b51d 100644
--- i/lib/librte_timer/rte_timer.c
+++ w/lib/librte_timer/rte_timer.c
@@ -562,7 +562,7 @@ void rte_timer_manage(void)
 	run_first_tim = tim;
 	pprev = &run_first_tim;
 
-	for ( ; tim != NULL; tim = next_tim) {
+	for (; tim != NULL; tim = next_tim) {
 		next_tim = tim->sl_next[0];
 
 		ret = timer_set_running_state(tim);
diff --git i/test/test-pipeline/pipeline_acl.c w/test/test-pipeline/pipeline_acl.c
index 22d5f36..dfd476f 100644
--- i/test/test-pipeline/pipeline_acl.c
+++ w/test/test-pipeline/pipeline_acl.c
@@ -264,7 +264,7 @@ app_main_loop_worker_pipeline_acl(void) {
 
 	/* Run-time */
 #if APP_FLUSH == 0
-	for ( ; ; )
+	for (; ; )
 		rte_pipeline_run(p);
 #else
 	for (i = 0; ; i++) {
diff --git i/test/test-pipeline/pipeline_hash.c w/test/test-pipeline/pipeline_hash.c
index 991e381..0bcaa69 100644
--- i/test/test-pipeline/pipeline_hash.c
+++ w/test/test-pipeline/pipeline_hash.c
@@ -463,7 +463,7 @@ app_main_loop_worker_pipeline_hash(void) {
 
 	/* Run-time */
 #if APP_FLUSH == 0
-	for ( ; ; )
+	for (; ; )
 		rte_pipeline_run(p);
 #else
 	for (i = 0; ; i++) {
diff --git i/test/test-pipeline/pipeline_lpm.c w/test/test-pipeline/pipeline_lpm.c
index ecea6b3..051b43b 100644
--- i/test/test-pipeline/pipeline_lpm.c
+++ w/test/test-pipeline/pipeline_lpm.c
@@ -189,7 +189,7 @@ app_main_loop_worker_pipeline_lpm(void) {
 
 	/* Run-time */
 #if APP_FLUSH == 0
-	for ( ; ; )
+	for (; ; )
 		rte_pipeline_run(p);
 #else
 	for (i = 0; ; i++) {
diff --git i/test/test-pipeline/pipeline_lpm_ipv6.c w/test/test-pipeline/pipeline_lpm_ipv6.c
index 3352e89..9b9709c 100644
--- i/test/test-pipeline/pipeline_lpm_ipv6.c
+++ w/test/test-pipeline/pipeline_lpm_ipv6.c
@@ -187,7 +187,7 @@ app_main_loop_worker_pipeline_lpm_ipv6(void) {
 
 	/* Run-time */
 #if APP_FLUSH == 0
-	for ( ; ; )
+	for (; ; )
 		rte_pipeline_run(p);
 #else
 	for (i = 0; ; i++) {
diff --git i/test/test-pipeline/pipeline_stub.c w/test/test-pipeline/pipeline_stub.c
index ba710ca..0f899b8 100644
--- i/test/test-pipeline/pipeline_stub.c
+++ w/test/test-pipeline/pipeline_stub.c
@@ -151,7 +151,7 @@ app_main_loop_worker_pipeline_stub(void) {
 
 	/* Run-time */
 #if APP_FLUSH == 0
-	for ( ; ; )
+	for (; ; )
 		rte_pipeline_run(p);
 #else
 	for (i = 0; ; i++) {

Best regards,
Tiwei Bie

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-20  5:53   ` Tiwei Bie
@ 2017-07-20  7:13     ` Shreyansh Jain
  0 siblings, 0 replies; 10+ messages in thread
From: Shreyansh Jain @ 2017-07-20  7:13 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: dev, thomas, Van Haaren, Harry

On Thursday 20 July 2017 11:23 AM, Tiwei Bie wrote:
> On Thu, Jul 20, 2017 at 10:34:39AM +0530, Shreyansh Jain wrote:
>> On Wednesday 19 July 2017 02:36 PM, Tiwei Bie wrote:
>>> Remove the unwanted spaces before `;' across DPDK source code
>>> by below one-liner with some minor manual refinements.
>>>
>>> find . -name '*.[ch]' | xargs sed -i 's/\([^;(]\) \+;/\1;/g'
>>>
>>> The fixes for cmdline library are skipped, because it has a
>>> different coding style. It deserves a separate cleanup if
>>> necessary. The fixes for drivers' base code are also skipped
>>> to keep the base code intact.
>>>
>>> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
>>> ---
> [...]
>>>    		/* compute the number of steps to the right */
>>> diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
>>> index 010d752..e487b58 100644
>>> --- a/lib/librte_sched/rte_bitmap.h
>>> +++ b/lib/librte_sched/rte_bitmap.h
>>> @@ -500,7 +500,8 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)
>>>    	uint64_t *slab2;
>>>    	slab2 = bmp->array2 + bmp->index2;
>>> -	for ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
>>> +	for ( ; bmp->go2; bmp->index2++, slab2++,
>>> +			  bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {
>>
>>             ^^^^
>> Trivial: space before ';' in 'for' here should also be removed.
>>
> 
> Thank you for your feedbacks! :-)
> 
> Hmm.. Actually the space between `(' and `;' was kept intentionally
> when I wrote this 's/\([^;(]\) \+;/\1;/g' sed script. There are many
> other such cases. It's acceptable to me, and I thought we like it:

Ok.

> 
> diff --git i/app/test-eventdev/parser.h w/app/test-eventdev/parser.h
> index 75a5a3b..372b85f 100644
> --- i/app/test-eventdev/parser.h
> +++ w/app/test-eventdev/parser.h
> @@ -41,7 +41,7 @@
>   #define skip_white_spaces(pos)			\
>   ({						\
>   	__typeof__(pos) _p = (pos);		\
> -	for ( ; isspace(*_p); _p++)		\
> +	for (; isspace(*_p); _p++)		\
>   		;				\
>   	_p;					\

[...]

That is a long list of change :).
IMO, we should remove the space (in which case I agree with your change) 
- but, this is a more of a acceptable-coding-standards issue and I am 
not sure what the agreed standard for DPDK is in this case. Maybe Thomas 
can comment.

-
Shreyansh

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-19 10:23   ` Tiwei Bie
@ 2017-07-20  7:56     ` Jens Freimann
  2017-07-20  8:32       ` Thomas Monjalon
  0 siblings, 1 reply; 10+ messages in thread
From: Jens Freimann @ 2017-07-20  7:56 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: Van Haaren, Harry, thomas, dev

On Wed, Jul 19, 2017 at 06:23:21PM +0800, Tiwei Bie wrote:
>On Wed, Jul 19, 2017 at 05:24:38PM +0800, Van Haaren, Harry wrote:
[...]
>> Hi Tiwei,
>>
>> Although the idea and motivation for code-cleanup are good, performing
>> large cleanup across a code-base is not a good solution. The reason that
>> these types of cleanups (or even re-formatting the entire codebase) are not
>> performed often is that it "invalidates" any currently-in-progress patch-sets.
>> As a result, more work is required from many contributors to rebase useful
>> features due to across-the-board white-space cleanups.
>>
>> Just expressing concern that we need to think carefully about the impacts
>> of such a patch.
>>
>
>Yeah, I agree. Such patch may cause many conflicts. But this patch
>is almost generated automatically, that is to say, it's a quick work.
>And it's more like some fixes (for the bad coding style) rather than
>silly re-formatting done by `indent'. So I just want to share it with
>the community, and see the potential feedbacks. Thank you for your
>comments! :)

what I'm more concerned about with these kind of huge clean-ups is
that it makes git-blame less useful for me. Next time I want to look
up who changed this line I'll just find your cleanup patch. Then I have
to do another step to find out which commit introduced the change I'm
looking for. 

I'm more for cleaning up these things next time you do a semantic
change in this code.

regards,
Jens

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-20  7:56     ` Jens Freimann
@ 2017-07-20  8:32       ` Thomas Monjalon
  2017-07-20  9:01         ` Tiwei Bie
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2017-07-20  8:32 UTC (permalink / raw)
  To: Jens Freimann, Tiwei Bie; +Cc: Van Haaren, Harry, dev

20/07/2017 10:56, Jens Freimann:
> On Wed, Jul 19, 2017 at 06:23:21PM +0800, Tiwei Bie wrote:
> >On Wed, Jul 19, 2017 at 05:24:38PM +0800, Van Haaren, Harry wrote:
> [...]
> >> Hi Tiwei,
> >>
> >> Although the idea and motivation for code-cleanup are good, performing
> >> large cleanup across a code-base is not a good solution. The reason that
> >> these types of cleanups (or even re-formatting the entire codebase) are not
> >> performed often is that it "invalidates" any currently-in-progress patch-sets.
> >> As a result, more work is required from many contributors to rebase useful
> >> features due to across-the-board white-space cleanups.
> >>
> >> Just expressing concern that we need to think carefully about the impacts
> >> of such a patch.
> >>
> >
> >Yeah, I agree. Such patch may cause many conflicts. But this patch
> >is almost generated automatically, that is to say, it's a quick work.
> >And it's more like some fixes (for the bad coding style) rather than
> >silly re-formatting done by `indent'. So I just want to share it with
> >the community, and see the potential feedbacks. Thank you for your
> >comments! :)
> 
> what I'm more concerned about with these kind of huge clean-ups is
> that it makes git-blame less useful for me. Next time I want to look
> up who changed this line I'll just find your cleanup patch. Then I have
> to do another step to find out which commit introduced the change I'm
> looking for. 
> 
> I'm more for cleaning up these things next time you do a semantic
> change in this code.

+1 for doing clean-up when refactoring code

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

* Re: [dpdk-dev] [PATCH] all: refactor coding style
  2017-07-20  8:32       ` Thomas Monjalon
@ 2017-07-20  9:01         ` Tiwei Bie
  0 siblings, 0 replies; 10+ messages in thread
From: Tiwei Bie @ 2017-07-20  9:01 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Jens Freimann, Van Haaren, Harry, dev

On Thu, Jul 20, 2017 at 11:32:18AM +0300, Thomas Monjalon wrote:
> 20/07/2017 10:56, Jens Freimann:
> > On Wed, Jul 19, 2017 at 06:23:21PM +0800, Tiwei Bie wrote:
> > >On Wed, Jul 19, 2017 at 05:24:38PM +0800, Van Haaren, Harry wrote:
> > [...]
> > > > Hi Tiwei,
> > > >
> > > > Although the idea and motivation for code-cleanup are good, performing
> > > > large cleanup across a code-base is not a good solution. The reason that
> > > > these types of cleanups (or even re-formatting the entire codebase) are not
> > > > performed often is that it "invalidates" any currently-in-progress patch-sets.
> > > > As a result, more work is required from many contributors to rebase useful
> > > > features due to across-the-board white-space cleanups.
> > > >
> > > > Just expressing concern that we need to think carefully about the impacts
> > > > of such a patch.
> > > >
> > >
> > > Yeah, I agree. Such patch may cause many conflicts. But this patch
> > > is almost generated automatically, that is to say, it's a quick work.
> > > And it's more like some fixes (for the bad coding style) rather than
> > > silly re-formatting done by `indent'. So I just want to share it with
> > > the community, and see the potential feedbacks. Thank you for your
> > > comments! :)
> > 
> > what I'm more concerned about with these kind of huge clean-ups is
> > that it makes git-blame less useful for me. Next time I want to look
> > up who changed this line I'll just find your cleanup patch. Then I have
> > to do another step to find out which commit introduced the change I'm
> > looking for. 
> > 
> > I'm more for cleaning up these things next time you do a semantic
> > change in this code.
> 
> +1 for doing clean-up when refactoring code

Hi Jens and Thomas,

I agree with your concerns.

But if you look into this patch, you will find that it's not a
huge cleanup. Actually in this patch, although the file list is
long, there are only 69 lines are changed (across the whole DPDK
source code), and only 1 new line is added. The changes in each
file are very minimal. I don't think it will destroy the useful
info you need in git-blame.

I definitely agree that it would be perfect to clean-up the code
when you need to do a semantic change in this code. But you will
also find that it's very possible that you won't need to do a
semantic change to these code for a very long time. And much of
the changed code in this patch is old code. I think the new code
for DPDK has much better quality than before. It's really annoying
(at least to me) each time come across those bad code. :-(

Thank you for sharing your thoughts! :-)

Best regards,
Tiwei Bie 

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

end of thread, other threads:[~2017-07-20  9:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19  9:06 [dpdk-dev] [PATCH] all: refactor coding style Tiwei Bie
2017-07-19  9:24 ` Van Haaren, Harry
2017-07-19 10:23   ` Tiwei Bie
2017-07-20  7:56     ` Jens Freimann
2017-07-20  8:32       ` Thomas Monjalon
2017-07-20  9:01         ` Tiwei Bie
2017-07-19 10:45 ` Trahe, Fiona
2017-07-20  5:04 ` Shreyansh Jain
2017-07-20  5:53   ` Tiwei Bie
2017-07-20  7:13     ` Shreyansh Jain

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).