From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
davem@davemloft.net, netdev@vger.kernel.org
Subject: RE: [PATCH 3/7] netfilter: xt_HMARK: modulus is expensive for hash calculation
Date: Thu, 17 May 2012 10:39:28 +0200 [thread overview]
Message-ID: <1337243968.3403.3.camel@edumazet-glaptop> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6F10@saturn3.aculab.com>
On Thu, 2012-05-17 at 09:16 +0100, David Laight wrote:
> > From: Pablo Neira Ayuso <pablo@netfilter.org>
> >
> > Use:
> >
> > ((u64)(HASH_VAL * HASH_SIZE)) >> 32
> >
> > as suggested by David S. Miller.
>
> That (u64) cast is very unlikely to have any effect.
> If you want a 64 bit result from the product of two
> 32 bit values, you have to cast one of the 32 bit values
> prior to the multiply - as in the patch below.
Hey, Changelog is a bit wrong (for several reasons) but code is correct.
return (((u64)hash * info->hmodulus) >> 32) + info->hoffset;
next prev parent reply other threads:[~2012-05-17 8:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 23:06 [PATCH 0/7] netfilter updates for net-next (batch 3) pablo
2012-05-16 23:06 ` [PATCH 1/7] netfilter: xt_hashlimit: use _ALL macro to reject unknown flag bits pablo
2012-05-16 23:06 ` [PATCH 2/7] netfilter: xt_HMARK: potential NULL dereference in get_inner_hdr() pablo
2012-05-16 23:06 ` [PATCH 3/7] netfilter: xt_HMARK: modulus is expensive for hash calculation pablo
2012-05-17 8:16 ` David Laight
2012-05-17 8:39 ` Eric Dumazet [this message]
2012-05-17 14:55 ` Pablo Neira Ayuso
2012-05-16 23:06 ` [PATCH 4/7] netfilter: nf_ct_tcp: extend log message for invalid ignored packets pablo
2012-05-16 23:06 ` [PATCH 5/7] netfilter: ipset: fix timeout value overflow bug pablo
2012-05-16 23:06 ` [PATCH 6/7] netfilter: xt_CT: remove redundant header include pablo
2012-05-16 23:06 ` [PATCH 7/7] netfilter: nf_ct_h323: fix usage of MODULE_ALIAS_NFCT_HELPER pablo
2012-05-17 0:00 ` [PATCH 0/7] netfilter updates for net-next (batch 3) 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=1337243968.3403.3.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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