Hi Alfredo, Alfredo,
Thanks for the quick response. The example you give is what I am writing about. If I understand this correctly, what I am reusing is actually the buffer handle that contains a pointer to the data. So assuming the ring is continuous memory, what is actually passed in the handle (to avoid a copy) is a pointer to the location in the ring where the data actually is. Every time I call pfring_zc_recv, I get a different pointer into the ring even if I pass the same buffer handle. Is this correct? That would mean that if I save a buffer for later use, I would need to process it before the ring comes around again and fills the location I’m pointing to. So that is actually the question I am asking - if I intend to keep a buffer for a reasonably long period of time, do I need to copy it somewhere? Michael > On Jan 19, 2015, at 5:02 AM, Alfredo Cardigliano <[email protected]> wrote: > > Hi Michael > what do you mean with “buffers are never returned”? could you provide an > example? > Usually the flow is: > X = pfring_zc_get_packet_handle() > pfring_zc_recv_pkt(queue, &X, 1); > Then you can 1. process and reuse X for the next recv_pkt() call, or 2. if > you want to > hold X for late processing, you can allocate another buffer (provided that > you have > preallocated enough at cluster creation time). > > Alfredo > >> On 19 Jan 2015, at 05:10, Michael Nicolazzo <[email protected]> wrote: >> >> Hi, >> >> I am looking for some information and advice on how to manage buffers in >> PF_RING ZC. I noticed that in the examples, the buffers are never returned. >> Is this normally how they should be managed? If I need to pass a buffer to a >> thread that wishes to hold onto it and deal with it later, how should that >> be done? >> >> Regards, >> >> Michael Nicolazzo >> >> _______________________________________________ >> Ntop-misc mailing list >> [email protected] >> http://listgateway.unipi.it/mailman/listinfo/ntop-misc > > _______________________________________________ > Ntop-misc mailing list > [email protected] > http://listgateway.unipi.it/mailman/listinfo/ntop-misc _______________________________________________ Ntop-misc mailing list [email protected] http://listgateway.unipi.it/mailman/listinfo/ntop-misc
