From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by dpdk.org (Postfix) with ESMTP id E3491156 for ; Wed, 20 Nov 2013 19:31:57 +0100 (CET) Received: by mail-wi0-f173.google.com with SMTP id hm4so1944403wib.12 for ; Wed, 20 Nov 2013 10:32:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Bo0VlxPAgE32Qnaa+e+1wzwZG2XNsJRO8CXcyF4fn+g=; b=TaWSO4hEPjBiwzedn90bfBvuLnw2Qt7432xXcR6RBOeh04YRYag5LXHwzvBr+zfEB0 r5DJalebpnyal/cWUaLrUlYixJ9ClhZ5ilPVuWrXyGDDlOybdYxwYOG8IaRCZxIdqvfJ vUUdvpB/BH8xbETOa1UsANeDrcdlI9GsabuDDWUjt+JKh14NZwDVJsXfee8Ifu5kSfpP 7SGPNAdTpKFVP2FK/wWwdl5DguS2KTwIf7R5dtykI2V8WmlFhVKJt2cfXuvu6PXA6PQH R6rLB0CyQ75pctiFvhYuV3yNd/SOEBhfm6wASZW6sT1AX5a46EMkl4iiZWKYZfla3eqN bOqw== X-Gm-Message-State: ALoCoQk+YSaUSJqxvW52SIyWhRjOmGJ6wLqdVqADGQG+2DqqvIZhQeR5HpxC7DewxQYDtT2Jmn2d MIME-Version: 1.0 X-Received: by 10.194.175.66 with SMTP id by2mr1864426wjc.59.1384972375829; Wed, 20 Nov 2013 10:32:55 -0800 (PST) Received: by 10.227.227.147 with HTTP; Wed, 20 Nov 2013 10:32:55 -0800 (PST) In-Reply-To: <003d01cee5d1$acbee400$063cac00$@com> References: <000301cee54e$bb49d170$31dd7450$@com> <002f01cee5c9$eb6bf0b0$c243d210$@com> <003d01cee5d1$acbee400$063cac00$@com> Date: Wed, 20 Nov 2013 10:32:55 -0800 Message-ID: From: Jeff Venable To: Etai Lev-Ran Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] rte_ring_sc_dequeue returns 0 but sets packet to NULL 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: Wed, 20 Nov 2013 18:31:58 -0000 I was using NULLs in the ring to cache-line pad and maintain alignment during burst dequeue. The receiving code discards the NULLs as NOPs. Jeff On Wed, Nov 20, 2013 at 1:19 AM, Etai Lev-Ran wrote: > > > Hi Pepe, > > > > I=92m assuming you=92re creating and accessing the ring safely (i.e., > single/multiple consumers and producers). > > > > Based on the code, these return values are possible if the ring somehow > got a NULL object pointer enqueued to it. > > From the ring=92s perspective the entries are valid, and since the dequeu= e > does not check for NULL object pointers, > > you=92re getting back element(s) that happen to be NULL. > > > > If this is indeed the case, I would propose the following patch: > > - Adding a check for NULL object pointers to ENQUEUE_PTRS in rte_ring.h > (in debug code so not to hurt performance?) > > - returning an EINVAL error code if any object in a burst is NULL and > aborting all enqueue (ie. all or none) > > > > IMHO, adding NULL objects is likely an error not a legitimate use case fo= r > adding ring elements. > > Can anyone think of a use case where adding NULL pointer objects makes > sense? > > Best regards, > Etai > > > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jose Gavine Cueto > Sent: Tuesday, November 19, 2013 12:35 PM > To: dev@dpdk.org > Subject: [dpdk-dev] rte_ring_sc_dequeue returns 0 but sets packet to NULL > > Hi, > > I am encountering a strange behavior of rte_ring_sc_dequeue, though I'm n= ot > yet sure what causes this. > > I have a code: > > rc =3D rte_ring_sc_dequeue(fwdp->rxtx_rings->xmit_ring, &rpackets); > > At first dequeue, rpackets gets a correct address of an rte_mbuf, however > at > the second dequeue it returns 0 which is successful but sets the rte_mbuf > result to a NULL value. Is this even possible, because its happening in = my > scenario. Or it could be just there's something wrong with my code. > > Cheers, > Pepe > > -- > To stop learning is like to stop loving. > >