Commit fc184f08 authored by Akinobu Mita's avatar Akinobu Mita Committed by David S. Miller

sctp: use bitmap_weight

Use bitmap_weight to count the total number of bits set in bitmap.
Signed-off-by: default avatarAkinobu 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: default avatarVlad Yasevich <vyasevich@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67f4efdc
...@@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map) ...@@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
__u32 max_tsn = map->max_tsn_seen; __u32 max_tsn = map->max_tsn_seen;
__u32 base_tsn = map->base_tsn; __u32 base_tsn = map->base_tsn;
__u16 pending_data; __u16 pending_data;
u32 gap, i; u32 gap;
pending_data = max_tsn - cum_tsn; pending_data = max_tsn - cum_tsn;
gap = max_tsn - base_tsn; gap = max_tsn - base_tsn;
...@@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map) ...@@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
if (gap == 0 || gap >= map->len) if (gap == 0 || gap >= map->len)
goto out; goto out;
for (i = 0; i < gap+1; i++) { pending_data -= bitmap_weight(map->tsn_map, gap + 1);
if (test_bit(i, map->tsn_map))
pending_data--;
}
out: out:
return pending_data; return pending_data;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment