summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Datapath.c
Commit message (Collapse)AuthorAgeFilesLines
* datapath-windows: support meter action initial versionldejing2022-09-201-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implemented meter action, currently, meter only support drop method and only support one band. The overall implementation is, when a packet comes in, it will first lookup meter according to the meter id, then get the band->rates and delta time since last access the same meter from the meter struct. Add the multiply result(band->rates * delta_time) to bucket, finally bucket minus the packet size, if the result larger than zero, allow the packet go through, otherwise deny the packet go through. Test case: 1. Setting the size meter size 3M, then the bandwidth was limit around 3M; ovs-ofctl -O OpenFlow13 add-meter br-test meter=2,kbps,\ band=type=drop,rate=3000 ovs-ofctl add-flow br-test "table=0,priority=1,ip \ actions=meter:2,normal" -O OpenFlow13 2. Setting the meter size 8M, then the bandwidth was limit around 8M; ovs-ofctl -O OpenFlow13 add-meter br-test meter=2,\ kbps,band=type=drop,rate=8000 ovs-ofctl add-flow br-test "table=0,priority=1,ip\ actions=meter:2,normal" -O OpenFlow13 Signed-off-by: ldejing <ldejing@vmware.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
* datapath-windows: Add support to configure ct zone limitsAnand Kumar2018-09-201-1/+33
| | | | | | | | | | | | | | | | | 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>
* datapath-windows: Use only non executable memoryAlin Serdean2017-11-291-2/+1
| | | | | | | | | | | 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: Add annotations for OvsReleaseCtrlLockAlin Serdean2017-08-021-0/+1
| | | | | | | | | | | Add function annotations for `OvsReleaseCtrlLock`. We make it aware that it requires a certain dispatch level, that it restores the dispatch level, that it requires a lock held and release a lock. 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 annotations for OvsAcquireCtrlLockAlin Serdean2017-08-021-0/+1
| | | | | | | | | | Add annotations to the function `OvsAcquireCtrlLock`. We make it aware that it raises the dispatch level, where it saves the dispatch level and it acquires a lock. 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: Suppress PAGED_CODE warningsAlin Serdean2017-08-021-0/+3
| | | | | | | | | Suppress static code analysis around PAGED_CODE(). The macro is useful only in checked builds. 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 support for UPDATE events in ConntrackAnand Kumar2017-06-211-0/+3
| | | | | | | | | | | | | | | Introduce a new event type OVS_EVENT_CT_UPDATE to send a conntrack event whenever a MARK and/or LABEL gets changed for an existing conntrack entry. - Parse netlink conntrack attribute OVS_CT_ATTR_EVENTMASK, which is used to set the mask of bits specifying which conntrack events (IPCT_*) should be delivered via the Netfilter netlink multicast groups. - Send update event only when OVS_CT_ATTR_EVENTMASK attribute has the mask of bits set for IPCT_MARK and/or IPCT_LABEL. Signed-off-by: Anand Kumar <kumaranand@vmware.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Fix conntrack event handlerSairam Venugopal2016-09-121-2/+2
| | | | | | | | | | | | Fix an issue with the OvsReadEventCmdHandler when handling conntrack events. Driver initiated messages should have zero seq number. Reverting the previous review comment since the inputBuffer in this case will be NULL. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Update OvsReadEventCmdHandler in Datapath.c to support ↵Sairam Venugopal2016-07-291-16/+50
| | | | | | | | | | | | | | different events OvsReadEventCmdHandler must now reflect the right event being read. If the event is a Conntrack related event, then convert the entry to netlink format and send it to userspace. If it's Vport event, retain the existing workflow. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Define new multicast conntrack events and netlink protocolSairam Venugopal2016-07-291-3/+18
| | | | | | | | | | | | | | | The Hyper-V datapath supports NETLINK_GENERIC and NETLINK_NETFILTER protocols for netlink communication. Define these two protocols in the datapath. Define new Conntrack events (new and delete) and add support for subscribing to these events. Parse out OVS_NL_ATTR_MCAST_GRP and store it as part of OVS_EVENT_SUBSCRIBE structure. Signed-off-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: Fix bugs in Event.c around subscribe and lockSairam Venugopal2016-07-291-1/+6
| | | | | | | | | | | | | | | | | | | | When userspace tries to resubscribe to an existing queue, return STATUS_INVALID_PARAMETER since it's not supported. The current bug overwrites status to STATUS_SUCCESS. The second bug fix is around releasing the EventQueue lock if an open instance couldn't be found. The current version returns back without releasing the lock. Moving the OvsAcquireEventQueueLock() after the instance is verified. OvsGetOpenInstance does not enforce a safe read for gOvsSwitchContext->dpNo. Use the gOvsSwitchContext->dispatchLock for accessing the parameter. Signed-off-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: Explicitly name vport related event to vportEventSairam Venugopal2016-07-291-3/+4
| | | | | | | | | | | | | OVS_EVENT_ENTRY currently handles only Vport related events. Updating the name of the struct to OVS_VPORT_EVENT_ENTRY. Remove OVS_EVENT_STATUS since it's currently not in use. Update the datapath to refer to events as vportEvents. This will aid in the introduction of other events. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-By: Yin Lin <linyi@vmware.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-By: Yin Lin <linyi@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* Windows: Add support for handling protocol (netlink family)Sairam Venugopal2016-07-131-1/+103
| | | | | | | | | | | | | | | Windows datapath currently has no notion of netlink family. It assumes all netlink messages to belong to NETLINK_GENERIC family. This patch adds support for handling other protocols if the userspace sends it down to kernel. This patch introduces a new NETLINK_CMD - OVS_CTRL_CMD_SOCK_PROP to manage all properties associated with a socket. The properties are passed down as netlink message attributes. This makes it easier to introduce other properties in the future. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add support for Conntrack IPCTNL_MSG_CT_GET cmd in Datapath.cSairam Venugopal2016-07-011-2/+9
| | | | | | | | | | This will be used by userspace for dumping conntrack entries - "ovs-dpctl dump-conntrack". Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Add support for Conntrack IPCTNL_MSG_CT_DELETE cmd in ↵Sairam Venugopal2016-07-011-4/+59
| | | | | | | | | | | | | | Datapath.c Create new NETLINK_CMD and NETLINK_FAMILY to assist in flushing conntrack entries. Modify Datapath.c to now support netfilter-netlink messages apart from the existing netfilter-generic messages. Also hookup the command handler to execute the OvsCtFlush in Conntrack.c Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: Remove unused headers from Datapath.cSairam Venugopal2016-06-211-7/+0
| | | | | | | | Clean up unused headers in Datapath.c. Found by inspection. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Yin Lin<linyi@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* datapath-windows: o/p buffer must fit NL error messageNithin Raju2016-05-251-7/+12
| | | | | | | | | | | | | | | | | OVS_IOCTL_WRITE and OVS_IOCTL_TRANSACT can generate a netlink error that is represented by a OVS_MESSAGE_ERROR struct. We want to make sure at the entry point of the ioctl processing that the output buffer is big enough to hold the error message. We were earlier checking for struct OVS_MESSAGE which is smaller. Since we are ensuring that output buffer can fit OVS_MESSAGE_ERROR at the top of the ioctl function, there's no need to check for that later. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* datapath-windows: don't map output buffer in OVS_IOCTL_WRITENithin Raju2016-05-251-13/+0
| | | | | | | | | | | The contract of OVS_IOCTL_WRITE is that write operations will not need the output buffer. Only the input buffer will be used in the IRP. So, better to not map the output buffer at all. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* datapath-windows: Validate Netlink packets' integrity.Paul Boca2016-05-161-5/+40
| | | | | | | | | Solved access violation when trying to access Netlink message - obtained with forged IOCTLs. Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Avoid using uninitialized gOvsExtDriverHandlePaul Boca2016-04-211-1/+3
| | | | | | | | | Ensure gOvsExtDriverHandle is not used if initialization fails Added PAGED_CODE() where needed Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: cleanup after NdisRegisterDeviceEx()Nithin Raju2016-04-121-10/+4
| | | | | | | | The error handling code seems to be wrong. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Hot add CPU support.Sorin Vinturis2016-04-101-5/+8
| | | | | | | | | | | | | | | | Hot add CPU is the ability to dynamically add CPUs to a running system. Adding CPUs can occur physically by adding new hardware, logically by online hardware partitioning, or virtually through a virtualization layer. This patch add support to reallocate any per-cpu resources, in case a new processor is added. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/112 Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* datapath-windows: Added recirculation support.Sorin Vinturis2016-03-251-0/+5
| | | | | | | | | | | | | 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: cleanup events codeNithin Raju2015-11-251-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out that we don't need to generate an event is practically useful only in case of a port disconnect to let userspace know. Hence, this event is being posted from HvDisconnectNic(). In case of a new port appearing, it seems that userspace is not interested in a new port unless it was added by userspace itself. In my tests, userspce would end up deleting the port when it got a new port notification, despite the port existing in OVSDB. The reasoning seems simple enough: - On Linux, OVS is integrated with the hypervisor (libvirt for eg) and a port (ie. netdev) gets created in the Linux kernel and then get added to OVSDB. When vswitchd picks up the port addition in OVSDB, it adds the port in the OVS kernel DP. - If the kernel netdev does not exist while OVS userspace tries to create the port in OVS kernel DP, port addition fails. Moreover, the only way to re-add the port is to trigger userspace to re-add the port by deleting the port in OVSDB and re-adding it. With this patch, I have verified that if a VIF gets disconnected on the Hyper-V switch, it disappears from the OVS kernel DP as well. 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: return netlink error for read operationNithin Raju2015-09-291-1/+15
| | | | | | | | | | | | | | | The kernel datapath returns a NL error message upon any errors during read operations, and returns STATUS_SUCCESS as the return code. We reply on the input NL request to get the family ID, and the PID. However, when the request is of type OVS_CTRL_CMD_EVENT_NOTIFY and OVS_CTRL_CMD_READ_NOTIFY, there's no input buffer associated with the request. So, we use a temporary input buffer to be able to call the Netlink APIs for constructing the output NL error message. 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: Ben Pfaff <blp@nicira.com>
* datapath-windows: move packet read code to User.cNithin Raju2015-09-291-111/+4
| | | | | | | | | Simple code motion. 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: Ben Pfaff <blp@nicira.com>
* datapath-windows: Support for IRP cancelling mechanismSorin Vinturis2015-08-311-4/+0
| | | | | | | | | | | | | | | | Under certain circumstances, we might need to cancel a pending IRP that has been submitted and not yet responded. This might occur when the request takes too long to complete or when the process which initiated the request terminated, leaving the request outstanding. This patch provides this missing piece by adding support for IRP cancelling mechanism. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/95 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Fix iterator in NlAttrParse()Sairam Venugopal2015-08-261-3/+7
| | | | | | 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: Solved memory leak in OVS datapathSorin Vinturis2015-07-021-0/+1
| | | | | | | | | | When closing opened instances, make sure the user dump state is cleared. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/90 Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Return pending for IRPs completed laterSorin Vinturis2015-06-181-0/+1
| | | | | | | | | | | Return STATUS_PENDING for IRPs that are completed later in another thread. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/83 Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Removed memory barrier and master lockSorin Vinturis2015-05-271-9/+0
| | | | | | | | | | | | | | There is no need to enforce Netlink serialization on transactions sent from userspace. The access to the driver's shared resources is synchronized anyway. Thus I have removed the master lock. I also removed the memory barrier from filter dispatch routine. A memory barrier is already in place in OvsReleaseSwitchContext function, due to the use of InterlockedCompareExchange function. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Support for custom VXLAN tunnel portSorin Vinturis2015-05-271-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ovs-hyperv: make kernel return values netlink socket likeNithin Raju2015-04-291-8/+53
| | | | | | | | | | | | | | | | | | | | | | | In this patch, we make changes to usersapce as well as kernel datapath on hyperv to make it more netlink socket like. Previously, the kernel datapath did not distinguish between "transport errors" and other errors. Netlink semantics dictate that netlink functions should only return an error only in the case of a "transport error" which is generally something fatal. Eg. failure to communicate with the OVS module, or an invalid command altogether. Other errors such as an unsupported action, or an invalid flow key is not considered a "transport error", and in such cases, netlink functions are to return success with a 'struct nlmsgerr' populated in the output buffer. This patch implements these semantics. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/72 Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Removed gOvsCtrlLock global spinlockSorin Vinturis2015-04-231-15/+0
| | | | | | | | | | | | | There is no need to use gOvsCtrlLock spinlock to guard the switch context, as there is now the switch context's reference count used for this purpose. Now the gOvsCtrlLock spinlock guards only one shared resource, the OVS_OPEN_INSTANCE global instance array. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Solved BSOD when uninstalling the driver (race condition)Sorin Vinturis2015-04-071-2/+10
| | | | | | | | | | | | | | The BSOD occurred because the FilterAttach routine released the switch context, while there were IRPs in processing. The solution was to add a reference count to prevent premature deallocation of the global switch context structure, gOvsSwitchContext. 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/58 Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* datapath-windows: Make GET_PID a separate IOCTLSorin Vinturis2015-04-021-28/+35
| | | | | | | | | | | | | | Added a new IOCTL in order to retrieve the PID from the kernel datapath. The new method uses a direct and cleaner way, as opposed to the old way of using a Netlink transaction, avoiding the unnecessary overhead. 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/31 Acked-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: Added specific pool tag for datapath codeSorin Vinturis2015-03-261-3/+35
| | | | | | | | | | | All memory allocations within datapath code have 'DSVO' 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: Updated WFP system provider handlingSorin Vinturis2015-03-241-16/+4
| | | | | | | | | | | | | | | | If the Base Filtering Engine (BFE) is not started, the WFP system provider failed to be added because no session to the engine could be acquired. The solution for this was to registered a BFE notification callback that is called whenever the BFE's state changes. Only if the BFE's state is running the WFP system provider is added. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/65 Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Solved BSOD when loading an activated extensionSorin Vinturis2015-01-301-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the OVS extension was previously enabled and the driver unloaded, when the driver is loaded again a BSOD is triggered. This happens because the OVS extension registers its FilterXxx routines to NDIS, by calling NdisFRegisterFilterDriver, before performing all the necessary initialization. Because drivers that call NdisFRegisterFilterDriver must be prepared for an immediate call to any of their FilterXxx functions. The BSOD is triggered because the FilterAttach routine, OvsExtAttach, tries to acquire the control lock, when the lock is not yet initialized. This happens because the FilterAttach is called before the driver finishes initialization, in OvsInit(). The solution is to perform all necessary initialization before registering OVS FilterXxx routines. If device object creation fails, all allocated resources during init phase are released by calling OvsCleanup and NdisFDeregisterFilterDriver functions. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/67 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Add a WFP system providerSorin Vinturis2015-01-061-0/+16
| | | | | | | | | | | | This patch was enforced by the WHCK logo testing. In order to pass the Windows Filtering Platform tests we need to add a persistent system provider. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/65 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Cleanup OVSSorin Vinturis2014-12-311-1/+0
| | | | | | | | | | | Removed duplicate include of "Switch.h" header. Removed useless usage of UNREFERENCED_PARAMETER macro for a referenced parameter. Added debug logs for dropped packets. 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: refactor BuildReplyMsgFromMsgIn & BuildErrorMsgNithin Raju2014-12-111-1/+1
| | | | | | | | In this patch, we consolidate code in Netlink.c. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Add PID Number attribute for port notification / Fix logicEitan Eliahu2014-12-051-6/+8
| | | | | | | | | | | | [1] User mode OVS expects to have the PID number in the port state notification command [2] Fix logic error-for-Windows-user-mode Signed-off-by: Eitan Eliahu <eliahue@vmware.com> Acked-by: Ankur Sharma <ankursharma@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Fixed Release broken build.Sorin Vinturis2014-11-251-0/+2
| | | | | | | | | | | The release configurations of the OVSEXT project were not compiling. This was due to a warning that was treated as error. Fixed that. I did not want to remove that variable, because it is used in an ASSERT in that function. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* datapath-windows: Move vport code from Datapath.c to Vport.c.Nithin Raju2014-11-241-747/+3
| | | | | | | | | | Plain code motion. No additional cleanup or refactoring peformed. I'll be doing some code refactoring in subsequent patches. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* datapath-windows: Removed duplicate checking of previous dump stateSorin Vinturis2014-11-241-4/+2
| | | | | | | | | Removed the check for previous dump state before calling FreeUserDumpState as the check is also performed in the latter function. 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: do not complete an IRP when pending status returnedEitan Eliahu2014-11-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver completes a pending IRP, the IRP is being marked free by the I/O manager which causes a system crash when the IRP is completed at the second time. The driver should not complete a pending IRP in the context of the Device I/O control thread. *** Fatal System Error: 0x00000044 (0xFFFFFA800CF897D0,0x0000000000000F7A,0x0000000000000000,0x0000000000000000) Break instruction exception - code 80000003 (first chance) BugCheck 44, {fffffa800cf897d0, f7a, 0, 0} Probably caused by : OVSExt.sys ( OVSExt!OvsCompleteIrpRequest+3a ) Followup: MachineOwner --------- nt!DbgBreakPointWithStatus: fffff800`5a100930 cc int 3 11: kd> !analyze -v ******************************************************************************* * * * Bugcheck Analysis * * * ******************************************************************************* MULTIPLE_IRP_COMPLETE_REQUESTS (44) A driver has requested that an IRP be completed (IoCompleteRequest()), but the packet has already been completed. This is a tough bug to find because the easiest case, a driver actually attempted to complete its own packet twice, is generally not what happened. Rather, two separate drivers each believe that they own the packet, and each attempts to complete it. The first actually works, and the second fails. Tracking down which drivers in the system actually did this is difficult, generally because the trails of the first driver have been covered by the second. However, the driver stack for the current request can be found by examining the DeviceObject fields in each of the stack locations. Arguments: Arg1: fffffa800cf897d0, Address of the IRP Arg2: 0000000000000f7a Arg3: 0000000000000000 Arg4: 0000000000000000 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: rename 'hvDeleted' to 'isPresentOnHv'Nithin Raju2014-11-201-1/+1
| | | | | | | | | | | | | '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>
* datpaath-windows: consolidate check for output bufferNithin Raju2014-11-201-18/+20
| | | | | | | | | | | | | | Earlier, output buffer was optional in a transaction command. Thus each command handler, had to check if the output buffer had indeed been specified by userspace or not. Now that output buffer is mandatory in transaction command, let's consolidate the check in one place, and also convert the previous check to ASSERTs. 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: nuke non-netlink based interfaceNithin Raju2014-11-201-3/+0
| | | | | | Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>