netdev
[Top] [All Lists]

Re: [PATCH] improvement on net/sched/cls_fw.c's hash function

To: emann@xxxxxxx (Eran Mann)
Subject: Re: [PATCH] improvement on net/sched/cls_fw.c's hash function
From: Wang Jian <lark@xxxxxxxxxxxx>
Date: Wed, 06 Apr 2005 21:53:55 +0800
Cc: Thomas Graf <tgraf@xxxxxxx>, hadi@xxxxxxxxxx, netdev <netdev@xxxxxxxxxxx>
In-reply-to: <4253E5D4.60504@xxxxxxx>
References: <20050406123036.GO26731@xxxxxxxxxxxxxx> <4253E5D4.60504@xxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
Hi Eran Mann,


On Wed, 06 Apr 2005 16:36:20 +0300, emann@xxxxxxx (Eran Mann) wrote:


> 
> Maybe you could add to the list of options a XOR of bytes hash, 
> something like:
> static inline u8 bytes_xor_u32( u32 key )
> {
>       u8 *dummy_array = (u8 *)&key;
>       u8 hash = dummy_array[0] ^ dummy_array[1] ^
>                 dummy_array[2] ^ dummy_array[3];
> 
>       return hash;
> }
> 

Ha, then this hi-or-lo word hash, which assumes that high or low word is
0, and key is distributed in the old fashion (0..255, etc)

static inline u32 hi_or_lo_hash(u32 key)
{
        return (key >> 16 ^ key) & 0xFF;
}


-- 
  lark


<Prev in Thread] Current Thread [Next in Thread>