DPDK usage discussions
 help / color / mirror / Atom feed
From: Omer Yamac <omer.yamac@ceng.metu.edu.tr>
To: users@dpdk.org
Subject: rte_ring_enqueue_burst enqueue single packet for each call
Date: Fri, 15 Jul 2022 14:34:26 +0300	[thread overview]
Message-ID: <28b48411ea7657cce854dc3cc1cf98c8@ceng.metu.edu.tr> (raw)

Hi All,

I was working on passive traffic application. That means I receive 
packets but I transmit nothing. So I have two core one for the capture 
packet and one for the processing packet. In my case, Worker thread 
(processing packet) is much slower than the capturing packet. I just 
want to test this case and to see what happens if the number of enqueue 
operation is much higher than the dequeue operation.

I realize that I got a segmentation fault if I enqueue packets one by 
one. Do I miss some point? Why "rte_ring_enqueue_burst" function behaves 
differently? Any Idea

Here are the loops of cores:

Capture core loop:
while (!quit_signal_rx) {
	const uint16_t nb_rx = rte_eth_rx_burst(0, 0, bufs,BURST_SIZE);
	uint16_t sent = 0;

	// following line seg fault
	for (size_t i = 0; i < nb_rx; i++)
	   sent += rte_ring_enqueue_burst(out_ring, (void *)&bufs[i], 1, NULL);

	// Works perfectly
	//sent = rte_ring_enqueue_burst(out_ring, (void *)bufs, nb_rx, NULL);

	if(nb_rx - sent != 0)
		rte_pktmbuf_free_bulk(&bufs[sent],nb_rx - sent);
}


Worker core loop:
while (!quit_signal_work) {
	const uint16_t num = rte_ring_dequeue_burst(in_r,
				(void *)bufs, BURST_SIZE*1, NULL);
	/* Do a little bit of work for each packet */
	for (i = 0; i < num; i++) {
		uint64_t t = rte_rdtsc()+100000;
		while (rte_rdtsc() < t)
			rte_pause();
	}

	rte_pktmbuf_free_bulk(bufs,num);
}

                 reply	other threads:[~2022-07-15 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=28b48411ea7657cce854dc3cc1cf98c8@ceng.metu.edu.tr \
    --to=omer.yamac@ceng.metu.edu.tr \
    --cc=users@dpdk.org \
    /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).