[ovs-discuss] [abstract-netdev v2 13/21] netdev: Make netdev_find_dev_by_in4() use netdevs, not device names.

Ben Pfaff blp at nicira.com
Wed Jul 29 17:51:30 UTC 2009


Justin Pettit <jpettit at nicira.com> writes:

> I agree that the old "hint" mechanism was a bit clunky as implemented,
> but do you think we should scrap it entirely?  Opening the netdev
> device for all the devices each time this call is made seems like it
> could get pretty expensive.  

I did not see a reason to implement the hinting in
netdev_find_dev_by_in4() itself.  The caller can do it just as
well, and that's what the commit in question does.  This seems
cleaner to me, since it makes netdev_find_dev_by_in4() do just
one thing (finding a netdev by IP address), not one-and-a-half
(finding a netdev by IP address, first checking a hint netdev).

As for the penalty for opening a network device, it is true that
there is one at this commit, but one of the nice things that the
abstracted implementation of netdevs (a few commits later) gives
us is that opening a network device becomes essentially free.  In
that netdev implementation, if "eth0" is a network device that
we've already opened before, then the call sequence
netdev_open("eth0", &netdev), netdev_get_in4(netdev),
netdev_close(netdev) makes no system calls at all in the common
case, so there's no reason not to just do it that way.




More information about the discuss mailing list