summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Vport.h
Commit message (Collapse)AuthorAgeFilesLines
* datapath-windows: Add annotations to find vport functionsAlin Gabriel Serdean2019-03-131-0/+5
| | | | | | | | | Add annotations to find vport functions to check if the dispatch lock is held. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com>
* datapath-windows: Add a wrapper to retreive external vportShashank Ram2017-01-271-0/+2
| | | | | | | | This wrapper is to simplify readability. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add multiple switch internal portsAlin Serdean2016-12-201-62/+42
| | | | | | | | | | | | This patch adds multiple internal ports support to the windows datapath. All tunnels types have been updated to accommodate this new functionality. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Fix various Geneve bugsYin Lin2016-07-211-0/+5
| | | | | | | Signed-off-by: Yin Lin <linyi@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: use ip proto for tunnel port lookupNithin Raju2016-06-171-3/+6
| | | | | | | | | | | | | | | | | | In Actions.c, based on the IP Protocol type and L4 port of the outer packet, we lookup the tunnel port. The function that made this happen took the tunnel type as an argument. Semantically, is is better to pass the IP protocol type and let the lookup code map IP protocol type to tunnel type. In the vport add code, we make sure that we block tunnel port addition if there's already a tunnel port that uses the same IP protocol type and L4 port number. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Yin Lin <linyi@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add GRE TEB support for windows datapathAlin Serdean2015-12-111-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces the support for GRE TEB (trasparent ethernet bridging) for the windows datapath. The GRE support is based on http://tools.ietf.org/html/rfc2890, without taking into account the GRE sequence, and it supports only the GRE protocol type 6558 (trasparent ethernet bridging) like its linux counterpart. Util.h: define the GRE pool tag Vport.c/h: sort the includes alphabetically add the function OvsFindTunnelVportByPortType which searches the tunnelVportsArray for a given port type Actions.c : sort the includes alphabetically call the GRE encapsulation / decapsulation functions when needed Gre.c/h : add GRE type defines add initialization/cleanup functions add encapsulation / decapsulation functions with software offloads (hardware offloads will be added in a separate patch) support Tested using: PSPING (https://technet.microsoft.com/en-us/sysinternals/psping.aspx) (ICMP, TCP, UDP) with various packet lengths IPERF3 (https://iperf.fr/iperf-download.php) (TCP, UDP) with various options Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* datapath-windows: Fix HvUpdateNic() to handle name changesNithin Raju2015-11-251-3/+31
| | | | | | | | | | | | | | | | | If the name of an internal or external NIC changes, we need to disconnect the NIC from OVS since the name is the key. In this change, we generate a link down event. It is as though we got a call to HvDisconnectNic() for the old name and got a HvConnectNic() for the new name. Also, HvCreateNic() has been cleaned up to remove the code to look for existing vport. We won't have a vport now since we'd have deleted the vport in HvDeleteNic(). 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: cleanup InitHvVportCommon()Nithin Raju2015-11-251-1/+2
| | | | | | | | | | | | | | | | | | | | | The workflow being implemented is that, we need to assign a special name to the internal and external NICs, and it it not necessary to do that from InitHvVportCommon(). The purpose of InitHvVportCommon() is to insert the vport into the hash tables and update the switch context. We special case the name assignment in HvCreateNIC() for internal and external NICs. That seems more meaningful. Also, reused HvCreatePort() to allocate a Vport for each of the external NICs with NicIndex != 0. Due to this HvCreatePort() now takes 'nicIndex' as an additional parameter. Renamed InitHvVportCommon() to UpdateSwitchCtxWithVport(). 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: Removed hardcoded names for internal/external vportsSorin Vinturis2015-09-221-5/+0
| | | | | | | | | | The internal/external vports will have the actual OS-based names, which represent the NIC interface alias that is displayed by running 'Get-NetAdapter' Hyper-V PS command. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmare.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* tunneling: Remove gre64 tunnel support.Pravin B Shelar2015-08-201-3/+2
| | | | | | | | | | GRE64 was introduced to extend gre key from 32-bit to 64-bit using gre-key and sequence number field. But GRE64 is not standard protocol. There are not many users of this protocol. Therefore we have decided to remove it. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* datapath-windows: Rename 'vport->isPresentOnHv' to 'isAbsentOnHv'Nithin Raju2015-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | Looking at the code, the flag 'vport->isPresentOnHv' is actually indicating if the vport is present on the Hyper-V switch or not, but the logic seems to be inverse. 'isPresentOnHv == TRUE' indicates that the vport is not present on the Hyper-V switch. Eg. VXLAN port, would have isPresentOnHv == TRUE. In this patch, we rename the variable to reflect its meaning. vport->isAbsentOnHv is TRUE iff: - vport is bridge internal port - vport is tunnel port - vport was added from Hyper-V and also from OVS, but got deleted from Hyper-V Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Stateless TCP Tunnelling protocol - Initial implementationEitan Eliahu2015-06-111-1/+46
| | | | | | | | | | | | | | | | | | | This change include an initial implementable of STT. The following should be added: [1] Checksum offload (SW and HW) [2] LSO (SW and HW) [3] IP layer WFP callout for IP segments Added support for multiple (per TCP port) STT ports Testing: link layer connection through ping works. File transfer. Signed-off-by: Eitan Eliahu <eliahue@vmware.com> Co-authored-by: Saurabh Shah <ssaurabh@vmware.com> Signed-off-by: Saurabh Shah <ssaurabh@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Support for multiple VXLAN tunnelsSorin Vinturis2015-05-271-16/+5
| | | | | | | | | | | | | | At the moment the OVS extension supports only one VXLAN tunnel that is cached in the extension switch context. Replaced the latter cached pointer with an array list that contains all VXLAN tunnel vports. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/64 Acked-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Support for custom VXLAN tunnel portSorin Vinturis2015-05-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel datapath supports only port 4789 for VXLAN tunnel creation. Added support in order to allow for the VXLAN tunnel port to be configurable to any port number set by the userspace. The patch also checks to see if an existing WFP filter, for the necessary UDP tunnel port, is already created before adding a new one. This is a double check, because currently the userspace also verifies this, but it is necessary to avoid future issues. Custom VXLAN tunnel port requires the addition of a new WFP filter with the new UDP tunnel port. The creation of a new WFP filter is triggered in OvsInitVxlanTunnel function and the removal of the WFP filter in OvsCleanupVxlanTunnel function. But the latter functions are running at IRQL = DISPATCH_LEVEL, due to the NDIS RW lock acquisition, and all WFP calls must be running at IRQL = PASSIVE_LEVEL. This is why I have created a system thread which records all filter addition/removal requests into a list for later processing by the system thread. The ThreadStart routine processes all received requests at IRQL = PASSIVE_LEVEL, which is the required IRQL for the necessary WFP calls for adding/removal of the WFP filters. The WFP filter for the default VXLAN port 4789 is not added anymore at filter attach. All WFP filters for the tunnel ports are added when the tunnel ports are initialized and are removed at cleanup. WFP operation status is then reported to userspace. It is necessary that OvsTunnelFilterUninitialize function is called after OvsClearAllSwitchVports in order to allow for the added WFP filters to be removed. OvsTunnelFilterUninitialize function closes the global engine handle used by most of the WFP calls, including filter removal. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/66 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: rename 'hvDeleted' to 'isPresentOnHv'Nithin Raju2014-11-201-1/+2
| | | | | | | | | | | | | 'hvDeleted' was originally added to track vports that got deleted from the Hyper-V switch, but which still exists in OVS. Since then, it has taken a new meaning: eg. it is set to TRUE for VXLAN ports which don't exist on the Hyper-V switch at all. Hence renaming it to something more appropriate. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: cleanup DpInternal.hNithin Raju2014-11-201-3/+3
| | | | | | | | | | Getting rid of unused definitions in DpInternal.h. This is only the first round. There's scope for more cleanup. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Changes to InitOvsVportCommon()Nithin Raju2014-11-201-2/+0
| | | | | | | | | | | | | | | | | If a Hyper-V port (for which there exists an OVS port), gets deleted and re-added, we'll call into InitOvsVportCommon() for the port to insert the port into the 'portIdHashArray' as well as do a few other initialization in the switch ocntext. We should not be incrementing 'numHvPorts' at this point since this vport has been counted before when it was first allocated. To account for this, we add a new parameter to InitOvsVportCommon(). The arguments passed by some of the callers are not 100% correct, and will be fixed in future commit in the series. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Changes to OvsRemoveAndDeleteVport()Nithin Raju2014-11-201-1/+3
| | | | | | | | | | | | | | | | In this patch, we add changes to OvsRemoveAndDeleteVport() to allow the caller to specify if a vport is being deleted because it got deleted on Hyper-V or if it got deleted from OVS userspace. The reason we need to make the distinction is to be able to delete the vport from the relevant hash tables. If a port has been deleted from all the hash tables ie. has been deleted from Hyper-V as well as OVS userspace, it gets deallocated. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: add WCHAR version of OvsFindVportByHvName()Nithin Raju2014-11-201-9/+7
| | | | | | | | | | | | | | In this patch, we rename the existing OvsFindVportByHvName() to OvsFindVportByHvNameA() to indicate that the input string is an ASCII string. We also define a OvsFindVportByHvNameW() that takes as input a WCHAR string. This will be used later in HvCreatPort() to check for ports with duplicate names. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Update port property.Eitan Eliahu2014-11-121-0/+2
| | | | | | | | | | | | | | | | Update Hyper-V port properties on NDIS property port set callback. Driver update the port friendly name in its internal table. Since the NIC Create callback won't be called after we need to maintain the NIC and THE OVS states of the Vport. Setting a new friendly name was tested in the following states: [1] The port is disconnected [2] The port is connected but not OVS user mode counter port [3] The port is connected and an OCS port associated with it Signed-off-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Update vport add code.Nithin Raju2014-10-281-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* datapath-windows: Refactor core in Vport.c.Nithin Raju2014-10-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* datapath-windows: OvsInitTunnelVport() and OvsInitBridgeInternalVport().Nithin Raju2014-10-281-0/+3
| | | | | | | | | | In this patch, we add the init functions for a Tunnel vport and a Bridge-internal vport. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Introduce bridge-internal ports.Nithin Raju2014-10-281-0/+29
| | | | | | | | | | | | | | In this patch, we provide explanation and the reasoning for bridge-internal ports. The code to add such a port in come in later patch in the series. We also fix some formatting issues in PacketIO.c. 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>
* datapath-windows: Add netlink command: vport newNithin Raju2014-10-131-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Does the following: a. before creating the vport, makes sure there is no existing vport with the same ovs (datapath) port name. If this is not so, it means that the specified port already exists: it returns NL_ERROR_EXIST. b. looks up the vport: o) if the vport type is "internal", then the internal vport of the hyper-v switch is yielded. o) if the vport type is "netdev" and the vport ovs (datapath) name is "external", then the external vport is yielded. The switch can have only one "external" vport. The method of looking up the "external" port can be changed later, if a better method is found. o) if the vport type is "netdev" but the name is not "external", then a VM VNic is assumed, so the vport is looked up by hyper-v switch port friendly name. o) if none of the above, a tunneling vport type is expected, which in our case, at the moment, can only be the one vxlan vport. Only one vxlan vport is allowed, and it's saved in switchContext->vxlanVport. The tunneling vport is the only kind which is created in the netlink command vport new, because it does not have a hyper-v switch port counterpart. c. if the vport could not be found (non-tunneling vports), then the NL_ERROR_INVAL is returned to the userspace. d. if the vport was found, but it has a valid ovs (datapath) port number, it means that this port was already created by a netlink command vport new. Therefore, NL_ERROR_EXIST is returned to the userspace. e. if the netlink command vport new specified an ovs (datapath) port number, then it means that the userspace is trying to re-create a vport: that specified port number will be used. Otherwise, a new ovs (datapath) port number is computed and assigned to the vport. f. the ovsName field of the vport is set to the name given by the OVS_VPORT_ATTR_NAME netlink attribute. The ovsNameLen is no longer stored in the OVS_VPORT_ENTRY struct, because ovsName is null-terminated. g. the "portOptions" are set to the vport, if the attribute OVS_VPORT_ATTR_OPTIONS was given. Otherwise, it is set to NULL. portOptions is a PNL_ATTR, which is yet to be implemented. The only option available for now would be vxlan udp destination port, but we have a constant value there, so this option is not yet needed. h. the upcall pid is set to the vport. i. if the vport type is vxlan, then the vport pointer is also saved to switchContext->vxlanVport. j. Now that the ovs (datapath) port number and the ovs name were set, the vport can be added to the hash array of vports, hashed on ovs name and to the hash array of vports hashed by ovs (datapath) port number. k. the reply is yielded to the userspace. Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Add port friendly name to OVS_VPORT_ENTRYAlin Serdean2014-10-091-1/+4
| | | | | | | | | | | | | | | | | The port friendly name will be set by WMI / powershell script. It will be used from within the netlink command vport new to identify the hyper-v switch port it represents. This patch also adds a function to lookup a vport by the port friendly name. 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>
* datapath-windows: Make VPORT ovs number values smaller than MAXUINT16Alin Serdean2014-10-091-43/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* datapath-windows: Rename switch context's portHashArray and vport's portLinkAlin Serdean2014-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The field portLink of the OVS_VPORT_ENTRY is the link within the OVS_SWITCH_CONTEXT's hash array of vports portHashArray, hashed by the portId field of the OVS_VPORT_ENTRY. Later on, we will need to modify the OVS_VPORT_ENTRY so that its port numbers are set to maximum MAXUINT16. This will require that the field vportArray of OVS_SWITCH_CONTEXT be removed and replaced with a hash array, portNoHashArray. Also, a new field, portNoLink, will need to be added to OVS_VPORT_ENTRY. In order to differentiate between portHashArray and portNoHashArray, portHashArray is renamed to portIdHashArray. Also, in order to differentiate between portLink and portNoLink, portLink is renamed to portIdLink. In a future patch the vport functionality will be changed to constraint the port numbers to MAXUINT16. 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>
* datapath-windows: Rename switch context's nameHashArray and vport's nameLink ↵Alin Serdean2014-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | login register The field nameLink of the OVS_VPORT_ENTRY is the link within the OVS_SWITCH_CONTEXT's hash array of vports nameHashArray, hashed by the ovsName field of the OVS_VPORT_ENTRY. Later on, the friendly name of the hyper-v switch port will need to be set from userspace using WMI. This will require that the hyper-v switch port friendly name be set to the exact string value as the ovs (datapath) port name set from netlink command vport add. The vport will need to differentiate between the ovs (datapath) port name and hyper-v switch port friendly name, because they may differ in erroneous scenarios, or state differences between the hyper-v switch port and the ovs (datapath) port. This may happen if the vport was created by the netlink command vport add, but the VM disconnected (i.e. the hyper-v switch port was later deleted). Storing another field in vport, "portFriendlyName" would normally make the current switchContext->nameHashArray and vport->nameLink confusing since the "name"-s may be understood to mean the hyper-v switch port friendly name, or the hyper-v switch port name, when it actually refers to the ovs (datapath) port name. Hence, the variable nameHashArray is renamed to ovsPortNameHashArray, while the nameLink is renamed to ovsPortNameLink. This change will make a clearer connection between these and the vport field "ovsName" to which they revolve around. 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>
* datapath-windows: Rename OvsGetVportNo into OvsComputeVportNo and make publicAlin Serdean2014-10-091-0/+5
| | | | | | | | | | | | | | | | | | | | | OvsGetVportNo computes a new port number. Therefore, OvsComputeVportNo is a more clear name for what the function does. Reading OvsGetVportNo may give the false impression that it returns the port number of an existing vport. Also, since the responsibility of assigning dp port numbers no longer falls on the hyper-v switch port handlers side, but on the netlink vport commands side (vport add), we will need to use this compute port number function from outside Vport.c. Therefore, this function declaration is moved from Vport.c to Vport.h, and becomes public. 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>
* datapath-windows: Define OVS_DPPORT_NUMBER_INVALIDAlin Serdean2014-10-091-0/+2
| | | | | | | | | | | | | | | | | | | The fields externalVport and internalVport of the OVS_SWITCH_CONTEXT struct are currently defined as PVOID. However, all over the code they are used as POVS_VPORT_ENTRY. In order to improve clarity and reduce the need for useless casts to POVS_VPORT_ENTRY, this patch changes the type from PVOID to POVS_VPORT_ENTRY. This patch does not cleanup the code that already uses casts to POVS_VPORT_ENTRY. This cleanup can be done later on as well. 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>
* datapath-windows: We don't need to keep validation ports in ovsAlin Serdean2014-10-091-1/+0
| | | | | | | | | | | | | | | Validation ports are used internally by the hyper-v switch to validate and verify settings for the real hyper-v switch ports that will be connected to the VNic. The validation ports are of no use to us - we must skip handling them, and return STATUS_SUCCESS as the OID result. 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>
* datapath-windows: Rename hyper-v switch port and nic handlersAlin Serdean2014-10-091-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | Functions such as OvsCreatePort are vague in regard to who creates it or when. It wasn't a problem thus far, since the vports were created, updated and destroyed from one place only (hyper-v switch part). But now, with the netlink implementation of the vport commands, a part of the vport is constructed by the netlink vport add, and the other part is constructed by the hyper-v switch nic and port handlers. This patch renames the hyper-v switch nic and port handlers, so that they are now prefixed by "Hv" instead of "Ovs", in order to clarify which of the functions are nic or port handlers. This will make more clear the usages from netlink vport commands side and from hyper-v switch side. It will also make more obvious which nic and port functions are helper functions. 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>
* datapath-windows: Remove the old IOCTL vport functions.Alin Serdean2014-10-091-11/+0
| | | | | | | | | | | | | The old IOCTL vport functions (using the non-netlink device) are no longer needed. They should be removed. 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>
* datapath-windows: implementation of netdev commandsNithin Raju2014-10-061-3/+0
| | | | | | | | | | | | validation: - Vport dump works now without printing any errors. I didn't go so far as to test if vport add works. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Implement vport dump Netlink command.Samuel Ghinet2014-09-261-2/+9
| | | | | | | | | | | | | | | | | Functionality for vport dump. Later, when we will add more netlink dump commands, some common code will need to be split to functions. Notes: a) the current implementation of vport assumes the datapath feature "multiple upcall pids" is not used. A single upcall pid is used now. c) the vxlan destination udp port is currently a constant. When it will become configurable, the vport options netlink attribute will become relevant. Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: fix OVS_VPORT_TYPESamuel Ghinet2014-09-261-5/+6
| | | | | | | | | | | | | | | | | The windows ovs kernel uses an OVS_VPORT_TYPE enum that is incompatible with the userspace counterpart (enum ovs_vport_type from openvswitch.h). We must use the same enum type for the netlink communication to work properly. This patch makes the fix: "typedef enum ovs_vport_type OVS_VPORT_TYPE" and changes the afferent kernel driver code: o) vport types synthetic and emulated turn to: netdev o) vport type internal turns to: internal o) vport type external truns to: netdev (plus, we hold a field in vport, "isExternal" Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Rename files.Samuel Ghinet2014-08-291-0/+197
This patch includes the file renaming and accommodations needed for the file renaming to build the forwarding extension for Hyper-V. This patch is also a follow-up for the thread: http://openvswitch.org/pipermail/dev/2014-August/044005.html Signed-off-by: Samuel Ghinet <sghinet@cloudbasesolutions.com> Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>