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
|