From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ea0-x236.google.com (mail-ea0-x236.google.com [IPv6:2a00:1450:4013:c01::236]) by dpdk.org (Postfix) with ESMTP id 58AF4156 for ; Wed, 20 Nov 2013 10:18:58 +0100 (CET) Received: by mail-ea0-f182.google.com with SMTP id o10so4661934eaj.27 for ; Wed, 20 Nov 2013 01:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-language:thread-index; bh=X0pF7/ZsNq8ch1hN9VYK8WWO4G268aTBClGa4MWlDzs=; b=MXvzMjLXsItzC4kHS6SqwePlXOAf7y0WifSs1kf9KyHPMhn/OV/o3W6h3ywLZn6f+d 6R8gu6VXOkwK7WLwsMtlZxfmkc9mSoHtbid+G5RmOlhk39lMVcqEeCNRSf3tpFsu0+mY nKXEMFmm+2aX1x7G/srFjVfF+wkcJF8lOkDzMEaHTv7BOvnWpjNwQ0df8zrj4dzAijqi mFESYGPXXlIQsMmob5+bCk5ir2tRLkyKAv5zSsfRlEHX5VAg5Gt6cde7TKICIRRV8LLv M3pYHMN80htqhUp1rZpabzYlJiK8IPgPfa6ZYtzO3H2vwLyQEF2v87vUiDRvwvUbMVWD 7a1g== X-Received: by 10.14.225.2 with SMTP id y2mr881320eep.62.1384939195838; Wed, 20 Nov 2013 01:19:55 -0800 (PST) Received: from elevranwin7 ([109.65.139.169]) by mx.google.com with ESMTPSA id k7sm17889717eeg.13.2013.11.20.01.19.53 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2013 01:19:54 -0800 (PST) From: "Etai Lev-Ran" To: References: <000301cee54e$bb49d170$31dd7450$@com> <002f01cee5c9$eb6bf0b0$c243d210$@com> In-Reply-To: Date: Wed, 20 Nov 2013 11:19:52 +0200 Message-ID: <003d01cee5d1$acbee400$063cac00$@com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Content-language: en-us Thread-index: Ac7lzemRx3Llcf0CSyW0kiWW7cjvMgAAbYtQ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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 09:18:58 -0000 =20 Hi Pepe, =20 I=E2=80=99m assuming you=E2=80=99re creating and accessing the ring = safely (i.e., single/multiple consumers and producers). =20 Based on the code, these return values are possible if the ring somehow = got a NULL object pointer enqueued to it.=20 >>From the ring=E2=80=99s perspective the entries are valid, and since the = dequeue does not check for NULL object pointers,=20 you=E2=80=99re getting back element(s) that happen to be NULL. =20 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?)=20 - returning an EINVAL error code if any object in a burst is NULL and = aborting all enqueue (ie. all or none) =20 IMHO, adding NULL objects is likely an error not a legitimate use case = for 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 = not 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.