summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/BufferMgmt.c
Commit message (Collapse)AuthorAgeFilesLines
* datapath-windows: Add IPv6 conntrack ip fragment support on windowsldejing2022-09-201-36/+428
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation on Windows: IPv6 conntrack ip fragment feature use a link list to store ip fragment. When ipv6 fragment module receives a fragment packet, it will store length of the fragment, until to the received length equal to the packet length before fragmented, it will reassemble fragment packet to a complete packet and send the complete packet to conntrack module. After conntrack processed the packet, fragment module will divide the complete packet into small fragment and send it to destination. Currently, ipv6 was implemented in a indenpent module, for the reason it can reduce the risk of introduce bug to ipv4 fragmenb module. Testing Topology: On the Windows VM runs on the ESXi host, two hyper-v ports attached to the ovs bridge; one hyper-v port worked as client and the other port worked as server. Testing Case: 1.UdpV6 a) UdpV6 fragment with multiple ipv6 extension fields. b) UdpV6 fragment in normal scenario. c) UdpV6 fragment in nat scenario. 2.IcmpV6 a) IcmpV6 fragment in normal scenario. b) IcmpV6 fragment in nat scenario. Signed-off-by: ldejing <ldejing@vmware.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Copy mru information when cloning a nbl.Anand Kumar2019-05-201-7/+8
| | | | | | | | | | When a nbl is cloned, mru value stored in the original nbl context is lost, which skips refragemting the cloned nbls. This patch fixes it. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Do not send out nbls when cloned nbls are being accessedAnand Kumar2019-04-251-1/+8
| | | | | | | | | | | | | | | | | | | As per MSDN documentation, "As soon as a filter driver calls the NdisFSendNetBufferLists function, it relinquishes ownership of the NET_BUFFER_LIST structures and all associated resources. A filter driver should never try to examine the NET_BUFFER_LIST structures or any associated data after calling NdisFSendNetBufferLists". https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ndis/nf-ndis-ndisfsendnetbufferlists When freeing up memory of a cloned nbl, parent's nbl and context is being accessed, which is incorrect can cause BSOD. With this patch, original nbl is sent out only when cloned nbl is done with packet processing and its memory is freed. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Use layers info to extract IP header in IpFragmentAnand Kumar2018-12-211-9/+7
| | | | | | | | | | - Rely on layers l3Offset field to get offset of IP header. - Aslo fix passing 'newNbl' to IP fragment which is not required. - Fixed including a header file twice. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Fix invalid reference in Buffermgmt.cSairam Venugopal2018-11-151-2/+4
| | | | | | | | | | | | OVS_BUFFER_CONTEXT gets cleared as part of NdisFreeNetBufferListContext function call. This causes an invalid reference error. Found while testing with driver verifier enabled. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: On Debug builds, dump NBL info based on OVS_DBG_DEFAULT macroAnand Kumar2018-03-011-1/+12
| | | | | | | | | | | Currently nbl information is getting dumped whenever a nbl is copied or allocated, since OVS_DBG_DEFAULT is set to OVS_DBG_INFO for debug builds, which affects the ovs performance. Instead dump nbl information only when OVS_DBG_DEFAULT is set to OVS_LOG_LOUD Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Use only non executable memoryAlin Serdean2017-11-291-4/+4
| | | | | | | | | | | 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: Update OvsCompleteNbl argument to match definitionSairam Venugopal2017-10-311-1/+2
| | | | | | | | | | | | Update the OvsCompleteNbl to take in a PVOID and explicitly cast to POVS_SWITCH_CONTEXT. This is useful when finding declarations in Visual Studio. The mismatch breaks this functionality. Found by inspection. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Shashank Ram <rams@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Move OvsCreateNewNBLsFromMultipleNBs to BuggerMgmtShashank Ram2017-08-231-0/+47
| | | | | | | | | | Moves function OvsCreateNewNBLsFromMultipleNBs() to BufferMgmt.c to facilitate consumption from outside PacketIO.c. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Fix possible NULL deference in OvsFullCopyNBLAlin Serdean2017-08-021-0/+3
| | | | | | | | | | Check if the first net buffer exists before trying to copy it. Found using WDK 10 static code analysis. 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 assert in OvsPartialCopyNBLAlin Serdean2017-08-021-0/+1
| | | | | | | | | `srcNb` should never be NULL since it was copied over from another nbl. Add an assertion just in case and to keep static analysis happy. 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 possible NULL dereference in BufferMgmtAlin Serdean2017-08-021-2/+4
| | | | | | | | | | The mdl can be NULL. Found using WDK 10 static code analysis. 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: Updated OvsTcpSegmentNBL to handle IP fragments.Anand Kumar2017-05-081-21/+150
| | | | | | | | | | | | 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: Retain MRU value in the _OVS_BUFFER_CONTEXT.Anand Kumar2017-05-081-0/+1
| | | | | | | | | | This patch introduces a new field MRU(Maximum Recieved Unit) in the _OVS_BUFFER_CONTEXT and it is used only for Ip Fragments to retain MRU for the reassembled IP datagram when the packet is forwarded to userspace. 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: Fix the redefinition of variablesSairam Venugopal2016-12-131-11/+11
| | | | | | | | | Some of the variables were getting re-defined in the function. This causes compiler warning in Windows SDK 10. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Fix typos in function summariesSairam Venugopal2016-12-021-1/+1
| | | | | | | Fixed mismatch between function names and descriptions. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Support for IPv6 in TCP segmentationSairam Venugopal2016-03-141-39/+80
| | | | | | | | | | | | | | | | | | | | When a packet which needs segmentation is received, the header for each segment is being calculated, i.e. IP length, checksum, TCP seq, TCP checksum. The problem with the current code is that it wrongly assumes that the Ethernet frame payload is always an IPv4 packet. This patch checks the EtherType field of the Ethernet frame to see which protocol is encapsulated in its payload, IPv4 or IPv6, and calculates the segment's header accordingly. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Co-authored-by: Sairam Venugopal <vsairam@vmware.com> Reported-by: Sairam Venugopal <vsairam@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/105 Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Refactor sofware offloads and mssAlin Serdean2016-02-101-7/+8
| | | | | | | | | | | | | | | | | | 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: nuke port # argument in IP helperNithin Raju2015-11-251-5/+7
| | | | | | | | | | | | Port # doesn't make much sense since it has not been computed yet. Also, get rid of OVS_DEFAULT_PORT_NO and use OVS_DPPORT_NUMBER_INVALID instead. 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: Move OvsAllocateNBLFromBuffer to BufferMgmtSairam Venugopal2015-10-271-0/+46
| | | | | | | | | | Move the functionality around creating an NBL from Buffer to Buffermanagement. This function will be used for converting the buffer from user-space to NBL and also by STT - reassembly logic. 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: Compute checksums for VXLAN inner packets.Alin Serdean2015-10-021-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | Windows does not support VXLAN hardware offloading. Currently we do not compute IP/TCP/UDP checksums for the inner packet. This patch computes the checksums mentioned above in regards with the enabled settings. i.e. if IP checksum offloading is enabled for the inner packet we compute it. The same applies for TCP and UDP packets. This patch also revizes the computation of ones' complement over different memory blocks, in the case the lengths are odd. Also per documentation: https://msdn.microsoft.com/en-us/library/windows/hardware/ff568840%28v=vs.85%29.aspx set the TCP flags FIN and PSH only for the last segment in the case LSO is enabled. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Solved BSOD when adding OVS portsSorin Vinturis2015-07-061-1/+4
| | | | | | | | | | | | This BSOD occurred in the context of a packet (NBL) with multiple NET_BUFFER(s) (NBs). The reason for the BSOD is due to the marking of NBLs created by OVS as being external and wrongly completing them. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/82 Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Wrong cleanup of newly created multiple NBLsSorin Vinturis2015-06-241-1/+1
| | | | | | | | | | | | Bug found in OvsPartialCopyToMultipleNBLs function in the cleanup part of the code. Before completing the current NBL (newNbl) the NEXT link for the following NBL (firstNbl) was broken, instead of the current one (newNbl). Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/87 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Correctly link newly allocated NBLSorin Vinturis2015-05-081-1/+1
| | | | | | | | | | OvsPartialCopyToMultipleNBLs function failed to correctly link the newly created NBL with single NB to the multiple NBLs list. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Added specific pool tag for buffermgmt codeSorin Vinturis2015-03-261-3/+3
| | | | | | | | | | | | All MDL memory allocations within buffermgmt code have 'BSVO' pool tag. 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/56 Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Rename files.Samuel Ghinet2014-08-291-0/+1535
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>