mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 16:25:17 +00:00
netdev-linux: Factor out duplicate ifi_flags update code.
Signed-off-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2010, 2011 Nicira Networks.
|
* Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -483,12 +483,18 @@ netdev_linux_wait(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
netdev_dev_linux_changed(struct netdev_dev_linux *dev)
|
netdev_dev_linux_changed(struct netdev_dev_linux *dev, unsigned int ifi_flags)
|
||||||
{
|
{
|
||||||
dev->change_seq++;
|
dev->change_seq++;
|
||||||
if (!dev->change_seq) {
|
if (!dev->change_seq) {
|
||||||
dev->change_seq++;
|
dev->change_seq++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((dev->ifi_flags ^ ifi_flags) & IFF_RUNNING) {
|
||||||
|
dev->carrier_resets++;
|
||||||
|
}
|
||||||
|
dev->ifi_flags = ifi_flags;
|
||||||
|
|
||||||
dev->cache_valid = 0;
|
dev->cache_valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,13 +511,7 @@ netdev_linux_cache_cb(const struct rtnetlink_link_change *change,
|
|||||||
|
|
||||||
if (is_netdev_linux_class(netdev_class)) {
|
if (is_netdev_linux_class(netdev_class)) {
|
||||||
dev = netdev_dev_linux_cast(base_dev);
|
dev = netdev_dev_linux_cast(base_dev);
|
||||||
|
netdev_dev_linux_changed(dev, change->ifi_flags);
|
||||||
if ((dev->ifi_flags ^ change->ifi_flags) & IFF_RUNNING) {
|
|
||||||
dev->carrier_resets++;
|
|
||||||
}
|
|
||||||
dev->ifi_flags = change->ifi_flags;
|
|
||||||
|
|
||||||
netdev_dev_linux_changed(dev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -526,12 +526,7 @@ netdev_linux_cache_cb(const struct rtnetlink_link_change *change,
|
|||||||
dev = node->data;
|
dev = node->data;
|
||||||
|
|
||||||
get_flags(&dev->netdev_dev, &flags);
|
get_flags(&dev->netdev_dev, &flags);
|
||||||
if ((dev->ifi_flags ^ flags) & IFF_RUNNING) {
|
netdev_dev_linux_changed(dev, flags);
|
||||||
dev->carrier_resets++;
|
|
||||||
}
|
|
||||||
dev->ifi_flags = flags;
|
|
||||||
|
|
||||||
netdev_dev_linux_changed(dev);
|
|
||||||
}
|
}
|
||||||
shash_destroy(&device_shash);
|
shash_destroy(&device_shash);
|
||||||
}
|
}
|
||||||
@@ -1171,7 +1166,7 @@ netdev_linux_miimon_run(void)
|
|||||||
netdev_linux_get_miimon(dev->netdev_dev.name, &miimon);
|
netdev_linux_get_miimon(dev->netdev_dev.name, &miimon);
|
||||||
if (miimon != dev->miimon) {
|
if (miimon != dev->miimon) {
|
||||||
dev->miimon = miimon;
|
dev->miimon = miimon;
|
||||||
netdev_dev_linux_changed(dev);
|
netdev_dev_linux_changed(dev, dev->ifi_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_set_duration(&dev->miimon_timer, dev->miimon_interval);
|
timer_set_duration(&dev->miimon_timer, dev->miimon_interval);
|
||||||
|
Reference in New Issue
Block a user