summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/PacketIO.c
Commit message (Collapse)AuthorAgeFilesLines
* Carefully release NBL in Windowshxie2022-05-251-9/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OvsExtSendNBLComplete always release NBLs with flag SINGL_SOURCE, this is an efficient way, which requires all the NBLs having the same source port, when cloned/fragment NBLs are released, the parent NBLs will be released as well, the problem is that a parent NBL may have a different source port from the cloned/fragment NBL, so releasing the parent NBLs with flag SINGLE_SOURCE is not corrct, see: https://github.com/microsoft/hcsshim/issues/1056 When this happens, commands 'Get-NetAdapter' and 'Get-HnsEndpoint' in the Windows node show that one net-adapter/hns-endpoint is in 'disconnected' state, meanwhile, following processes are affected, ecah of them has one thread pending on a lock: vmcompute.exe containerd.exe antrea-agent.exe To fix this issue, we may check SourcePortId in each parent NBLs before released. A simple way to reprodue this issue: 1, Enable encap mode 2, create 2 nodes, nodeA and nodeB 3, create podA with image k8s.gcr.io/e2e-test-images/agnhost:2.21 on nodeA, run 'iperf/iperf.exe -s -p 9000 -D' 4, create podB with same image on nodeB, run command 'iperf/iperf.exe -c <podA-ip> -p 9000' 5, delete podB 6, run 'Get-NetAdapter' on nodeB, you will find the leaked net adapter. Signed-off-by: Hongsheng Xie <hxie@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-0/+10
| | | | | | | | | | | | | | | | | | | 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: Fix nbl cleanup when memory allocation failsSairam Venugopal2019-03-131-3/+2
| | | | | | | | | | | | | StartNblIngressError should be called only when an NBL hasn't been modified. In this case the nbl context was initialized. Rely on existing packet completion mechanism to cleanup the NBL. Found while testing with DriverVerifier with limited memory setting enabled. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Move OvsCreateNewNBLsFromMultipleNBs to BuggerMgmtShashank Ram2017-08-231-42/+0
| | | | | | | | | | 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: Refactor OvsCreateNewNBLsFromMultipleNBsShashank Ram2017-08-021-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the function would take the curNbl and nextNbl as inputs, and modify the linked list, and merge the input linked list with the newly generated newNbl list. This is confusing for the caller, and the function has unnecessary logic for merging linked lists that instead the caller should take care of. This is because the OvsCreateNewNBLsFromMultipleNBs() is a generic API that can be used by other functions as well, and its natural for different callers to have different needs. This patch refactors the behavior of OvsCreateNewNBLsFromMultipleNBs to take in the curNbl and lastNbl, and it returns a linked list of NBLs and sets the HEAD and TAIL of the new list obtained from the curNbl. If the caller wants to chain a new linked list at the HEAD or TAIL, it can make use of the curNbl and lastNbl to do so. Signed-off-by: Shashank Ram <rams@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* datapath-windows: Add a wrapper to retreive external vportShashank Ram2017-01-271-3/+3
| | | | | | | | 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: Fix function prototypesAlin Serdean2016-12-211-2/+2
| | | | | | | | | | | | | | | There is a mismatch between OvsInitCompletionList and OvsAddPktCompletionList prototypes. Eg: https://github.com/openvswitch/ovs/blob/master/datapath-windows/ovsext/PacketIO.h#L33 https://github.com/openvswitch/ovs/blob/master/datapath-windows/ovsext/PacketIO.c#L54 Found while compiling with Windows 10 kernel tool chain. 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: Remove dead code from PacketIOAlin Serdean2016-12-211-1/+0
| | | | | | | | | Assigning value to 'nativeNbls' has no effect outside the function and the variable is not used inside the function. 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: Added recirculation support.Sorin Vinturis2016-03-251-7/+9
| | | | | | | | | | | | | Recirculation support for the OVS extension. Tested using PING and iperf with Driver Verifier enabled. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Co-authored-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/104 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Avoid unnecessary vport array searchSorin Vinturis2015-09-291-3/+3
| | | | | | Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Correctly complete the original NBL with multiple NBsSorin Vinturis2015-06-111-2/+3
| | | | | | | | | | | OvsCreateNewNBLsFromMultipleNBs function failed to correctly complete the original NBL with multiple NBs after creating multiple NBLs with single NB. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Fix build.Alin Serdean2015-05-291-1/+0
| | | | | | | | | | | Removing a variable which breaks the windows forwarding extension build. The error: warning C4189: 'bufContext' : local variable is initialized but not referenced Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Multiple NBLs support for ingress data pathSorin Vinturis2015-05-281-20/+70
| | | | | | | | | | | Added support for creating and handling multiple NBLs with only one NB for ingress data path. Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com> Reported-by: Alessandro Pilotti <apilotti at cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/2 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datpath-windows: Make PacketIO.c compilable with WDK8.Nithin Raju2015-05-261-1/+5
| | | | | | | | | There's some code in PacketIO.c that is supported in WDK 8.1 only. The variable declarations for that code must also be WDK 8.1 only. 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: Added new function for native forwarded trafficSorin Vinturis2015-05-081-47/+40
| | | | | | Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Support for hybrid forwardingSorin Vinturis2014-11-241-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | In a hybrid forwarding environment, there are two types of packets that enter and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE packets. Hybrid forwarding involves filtering the incoming traffic based on packet type. Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets. All non-NVGRE traffic is forwarded by the OVS extension and processed as usual, and the NVGRE traffic is passed to NDIS to be handled by the HNV module. Necessary VS project changes regarding the compiler settings will be made in a different patch. More details about hybrid forwarding and the necessary NDIS 6.40 support is provided in issue #52. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Nithin Raju <nithin@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/52 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Don't leak NBLs with multiple NBs.Nithin Raju2014-10-311-1/+6
| | | | | | | | | | | | | | Currently, if we receive an NBL with multiple NBs from NDIS, we just ASSERT() and not do anything. The right thing to do obviously is to process the NBL. This is a work in progress. In the meantime, we should complete the NBL and not just leak it. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-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-7/+4
| | | | | | | | | | | | | | 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: Clarify externalVport.Nithin Raju2014-10-281-2/+2
| | | | | | | | | | | | | | In this patch, we add some explanation about the usage of 'externalVport' in the switch context. Also, we rename 'externalVport' to 'virtualExternalVport' in alignment with the explanation. Also, we rename 'numVports' to 'numHvVports' since ports are added from 2 ends now. 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 CreateQueue function to handle vport pid.Ankur Sharma2014-10-241-1/+1
| | | | | | | | | Refactored CreateQueue function so that packets are enqueued to correct corresponding queue. Signed-off-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Upcall NL packet format: Call NL missed packet functionEitan Eliahu2014-10-151-5/+2
| | | | | | | | | | Remove hard coded queue is, pass the key rather the tunnel key, Remove the none NL implementation Signed-off-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Incorrect assumption of the IRQLSorin Vinturis2014-10-061-1/+1
| | | | | | | | | | | | | | | | | Acquiring a spin lock raises the IRQL to DISPATCH_LEVEL. But in many places of the code, while holding a spin lock, there are useless checks for the current IRQL against DISPATCH_LEVEL. Also, the dispatch flag is not correctly set when calling NdisAcquireRWLockXXX() functions, which causes an extra check of the current IRQL. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/47 Acked-by: Nithin Raju <nithin@vmware.com> 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/+440
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>