DPDK patches and discussions
 help / color / mirror / Atom feed
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: jerinj@marvell.com
Cc: mdr@ashroe.eu, thomas@monjalon.net, dev@dpdk.org
Subject: [PATCH v2] examples/eventdev_producer_consumer: fix 32-bit checkpatch issues
Date: Mon, 22 Aug 2022 14:26:51 -0500	[thread overview]
Message-ID: <20220822192651.3197685-1-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <20220818170204.1885568-1-timothy.mcdaniel@intel.com>

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

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));
-- 
2.25.1


  reply	other threads:[~2022-08-22 19:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 17:02 [PATCH] examples: add eventdev_producer_consumer example Timothy McDaniel
2022-08-22 19:26 ` Timothy McDaniel [this message]
2022-08-22 20:04 ` [PATCH v3] " Timothy McDaniel
2022-08-22 20:51 ` [PATCH v4] " Timothy McDaniel
2022-08-27 11:57   ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220822192651.3197685-1-timothy.mcdaniel@intel.com \
    --to=timothy.mcdaniel@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=mdr@ashroe.eu \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).