From: Changli Gao <xiaosuo@gmail.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org, Changli Gao <xiaosuo@gmail.com>
Subject: [PATCH] netfilter: remove modulo operations
Date: Sun, 24 Oct 2010 11:40:35 +0800 [thread overview]
Message-ID: <1287891635-30207-1-git-send-email-xiaosuo@gmail.com> (raw)
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
net/netfilter/xt_NFQUEUE.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_NFQUEUE.c b/net/netfilter/xt_NFQUEUE.c
index 039cce1..3962770 100644
--- a/net/netfilter/xt_NFQUEUE.c
+++ b/net/netfilter/xt_NFQUEUE.c
@@ -72,10 +72,12 @@ nfqueue_tg_v1(struct sk_buff *skb, const struct xt_action_param *par)
if (info->queues_total > 1) {
if (par->family == NFPROTO_IPV4)
- queue = hash_v4(skb) % info->queues_total + queue;
+ queue = (((u64) hash_v4(skb) * info->queues_total) >>
+ 32) + queue;
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
else if (par->family == NFPROTO_IPV6)
- queue = hash_v6(skb) % info->queues_total + queue;
+ queue = (((u64) hash_v6(skb) * info->queues_total) >>
+ 32) + queue;
#endif
}
return NF_QUEUE_NR(queue);
next reply other threads:[~2010-10-24 3:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 3:40 Changli Gao [this message]
2010-10-24 18:25 ` [PATCH] netfilter: remove modulo operations Florian Westphal
2010-10-24 19:11 ` Eric Dumazet
2010-10-24 20:44 ` Florian Westphal
2010-10-24 21:49 ` Maciej Żenczykowski
2010-10-25 3:02 ` Jan Engelhardt
2010-10-25 3:19 ` Maciej Żenczykowski
2010-10-25 9:13 ` Jan Engelhardt
2010-10-25 9:28 ` Jan Engelhardt
2010-10-25 9:26 ` Eric Dumazet
2010-10-25 15:39 ` Patrick McHardy
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=1287891635-30207-1-git-send-email-xiaosuo@gmail.com \
--to=xiaosuo@gmail.com \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
/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).