all: refactor coding style
Subsystems (3)
PATCH 1/1 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.
--- 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(-)
app/test-pmd/testpmd.h +2 -2
@@ -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
drivers/crypto/qat/qat_adf/icp_qat_fw.h +1 -1
@@ -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))
drivers/event/dpaa2/dpaa2_eventdev.c +1 -1
@@ -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,
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +1 -1
@@ -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;
drivers/net/bnx2x/bnx2x.c +2 -1
@@ -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;
drivers/net/bnx2x/elink.h +1 -1
@@ -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;
drivers/net/e1000/igb_pf.c +1 -1
@@ -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 */
drivers/net/ena/ena_ethdev.c +2 -2
@@ -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))
drivers/net/qede/qede_ethdev.c +1 -1
@@ -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; }
drivers/net/vhost/rte_eth_vhost.c +1 -1
@@ -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 ]++;
drivers/net/virtio/virtio_rxtx.c +2 -2
@@ -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]);
drivers/net/xenvirt/rte_eth_xenvirt.c +2 -2
@@ -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]); }
drivers/net/xenvirt/rte_xen_lib.c +1 -1
@@ -402,7 +402,7 @@ grant_node_create(uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, charif (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 ));
drivers/net/xenvirt/virtqueue.h +1 -1
@@ -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;
examples/ip_pipeline/cpu_core_map.c +2 -2
@@ -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++) {
examples/multi_process/l2fwd_fork/main.c +1 -1
@@ -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 ;
examples/netmap_compat/lib/compat_netmap.c +1 -1
@@ -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);
examples/performance-thread/l3fwd-thread/main.c +1 -1
@@ -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)
examples/qos_sched/app_thread.c +1 -1
@@ -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 ;
examples/quota_watermark/qw/main.c +1 -1
@@ -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) {
examples/vhost_xen/xenstore_parse.c +1 -2
@@ -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 ;
lib/librte_distributor/rte_distributor.c +6 -6
@@ -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,
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
@@ -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 */
lib/librte_eal/linuxapp/eal/eal_xen_memory.c +1 -1
@@ -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];
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +2 -2
@@ -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 ;
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c +1 -1
@@ -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 */
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.c +1 -1
@@ -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;
lib/librte_ether/rte_ethdev.c +1 -1
@@ -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; }
lib/librte_sched/rte_approx.c +4 -4
@@ -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 */
lib/librte_sched/rte_bitmap.h +2 -1
@@ -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;
test/test/test_cryptodev.c +1 -1
@@ -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,
test/test/test_cryptodev_perf.c +13 -13
@@ -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]); }
test/test/test_eventdev_sw.c +1 -1
@@ -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",
test/test/test_malloc.c +2 -2
@@ -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" );
test/test/test_memory.c +1 -1
@@ -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++) {
test/test/test_mempool.c +1 -1
@@ -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 ; }/*
test/test/test_ring.c +2 -4
@@ -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 */
test/test/test_table_acl.c +1 -1
@@ -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]);
test/test/test_table_pipeline.c +1 -1
@@ -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]);
Signature · 1 line
2.7.4
Quoted 9 lines
From: dev [mailto:[email protected]] On Behalf Of Tiwei Bie
Sent: Wednesday, July 19, 2017 10:07 AM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] all: refactor coding styleRemove the unwanted spaces before `;' across DPDK source code by below one-liner with some minor manual refinements.
Quoted 8 lines
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 <[email protected]>
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
Quoted 27 lines · Harry
Quoted 9 lines
From: dev [mailto:[email protected]] On Behalf Of Tiwei Bie
Sent: Wednesday, July 19, 2017 10:07 AM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] all: refactor coding styleRemove the unwanted spaces before `;' across DPDK source code by below one-liner with some minor manual refinements.
Quoted 8 lines
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 <[email protected]>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.
Quoted 3 lines
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
Quoted 1 line · Tiwei Bie
On Wed, Jul 19, 2017 at 05:24:38PM +0800, Van Haaren, Harry wrote:
[...]
Quoted 13 lines
Quoted 9 lines
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.
Quoted 3 lines
Just expressing concern that we need to think carefully about the impacts of such a patch.
Quoted 6 lines
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
20/07/2017 10:56, Jens Freimann:
Quoted 23 lines · Tiwei Bie
Quoted 1 line · Harry
[...]
Quoted 13 lines
Quoted 9 lines
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.
Quoted 3 lines
Just expressing concern that we need to think carefully about the impacts of such a patch.
Quoted 6 lines
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! :)
Quoted 8 lines
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
Quoted 30 lines · Thomas Monjalon
20/07/2017 10:56, Jens Freimann:
Quoted 29 lines · Tiwei Bie
Quoted 1 line · Harry
[...]
Quoted 13 lines
Quoted 9 lines
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.
Quoted 3 lines
Just expressing concern that we need to think carefully about the impacts of such a patch.
Quoted 6 lines
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.
Quoted 4 lines
Quoted 2 lines
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
Quoted 12 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Tiwei Bie
Sent: Wednesday, July 19, 2017 10:07 AM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] all: refactor coding styleRemove the unwanted spaces before `;' across DPDK source code by below one-liner with some minor manual refinements.
Quoted 8 lines
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 <[email protected]>
Quoted 44 lines · Tiwei Bie
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 <[email protected]>--- 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 +++++++++++-----------
Quoted 9 lines
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.
lib/librte_sched/rte_bitmap.h __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) · line 504
Quoted 12 lines
/* compute the number of steps to the right */
lib/librte_sched/rte_bitmap.h +2
-1@@ -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):
Quoted 13 lines · Shreyansh Jain
Quoted 12 lines · Tiwei Bie
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 <[email protected]>---
[...]
Quoted 13 lines
lib/librte_sched/rte_bitmap.h __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) · line 503
Quoted 11 lines
/* compute the number of steps to the right */
lib/librte_sched/rte_bitmap.h +2
-1@@ -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 ) {^^^^
Quoted 2 lines
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:
app/test-eventdev/parser.h +1 -1
@@ -41,7 +41,7 @@#define skip_white_spaces (pos) \ ({ \ __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ + for (; isspace(*_p); _p++) \ ; \ _p; \ })
app/test-eventdev/test_perf_common.c +1 -1
@@ -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;
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
@@ -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]; } }
drivers/net/cxgbe/base/t4_hw.c +2 -2
@@ -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 */
drivers/net/e1000/igb_flow.c +1 -1
@@ -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)
examples/ip_pipeline/cpu_core_map.c +1 -1
@@ -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++) {
examples/ip_pipeline/parser.c +1 -1
@@ -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;
examples/ip_pipeline/parser.h +1 -1
@@ -44,7 +44,7 @@#define skip_white_spaces (pos) \ ({ \ __typeof__(pos) _p = (pos); \ - for ( ; isspace(*_p); _p++) \ + for (; isspace(*_p); _p++) \ ; \ _p; \ })
examples/ip_pipeline/pipeline/pipeline_actions_common.h +10 -10
@@ -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], \
examples/ip_pipeline/pipeline/pipeline_common_be.c +1 -1
@@ -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;
examples/ip_pipeline/pipeline/pipeline_common_fe.c +1 -1
@@ -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];
examples/load_balancer/runtime.c +3 -3
@@ -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 ;
lib/librte_distributor/rte_distributor.c +1 -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 ; }
lib/librte_eal/common/include/arch/arm/rte_memcpy_32.h +1 -1
@@ -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 ;
lib/librte_eal/common/include/arch/ppc_64/rte_memcpy.h +1 -1
@@ -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 ;
lib/librte_ether/rte_ethdev.c +1 -1
@@ -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;
lib/librte_port/rte_port_ethdev.c +5 -5
@@ -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];
lib/librte_port/rte_port_fd.c +3 -3
@@ -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];
lib/librte_port/rte_port_frag.c +1 -1
@@ -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;
lib/librte_port/rte_port_kni.c +2 -2
@@ -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];
lib/librte_port/rte_port_ras.c +2 -2
@@ -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];
lib/librte_port/rte_port_ring.c +7 -7
@@ -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];
lib/librte_port/rte_port_sched.c +1 -1
@@ -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];
lib/librte_port/rte_port_source_sink.c +2 -2
@@ -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];
lib/librte_sched/rte_bitmap.h +1 -1
@@ -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 ;
lib/librte_table/rte_table_array.c +1 -1
@@ -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];
lib/librte_table/rte_table_hash_ext.c +3 -3
@@ -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;
lib/librte_table/rte_table_hash_key16.c +12 -12
@@ -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;
lib/librte_table/rte_table_hash_key32.c +6 -6
@@ -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;
lib/librte_table/rte_table_hash_key8.c +12 -12
@@ -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;
lib/librte_table/rte_table_hash_lru.c +3 -3
@@ -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;
lib/librte_timer/rte_timer.c +1 -1
@@ -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);
test/test-pipeline/pipeline_acl.c +1 -1
@@ -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++) {
test/test-pipeline/pipeline_hash.c +1 -1
@@ -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++) {
test/test-pipeline/pipeline_lpm.c +1 -1
@@ -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++) {
test/test-pipeline/pipeline_lpm_ipv6.c +1 -1
@@ -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++) {
test/test-pipeline/pipeline_stub.c +1 -1
@@ -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
Quoted 31 lines · Tiwei Bie
Quoted 13 lines · Shreyansh Jain
Quoted 12 lines · Tiwei Bie
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 <[email protected]>---
[...]
Quoted 13 lines
lib/librte_sched/rte_bitmap.h __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab) · line 503
Quoted 11 lines
/* compute the number of steps to the right */lib/librte_sched/rte_bitmap.h +2
-1@@ -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 ) {^^^^Quoted 2 lines
Trivial: space before ';' in 'for' here should also be removed.
Quoted 5 lines
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.
app/test-eventdev/parser.h line 46
Quoted 13 lines
app/test-eventdev/parser.h +1
-1@@ -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