Alfredo,

OK, now I understand. Thanks.

Michael

> On Jan 19, 2015, at 8:57 AM, Alfredo Cardigliano <[email protected]> wrote:
> 
> Hi Michael
> no, your buffer will not be overwritten, you can keep your buffer for a long 
> period of time, provided that you have enough empty buffers  to pass to 
> recv_pkt().
> When you call recv_pkt(&X), you are replacing the received buffer (let’s call 
> it A) with the fresh buffer pointed by X (let’s call it B), thus your X 
> pointer now points to A and the card will put the next packet (+ ring size) 
> to B.
> 
> X = pfring_zc_get_packet_handle() <- X points to buffer B (fresh)
> pfring_zc_recv_pkt(queue, &X, 1);  <- X points to buffer A (received)
> 
> Alfredo
> 
>> On 19 Jan 2015, at 13:58, Michael Nicolazzo <[email protected]> wrote:
>> 
>> 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
> 
> _______________________________________________
> 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

Reply via email to