summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Stt.c
Commit message (Collapse)AuthorAgeFilesLines
* datapath-windows: Fix GRE/VxLAN/STT Tunnel RX.William Tu2022-06-221-6/+0
| | | | | | | | | | | | GRE/Vxlan/STT tunnel RX is broken due to incorrecly checking the 'tunKey->dst.si_family != AF_INET', which is actually set later after parsing the GRE header. Removing such chunk makes tunnel works. Fixes: edb2335861d6 ("datapath-windows: Add IPv6 Geneve tunnel support in Windows") Cc: Alin-Gabriel Serdean <aserdean@ovn.org> Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Add IPv6 Geneve tunnel support in WindowsWilson Peng2022-04-101-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the first step OVS Windows will support IPv6 tunnel(Geneve IPv6 tunnel). Implementation on Windows ------------------------- 1. For the IPv6 tunnel support,  OvsIPTunnelKey will replace original OvsIPv4TunnelKey in the related flow context handing. 2. The related src and dst address will be  changed to SOCKADDR_INET type from UINT32. 3. For the IPv6 tunnel,  one node running OVS-Windows could encapsulate IPv4/IPv6 Packets via IPV6 Geneve Tunnel, and the node could also encapsulate IPv4/IPv6 packet Via IPv4 Geneve tunnel. 4. Related IPHelper data structure will be adapted to support IPv6 Tunnel. In the IPHelper part the related Windows API(such as GetUnicastIpAddressTable/GetBestRoute2/GetIpNetEntry2/ ResolveIpNetEntry2) and Windows data structure(MIB_IPFORWARD_ROW2/MIB_IPNET_ROW2/IP_ADDRESS_PREFIX) Have already supported both IPv4 and IPV6. Now OVS Windows has been adjusted some functions And data structured to support IPV6 tunnel also. 5. OVS_TUNNEL_KEY_ATTR_IPV6_SRC and OVS_TUNNEL_KEY_ATTR_IPV6_DST filed will be supported in OVS-Windows kernel for IPV6 tunnel. Testing done. ------------------------- Related topo, 1 Windows VM(Win2019) and 2 Ubuntu 16.04 server. Both VMs Are running on one ESX host. 1. Setup one IPV6 Geneve Tunnel between 1 Windows VM and 1 Ubuntu server. Windows VM, vif0( 6000::2/40.1.1.10) vif1(5000::2)—— Ubuntu VM Eth2(5000::9), name space ns1 with interface ns1_link_peer(6000::9/40.1.1.2) Related tunnnel, ovs-vsctl.exe add-port br-int bms-tun0 -- set interface bms-tun0 type=Geneve options:csum=true options:key=flow options:local_ip="5000::2" options:remote_ip=flow In this topo, traffic from Vif0(Win) to ns1_link_peer(Ubuntu) will be gone through the Geneve tunnel (5000::2—>5000::9) for both IPv4 traffic(40.1.1.10-->40.1.1.2) and IPv6 traffic(6000::2—>6000::9) 2. Setup one IPV4 Geneve Tunnel between Windows VM and 1 Ubuntu server. Windows VM, vif0( 6000::2/40.1.1.10) vif1(50.1.1.11)—— Ubuntu, Eth2(50.1.1.9), name space ns1 with interface ns1_link_peer(6000::19/40.1.1.9) Related tunnnel, ovs-vsctl.exe -- set Interface bms-tun0 type=geneve options:csum=true options:key=flow options:local_ip="50.1.1.11" options:remote_ip=flow In this topo, traffic from Vif0(Win) to ns1_link_peer(Ubuntu) will be gone through the Geneve Tunnel (50.1.1.11—>50.1.1.9) for both IPv4 traffic(40.1.1.10-->40.1.1.9) and IPv6 traffic(6000::2—>6000::19). 3.Regression test for IpV4 in Antrea project (about 60 test case) is PASS Future Work ----------- Add other type IPv6 tunnel support for Gre/Vxlan/Stt. Signed-off-by: Wilson Peng <pweisong@vmware.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Fix static analysis in Stt.cAlin Gabriel Serdean2018-03-061-2/+2
| | | | | | | | | | The WDK 10 static analysis complains: stt.c(427): warning C30030: Warning: Allocating executable memory via specifying a MM_PAGE_PRIORITY type without a bitwise OR with MdlMappingNoExecute. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Sairam Venugopal <vsairam@vmware.com>
* datapath-windows: Use only non executable memoryAlin Serdean2017-11-291-5/+3
| | | | | | | | | | | Use only non-executable memory when using MmGetSystemAddressForMdlSafe. Introduce a new function called OvsGetMdlWithLowPriority for readability. Found using WDK 10 static code analysis. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Shashank Ram <shashank08@gmail.com>
* datapath-windows: Account for VLAN tag in tunnel DecapShashank Ram2017-11-281-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Decap functions for tunneling protocols do not compute the packet header offsets correctly when there is a VLAN tag in the L2 header. This results in incorrect checksum computation causing the packet to be dropped. This patch adds support to account for the VLAN tag in the packet if its present, and makes use of the OvsExtractLayers() function to correctly compute the header offsets for different layers. Testing done: - Tested Geneve, STT, Vxlan and Gre and verified that there are no regressions. - Verified that packets with VLAN tags are correctly handled in the decap code of all tunneling protocols. Previously, this would result in packet drops due to invalid checksums being computed. - Verified that non-VLAN tagged packets are handled correctly. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Fix bugs in cleaner threadsShashank Ram2017-09-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conntrack, Conntrack-related, Stt, and IP fragmentation have cleaner threads that run periodically to clean up their respective tables. During driver unload, OvsExtDetach() calls into routines that are meant for explicitly cleaning these tables up and freeing the resources associated with these threads. If during driver unload, these cleaner threads run immediately after the resources are freed, such as locks used by these threads, then the cleaner threads result in a kernel crash since they try to acquire locks that have already been freed. For eg, OvsIpFragmentEntryCleaner() caused a kernel crash because it tried to acquire a lock that was already freed by OvsCleanupIpFragment(). The fix is to simply exit the cleaner thread if the lock associated with the thread is not initialized, because the only way the threads can run when the lock is invalid is when the lock has been freed up during driver unload. Testing done: Verified that cleaner threads run as expected without crashing during driver unload. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add asserts to SttAlin Serdean2017-08-021-0/+2
| | | | | | | | | | Unfortunately the WDK 10 static code analysis can't see this one clearly. Add an ASSERT to silence the warning. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Shashank Ram <rams@vmware.com>
* datapath-windows: Fix code alignment in SttAlin Serdean2017-08-021-2/+2
| | | | | | | | Found by inspection. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Shashank Ram <rams@vmware.com>
* datapath-windows: Add validations for IP_HEADER_LENShashank Ram2017-06-221-1/+1
| | | | | | | | | | | Adds validations in OvsGetIp() to make sure the IHL is within valid bounds. If IHL is invalid, then the packet is dropped by the callers of this function. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Updated OvsTcpSegmentNBL to handle IP fragments.Anand Kumar2017-05-081-1/+1
| | | | | | | | | | | | With this patch, OvsTcpSegmentNBL not only supports fragmenting NBL to TCP segments but also Ipv4 fragments. To reflect the new changes, renamed function name from OvsTcpSegmentNBL to OvsFragmentNBL and created a wrapper for OvsTcpSegmentNBL. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* datapath-windows: STT Check for flow destination portAlin Serdean2017-02-021-1/+2
| | | | | | | | | | | Change the TCP destination port(STT header) to check if it was set by the userspace, use it if it was set. If the userspace did not specify a destination port, use the configured vport destination port. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Sairam Venugopal <vsairam@vmware.com>
* datapath-windows: Add multiple switch internal portsAlin Serdean2016-12-201-2/+5
| | | | | | | | | | | | 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: clean code in sttAlin Serdean2016-11-041-3/+3
| | | | | | | | | The purpose of this patch is to make the code more readable and fix a static analyzer warning. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Fixed packet limits on STT protocolPaul Boca2016-07-151-169/+194
| | | | | | | | | | | "If the length of the payload to be encapsulated exceeds 64KB, or if the offset to the L4 header exceeds 255 bytes, then it will not be possible to offload the packet to the NIC for segmentation." (STT RFC) In this case the packet needs to be segmented by us, before sending it. Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Handle possible NULL pointer dereference in STT.Paul Boca2016-06-271-9/+43
| | | | | | | | | Check if OvsAllocatememoryWithTag succeeded or not. In case of failure propagate cleanup and return. Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Address minor alignment issues in Stt code.Yin Lin2016-06-241-1/+1
| | | | | | Signed-off-by: Yin Lin <linyi@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add ECN support on STT decapsulationPaul Boca2016-06-071-10/+75
| | | | | Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: STT reassemble small fixPaul Boca2016-06-071-3/+13
| | | | | | | | | Fixed possible deadlock in case NdisGetDataBuffer fails Validate the segment length and offset on reassemble to avoid buffer overflow Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Add VLAN support to STTPaul Boca2016-06-071-1/+21
| | | | | | | | Add VLAN to STT header and on receive applyit to encapsulated packet Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Improved offloading on STT tunnelPaul Boca2016-06-071-25/+99
| | | | | | | | | | | | | | | | | *Added OvsExtractLayers - populates only the layers field without unnecessary memory operations for flow part *If in STT header the flags are 0 then force packets checksums calculation on receive. *Ensure correct pseudo checksum is set for LSO both on send and receive. Linux includes the segment length to TCP pseudo-checksum conforming to RFC 793 but in case of LSO Windows expects this to be only on Source IP Address, Destination IP Address, and Protocol. *Fragment expiration on rx side of STT was set to 30 seconds, but the correct timeout would be TTL of the packet Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Refactor sofware offloads and mssAlin Serdean2016-02-101-18/+6
| | | | | | | | | | | | | | | | | | The purpose of this patch is to refactor the software offloads found in the VXLAN and GRE code and also to refactor how the maximmum segment size for a given NBL is obtained. This patch introduces two functions OvsApplySWChecksumOnNB and OVSGetTcpMSS. OVSGetTcpMSS - will return the mss found in a given NBL. OvsApplySWChecksumOnNB - will compute and set software offloads for a given NBL. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sorin Vinturis <svinturis at cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Cleanup Stt.cAlin Serdean2015-12-111-22/+22
| | | | | | | | | | | | | Remove double include for Flow.h and sort the includes alphabetically. Also remove tabs. Found by inspection. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* datapath-windows: Fix small bug in STTAlin Serdean2015-12-111-1/+0
| | | | | | | | | Allow STT encapsulation to take place in the case we have a TCP payload without LSO. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* datapath-windows: STT - Offload inner checksum calculationSairam Venugopal2015-11-031-75/+58
| | | | | | | | Offload the inner checksum computation to NDIS in OvsDecapStt function. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: STT - Enable support for TCP Segmentation offloadsSairam Venugopal2015-10-271-92/+306
| | | | | | | | | Add support to STT - Encap and Decap functions to reassemble the packet fragments. Also add support to offload the packet to NDIS. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: STT - Add support for TCP Segmentation OffloadSairam Venugopal2015-10-271-3/+125
| | | | | | | | | Create and initialize the background thread and buffer that assists in defragmenting and completing a TSO packet. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Enable checksum offloads in STTSairam Venugopal2015-09-221-8/+165
| | | | | | | | | | Enable support for Checksum offloads in STT if it's enabled in the Windows VM. Set the Checksum Partial and Checksum Verified flags as mentioned in the STT Draft - https://tools.ietf.org/html/draft-davie-stt-06 Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: use correct dst port during Vxlan TxNithin Raju2015-06-191-2/+2
| | | | | | | | | | | | | | | | | | | A previous commit used the wrong DST port in the UDP header during Vxlan Tx which caused Vxlan tunneling to break. Fixing it here.. Also included is a cosmetic fix in OvsDetectTunnelRxPkt() where we were using htons() instead of ntohs(). Doesn't make a difference in practice though. One more change is, OvsIpHlprCbVxlan() has been nuked since it is not used. Not sure if it is worth being resurrected. Testing done: Ping across Vxlan tunnel and Stt tunnel. Signed-off-by: Nithin Raju <nithin@vmware.com> Reported-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Stateless TCP Tunnelling protocol - Initial implementationEitan Eliahu2015-06-111-0/+369
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>