lkml.org 
[lkml]   [2022]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 33/54] net: ethernet: replace bitmap_weight with bitmap_weight_{eq,gt,ge,lt,le} for mellanox
On Mon, Jan 24, 2022 at 02:48:12PM +0200, Andy Shevchenko wrote:
> On Sun, Jan 23, 2022 at 10:39:04AM -0800, Yury Norov wrote:
> > Mellanox code uses bitmap_weight() to compare the weight of bitmap with
> > a given number. We can do it more efficiently with bitmap_weight_{eq, ...}
> > because conditional bitmap_weight may stop traversing the bitmap earlier,
> > as soon as condition is met.
>
> > - if (port <= 0 || port > m)
> > + if (port <= 0 || bitmap_weight_lt(actv_ports.ports, dev->caps.num_ports, port))
> > return -EINVAL;
>
> Can we eliminate now the port <= 0 check? Or at least make it port == 0?

The port is a parameter of exported function. I'd rather not take this risk.
Even if it makes sense, it should be a separate patch anyways.

\
 
 \ /
  Last update: 2022-02-09 07:50    [W:0.073 / U:24.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site