Re: dev_get_by_index is not hashed: O(n)

From: Bernd Eckenfels (
Date: Fri Aug 30 2002 - 04:32:17 EST

In article <> you wrote:
> What does it use? And btw, I'd hash get-by-name too.

to get a list of interfaces it first tries to read with SIOCGIFCONF a list
of all interfaces in a single read into a buffer which has room for 30
entries (and increases the buffer *= 2 in case it was too small).

It also linearly reads proc/net/dev and merges the info from there into the
list of interfaces from above. Then it does a whole lot of ioctls on the
name of that interface to get protocol family dependend info. I think this
is the slowest thing.

the SIOCGIFCONF used to take a lot of time, cause the buffer was increasing
more slowly. Someone could try to use even more aggresive algo. or just use
a bigger start value. I havent benchmarked it, but I guess it it the getting
of all the protocol params which slows it.

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to
More majordomo info at

This archive was generated by hypermail 2b29 : Sat Aug 31 2002 - 22:00:01 EST