From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id 349B18DAD for ; Mon, 17 Aug 2015 12:50:05 +0200 (CEST) Received: by wibhh20 with SMTP id hh20so77337575wib.0 for ; Mon, 17 Aug 2015 03:50:05 -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:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=oprmn3SKelZcDyZtbEymCWlajikJrXLgOaK0ldc0PHM=; b=IWleHzgXXhrzQGN2KNjlPp7xgM80NZLfHRDskXIJlEk7ZeAV/xwF9u35cg91nTQnjN QrUr4A9j3M2pAnxmoo4GQiEF5IsEF90gM9uEscVFNeJP22eRTvO5Z/AhaJwIY6V1Nn7j zkruYdmT091gybogFUWbffGb34MvYcg3sPnoy1b50RHAbJypdUKNSpao7njL+lN7hkI7 wQ9qC+uZ+DVz3botFt0p68Zfz7SlfoWqVleO/ZHFqb+aPidOs9OK25xywE/j4iMsEUvh tDxb+3pCru+ZCYtt+ttwtSTnMhXl+5sn6fqCf4WelzoMtkCqu3G5YiIWjHGewtnlUqa6 +IsA== X-Gm-Message-State: ALoCoQli54di9UK4MJwdFdjbO1YreKY2NWZg8OVCQfW3vbE3rtwq9B2J6aOaSbcVFHhICPwG2IK8 X-Received: by 10.194.60.226 with SMTP id k2mr1459175wjr.10.1439808605099; Mon, 17 Aug 2015 03:50:05 -0700 (PDT) Received: from gmail.com (bzq-158-168-31-2.red.bezeqint.net. [31.168.158.2]) by smtp.gmail.com with ESMTPSA id i6sm21296758wje.33.2015.08.17.03.50.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 03:50:04 -0700 (PDT) Date: Mon, 17 Aug 2015 13:50:01 +0300 From: Dan Aloni To: Olivier MATZ Message-ID: <20150817105001.GC15603@gmail.com> References: <1439752099-23090-1-git-send-email-dan@kernelim.com> <55D1A187.7080802@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55D1A187.7080802@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] mempool: fix the inverted pg_num check on create 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: Mon, 17 Aug 2015 10:50:05 -0000 On Mon, Aug 17, 2015 at 10:55:35AM +0200, Olivier MATZ wrote: > On 08/16/2015 09:08 PM, Dan Aloni wrote: [..] > > /* Check that pg_num and pg_shift parameters are valid. */ > > - if (pg_num < RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) { > > + if (pg_num > RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) { > > rte_errno = EINVAL; > > return NULL; > > From what I see, RTE_DIM(mp->elt_pa) is always 1: > > #define MEMPOOL_PG_NUM_DEFAULT 1 > struct rte_mempool { > ... > phys_addr_t elt_pa[MEMPOOL_PG_NUM_DEFAULT]; > } __rte_cache_aligned; > > From rte_mempool_xmem_create() documentation, pg_num gives the size of > the paddr array, which is allocated by the caller. So I think there is > no issue here. You're right, I missed on the fact that mempool takes pg_num as its run-time determined size of the array for both its dynamically allocated copy and the caller's provided array. The MEMPOOL_PG_NUM_DEFAULT macro is was a bit distracting in this. I wanted to provide pg_num > 1 and it wasn't clear on whether to modify the macro, or simply call the function :). So, never mind the patch. -- Dan Aloni