All of lore.kernel.org
 help / color / mirror / Atom feed
From: emann@mrv.com (Eran Mann)
To: Thomas Graf <tgraf@suug.ch>
Cc: Wang Jian <lark@linux.net.cn>,
	hadi@cyberus.ca, netdev <netdev@oss.sgi.com>
Subject: Re: [PATCH] improvement on net/sched/cls_fw.c's hash function
Date: Wed, 06 Apr 2005 16:36:20 +0300	[thread overview]
Message-ID: <4253E5D4.60504@mrv.com> (raw)
In-Reply-To: <20050406123036.GO26731@postel.suug.ch>

Thomas Graf wrote:
> We need to provide some kind of option to the user so he can specify
> the needs.  The & 0xFF will suit most just fine but has one essential
> drawback which is that no distribution is done at all if the lower 8
> bits are set to 0. For static marks this is no issue at all and even
> for enumerated marks growing it takes quite some time to grow into
> an area where it starts hurting. The problem obviously is if someone
> splits the mark field into 2 parts and uses the upper 16 bits for
> some special purpose just like you did. In such as case it would make
> sense to either take all bits into account or let the user specify
> a bitmask + shift.
> 
> So here is the same idea I posted before but revised:
> 
> Let the user specify one of the hash tables via a new TLV:
>  - default: & 0xFF
>  - ((mark & mask) >> shift) & 0xFF
>  - jenkins for 16, 32, and 64 bits
>  - FNV for 16, 32, and 64 bits
> 
> Why variations for type sizes? The chance of collisions reduces
> a lot if the user exactly knows he'll never use more than 16bits
> but 255 marks are not enough.
> 
> I'm cooking up a patch for this today together with a fix to
> allow 64bit values for the mark.
> 

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;
}

-- 
Eran Mann
MRV International
www.mrv.com

  parent reply	other threads:[~2005-04-06 13:36 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-05  5:35 [PATCH] improvement on net/sched/cls_fw.c's hash function Wang Jian
2005-04-05  5:37 ` David S. Miller
2005-04-05  6:05   ` Wang Jian
2005-04-05 10:25     ` jamal
2005-04-05 10:38     ` Thomas Graf
2005-04-05 11:25       ` Wang Jian
2005-04-05 12:16         ` Thomas Graf
2005-04-05 12:39           ` Wang Jian
2005-04-05 12:52             ` Thomas Graf
2005-04-05 13:29               ` Wang Jian
2005-04-05 12:54             ` jamal
2005-04-05 14:18               ` Wang Jian
2005-04-05 16:11                 ` jamal
2005-04-06  6:45                   ` Wang Jian
2005-04-06 12:16                     ` jamal
2005-04-06 12:30                     ` Thomas Graf
2005-04-06 13:01                       ` Wang Jian
2005-04-06 13:34                       ` jamal
2005-04-06 13:45                         ` Thomas Graf
2005-04-06 14:10                           ` Thomas Graf
2005-04-06 18:15                             ` David S. Miller
2005-04-06 18:31                               ` Thomas Graf
2005-04-07  0:55                                 ` [RFC] dynamic hash table size & xor hash function for cls_fw Thomas Graf
2005-04-07 10:38                                   ` jamal
2005-04-07 10:47                                     ` Wang Jian
2005-04-07 10:51                                     ` Thomas Graf
2005-04-07 11:07                                       ` jamal
2005-04-07 13:09                                         ` [PATCH] [PKT_SCHED]: improve hashing performance of cls_fw Thomas Graf
2005-04-07 13:31                                           ` Wang Jian
2005-04-07 13:52                                             ` Thomas Graf
2005-04-07 14:03                                               ` Wang Jian
2005-04-06 13:36                       ` Eran Mann [this message]
2005-04-06 13:53                         ` [PATCH] improvement on net/sched/cls_fw.c's hash function Wang Jian

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=4253E5D4.60504@mrv.com \
    --to=emann@mrv.com \
    --cc=hadi@cyberus.ca \
    --cc=lark@linux.net.cn \
    --cc=netdev@oss.sgi.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 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.