summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Switch.h
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2014-10-09 17:46:57 +0000
committerBen Pfaff <blp@nicira.com>2014-10-09 15:47:53 -0700
commit429d455615b010cebe9cf1fbcb10b5e20c08c21f (patch)
tree47a17b726d003d7af0ead977c74e4ec4c13d1e16 /datapath-windows/ovsext/Switch.h
parent91c261cd0efc40f7ed70427441141656cf5a3932 (diff)
downloadopenvswitch-429d455615b010cebe9cf1fbcb10b5e20c08c21f.tar.gz
datapath-windows: Make VPORT ovs number values smaller than MAXUINT16
For this, the old method of finding vports based on the ovs port numbers is removed. Now, the lookup of a vport by ovs port number is done the same way as the lookup by hyper-v switch port id. This is done so that the kernel is able to interact with the userspace correctly when using vport channels. The problem manifested in lib/dpif-netlink.c, at the function vport_add_channels. This patch removes the field vportArray from OVS_SWITCH_CONTEXT. In its place, portNoHashArray is set. In the OVS_VPORT_ENTRY struct, we also add portNoLink. This new method will do lookup and insertions of vports by ovs (datapath) port numbers the same way it is done for hyper-v switch port ids. This patch implicitly removes the indexes, which were previously used in insertions and lookups on ovs port numbers. The removal of the index also means that the vxlan vport can no longer be looked up the same way as it was done before: now we hold a pointer to it, vxlanVport in OVS_SWITCH_CONTEXT. For the moment, we can have only one vxlan vport. When more will be allowed, this field will turn into a list of vxlan ports. The invalid port number value (held in OVS_DPPORT_NUMBER_INVALID) is now changed from 0 to MAXUINT16, the same as it is on linux. The function OvsComputeVportNo has also been removed, since the computation of a vport port number can no longer be done like this. When vport add will be added, a new, updated OvsComputeVportNo function will be added. Also, in OvsInitVportCommon, we no longer need to (and no longer can) initialize vport->ovsName, nor vport->ovsNameLen, because they will be initialized by the netlink command vport add. Since the netlink command vport add will generate numbers for the datapath (ovs) port numbers and set the port names, we cannot insert the vport into the hash array of port numbers here, nor into the hash array of port names. Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Tested-by: Nithin Raju <nithin@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.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/datapath-windows/ovsext/Switch.h b/datapath-windows/ovsext/Switch.h
index d9761b45c..4591c11a7 100644
--- a/datapath-windows/ovsext/Switch.h
+++ b/datapath-windows/ovsext/Switch.h
@@ -37,17 +37,6 @@
#define OVS_GRE64_VPORT_INDEX 4
#define OVS_TUNNEL_INDEX_END OVS_GRE64_VPORT_INDEX
-#define OVS_EXTERNAL_VPORT_START 8
-#define OVS_EXTERNAL_VPORT_END 40
-#define OVS_INTERNAL_VPORT_START 40
-#define OVS_INTERNAL_VPOR_END 72
-#define OVS_VM_VPORT_START 72
-#define OVS_VM_VPORT_MAX 0xffff
-#define OVS_VPORT_INDEX(_portNo) ((_portNo) & 0xffffff)
-#define OVS_VPORT_PORT_NO(_index, _gen) \
- (((_index) & 0xffffff) | ((UINT32)(_gen) << 24))
-#define OVS_VPORT_GEN(portNo) (portNo >> 24)
-
#define OVS_MAX_PHYS_ADAPTERS 32
#define OVS_MAX_IP_VPOR 32
@@ -109,9 +98,15 @@ typedef struct _OVS_SWITCH_CONTEXT
POVS_VPORT_ENTRY externalVport; // the virtual adapter vport
POVS_VPORT_ENTRY internalVport;
- PVOID *vportArray;
- PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
- PLIST_ENTRY portIdHashArray; // based on portId
+ /*
+ * XXX when we support multiple VXLAN ports, we will need a list entry
+ * instead
+ */
+ POVS_VPORT_ENTRY vxlanVport;
+
+ PLIST_ENTRY ovsPortNameHashArray; // based on ovsName
+ PLIST_ENTRY portIdHashArray; // based on portId
+ PLIST_ENTRY portNoHashArray; // based on ovs port number
UINT32 numPhysicalNics;
UINT32 numVports; // include validation port
@@ -165,7 +160,6 @@ OvsReleaseDatapath(OVS_DATAPATH *datapath,
}
-PVOID OvsGetVportFromIndex(UINT16 index);
PVOID OvsGetExternalVport();
#endif /* __SWITCH_H_ */