From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5CE0A046B for ; Wed, 24 Jul 2019 20:41:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2717B1C241; Wed, 24 Jul 2019 20:41:32 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 886691C000; Wed, 24 Jul 2019 20:41:30 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 1DDD71C0065; Wed, 24 Jul 2019 18:41:29 +0000 (UTC) Received: from [192.168.1.11] (85.187.13.152) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 24 Jul 2019 19:41:17 +0100 To: Ferruh Yigit , CC: References: <1563973146-16577-1-git-send-email-arybchenko@solarflare.com> <1563974194-5930-1-git-send-email-arybchenko@solarflare.com> <1563974194-5930-2-git-send-email-arybchenko@solarflare.com> From: Andrew Rybchenko Message-ID: Date: Wed, 24 Jul 2019 21:41:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [85.187.13.152] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24792.000 X-TM-AS-Result: No-15.930000-8.000000-10 X-TMASE-MatchedRID: hls5oAVArl/mLzc6AOD8DfHkpkyUphL9SWg+u4ir2NPXLRpcXl5f6PXx sNZ0PeU/CBG3yFdIPKSmcFuKGELrlj13WcdbGR6QdOc7KAdVCk6HVVN5PFJqUU+86maMM3aSJUK ZO8NXb6fCWBQM1oYR/DEhtstrjN4wH7OvhmslZN3H1T7seczVM87+ztu7aOuRrP7fIroeSfOpEW LJmBEWxD1YR2kVjgEg9Gvotd09KzaxouEUueEHDjahjZPEodkXUXlp1FHYSPV+lv4iHMG8GVl4x fTSs3Qpnxp6cGETvnAS5thlB89aW01+zyfzlN7ygxsfzkNRlfKx5amWK2anSPoLR4+zsDTtifGC YEa4FxfVviYBQTtBoodyb+bi8Fb+wSAxLU5w6QgrHVTw5Z+w5Q== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--15.930000-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24792.000 X-MDID: 1563993689-vkqYEo1WGjwX Subject: Re: [dpdk-dev] [PATCH v3 1/3] net/sfc: fix power of 2 round up when align has smaller type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 7/24/19 7:57 PM, Ferruh Yigit wrote: > On 7/24/2019 2:16 PM, Andrew Rybchenko wrote: >> Substitute driver-defined P2ROUNDUP() h with EFX_P2ROUNDUP() >> defined in libefx. >> >> Cast value and alignment to one specified type to guarantee result >> correctness. >> >> Fixes: e1b944598579 ("net/sfc: build libefx") >> Cc: stable@dpdk.org >> >> Signed-off-by: Andrew Rybchenko > <...> > >> @@ -29,6 +29,10 @@ extern "C" { >> /* The macro expands divider twice */ >> #define EFX_DIV_ROUND_UP(_n, _d) (((_n) + (_d) - 1) / (_d)) >> >> +/* Round value up to the nearest power of two. */ >> +#define EFX_P2ROUNDUP(_type, _value, _align) \ >> + (-(-(_type)(_value) & -(_type)(_align))) >> + > I trust you it does what it says J > > Just a high level comment, should we have some kind of tools/utilities file in > one of the libraries so everyone can use/share them? It is the base driver code and it is used in the base driver, so it can't rely on any DPDK library. There are RTE_ALIGN_FLOOR/CEIL in lib/librte_eal/common/include/rte_common.h. Before the patch the macro was defined in efsys.h (i.e. driver specific and could use defines available for the driver), but in fact it was duplicated in too many drivers and we decided to have it in libefx (base driver in DPDK case) itself.