From patchwork Thu Jul 20 05:53:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiwei Bie X-Patchwork-Id: 27072 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 050042C55; Thu, 20 Jul 2017 07:52:12 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 61C0329C8 for ; Thu, 20 Jul 2017 07:52:09 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2017 22:52:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,382,1496127600"; d="scan'208";a="995004517" Received: from debian-zgviawfucg.sh.intel.com (HELO debian-ZGViaWFuCg) ([10.67.104.212]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2017 22:52:06 -0700 Date: Thu, 20 Jul 2017 13:53:10 +0800 From: Tiwei Bie To: Shreyansh Jain Cc: dev@dpdk.org, thomas@monjalon.net, "Van Haaren, Harry" Message-ID: <20170720055309.GA975@debian-ZGViaWFuCg> References: <1500455196-182365-1-git-send-email-tiwei.bie@intel.com> <39182ae5-d8e1-f84a-6701-2732dfbfdb5f@nxp.com> MIME-Version: 1.0 Content-Disposition: attachment In-Reply-To: <39182ae5-d8e1-f84a-6701-2732dfbfdb5f@nxp.com> User-Agent: Mutt/1.7.2 (2016-11-26) Subject: Re: [dpdk-dev] [PATCH] all: refactor coding style X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > > --- [...] > > /* 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: Best regards, Tiwei Bie 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++) {