[dpdk-dev] Could DPDK ring provide peek interface or any comments for this function?

Stephen Hemminger stephen at networkplumber.org
Tue Aug 4 18:14:22 CEST 2015


On Tue, 04 Aug 2015 14:57:16 +0200
Olivier MATZ <olivier.matz at 6wind.com> wrote:

> Hi,
> 
> 
> On 08/04/2015 04:20 AM, Yan, Liming (Nokia - CN/Hangzhou) wrote:
> > Hi,
> >     As we see, DPDK ring has mainly the enqueue/dequeue APIs for SINGLE/MULTI producer/consumer.  I have a requirement in work to take a peek on the top object in the ring. I don't want to consume it, just check the reference of the object.  How could this be supported?   Or any alternative solution for my requirement?  Thanks.
> >     I wrote my own simple peek interface but it's not MC-safe. I think it's better if DPDK can support it officially.
> 
> I think it's a good idea. I think we could avoid a test by using
> the same naming convention than other functions applying to single
> consumer rings.
> 
> I'm not sure the function is safe on mc rings: the pointer returned
> via peek() should not be accessed while another core dequeues the
> object and modify/free it.

It is not possible for peek to be SMP safe. Another consumer could remove
item from ring and  free at any time.





More information about the dev mailing list