From: Vlad Yasevich <vyasevich@gmail.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-sctp@vger.kernel.org, Sridhar Samudrala <sri@us.ibm.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH] sctp: use bitmap_weight
Date: Sun, 18 Nov 2012 01:45:19 +0000 [thread overview]
Message-ID: <50A83DAF.8000408@gmail.com> (raw)
In-Reply-To: <1353134389-25583-1-git-send-email-akinobu.mita@gmail.com>
On 11/17/2012 01:39 AM, Akinobu Mita wrote:
> 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>
-vlad
> ---
> net/sctp/tsnmap.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
> index b5fb7c4..5f25e0c 100644
> --- a/net/sctp/tsnmap.c
> +++ b/net/sctp/tsnmap.c
> @@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
> __u32 max_tsn = map->max_tsn_seen;
> __u32 base_tsn = map->base_tsn;
> __u16 pending_data;
> - u32 gap, i;
> + u32 gap;
>
> pending_data = max_tsn - cum_tsn;
> gap = max_tsn - base_tsn;
> @@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
> if (gap = 0 || gap >= map->len)
> goto out;
>
> - for (i = 0; i < gap+1; i++) {
> - if (test_bit(i, map->tsn_map))
> - pending_data--;
> - }
> -
> + pending_data -= bitmap_weight(map->tsn_map, gap + 1);
> out:
> return pending_data;
> }
>
next prev parent reply other threads:[~2012-11-18 1:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-17 6:39 [PATCH] sctp: use bitmap_weight Akinobu Mita
2012-11-18 1:45 ` Vlad Yasevich [this message]
2012-11-18 3:01 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A83DAF.8000408@gmail.com \
--to=vyasevich@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sri@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).