From: Johannes Berg <johannes@sipsolutions.net>
To: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Thomas Graf <tgraf@suug.ch>
Subject: Re: [RFC] mac80211: use rhashtable for station table
Date: Mon, 23 Feb 2015 23:07:26 +0100 [thread overview]
Message-ID: <1424729246.1899.6.camel@sipsolutions.net> (raw)
In-Reply-To: <1424728896.1899.4.camel@sipsolutions.net> (sfid-20150223_230144_756013_7AD36172)
On Mon, 2015-02-23 at 23:01 +0100, Johannes Berg wrote:
> On Mon, 2015-02-23 at 22:52 +0100, Johannes Berg wrote:
>
> > We also can't rely on 4-byte alignment though, so perhaps we should do
> > something like
> >
> > u32 sta_info_hash(void *addr, u32 len, u32 seed)
> > {
> > u16 *a = addr;
> >
> > return jhash_3words(a[0], a[1], a[2], seed);
> > }
>
> Or better do
>
> return jhash_2words(addr[0], (addr[1] << 16) | addr[2], seed);
>
> since I have no idea how the missing high 16 bits would behave.
> (we can rely on 2-byte alignment, but not 4-byte)
Actually, we cannot rely on alignment, so we need to do this:
static u32 sta_addr_hash(const void *key, u32 length, u32 seed)
{
return jhash(key, ETH_ALEN, seed);
}
which still generates better code since the compiler can optimise based
on the fixed length.
johannes
next prev parent reply other threads:[~2015-02-23 22:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-13 21:47 [RFC] mac80211: use rhashtable for station table Johannes Berg
2015-02-13 22:13 ` Ben Greear
2015-02-23 16:32 ` Johannes Berg
2015-02-14 2:14 ` Sergey Ryazanov
2015-02-23 16:33 ` Johannes Berg
2015-02-23 21:26 ` Sergey Ryazanov
2015-02-23 21:52 ` Johannes Berg
2015-02-23 22:01 ` Johannes Berg
2015-02-23 22:07 ` Johannes Berg [this message]
2015-02-23 22:15 ` Sergey Ryazanov
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=1424729246.1899.6.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=ryazanov.s.a@gmail.com \
--cc=tgraf@suug.ch \
/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).