[ovs-dev] [PATCH 2/3] datapath: Mega flow implementation

Rajahalme, Jarno (NSN - FI/Espoo) jarno.rajahalme at nsn.com
Fri Jun 7 20:28:20 UTC 2013


It is in lib/util.h:

lib/util.h:#define DIV_ROUND_UP(X, Y) (((X) + ((Y) - 1)) / (Y))
lib/util.h:#define ROUND_UP(X, Y) (DIV_ROUND_UP(X, Y) * (Y))

  Jarno

On Jun 7, 2013, at 17:39 , ext Andy Zhou wrote:

Thanks for the suggestion.

The kernel source I am looking at: 3.9.0-rc8, does not a accessible definition of ROUND_UP,  but roundup(x,y) is, and fits the bill.  I am thinking of using it instead, unless it breaks on some older kernel version that we care about.

>From kernel.h:

/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
#define roundup(x, y) (                 \
{                           \
    const typeof(y) __y = y;            \
    (((x) + (__y - 1)) / __y) * __y;        \
}


On Fri, Jun 7, 2013 at 7:19 AM, Rajahalme, Jarno (NSN - FI/Espoo) <jarno.rajahalme at nsn.com<mailto:jarno.rajahalme at nsn.com>> wrote:

On Jun 7, 2013, at 13:35 , ext Andy Zhou wrote:

Is this the same as DIV_ROUND_UP?
I did not use it because DIV_ROUND_UP gives the roundup of u32, I needed the roundup in bytes.  However, I could rewrite this function using DIV_ROUND_UP.

There is ROUND_UP doing that already.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130607/b7d9056d/attachment-0003.html>


More information about the dev mailing list