From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77986C76186 for ; Wed, 24 Jul 2019 18:41:33 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 0FA3B2173B for ; Wed, 24 Jul 2019 18:41:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FA3B2173B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=solarflare.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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.