[ovs-dev] [PATCH 6/6] netdev-linux: Cache error code from do_get_ifindex().
blp at nicira.com
Thu Mar 8 15:40:40 PST 2012
On Thu, Mar 08, 2012 at 07:26:49AM -0800, Pravin B Shelar wrote:
> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
I think that we need to be a little bit careful here, because people
do make changes such that the ifindex associated with a particular
network device name changes. One case is renaming network devices,
e.g. some distros actually swap around device names at system startup
in some cases. Another case is VM startup on XenServer; I know that
I've seen e.g. vif1.0 appear and then disappear and then reappear as a
new device (with a new ifindex) that just happens to have the same
So, if we want to cache this mapping, then I'd suggest:
- Update the ifindex from rtnetlink notifications (it's
already in struct rtnetlink_link_change as ifi_index).
- Drop the cached ifindexes if netdev_linux_cache_cb() gets a
NULL 'change' parameter.
As a minor point of style, in netdev_dev_linux_changed() you can drop
the parentheses here:
> + /* Always cache driver-info and ifindex. */
> + dev->cache_valid &= (VALID_DRVINFO | VALID_IFINDEX);
More information about the dev