diff options
author | Eric Dumazet <edumazet@google.com> | 2018-11-21 20:39:28 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-23 20:32:55 +0100 |
commit | 42519ede4fde2a50919215933e0f02c8342aba0f (patch) | |
tree | 17d661043dfc332ff0f8e515a6ea5cfacbcba1f9 /net | |
parent | Merge branch 'dpaa-coalesce' (diff) | |
download | linux-42519ede4fde2a50919215933e0f02c8342aba0f.tar.xz linux-42519ede4fde2a50919215933e0f02c8342aba0f.zip |
net-gro: use ffs() to speedup napi_gro_flush()
We very often have few flows/chains to look at, and we
might increase GRO_HASH_BUCKETS to 32 or 64 in the future.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index f2bfd2eda7b2..d83582623cd7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5364,11 +5364,13 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index, */ void napi_gro_flush(struct napi_struct *napi, bool flush_old) { - u32 i; + unsigned long bitmask = napi->gro_bitmask; + unsigned int i, base = ~0U; - for (i = 0; i < GRO_HASH_BUCKETS; i++) { - if (test_bit(i, &napi->gro_bitmask)) - __napi_gro_flush_chain(napi, i, flush_old); + while ((i = ffs(bitmask)) != 0) { + bitmask >>= i; + base += i; + __napi_gro_flush_chain(napi, base, flush_old); } } EXPORT_SYMBOL(napi_gro_flush); |