From patchwork Tue Apr 3 15:08:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin-Gabriel Serdean X-Patchwork-Id: 894635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fstp4g9hz9s4Z for ; Wed, 4 Apr 2018 01:09:05 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A0DA0EB8; Tue, 3 Apr 2018 15:09:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C9D09EB2 for ; Tue, 3 Apr 2018 15:09:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id ED29362B for ; Tue, 3 Apr 2018 15:08:59 +0000 (UTC) X-Originating-IP: 85.186.139.13 Received: from localhost.localdomain (unknown [85.186.139.13]) (Authenticated sender: aserdean@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E44CA60002; Tue, 3 Apr 2018 17:08:57 +0200 (CEST) From: Alin Gabriel Serdean To: dev@openvswitch.org Date: Tue, 3 Apr 2018 18:08:49 +0300 Message-Id: <20180403150849.4812-1-aserdean@ovn.org> X-Mailer: git-send-email 2.16.1.windows.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Alin Gabriel Serdean Subject: [ovs-dev] [PATCH] RFC datapath-windows: Create com device only when extension is enabled X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Until now the communication device between the kernel and userspace is created when the network driver is installed. Since we only do processing if the Hyper-V vSwitch extension is enabled by the user, it makes more sense to move the device creation only when that is true. Signed-off-by: Alin Gabriel Serdean --- datapath-windows/ovsext/Datapath.c | 2 +- datapath-windows/ovsext/Driver.c | 10 ---------- datapath-windows/ovsext/Switch.c | 7 +++++++ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c index 34ef2b40a..264cfd3a0 100644 --- a/datapath-windows/ovsext/Datapath.c +++ b/datapath-windows/ovsext/Datapath.c @@ -352,7 +352,7 @@ _Dispatch_type_(IRP_MJ_DEVICE_CONTROL) DRIVER_DISPATCH OvsDeviceControl; #ifdef ALLOC_PRAGMA -#pragma alloc_text(INIT, OvsCreateDeviceObject) +#pragma alloc_text(PAGE, OvsCreateDeviceObject) #pragma alloc_text(PAGE, OvsOpenCloseDevice) #pragma alloc_text(PAGE, OvsCleanupDevice) #pragma alloc_text(PAGE, OvsDeviceControl) diff --git a/datapath-windows/ovsext/Driver.c b/datapath-windows/ovsext/Driver.c index 50c9614e4..39e50c34b 100644 --- a/datapath-windows/ovsext/Driver.c +++ b/datapath-windows/ovsext/Driver.c @@ -152,14 +152,6 @@ DriverEntry(PDRIVER_OBJECT driverObject, goto cleanup; } - /* Create the communication channel for userspace. */ - status = OvsCreateDeviceObject(gOvsExtDriverHandle); - if (status != NDIS_STATUS_SUCCESS) { - NdisFDeregisterFilterDriver(gOvsExtDriverHandle); - gOvsExtDriverHandle = NULL; - goto cleanup; - } - cleanup: if (status != NDIS_STATUS_SUCCESS){ OvsCleanup(); @@ -179,8 +171,6 @@ OvsExtUnload(struct _DRIVER_OBJECT *driverObject) { UNREFERENCED_PARAMETER(driverObject); - OvsDeleteDeviceObject(); - NdisFDeregisterFilterDriver(gOvsExtDriverHandle); /* Release driver associated data structures. */ diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index 1ac4fa77c..81b897ffe 100644 --- a/datapath-windows/ovsext/Switch.c +++ b/datapath-windows/ovsext/Switch.c @@ -73,6 +73,12 @@ OvsExtAttach(NDIS_HANDLE ndisFilterHandle, NDIS_STATUS status = NDIS_STATUS_FAILURE; NDIS_FILTER_ATTRIBUTES ovsExtAttributes; POVS_SWITCH_CONTEXT switchContext = NULL; + /* Create the communication channel for userspace. */ + status = OvsCreateDeviceObject(gOvsExtDriverHandle); + if (status != NDIS_STATUS_SUCCESS) { + status = NDIS_STATUS_INVALID_PARAMETER; + goto cleanup; + } UNREFERENCED_PARAMETER(filterDriverContext); @@ -266,6 +272,7 @@ OvsExtDetach(NDIS_HANDLE filterModuleContext) while(switchContext->pendingOidCount > 0) { NdisMSleep(1000); } + OvsDeleteDeviceObject(); OvsDeleteSwitch(switchContext); OvsCleanupIpHelper(); OvsCleanupSttDefragmentation();