Commit fc184f089220f7abd604993d7c69218603c2ffb2
Committed by
David S. Miller
1 parent
67f4efdce7
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
sctp: use bitmap_weight
Use bitmap_weight to count the total number of bits set in bitmap. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Vlad Yasevich <vyasevich@gmail.com> Cc: Sridhar Samudrala <sri@us.ibm.com> Cc: linux-sctp@vger.kernel.org Cc: netdev@vger.kernel.org Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 2 additions and 6 deletions Side-by-side Diff
net/sctp/tsnmap.c
... | ... | @@ -272,7 +272,7 @@ |
272 | 272 | __u32 max_tsn = map->max_tsn_seen; |
273 | 273 | __u32 base_tsn = map->base_tsn; |
274 | 274 | __u16 pending_data; |
275 | - u32 gap, i; | |
275 | + u32 gap; | |
276 | 276 | |
277 | 277 | pending_data = max_tsn - cum_tsn; |
278 | 278 | gap = max_tsn - base_tsn; |
... | ... | @@ -280,11 +280,7 @@ |
280 | 280 | if (gap == 0 || gap >= map->len) |
281 | 281 | goto out; |
282 | 282 | |
283 | - for (i = 0; i < gap+1; i++) { | |
284 | - if (test_bit(i, map->tsn_map)) | |
285 | - pending_data--; | |
286 | - } | |
287 | - | |
283 | + pending_data -= bitmap_weight(map->tsn_map, gap + 1); | |
288 | 284 | out: |
289 | 285 | return pending_data; |
290 | 286 | } |