From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67])
 by dpdk.org (Postfix) with ESMTP id EB16D282
 for <dev@dpdk.org>; Fri,  9 Jan 2015 15:28:36 +0100 (CET)
Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214]
 helo=[192.168.0.10])
 by mail.droids-corp.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128)
 (Exim 4.80) (envelope-from <olivier.matz@6wind.com>)
 id 1Y9abg-0005c3-O2; Fri, 09 Jan 2015 15:32:09 +0100
Message-ID: <54AFE58E.50009@6wind.com>
Date: Fri, 09 Jan 2015 15:28:30 +0100
From: Olivier MATZ <olivier.matz@6wind.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Icedove/31.3.0
MIME-Version: 1.0
To: Alejandro Lucero <alejandro.lucero@netronome.com>, dev <dev@dpdk.org>
References: <CAD+H9911EO_0J_GRt34j-ugOSqeJo-QobNYc_cMe+52kvXLEfw@mail.gmail.com>
In-Reply-To: <CAD+H9911EO_0J_GRt34j-ugOSqeJo-QobNYc_cMe+52kvXLEfw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] ret_pktmbuf_pool_init problem with opaque_arg
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Jan 2015 14:28:37 -0000

Hi Alejandro,

On 01/09/2015 03:12 PM, Alejandro Lucero wrote:
> Inside this function mbuf_data_room_size is set to a default value if
> opaque_arg is null and it should be set to the value pointed by opaque_arg
> if not null. Current implementation is using not the value but with the
> pointer itself. I think this:
> 
>         roomsz = (uint16_t)(uintptr_t)opaque_arg;
> 
> should be something like this:
> 
>         roomsz = *(uint16_t *)opaque_arg;
> 

In this particular case, the integer value is stored in the pointer
value: the pointer is not used as a pointer but as an integer. I agree
it can be surprising, but I think the code is correct.

Regards,
Olivier