From: Philipp Beyer <pbeyer@voipfuture.com>
To: users@dpdk.org
Subject: [dpdk-users] Beginners question: rte_eth_tx_burst, rte_mbuf access synchronization
Date: Fri, 11 Nov 2016 10:49:22 +0100 [thread overview]
Message-ID: <750170fd-492a-588c-de6a-27c0547d1cbd@voipfuture.com> (raw)
Hi!
I am just writing my first code using dpdk, a traffic generator, for
which I started with the l2fwd example.
Basically, I need to send the same packet over a single interface, over
an over again, with single bytes changed each time.
I use rte_eth_tx_burst to send 16 packets at once. As I want to re-use
the same buffers in a very simple way, I just increment the refcnt
accordingly.
My current code prepares all 16 buffers, calls rte_eth_tx_burst until
all 16 packets are stored in the transmit ring, and starts over again,
adjusting the buffers to send the next 16 packets.
Currently I observe duplicate packets, although every packet should be
individual due to single byte adjustments.
My current problem is, as I guess, that rte_eth_tx_burst does not
synchnolously transmit the count of packets, which is returned to the
caller, but just stores them in transmit queue. So, I am not allowed to
instantly re-use these buffers again.
My question is: How do I know when to re-use buffers passed to
rte_eth_tx_burst. Of course, I can check their refcnt member, and this
would be perfectly fine. Apparently, I should have at least BURST_SIZE*2
buffers, passing BURST_SIZE buffers at once, so I can manipulate one set
of buffers while the other is transmitted. But I am missing the idea of
the best synchronization scheme here: How should I wait on this refcnt
to drop?
Some blind guessing:
If I take the documentation of rte_eth_tx_burst literally, I could get
the idea that refcounts of buffers are only decreased (buffers are
'freed'), while rte_eth_tx_burst is executed, but one function call
might free buffers used by previous function calls. If this is correct,
I still do not see a complete synchronization scheme. There is still a
chance that I end up without any buffers left, which means I do not have
a chance to call rte_eth_tx_burst again to free buffers.
Thanks for any help,
Philipp
next reply other threads:[~2016-11-11 9:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-11 9:49 Philipp Beyer [this message]
2016-11-11 12:35 ` Anupam Kapoor
2016-11-11 13:09 ` Philipp Beyer
2016-11-11 13:45 ` Matt Laswell
2016-11-11 14:06 ` Philipp Beyer
[not found] ` <9754A038-DB66-417F-8958-2DDDE317E7A2@net.in.tum.de>
2016-11-11 14:16 ` Paul Emmerich
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=750170fd-492a-588c-de6a-27c0547d1cbd@voipfuture.com \
--to=pbeyer@voipfuture.com \
--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).