DPDK usage discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Alan Beadle <ab.beadle@gmail.com>
Cc: users@dpdk.org
Subject: Re: Multiprocess App Problems with tx_burst
Date: Sun, 5 Jan 2025 01:01:48 +0300	[thread overview]
Message-ID: <20250105010148.1ef26333@sovereign> (raw)
In-Reply-To: <CANTAOdyE2=a7XvteRCDv-uLd-rUEDRpZAMjXmaGOvH6cVfYwFw@mail.gmail.com>

2025-01-04 14:16 (UTC-0500), Alan Beadle:
> I am setting up one tx queue and one rx queue via the primary process
> init code. The code here resembles the "basic forwarding" sample
> application (in the skeleton/ subdir). Please let me know whether it
> would be possible for each process to use entirely separate queues and
> still pass mbuf pointers around.

It is possible. Mbufs are in memory shared by all processes.
For example, the primary process can setup 2 Rx queues:
to use queue 0 by itself, and to let the secondary process use queue 1.
Steering incoming packets to the right queue (of set of queues)
would be another question, however.

> I will explain the processes and lcores below. First of all though, my
> application uses several types of packets. There are handshake packets
> (acknacks and the like) and data packets. The data packets are
> addressed to specific subsets of my secondary processes (for now just
> 1 or 2 secondary processes exist per machine, but support for even
> more is in principle part of my design). Sometimes the data should
> also be read by other peer processes on the same machine (including
> the daemon/primary process) so I chose to make the mbufs readable
> instead of allocating a duplicate local buffer. It is important that
> mbuf pointers from one process will work in the others. Otherwise all
> of my data would need to be duplicated into non-dpdk shared buffers
> too.
> 
> The first process is the "daemon". This is the primary process. It
> uses DPDK through my shared library (which uses DPDK internally, as
> explained above). The daemon just polls the NIC and periodically
> cleans up my non-DPDK data structures in shared memory. The intent is
> to rely on the daemon to watch for packets during periods of low
> activity and avoid unnecessary CPU usage. When a packet arrives it can
> wake the correct secondary process by finding a futex in shared memory
> for that process. On both machines the daemon is mapped to core 2 with
> the parameter "-l 2".
> 
> The second process is the "server". It uses separate app code from the
> daemon but calls into the same library. Like the daemon, it receives
> and parses packets. The server can originate new data packets, and can
> also reply to inbound data packets with more data packets to be sent
> back to processes on the other machine. It sleeps on a shared futex
> during periods of inactivity. If there were additional secondary
> processes (as is the case on the other machine) it could wake them
> when packets arrive for those other processes, again using futexes in
> shared memory. On both machines this second process is mapped to core
> 4 with the parameter "-l 4".
> 
> The other machine has another secondary process (a third process)
> which is on core 6 with "-l 6". For the purposes of this discussion,
> it behaves similarly to the server process above (sends, receives, and
> sometime sleeps).

So, "deamon" and "server" may try using the same queue sometimes, correct?
Synchronizing all access to the single queue should work in this case.

BTW, rte_eth_tx_burst() returning >0 does not mean the packets have been sent.
It only means they have been enqueued for sending.
At some point the NIC will complete sending,
only then the PMD can free the mbuf (or decrement its reference count).
For most PMDs, this happens on a subsequent call to rte_eth_tx_burst().
Which PMD and HW is it?
Have you tried to print as many stats as possible when rte_eth_tx_burst()
can't consume all packets (rte_eth_stats_get(), rte_eth_xstats_get())?

  reply	other threads:[~2025-01-04 22:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-31 17:49 Alan Beadle
2025-01-04 16:22 ` Alan Beadle
2025-01-04 18:40   ` Dmitry Kozlyuk
2025-01-04 19:16     ` Alan Beadle
2025-01-04 22:01       ` Dmitry Kozlyuk [this message]
2025-01-05 16:01         ` Alan Beadle
2025-01-06 16:05           ` Alan Beadle
2025-01-06 20:10             ` Dmitry Kozlyuk
2025-01-06 20:34               ` Alan Beadle
2025-01-07 16:09                 ` Alan Beadle

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=20250105010148.1ef26333@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=ab.beadle@gmail.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).