X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-vport.c;h=ec67aaaae45093727155e5f3184c914537dc0dca;hb=ac4d3bcb46fa0acd0b63f79449432df28569f74f;hp=3067323671a1a7e87cd286214a385da56143c8f3;hpb=b2fda3effc787f265b5ad5dfa967ac00627bd075;p=sliver-openvswitch.git diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 306732367..ec67aaaae 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -59,6 +59,7 @@ struct netdev_dev_vport { struct ofpbuf *options; int dp_ifindex; /* -1 if unknown. */ uint32_t port_no; /* UINT32_MAX if unknown. */ + unsigned int change_seq; }; struct netdev_vport { @@ -242,6 +243,7 @@ netdev_vport_create(const struct netdev_class *netdev_class, const char *name, dev->options = options; dev->dp_ifindex = dp_ifindex; dev->port_no = port_no; + dev->change_seq = 1; *netdev_devp = &dev->netdev_dev; route_table_register(); @@ -538,6 +540,12 @@ netdev_vport_poll_remove(struct netdev_notifier *notifier_) free(notifier); } +static unsigned int +netdev_vport_change_seq(const struct netdev *netdev) +{ + return netdev_dev_vport_cast(netdev_get_dev(netdev))->change_seq; +} + static void netdev_vport_run(void) { @@ -581,6 +589,9 @@ netdev_vport_poll_notify(const struct netdev *netdev) char *poll_name = make_poll_name(netdev); struct list *list = shash_find_data(&netdev_vport_notifiers, poll_name); + struct netdev_dev_vport *ndv; + + ndv = netdev_dev_vport_cast(netdev_get_dev(netdev)); if (list) { struct netdev_vport_notifier *notifier; @@ -591,6 +602,11 @@ netdev_vport_poll_notify(const struct netdev *netdev) } } + ndv->change_seq++; + if (!ndv->change_seq) { + ndv->change_seq++; + } + free(poll_name); } @@ -986,7 +1002,8 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, netdev_vport_update_flags, \ \ netdev_vport_poll_add, \ - netdev_vport_poll_remove, + netdev_vport_poll_remove, \ + netdev_vport_change_seq void netdev_vport_register(void)