From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
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 16:55:50 +0200 [thread overview]
Message-ID: <20120517145550.GA6501@1984> (raw)
In-Reply-To: <1337243968.3403.3.camel@edumazet-glaptop>
On Thu, May 17, 2012 at 10:39:28AM +0200, Eric Dumazet wrote:
> 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;
Sorry, for the mistake in the changelog. I copied & pasted it from the
mailing list discussion.
next prev parent reply other threads:[~2012-05-17 14:55 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
2012-05-17 14:55 ` Pablo Neira Ayuso [this message]
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=20120517145550.GA6501@1984 \
--to=pablo@netfilter.org \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.