Skip to content

Commit

Permalink
netdev-vport: Do not update netdev when there is no config change.
Browse files Browse the repository at this point in the history
When there is any update from ovsdb, ovs will call netdev_set_config()
for every vport.  Even though the change is not related to vport, the
current implementation will always increment the per-netdev sequence
number.  Subsequently this could cause even more unwanted effects,
e.g. the recreation of 'struct tnl_port' in ofproto level.

This commit fixes the issue by only updating the netdev when there
is actual configuration change.

Signed-off-by: Alex Wang <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
yew011 committed Mar 27, 2015
1 parent c1ddf09 commit a190839
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/netdev-vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,11 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
&tnl_cfg.out_key_flow);

ovs_mutex_lock(&dev->mutex);
dev->tnl_cfg = tnl_cfg;
tunnel_check_status_change__(dev);
netdev_change_seq_changed(dev_);
if (memcmp(&dev->tnl_cfg, &tnl_cfg, sizeof tnl_cfg)) {
dev->tnl_cfg = tnl_cfg;
tunnel_check_status_change__(dev);
netdev_change_seq_changed(dev_);
}
ovs_mutex_unlock(&dev->mutex);

return 0;
Expand Down Expand Up @@ -787,9 +789,11 @@ set_patch_config(struct netdev *dev_, const struct smap *args)
}

ovs_mutex_lock(&dev->mutex);
free(dev->peer);
dev->peer = xstrdup(peer);
netdev_change_seq_changed(dev_);
if (!dev->peer || strcmp(dev->peer, peer)) {
free(dev->peer);
dev->peer = xstrdup(peer);
netdev_change_seq_changed(dev_);
}
ovs_mutex_unlock(&dev->mutex);

return 0;
Expand Down

0 comments on commit a190839

Please sign in to comment.