summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Datapath.c
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2015-11-25 12:00:55 -0800
committerGurucharan Shetty <gshetty@nicira.com>2015-11-25 13:54:28 -0800
commit9be4a8373394c3afcf80a4b02a12a914e7fc1eb9 (patch)
treecda8c971bd6c75490d4c0b4c0d6cd29a0fb7f786 /datapath-windows/ovsext/Datapath.c
parent958227c655d41821843e8d5d2b636f586b0cb5b4 (diff)
downloadopenvswitch-9be4a8373394c3afcf80a4b02a12a914e7fc1eb9.tar.gz
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>
Diffstat (limited to 'datapath-windows/ovsext/Datapath.c')
-rw-r--r--datapath-windows/ovsext/Datapath.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index b3dbd7164..a9a218d20 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -1497,7 +1497,6 @@ OvsPortFillInfo(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
BOOLEAN ok;
OVS_MESSAGE msgOutTmp;
PNL_MSG_HDR nlMsg;
- POVS_VPORT_ENTRY vport;
ASSERT(NlBufAt(nlBuf, 0, 0) != 0 && nlBuf->bufRemLen >= sizeof msgOutTmp);
@@ -1512,9 +1511,9 @@ OvsPortFillInfo(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
msgOutTmp.genlMsg.reserved = 0;
/* we don't have netdev yet, treat link up/down a adding/removing a port*/
- if (eventEntry->status & (OVS_EVENT_LINK_UP | OVS_EVENT_CONNECT)) {
+ if (eventEntry->type & (OVS_EVENT_LINK_UP | OVS_EVENT_CONNECT)) {
msgOutTmp.genlMsg.cmd = OVS_VPORT_CMD_NEW;
- } else if (eventEntry->status &
+ } else if (eventEntry->type &
(OVS_EVENT_LINK_DOWN | OVS_EVENT_DISCONNECT)) {
msgOutTmp.genlMsg.cmd = OVS_VPORT_CMD_DEL;
} else {
@@ -1529,17 +1528,11 @@ OvsPortFillInfo(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
goto cleanup;
}
- vport = OvsFindVportByPortNo(gOvsSwitchContext, eventEntry->portNo);
- if (!vport) {
- status = STATUS_DEVICE_DOES_NOT_EXIST;
- goto cleanup;
- }
-
ok = NlMsgPutTailU32(nlBuf, OVS_VPORT_ATTR_PORT_NO, eventEntry->portNo) &&
- NlMsgPutTailU32(nlBuf, OVS_VPORT_ATTR_TYPE, vport->ovsType) &&
+ NlMsgPutTailU32(nlBuf, OVS_VPORT_ATTR_TYPE, eventEntry->ovsType) &&
NlMsgPutTailU32(nlBuf, OVS_VPORT_ATTR_UPCALL_PID,
- vport->upcallPid) &&
- NlMsgPutTailString(nlBuf, OVS_VPORT_ATTR_NAME, vport->ovsName);
+ eventEntry->upcallPid) &&
+ NlMsgPutTailString(nlBuf, OVS_VPORT_ATTR_NAME, eventEntry->ovsName);
if (!ok) {
status = STATUS_INVALID_BUFFER_SIZE;
goto cleanup;
@@ -1606,4 +1599,3 @@ OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
cleanup:
return status;
}
-