summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Switch.h
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2014-10-23 17:33:13 -0700
committerBen Pfaff <blp@nicira.com>2014-10-28 08:43:34 -0700
commit35f20164e225240e443b9140313ce75539c841d3 (patch)
treee4835d0a52ea1dfbaf3cfaf11584b2ff06c9cbc7 /datapath-windows/ovsext/Switch.h
parentf16130074152b301515f52867cf9eaa012e4dc54 (diff)
downloadopenvswitch-35f20164e225240e443b9140313ce75539c841d3.tar.gz
datapath-windows: Update vport add code.
In this patch, we make the following updates to the vport add code: 1. Clarify the roles of the different hash tables, so it is easier to read/write code in the future. 2. Update OvsNewVportCmdHandler() to support adding bridge-internal ports. 3. Fixes in OvsNewVportCmdHandler() to support adding external port. Earlier, we'd hit ASSERTs. 4. I could not figure out way to add a port of type OVS_PORT_TYPE_INTERNAL with name "internal" to the confdb using ovs-vsctl.exe. And, this is needed in order to add the Hyper-V internal port from userspace. To workaround this problem, we treat a port of type OVS_PORT_TYPE_NETDEV with name "internal" as a request to add the Hyper-V internal port. This is a workaround. The end result is that there's a discrepancy between the port type in the datpaath v/s confdb, but this has not created any trouble in testing so far. If this ends up becoming an issue, we can mark the Hyper-V internal port to be of type OVS_PORT_TYPE_NETDEV. No harm. 5. Because of changes indicated in #1, we also update the vport dump code to look at the correct hash table for ports added from userspace. 6. Add a OvsGetTunnelVport() for convenience. 7. Update ASSERTs() while cleaning up the switch. 8. Nuke OvsGetExternalVport() and OvsGetExternalMtu(). 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/Switch.h')
-rw-r--r--datapath-windows/ovsext/Switch.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/datapath-windows/ovsext/Switch.h b/datapath-windows/ovsext/Switch.h
index 11d9df623..8df250089 100644
--- a/datapath-windows/ovsext/Switch.h
+++ b/datapath-windows/ovsext/Switch.h
@@ -133,20 +133,28 @@ typedef struct _OVS_SWITCH_CONTEXT
POVS_VPORT_ENTRY vxlanVport;
- PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
+ /*
+ * 'portIdHashArray' ONLY contains ports that exist on the Hyper-V switch,
+ * namely: VIF (vNIC) ports, external port and Hyper-V internal port.
+ * 'numHvVports' counts the ports in 'portIdHashArray'.
+ *
+ * 'portNoHashArray' ONLY contains ports that are added from OVS userspace,
+ * regardless of whether that port exists on the Hyper-V switch or not.
+ * Tunnel ports and bridge-internal ports are examples of ports that do not
+ * exist on the Hyper-V switch, and 'numNonHvVports' counts such ports in
+ * 'portNoHashArray'.
+ *
+ * 'ovsPortNameHashArray' contains the same entries as 'portNoHashArray' but
+ * hashed on a different key.
+ */
PLIST_ENTRY portIdHashArray; // based on Hyper-V portId
PLIST_ENTRY portNoHashArray; // based on ovs port number
+ PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
PLIST_ENTRY pidHashArray; // based on packet pids
NDIS_SPIN_LOCK pidHashLock; // Lock for pidHash table
- /*
- * 'numPhysicalNics' is the number of physical external NICs.
- * 'numHvVports' is the number of Hyper-V switch ports added to OVS
- * via the NDIS callbacks.
- * 'numNonHvVports' is the number of ports added from userspace that are
- * not on the Hyper-V switch. Eg. tunnel ports.
- */
- UINT32 numPhysicalNics;
+ UINT32 numPhysicalNics; // the number of physical
+ // external NICs.
UINT32 numHvVports;
UINT32 numNonHvVports;