Re: [PATCH net-next v2 2/3] net: add trim helper and convert users

2014-01-17 Thread Eric Dumazet
On Fri, 2014-01-17 at 18:15 +, Ben Hutchings wrote: > On Fri, 2014-01-17 at 01:28 +0100, Hannes Frederic Sowa wrote: > [...] > > --- a/include/linux/kernel.h > > +++ b/include/linux/kernel.h > > @@ -193,6 +193,25 @@ extern int _cond_resched(void); > > (__x < 0) ? -__x : __x;

Re: [PATCH net-next v2 2/3] net: add trim helper and convert users

2014-01-17 Thread Ben Hutchings
On Fri, 2014-01-17 at 01:28 +0100, Hannes Frederic Sowa wrote: [...] > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -193,6 +193,25 @@ extern int _cond_resched(void); > (__x < 0) ? -__x : __x; \ > }) > > +/** > + * trim - perform a reciprocal multipl

Re: [PATCH net-next v2 2/3] net: add trim helper and convert users

2014-01-17 Thread Daniel Borkmann
On 01/17/2014 10:52 AM, David Laight wrote: From: Hannes Frederic Sowa ... +/** + * trim - perform a reciprocal multiplication in order to "clamp" a + *value into range [0, ep_ro), where the upper interval + *endpoint is right-open. This is useful, e.g. for accessing + *a

RE: [PATCH net-next v2 2/3] net: add trim helper and convert users

2014-01-17 Thread David Laight
From: Hannes Frederic Sowa ... > +/** > + * trim - perform a reciprocal multiplication in order to "clamp" a > + *value into range [0, ep_ro), where the upper interval > + *endpoint is right-open. This is useful, e.g. for accessing > + *a index of an array containing ep_ro e

[PATCH net-next v2 2/3] net: add trim helper and convert users

2014-01-16 Thread Hannes Frederic Sowa
From: Daniel Borkmann As David Laight suggests, we shouldn't necessarily call this reciprocal_divide() when users didn't requested a reciprocal_value(). Lets make the name short and nifty, put this where we have other generic helpers of similar kind and convert users. Joint work with Hannes Fred