netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: "David S. Miller" <davem@redhat.com>
Cc: shemminger@osdl.org, netdev@oss.sgi.com
Subject: Re: [PATCH] support for large number of network devices.
Date: Tue, 13 Jan 2004 23:54:56 -0800	[thread overview]
Message-ID: <4004F5D0.7040106@candelatech.com> (raw)
In-Reply-To: <20040113231825.700e534f.davem@redhat.com>

David S. Miller wrote:

> Therefore, I think it's wise to just do this right from the start and use a hash.
> Stephen can you test up and submit the netdev name hash patch you have?
> 

In case it proves useful, here's the hash I used before.  It makes some
assumptions based on the fact that the last two characters of a device name
are often numbers, especially when you have lots of devices.  Someone
did a mapping of this and found it worked well for vlans, at least.


int fdl_calc_name_idx(const char* dev_name) {
  int tmp = 0;
  int i;

  for (i = 0; dev_name[i]; i++) {
    tmp += (int)(dev_name[i]);
  }
  if (i > 3) {
    tmp += (dev_name[i-2] * 10); /* might add a little spread to the hash */
    tmp += (dev_name[i-3] * 100); /* might add a little spread to the hash */
  }
  return (tmp % FDL_HASH_LEN);
}


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2004-01-14  7:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-13 23:46 [PATCH] support for large number of network devices Stephen Hemminger
2004-01-13 23:59 ` David S. Miller
2004-01-14  0:13   ` Stephen Hemminger
2004-01-14  7:13     ` Matt Mackall
2004-01-14 19:37       ` Stephen Hemminger
2004-01-14 19:51         ` Matt Mackall
2004-01-14 20:11         ` David S. Miller
2004-01-15  0:24           ` Stephen Hemminger
2004-01-15  8:46             ` David S. Miller
2004-01-15 17:52               ` Stephen Hemminger
2004-01-15 19:40                 ` David S. Miller
2004-01-14  0:23 ` Ben Greear
2004-01-14  0:38   ` Stephen Hemminger
2004-01-14  1:55     ` Ben Greear
2004-01-14  7:18       ` David S. Miller
2004-01-14  7:54         ` Ben Greear [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-01-14 21:39 Jean Tourrilhes

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=4004F5D0.7040106@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=shemminger@osdl.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;
as well as URLs for NNTP newsgroup(s).