[v2] examples/eventdev_producer_consumer: fix 32-bit checkpatch issues

Message ID 20220822192651.3197685-1-timothy.mcdaniel@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] examples/eventdev_producer_consumer: fix 32-bit checkpatch issues |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure

Commit Message

Timothy McDaniel Aug. 22, 2022, 7:26 p.m. UTC
  Fixed style and format issues, primarily those involving data types
whose size varies depending on whether we are building for 32 or
64 bit platforms.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 examples/eventdev_producer_consumer/main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
  

Patch

diff --git a/examples/eventdev_producer_consumer/main.c b/examples/eventdev_producer_consumer/main.c
index 54a550b459..164bdf6f74 100644
--- a/examples/eventdev_producer_consumer/main.c
+++ b/examples/eventdev_producer_consumer/main.c
@@ -21,7 +21,7 @@ 
 
 static unsigned int num_workers = 4;
 static bool g_is_mbuf;
-static unsigned long num_packets = (1L << 25); /* do ~32M packets */
+static uint64_t num_packets = (1L << 25); /* do ~32M packets */
 static int sched_type = RTE_SCHED_TYPE_ATOMIC;
 
 struct prod_data {
@@ -51,13 +51,13 @@  static struct rte_mempool *mp;
 static int
 worker(void *arg)
 {
-	struct rte_event rcv_events[BATCH_SIZE] = {0};
+	struct rte_event rcv_events[BATCH_SIZE];
 
 	struct worker_data *data = (struct worker_data *)arg;
 	uint8_t event_dev_id = data->event_dev_id;
 	uint8_t event_port_id = data->event_port_id;
 	int32_t qid = data->qid;
-	size_t sent = 0, received = 0;
+	uint64_t sent = 0, received = 0;
 	uint16_t n;
 
 	if (!quiet)
@@ -83,7 +83,7 @@  worker(void *arg)
 			rte_pause();
 			continue;
 		} else if (!quiet)
-			printf("Worker received %d events (%zu total)\n",
+			printf("Worker received %d events(%"PRIu64" total)\n",
 			       n, received);
 
 		delay_start = rte_rdtsc();
@@ -113,7 +113,7 @@  worker(void *arg)
 	} /* while (!done) */
 
 	if (!quiet)
-		printf("%s %d thread done. RX=%zu TX=%zu\n",
+		printf("%s %d thread done. RX= %"PRIu64" TX= %"PRIu64"\n",
 			__func__, rte_lcore_id(), received, sent);
 
 	return 0;
@@ -122,7 +122,7 @@  worker(void *arg)
 static int
 consumer(void *arg)
 {
-	struct rte_event events[BATCH_SIZE] = {0};
+	struct rte_event events[BATCH_SIZE];
 	struct cons_data *data = (struct cons_data *)arg;
 	uint8_t event_dev_id = data->event_dev_id;
 	uint8_t event_port_id = data->event_port_id;
@@ -165,7 +165,7 @@  consumer(void *arg)
 	printf("deq_end = %"PRIu64", deq_start = %"PRIu64"\n",
 	       deq_end, deq_start);
 
-	printf("Consumer done! RX=%zu, time %"PRIu64"ms\n",
+	printf("Consumer done! RX=%"PRIu64", time %"PRIu64"ms\n",
 	       num_packets,
 	       (rte_get_timer_cycles() - start_time) / freq_khz);
 	done = 1;
@@ -188,7 +188,7 @@  producer(void *arg)
 	uint64_t enq_start, enq_end;
 	int k = 0;
 	struct rte_mbuf *m;
-	struct rte_event producer_events[BATCH_SIZE] = {0};
+	struct rte_event producer_events[BATCH_SIZE];
 	struct rte_event *ev = &producer_events[0];
 	int l = 0;
 	struct rte_mbuf *mbufs[BATCH_SIZE];
@@ -263,7 +263,7 @@  producer(void *arg)
 
 	printf("Producer done. %"PRIu64" packets sent in %"PRIu64" cycles"
 	       "(%f cycles/evt) (%f pkts/sec)\n",
-	       num_packets, enq_end-enq_start,
+	       num_packets, enq_end - enq_start,
 	       (float)(enq_end - enq_start)/(float)num_packets,
 	       (float) (num_packets * rte_get_timer_hz()) /
 	       (float) (enq_end - enq_start));