netdev
[Top] [All Lists]

Re: [PATCH] support for large number of network devices.

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: [PATCH] support for large number of network devices.
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Tue, 13 Jan 2004 23:54:56 -0800
Cc: shemminger@xxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040113231825.700e534f.davem@xxxxxxxxxx>
Organization: Candela Technologies
References: <20040113154610.38f5934c.shemminger@xxxxxxxx> <40048BFD.4010303@xxxxxxxxxxxxxxx> <20040113163828.64ec4743.shemminger@xxxxxxxx> <4004A194.3030602@xxxxxxxxxxxxxxx> <20040113231825.700e534f.davem@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
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@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com



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