diff options
author | Nithin Raju <nithin@vmware.com> | 2014-10-23 17:33:12 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-10-28 08:40:49 -0700 |
commit | f16130074152b301515f52867cf9eaa012e4dc54 (patch) | |
tree | 3caff443f39f381ac243c9185cb85ad38297f647 /datapath-windows/ovsext/Vxlan.c | |
parent | b3b8a9c307c0154c0f65901986f57f14522b50cb (diff) | |
download | openvswitch-f16130074152b301515f52867cf9eaa012e4dc54.tar.gz |
datapath-windows: Refactor core in Vport.c.
We do a bunch of changes that did not make sense to split up into
smaller patches:
1. Add descriptive comments to the important functions to clarify
purpose.
2. s/OvsInitVportCommon/InitHvVportCommon - this function is common code
for every port that shows up on the Hyper-V switch.
3. Introduce a InitOvsVportCommon() that is common code for evrey port
that gets added from userspace. This is especially useful for ports
that are not present on the Hyper-V switch. ie. tunnel ports and
bridge-internal ports.
4. Fix OvsClearAllSwitchVports() to remove ports from both the lists:
the ones added from Hyper-V as well as the ones added from OVS
userspace.
5. Update OvsInitVxlanTunnel() to not call into InitHvVportCommon
(formerly OvsInitVportCommon()) since it is not a port on the Hyper-v
switch. In a later patch in the series, we'll call
InitOvsVportCommon() for a VXLAN port.
6. 'numNonHvVports' increments and decrements ONLY for ports that are
added from OVS userspace but not present on the Hyper-V switch.
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Vxlan.c')
-rw-r--r-- | datapath-windows/ovsext/Vxlan.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/datapath-windows/ovsext/Vxlan.c b/datapath-windows/ovsext/Vxlan.c index f5f3c0818..0a68c9cd2 100644 --- a/datapath-windows/ovsext/Vxlan.c +++ b/datapath-windows/ovsext/Vxlan.c @@ -52,13 +52,12 @@ extern POVS_SWITCH_CONTEXT gOvsSwitchContext; /* * udpDestPort: the vxlan is set as payload to a udp frame. If the destination * port of an udp frame is udpDestPort, we understand it to be vxlan. -*/ + */ NL_ERROR OvsInitVxlanTunnel(POVS_VPORT_ENTRY vport, UINT16 udpDestPort) { POVS_VXLAN_VPORT vxlanPort; - NTSTATUS status; vxlanPort = OvsAllocateMemory(sizeof (*vxlanPort)); if (vxlanPort == NULL) { @@ -68,23 +67,13 @@ OvsInitVxlanTunnel(POVS_VPORT_ENTRY vport, RtlZeroMemory(vxlanPort, sizeof(*vxlanPort)); vxlanPort->dstPort = udpDestPort; /* - * since we are installing the WFP filter before the port is created - * We need to check if it is the same number - * XXX should be removed later - */ + * since we are installing the WFP filter before the port is created + * We need to check if it is the same number + * XXX should be removed later + */ ASSERT(vxlanPort->dstPort == VXLAN_UDP_PORT); vport->priv = (PVOID)vxlanPort; - status = OvsInitVportCommon(gOvsSwitchContext, vport); - ASSERT(status == NDIS_STATUS_SUCCESS); - - vport->ovsState = OVS_STATE_CONNECTED; - vport->nicState = NdisSwitchNicStateConnected; - /* - * allow the vport to be deleted, because there is no hyper-v switch part - */ - vport->hvDeleted = TRUE; - return NL_ERROR_SUCCESS; } |