datapath-windows: cleanup events code
authorNithin Raju <nithin@vmware.com>
Wed, 25 Nov 2015 20:00:55 +0000 (12:00 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 25 Nov 2015 21:54:28 +0000 (13:54 -0800)
commit9be4a8373394c3afcf80a4b02a12a914e7fc1eb9
treecda8c971bd6c75490d4c0b4c0d6cd29a0fb7f786
parent958227c655d41821843e8d5d2b636f586b0cb5b4
datapath-windows: cleanup events code

Turns out that we don't need to generate an event is practically
useful only in case of a port disconnect to let userspace know.
Hence, this event is being posted from HvDisconnectNic().

In case of a new port appearing, it seems that userspace is not
interested in a new port unless it was added by userspace itself.
In my tests, userspce would end up deleting the port when it got
a new port notification, despite the port existing in OVSDB.

The reasoning seems simple enough:
- On Linux, OVS is integrated with the hypervisor (libvirt for eg)
and a port (ie. netdev) gets created in the Linux kernel and then
get added to OVSDB. When vswitchd picks up the port addition in OVSDB,
it adds the port in the OVS kernel DP.
- If the kernel netdev does not exist while OVS userspace tries to
create the port in OVS kernel DP, port addition fails. Moreover, the
only way to re-add the port is to trigger userspace to re-add the port
by deleting the port in OVSDB and re-adding it.

With this patch, I have verified that if a VIF gets disconnected on the
Hyper-V switch, it disappears from the OVS kernel DP as well.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
datapath-windows/ovsext/Datapath.c
datapath-windows/ovsext/DpInternal.h
datapath-windows/ovsext/Event.c
datapath-windows/ovsext/Event.h
datapath-windows/ovsext/Switch.c
datapath-windows/ovsext/Vport.c