From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com [IPv6:2a00:1450:4010:c04::231]) by dpdk.org (Postfix) with ESMTP id B2108156 for ; Wed, 6 Nov 2013 00:27:35 +0100 (CET) Received: by mail-lb0-f177.google.com with SMTP id u14so7040769lbd.22 for ; Tue, 05 Nov 2013 15:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=HzrAw96TIUYmJg/HrO5zWleGzdPk8QfofV9S3CTHUCY=; b=iQsFcUI77ddr+nvGHq1/Cao8KBkTUk3Lk8dhcrX88vl7gpUEk6doYZAAiOPN7ROGaq mXEqrnPZX+vfmZmakg7rIJw/iWU28v3Ft3wBmdGE/kyXglwESXJ7UbkO+jsCvCCim4Sk qrFUoH6rZ1/DPc0802aj7lyeWvdJBK6XpP8ADEuqm3bi9Id/tC5SOPDk0tamB5dTLAg4 TevxgTaM0Pm33+b5R3tJad3hvFH4PFmFUa2DW/bYqijwxhe5x0pZrVIPTfS3ZhZqQz6Z kCUzNFhNwhz1cpcpJ9Nw6uwx5BjdOMA18MMG64a2eAMFJyCKfpp8LepJuH8byzXNGnDe JYpQ== MIME-Version: 1.0 X-Received: by 10.152.36.170 with SMTP id r10mr83914laj.48.1383694108435; Tue, 05 Nov 2013 15:28:28 -0800 (PST) Received: by 10.114.183.13 with HTTP; Tue, 5 Nov 2013 15:28:28 -0800 (PST) In-Reply-To: <20131105175413.GB26311@debian> References: <20131105103325.GA25808@debian> <201311051218.27016.thomas.monjalon@6wind.com> <20131105175413.GB26311@debian> Date: Wed, 6 Nov 2013 07:28:28 +0800 Message-ID: From: Jose Gavine Cueto To: Jose Gavine Cueto , Thomas Monjalon , "dev@dpdk.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] preallocation of void ** obj_p of rte_ring_dequeue 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, 05 Nov 2013 23:27:36 -0000 I see , now its clearer. Thanks, Pepe On Wed, Nov 6, 2013 at 1:54 AM, Cyril Cressent wrote: > On Wed, Nov 06, 2013 at 12:47:13AM +0800, Jose Gavine Cueto wrote: > > > Your'e welcome, and by the way the multiprocess example of simple_mp > seems > > confusing here: > > > > static int > > lcore_recv(__attribute__((unused)) void *arg) > > { > > unsigned lcore_id = rte_lcore_id(); > > > > printf("Starting core %u\n", lcore_id); > > while (!quit){ > > void *msg; > > if (rte_ring_dequeue(recv_ring, &msg) < 0){ > > usleep(5); > > continue; > > } > > printf("core %u: Received '%s'\n", lcore_id, (char *)msg); > > rte_mempool_put(message_pool, msg); > > } > > > > return 0; > > } > > > > It seems that it isn't allocating msg here, or maybe I'm just missing > something > > I understand your question better now, and in that light I think my > previous answer was confusing. Let me try to clarify: > > A ring only holds *pointers* to objects. You enqueue pointers, and > dequeue those pointers later, somewhere else, usually in another thread. > The allocation/deallocation of the actual objects is none the concern of > the ring and its enqueue/dequeue operations. > > If we take the simple_mp example, the msg dequeued by the lcore_recv() > thread is created in mp_command.c and a pointer to that message is > enqueued on "send_ring". If you read carefully how the rings are created > you'll understand how "send_ring" and "recv_ring" relate to each other. > > I hope this is a bit clearer, > > Cyril > -- To stop learning is like to stop loving.