DPDK usage discussions
 help / color / mirror / Atom feed
* multi-process support: how to share THE SAME packet between two different processes
@ 2022-11-25 16:27 ikuzar RABE
  2022-11-25 17:09 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: ikuzar RABE @ 2022-11-25 16:27 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hi all,

I would like to know how do you usually proceed to retrieve and share the
same packet read from NIC port between two different processes ? I try to
work in zero-copy way.

The first process job consists in parsing the packet and make some protocol
statistics. The second one dumps the same packet into pcap file for further
analysis with wireshark for example.

I think none of the cases exposed here corresponds to my need: 43.
Multi-process Support — Data Plane Development Kit 22.11.0-rc4
documentation (dpdk.org)
<https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html#:~:text=Standalone%20DPDK%20processes%20are%20primary,process%20with%20same%20DPDK%20version.>.
Am I wrong ?

is there a dpdk-compliant way to do it with threads instead of processes ?

Thank you for your help.

Regards,

ikuzar

[-- Attachment #2: Type: text/html, Size: 1024 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: multi-process support: how to share THE SAME packet between two different processes
  2022-11-25 16:27 multi-process support: how to share THE SAME packet between two different processes ikuzar RABE
@ 2022-11-25 17:09 ` Stephen Hemminger
  2022-11-28 14:10   ` ikuzar RABE
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2022-11-25 17:09 UTC (permalink / raw)
  To: ikuzar RABE; +Cc: users

On Fri, 25 Nov 2022 17:27:46 +0100
ikuzar RABE <ikuzar9295@gmail.com> wrote:

> Hi all,
> 
> I would like to know how do you usually proceed to retrieve and share the
> same packet read from NIC port between two different processes ? I try to
> work in zero-copy way.
> 
> The first process job consists in parsing the packet and make some protocol
> statistics. The second one dumps the same packet into pcap file for further
> analysis with wireshark for example.
> 
> I think none of the cases exposed here corresponds to my need: 43.
> Multi-process Support — Data Plane Development Kit 22.11.0-rc4
> documentation (dpdk.org)
> <https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html#:~:text=Standalone%20DPDK%20processes%20are%20primary,process%20with%20same%20DPDK%20version.>.
> Am I wrong ?
> 
> is there a dpdk-compliant way to do it with threads instead of processes ?
> 
> Thank you for your help.
> 
> Regards,
> 
> ikuzar

Use a ring buffer.
Why are you reinventing what the pdump library does?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: multi-process support: how to share THE SAME packet between two different processes
  2022-11-25 17:09 ` Stephen Hemminger
@ 2022-11-28 14:10   ` ikuzar RABE
  2022-11-28 17:16     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: ikuzar RABE @ 2022-11-28 14:10 UTC (permalink / raw)
  To: stephen; +Cc: users

[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]

In this case:  9. DPDK packet capture libraries and tools — Data Plane
Development Kit 22.11.0 documentation
<https://doc.dpdk.org/guides/howto/packet_capture_framework.html>, which
process is responsible of deallocing the memory occupied by a packet ? the
primary process or the dpdk-dumpcap tool process ?
if one process deallocates a memory, the second one will point to nothing...

ikuzar

i

Le ven. 25 nov. 2022 à 18:09, Stephen Hemminger <stephen@networkplumber.org>
a écrit :

> On Fri, 25 Nov 2022 17:27:46 +0100
> ikuzar RABE <ikuzar9295@gmail.com> wrote:
>
> > Hi all,
> >
> > I would like to know how do you usually proceed to retrieve and share the
> > same packet read from NIC port between two different processes ? I try to
> > work in zero-copy way.
> >
> > The first process job consists in parsing the packet and make some
> protocol
> > statistics. The second one dumps the same packet into pcap file for
> further
> > analysis with wireshark for example.
> >
> > I think none of the cases exposed here corresponds to my need: 43.
> > Multi-process Support — Data Plane Development Kit 22.11.0-rc4
> > documentation (dpdk.org)
> > <
> https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html#:~:text=Standalone%20DPDK%20processes%20are%20primary,process%20with%20same%20DPDK%20version
> .>.
> > Am I wrong ?
> >
> > is there a dpdk-compliant way to do it with threads instead of processes
> ?
> >
> > Thank you for your help.
> >
> > Regards,
> >
> > ikuzar
>
> Use a ring buffer.
> Why are you reinventing what the pdump library does?
>

[-- Attachment #2: Type: text/html, Size: 2420 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: multi-process support: how to share THE SAME packet between two different processes
  2022-11-28 14:10   ` ikuzar RABE
@ 2022-11-28 17:16     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2022-11-28 17:16 UTC (permalink / raw)
  To: ikuzar RABE; +Cc: users

On Mon, 28 Nov 2022 15:10:39 +0100
ikuzar RABE <ikuzar9295@gmail.com> wrote:

> In this case:  9. DPDK packet capture libraries and tools — Data Plane
> Development Kit 22.11.0 documentation
> <https://doc.dpdk.org/guides/howto/packet_capture_framework.html>, which
> process is responsible of deallocing the memory occupied by a packet ? the
> primary process or the dpdk-dumpcap tool process ?
> if one process deallocates a memory, the second one will point to nothing...
> 
> ikuzar
> 
> i
> 
> Le ven. 25 nov. 2022 à 18:09, Stephen Hemminger <stephen@networkplumber.org>
> a écrit :
> 
> > On Fri, 25 Nov 2022 17:27:46 +0100
> > ikuzar RABE <ikuzar9295@gmail.com> wrote:
> >  
> > > Hi all,
> > >
> > > I would like to know how do you usually proceed to retrieve and share the
> > > same packet read from NIC port between two different processes ? I try to
> > > work in zero-copy way.
> > >
> > > The first process job consists in parsing the packet and make some  
> > protocol  
> > > statistics. The second one dumps the same packet into pcap file for  
> > further  
> > > analysis with wireshark for example.
> > >
> > > I think none of the cases exposed here corresponds to my need: 43.
> > > Multi-process Support — Data Plane Development Kit 22.11.0-rc4
> > > documentation (dpdk.org)
> > > <  
> > https://doc.dpdk.org/guides/prog_guide/multi_proc_support.html#:~:text=Standalone%20DPDK%20processes%20are%20primary,process%20with%20same%20DPDK%20version  
> > .>.
> > > Am I wrong ?
> > >
> > > is there a dpdk-compliant way to do it with threads instead of processes  
> > ?  
> > >
> > > Thank you for your help.
> > >
> > > Regards,
> > >
> > > ikuzar  
> >
> > Use a ring buffer.
> > Why are you reinventing what the pdump library does?
> >  

Please do not top quote on mailing lists.

The DPDK uses the concept of packet ownership (like BSD and Linux kernels).
The mbuf is allocated by the receiving poll mode driver and returned by the rx_burst call.
At that point ownership is in the application.
The application may:

   - free the mbuf immediately
   - pass it to a driver transmit; this passes ownership to the PMD
   - enqueue it in a ring or other mechanism; this passes ownership to the ring reader

The owner, which is a thread in primary or secondary can free the mbuf.
It gets a little more complicated if reference counts are used. In that case:
   - when reference count is decremented to zero, the mbuf is freed
   - if reference count is greater than one, then the mbuf should be treated as read-only.

Most code gets the last thing wrong.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-28 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 16:27 multi-process support: how to share THE SAME packet between two different processes ikuzar RABE
2022-11-25 17:09 ` Stephen Hemminger
2022-11-28 14:10   ` ikuzar RABE
2022-11-28 17:16     ` Stephen Hemminger

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