summaryrefslogtreecommitdiff
path: root/datapath-windows
Commit message (Collapse)AuthorAgeFilesLines
* Remove duplicate include fileYi Li2020-09-221-1/+0
| | | | | | | Found by checkincludes.pl Signed-off-by: Yi Li <yili@winhong.com> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* datapath-windows: Update flow key in SET actionJinjun Gao2020-07-292-7/+27
| | | | | | | | | | The flow key is not updated when process OVS_ACTION_ATTR_SET action. It will impact follow-up actions, such as, conntrack module cannot find created conntrack entry if passing old flow key to it. Reported-by: Rui Cao <rcao@vmware.com> Signed-off-by: Jinjun Gao <jinjung@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* datapath-windows: Reset ct_mark/ct_label to support ALGJinjun Gao2020-07-281-32/+54
| | | | | | | | | | | The ct_mark/ct_label setting on related connection keep the same behavior with Linux datapath. If one CT entry has parent/master entry, its ct_mark and ct_label should inherit from the corresponding part of parent/master entry at initialization. Signed-off-by: Jinjun Gao <jinjung@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* datapath-windows: Add CTA_HELP and CTA_TUPLE_MASTERJinjun Gao2020-06-303-8/+48
| | | | | | | | | Add helper and master if existing to a conntrack entry: 1, For CTA_HELP, only support FTP/TFTP; 2, For CTA_TUPLE_MASTER, only support FTP. Signed-off-by: Jinjun Gao <jinjung@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows, conntrack: Fix conntrack new stateRui Cao2020-06-274-5/+17
| | | | | | | | | | | | | | | | On windows, if we send a connection setup packet in one direction twice, it will make the connection to be in established state. The same issue happened in Linux userspace conntrack module and has been fixed. This patch port the following previous fixes to windows datapath to fix the issue: - a867c010ee9183885ee9d3eb76a0005c075c4d2e - ac23d20fc90da3b1c9b2117d1e22102e99fba006 Acked-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Rui Cao <rcao@vmware.com> Signed-off-by: William Tu <u9012063@gmail.com>
* datapath-windows: Append tunnel info to upcall for correct templateAmber Hu via dev2020-02-105-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formerly, there is no tunnel information appended in the upcall’s packet data, which is expected by IPFIX in userspace to calculate the template for exporting the sampled flow record of on egress tunnel port. To fix this, during performing OvsOutputUserspaceAction(), we would check whether it is initiated by the sampling on egress tunnel which would be indicated by the attribute as OVS_USERSPACE_ATTR_EGRESS_TUN_PORT in the nested attribute list. If so, we would append the tunKey in OvsForwardingContext indexed by OVS_PACKET_ATTR_EGRESS_TUN_KEY to the upcall. Besides, at this point, the source transport port and source ip address are not available in the structure, so we have to fill it in the way how the packet would be capsulated during performing OvsEncapGeneve(), which is following the OvsOutputUserspaceAction() unfortunately. I have tested the IPFIX functionality with the change, we could see the template is correct and the expected tunnel information could be packed in the IPFIX packet finally. The traffic for test is generated by PING utility. >From d727d051c9a44a4a93e5ee5f3da3ca9b125aad29 Mon Sep 17 00:00:00 2001 From: Amber Hu <qhu@vmware.com> Date: Thu, 30 Jan 2020 18:01:32 -0800 Subject: [PATCH v3] datapath-windows: Append tunnel info to upcall for correct template Signed-off-by: Amber Hu <qhu@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Do not delete internal port on OID_SWITCH_NIC_DISCONNECTJinjun Gao2019-12-091-3/+9
| | | | | | | | | | | | | | | | | | | According to the microsoft doc: https://docs.microsoft.com/en-us/windows-hardware/drivers/network/hyper-v-extensible-switch-port-and-network-adapter-states Below OID request sequence is validation: OID_SWITCH_NIC_CONNECT -> OID_SWITCH_NIC_DISCONNECT ^ | | V OID_SWITCH_NIC_CREATE <- OID_SWITCH_NIC_DELETE In above sequence, the windows extensible switch interface assumes the OID_SWITCH_PORT_CREATE has issued and the port has been created successfully. If delete the internal port in HvDisconnectNic(), HvCreateNic() will fail when received OID_SWITCH_NIC_CREATE late because there is no corresponding port. Signed-off-by: Jinjun Gao <jinjung@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* ct-dpif, dpif-netlink: Add conntrack timeout policy supportYi-Hung Wei2019-09-262-2/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch first defines the dpif interface for a datapath to support adding, deleting, getting and dumping conntrack timeout policy. The timeout policy is identified by a 4 bytes unsigned integer in datapath, and it currently support timeout for TCP, UDP, and ICMP protocols. Moreover, this patch provides the implementation for Linux kernel datapath in dpif-netlink. In Linux kernel, the timeout policy is maintained per L3/L4 protocol, and it is identified by 32 bytes null terminated string. On the other hand, in vswitchd, the timeout policy is a generic one that consists of all the supported L4 protocols. Therefore, one of the main task in dpif-netlink is to break down the generic timeout policy into 6 sub policies (ipv4 tcp, udp, icmp, and ipv6 tcp, udp, icmp), and push down the configuration using the netlink API in netlink-conntrack.c. This patch also adds missing symbols in the windows datapath so that the build on windows can pass. Appveyor CI: * https://ci.appveyor.com/project/YiHungWei/ovs/builds/26387754 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* datapath-windows: Fix updating ct label when mask is specifiedAnand Kumar2019-08-191-0/+1
| | | | | | | | | | When an existing label needs to be changed by specifing bits to be updated using mask, instead of updating only the masked bits, new label was getting overridden. This patch fixes this issue. 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: 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: Add Win10Analyze targetAlin Gabriel Serdean2019-05-097-4/+159
| | | | | | | | | | | | | | | | This patch adds a new target called `Win10Analyze` to the driver solution. It enables us to trigger static analysis over the Win10 target. Since the location of the ruleset of drivers is somewhat random starting from 1803: https://www.osr.com/blog/2018/05/21/wdk-1803-ca/ Commit the ruleset inside our repository. This is the same ruleset used for 8,8.1 and 10. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* datapath-windows: Do not send out nbls when cloned nbls are being accessedAnand Kumar2019-04-253-1/+20
| | | | | | | | | | | | | | | | | | | 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 vlan key getting stored in host byte order.Anand Kumar via dev2019-04-091-2/+2
| | | | | | | Update flowkey to set vlan information in network byte order. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Add guards around IpHelper adapter binding callsSairam Venugopal via dev2019-04-032-3/+33
| | | | | | | | | | | | Protect internal adapter up/down calls with a dispatch lock. It was observed that the InternalAdapter bind calls could happen out of order thereby causing encap packets to not be sent properly. Add assert around the IpHelper bind calls to ensure Up/Down gets called only for the appropriate vports. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Address memory allocation issues for OVS_BUFFER_CONTEXTAnand Kumar via dev2019-04-031-7/+4
| | | | | | | | | | | | | | | | | | With current implementation, when nbl pool is allocated, context size is specified as 64 bytes, while the OVS_BUFFER_CONTEXT size is only 32 bytes. Since context size is never changed, additional memory is not required. This patch makes it simpler to allocate memory for OVS_BUFFER_CONTEXT so that it is always aligned to MEMORY_ALLOCATION_ALIGNMENT. This is acheived by updating "value" field in the context structure, so that number of elements in array is always a multiple of MEMORY_ALLOCATION_ALIGNMENT. Also change the DEFAULT_CONTEXT_SIZE to accomodate OVS_BUFFER_CONTEXT size. 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: Add annotations to find vport functionsAlin Gabriel Serdean2019-03-132-1/+11
| | | | | | | | | 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: Guard vport usage in user.cAlin Gabriel Serdean2019-03-131-8/+8
| | | | | | | | When using a vport we need to guard its usage with the dispatch lock. 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: Fix race condition during port creationSairam Venugopal2019-03-131-2/+1
| | | | | | | | | | Hold the dispatch lock until port-add operations are completed. Found by inspection. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Fix potential deadlock in event subscriptionSairam Venugopal2019-03-131-2/+1
| | | | | | | | | | | | | | Move the EventQueue lock acquisition after the dispatchLock to prevent a potential deadlock in port creation pipeline. There could be a case where a port event could try to take up the Dispatch Lock before the Event Queue lock and the subscription queue event could take up the event queue lock before the dispatch lock. Found while testing with Driver Verifier enabled. Signed-off-by: Sairam Venugopal <vsairam@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: Add support for 'OVS_KEY_ATTR_ENCAP' key attribute.Anand Kumar2019-01-284-16/+144
| | | | | | | | | | | | | | | | | Add a new structure in l2 header to accomodate vlan header, based of commit "d7efce7beff25052bd9083419200e1a47f0d6066 datapath: 802.1AD Flow handling, actions, vlan parsing, netlink attributes" Also reset vlan header in flow key, after deleting vlan tag from nbl With this change a sample vlan flow would look like, eth(src=0a:ea:8a:24:03:86,dst=0a:cd:fa:4d:15:5c),in_port(3),eth_type(0x8100), vlan(vid=2239,pcp=0),encap(eth_type(0x0800),ipv4(src=13.12.11.149,dst=13.12.11.107, proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)) 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 race condition when deleting internal portsAlin Gabriel Serdean2018-12-281-1/+1
| | | | | | | | | | | We need to hold the port lock until all the operations with a port are completed. Found by inspection. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* datapath-windows: Use layers info to extract IP header in IpFragmentAnand Kumar2018-12-215-53/+41
| | | | | | | | | | - 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: Remove IP neighbor entries when internal adapter is down.Anand Kumar2018-10-241-18/+18
| | | | | | | | | | | | | Remove the IP neighboring entries when adapter is down, so that when 'OVS_IPHELPER_INSTANCE' is deleted, no stale entries are present Also fix accessing iphelper instance without acquiring the lock. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Tested-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Move OVS_IPHELPER_INSTANCE to IpHelper.hSairam Venugopal2018-10-022-39/+38
| | | | | | | | | | | | Move the IPHelper Instance to the main header file and update the usage to explicitly point to POVS_IPHELPER_INSTANCE instead of PVOID. Also rename the ipn->context to ipn->instance to make it more readable. Found by inspection. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* treewide: Fix spelling of "receive".Ben Pfaff2018-09-272-3/+3
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* datapath-windows: Fix payload length calculation in Conntrack.hAlin Gabriel Serdean2018-09-201-2/+1
| | | | | | | | | | The payload calculation in OvsGetTcpHeader is wrong: `ntohs(ipHdr->tot_len) - expr` instead of `ntohs((ipHdr->tot_len) - expr)`. We already have a macro for that calculation defined in NetProto.h so use it. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* datapath-windows: Add support to configure ct zone limitsAnand Kumar2018-09-204-3/+211
| | | | | | | | | | | | | | | | | This patch implements limiting conntrack entries per zone using dpctl commands. Example: ovs-appctl dpctl/ct-set-limits default=5 zone=1,limit=2 zone=1,limit=3 ovs-appctl dpct/ct-del-limits zone=4 ovs-appctl dpct/ct-get-limits zone=1,2,3 - Also update the netlink-socket.c to support netlink family 'OVS_WIN_NL_CTLIMIT_FAMILY_ID' for conntrack zone limit. 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>
* treewide: Remove pointless "return;" at ends of functions.Ben Pfaff2018-07-094-9/+0
| | | | | | | | | Found with: git ls-files | xargs pcregrep -n -M 'return;\n*}' Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Darrell Ball <dlu998@gmail.com> Tested-by: Darrell Ball <dlu998@gmail.com>
* datapath-windows: Compute ct hash based on 5-tuple and zoneAnand Kumar2018-06-242-114/+116
| | | | | | | | | | | | | | | | Conntrack 5-tuple consists of src address, dst address, src port, dst port and protocol which will be unique to a ct session. Use this information along with zone to compute hash. Also re-factor conntrack code related to parsing netlink attributes. Testing: Verified loading/unloading the driver with driver verified enabled. Ran TCP/UDP and ICMP traffic. 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: Implement locking in conntrack NAT.Anand Kumar2018-06-245-92/+101
| | | | | | | | | | | | | | | | | | | | | | | This patch primarily replaces existing ndis RWlock based implementaion for NAT in conntrack with a spinlock based implementation inside NAT, module along with some conntrack optimization. - The 'ovsNatTable' and 'ovsUnNatTable' tables are shared between cleanup threads and packet processing thread. In order to protect these two tables use a spinlock. Also introduce counters to track number of nat entries. - Introduce a new function OvsGetTcpHeader() to retrieve TCP header and payload length, to optimize for TCP traffic. - Optimize conntrack look up. - Remove 'bucketlockRef' member from conntrack entry structure. Testing: Verified loading/unloading the driver with driver verified enabled. Ran TCP/UDP and ICMP traffic. 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 spinlock instead of RW lock for ct entryAnand Kumar2018-06-245-87/+96
| | | | | | | | | | | | | | | | | | | This patch mainly changes a ndis RW lock for conntrack entry to a spinlock along with some minor refactor in conntrack. Using spinlock instead of RW lock as RW locks causes performance hits when acquired/released multiple times. - Use NdisInterlockedXX wrapper api's instead of InterlockedXX. - Update 'ctTotalRelatedEntries' using interlocked functions. - Move conntrack lock out of NAT module. Testing: Verified loading/unloading the driver with driver verified enabled. Ran TCP/UDP and ICMP traffic. 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: Add support for handling DEI bit of VLAN headerAnand Kumar2018-06-112-6/+14
| | | | | | | | | | The Drop eligible indicator(DEI) is 1 bit wide and it is part of Tag control information (TCI) in VLAN header, which indicates that the frame can be dropped during congestion. 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: Prevent ct-counters from getting redundantly incrementedAnand Kumar2018-04-301-3/+4
| | | | | | | | The conntrack-counters ought to be incremented only if it's a new lookup or if it's recirculated through a different zone for the first time. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Do not drop Ip fragments less than MIN_FRAGMENT_SIZEAnand Kumar2018-03-081-6/+3
| | | | | | | | | | | | | | | | | Previously ipfragment module would drop any fragments less than MIN_FRAGMENT_SIZE (400 bytes), which was added to safeguard against the vulnerability CVE-2000-0305. This check is incorrect, since minimum size of the Ipfragment is 68 bytes (i.e. max length of Ip Header + 8 bytes of L4 header). So Ip fragments less than MIN_FRAGMENT_SIZE (400 bytes) is not guranted to be malformed or illegal. To guard against security vulnerability CVE-2000-0305, for a given ip datagram, ipfragments should be dropped only when number of smallest fragments recieved reaches a certain threshold. 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 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: 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: fix hash creation on ct markAlin Gabriel Serdean2018-02-271-1/+1
| | | | | | | | | Use key->ct.mark instead of key->ct.zone when generating the hash over the mark. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* datapath-windows: Allow compiling all targets using SDK 10.0Shashank Ram2018-02-062-29/+49
| | | | | | | | | | | | | Previously, Win8/8.1 targets would use SDK8.1. However, its recommended to use the newer SDK as newer VS versions typically drop support for older SDKs later on. This patch adds support to compile all targets (Win8/8.1/10) using the 10.0 SDK. Note that his patch does not drop support for older SDKs. Signed-off-by: Shashank Ram <rams@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Add trace level logs in conntrack for invalid ct state.Anand Kumar2018-02-033-0/+11
| | | | | | 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: Optimize conntrack lock implementation.Anand Kumar2018-02-023-85/+160
| | | | | | | | | | | | | | | | | | | | | | | | Currently, there is one global lock for conntrack module, which protects conntrack entries and conntrack table. All the NAT operations are performed holding this lock. This becomes inefficient, as the number of conntrack entries grow. With new implementation, we will have two PNDIS_RW_LOCK_EX locks in conntrack. 1. ovsCtBucketLock - one rw lock per bucket of the conntrack table, which is shared by all the ct entries that belong to the same bucket. 2. lock - a rw lock in OVS_CT_ENTRY structure that protects the members of conntrack entry. Also, OVS_CT_ENTRY structure will have a lock reference(bucketLockRef) to the corresponding OvsCtBucketLock of conntrack table. We need this reference to retrieve ovsCtBucketLock from ct entry for delete operation. 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: Add a global level RW lock for NATAnand Kumar2018-02-021-2/+34
| | | | | | | | | | Currently NAT module relies on the existing conntrack lock. This patch provides a basic lock implementation for NAT module in conntrack. 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: Refactor conntrack code.Anand Kumar2018-02-023-86/+103
| | | | | | | | | Some of the functions and code are refactored so that new conntrack lock can be implemented 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: Add include directory to ovsext projectAlin Gabriel Serdean2018-01-081-3/+3
| | | | | | | | | | | When trying to compile with WDK 10, the files under datapath-windows/ovsext/Netlink can't see the headers from datapath-windows/ovsext. This patch adds the project directory under the include files. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Change include type in Iphelper.hAlin Gabriel Serdean2018-01-081-1/+1
| | | | | | | Found while compiling with VS2017. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Add directory to .gitignoreAlin Gabriel Serdean2018-01-081-0/+1
| | | | | | | | | Visual Studio 2017 uses `.vs` directory for temporary files. Add the directory to gitignore. Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Add support for deleting conntrack entry by 5-tuple.Anand Kumar2017-12-111-12/+134
| | | | | | | | | To delete a conntrack entry specified by 5-tuple pass an additional conntrack 5-tuple parameter to flush-conntrack. 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: Correct endianness for deleting zone.Justin Pettit2017-12-071-1/+1
| | | | | | | | | | | The zone Netlink attribute is supposed to be in network-byte order, but the Windows code for deleting conntrack entries was treating it as host-byte order. Found by inspection. Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Sairam Venugopal <vsairam@vmware.com>
* datapath-windows: Fix possible NULL dereference in IpFragmentAlin Serdean2017-11-291-0/+1
| | | | | | | | | If we can't allocate the NBL just go to the cleanup sequence. Found using WDK 10 static code analysis. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Shashank Ram <shashank08@gmail.com>