From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by dpdk.org (Postfix) with ESMTP id 7499E9A8E for ; Tue, 4 Aug 2015 18:14:13 +0200 (CEST) Received: by pdco4 with SMTP id o4so6226076pdc.3 for ; Tue, 04 Aug 2015 09:14:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=0b4x/1V99706qRhY+Slu/EcasdpGEyu+t2FtIhieKdo=; b=KXwcjpVBlUBJDm8wdGFqXZrizrxeofU6QKKUfDpw6EhAKhG8i+PkPcSyF2SVVAG0Ca TQTpdJ6dGlWXzE5dYHQWmMKn5BYNipIoYUTc7vNEbiQ6ldBdl0aRGzc842OY1CMYkBAJ Y5DARcIJCz+dveVSMEGNk0wnW1+43Vc2p5cvY88cz3CgPnxhiiHveILjkiTUQNc9j17t 8EGTRYtAg0xphYEw8soi45Q9OpLmf2sPjsQ0deFvoQEnGAryG6eDxRrBUaIphr/7URm6 +Q7G7un2kAaS51mcoy8YwexTHO11X8GoX9ECzJu9tfdR8NXJ1LjAR2Z2qF2LjOB6j0S6 YK9Q== X-Gm-Message-State: ALoCoQnRXhDXM/GN0KK5TtN9G2+0bhj4mr39uG2gjxvMC2B6Y+yWqMcJMCs3FwOFLkbvw81gsTWd X-Received: by 10.70.4.3 with SMTP id g3mr9294368pdg.73.1438704852772; Tue, 04 Aug 2015 09:14:12 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id vx1sm747349pac.43.2015.08.04.09.14.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 09:14:12 -0700 (PDT) Date: Tue, 4 Aug 2015 09:14:22 -0700 From: Stephen Hemminger To: Olivier MATZ Message-ID: <20150804091422.2af96521@urahara> In-Reply-To: <55C0B6AC.2080001@6wind.com> References: <55C0B6AC.2080001@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] Could DPDK ring provide peek interface or any comments for this function? X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 16:14:13 -0000 On Tue, 04 Aug 2015 14:57:16 +0200 Olivier MATZ 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.