From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Andrew Rybchenko <arybchenko@solarflare.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 1/3] net/sfc: fix power of 2 round up when align has smaller type
Date: Wed, 24 Jul 2019 19:52:12 +0100 [thread overview]
Message-ID: <3a61d992-8800-84b2-a1f5-18c1eaf527d8@intel.com> (raw)
In-Reply-To: <f98676bd-3921-6d80-30d5-fdd9f1b94ffa@solarflare.com>
On 7/24/2019 7:41 PM, Andrew Rybchenko wrote:
> 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 <arybchenko@solarflare.com>
>> <...>
>>
>>> @@ -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.
>
Yes there are lots of small functionalities duplicated in various drivers, that
is why I thought perhaps we can unify them.
And the base driver concern is valid for many drivers I think, since those code
are mostly from a shared delivery, using DPDK specific macros in them will cause
more maintenance cost.
next prev parent reply other threads:[~2019-07-24 18:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-24 12:59 [dpdk-dev] [PATCH 0/3] net/sfc: fix power of 2 alignment macros Andrew Rybchenko
2019-07-24 12:59 ` [dpdk-dev] [PATCH 1/3] net/sfc: fix power of 2 round up when align has smaller type Andrew Rybchenko
2019-07-24 12:59 ` [dpdk-dev] [PATCH 2/3] net/sfc: fix align to power of 2 " Andrew Rybchenko
2019-07-24 12:59 ` [dpdk-dev] [PATCH 3/3] net/sfc: unify power of 2 alignment check macro Andrew Rybchenko
2019-07-24 13:04 ` [dpdk-dev] [PATCH 0/3] net/sfc: fix power of 2 alignment macros Andrew Rybchenko
2019-07-24 13:08 ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2019-07-24 13:08 ` [dpdk-dev] [PATCH v2 1/3] net/sfc: fix power of 2 round up when align has smaller type Andrew Rybchenko
2019-07-24 13:08 ` [dpdk-dev] [PATCH v2 3/3] net/sfc: unify power of 2 alignment check macro Andrew Rybchenko
2019-07-24 13:16 ` [dpdk-dev] [PATCH v3 0/3] net/sfc: fix power of 2 alignment macros Andrew Rybchenko
2019-07-24 13:16 ` [dpdk-dev] [PATCH v3 1/3] net/sfc: fix power of 2 round up when align has smaller type Andrew Rybchenko
2019-07-24 16:57 ` Ferruh Yigit
2019-07-24 18:41 ` Andrew Rybchenko
2019-07-24 18:52 ` Ferruh Yigit [this message]
2019-07-24 13:16 ` [dpdk-dev] [PATCH v3 2/3] net/sfc: fix align to power of 2 " Andrew Rybchenko
2019-07-24 13:16 ` [dpdk-dev] [PATCH v3 3/3] net/sfc: unify power of 2 alignment check macro Andrew Rybchenko
2019-07-24 18:47 ` [dpdk-dev] [PATCH v3 0/3] net/sfc: fix power of 2 alignment macros Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a61d992-8800-84b2-a1f5-18c1eaf527d8@intel.com \
--to=ferruh.yigit@intel.com \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).