From patchwork Thu Aug 13 23:21:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75519 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 879E6A04B1; Fri, 14 Aug 2020 01:22:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA3381C0D7; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 244281C0CF for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 7351820B4908; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7351820B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=sWBXs1TaEcacD5VJvrBlzPYk3ZQHrz9/isM4KB8U/6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qlFZlIEvpUhqi3o7G2bA9qGQxkW6Nyrgl+QF1dRMjJpcu5dddJy6FHnP02if2x0Hc Kc4NMVOW/xEyoRsdrlBfevKJOQMxEkCJaEXE751bfBL+QJ0GmnBcJSLS4BFF7LoHWo 2SiXwTW46aHTS61maW4gKutwaPS7beQ6n4ltsbl0= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Thomas Monjalon Date: Thu, 13 Aug 2020 16:21:24 -0700 Message-Id: <1597360905-74106-2-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 01/22] init DPDK repository X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Thomas Monjalon --- .gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e69de29bb From patchwork Thu Aug 13 23:21:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75522 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96D60A04B1; Fri, 14 Aug 2020 01:23:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5FDF91C114; Fri, 14 Aug 2020 01:22:50 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 2B8501C0D0 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 8113320B490A; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8113320B490A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=PI5zgh0qn/4AZKd5kk+aahAH9KDudcsUoa57OFrY5TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktGRKckTGbe8AbR25vzoikjR0rvDsUgbqM/+ok4Rl7j11qkrEob21xSCsOIjAh7l3 XRlmmDekVOumirZE3Ub7xOt+p2o1R320h8EchU1p/jHrZuqx3XzIaGhee++Ath6a4x yDskJtpcW9RhYTT1MHcMerFxpPAU5wCYuRgqUENo= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Jason Messer Date: Thu, 13 Aug 2020 16:21:25 -0700 Message-Id: <1597360905-74106-3-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 02/22] Initial commit of UIO driver for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jason Messer --- mk/exec-env/windows/netuio/netuio.sln | 24 ++++ mk/exec-env/windows/netuio/netuio.vcxproj | 108 ++++++++++++++++++ .../windows/netuio/netuio.vcxproj.filters | 59 ++++++++++ .../windows/netuio/netuio.vcxproj.user | 11 ++ 4 files changed, 202 insertions(+) create mode 100644 mk/exec-env/windows/netuio/netuio.sln create mode 100644 mk/exec-env/windows/netuio/netuio.vcxproj create mode 100644 mk/exec-env/windows/netuio/netuio.vcxproj.filters create mode 100644 mk/exec-env/windows/netuio/netuio.vcxproj.user diff --git a/mk/exec-env/windows/netuio/netuio.sln b/mk/exec-env/windows/netuio/netuio.sln new file mode 100644 index 000000000..15c26e6b9 --- /dev/null +++ b/mk/exec-env/windows/netuio/netuio.sln @@ -0,0 +1,24 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netuio", "netuio.vcxproj", "{66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Debug|x64.ActiveCfg = Debug|x64 + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Debug|x64.Build.0 = Debug|x64 + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Debug|x64.Deploy.0 = Debug|x64 + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Release|x64.ActiveCfg = Release|x64 + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Release|x64.Build.0 = Release|x64 + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6}.Release|x64.Deploy.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/mk/exec-env/windows/netuio/netuio.vcxproj new file mode 100644 index 000000000..251b8eb95 --- /dev/null +++ b/mk/exec-env/windows/netuio/netuio.vcxproj @@ -0,0 +1,108 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {66EC91EF-AC5B-4D1E-8314-9B3E2855CCF6} + {497e31cb-056b-4f31-abb8-447fd55ee5a5} + v4.5 + 12.0 + Debug + Win32 + netuio + $(LatestTargetPlatformVersion) + + + + + + true + WindowsKernelModeDriver10.0 + Driver + KMDF + Desktop + + + + + false + WindowsKernelModeDriver10.0 + Driver + KMDF + Desktop + + + + + + + + + + + DbgengKernelDebugger + $(SolutionDir)..\..\..\..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + $(SolutionDir)..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + + + DbgengKernelDebugger + $(SolutionDir)..\..\..\..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + $(SolutionDir)..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + + + + false + true + trace.h + true + false + + + 0.6.0.2 + + + + + false + true + trace.h + true + false + + + 0.6.0.2 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj.filters b/mk/exec-env/windows/netuio/netuio.vcxproj.filters new file mode 100644 index 000000000..72a397d7c --- /dev/null +++ b/mk/exec-env/windows/netuio/netuio.vcxproj.filters @@ -0,0 +1,59 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {8E41214B-6785-4CFE-B992-037D68949A14} + inf;inv;inx;mof;mc; + + + + + Driver Files + + + + + Resource Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj.user b/mk/exec-env/windows/netuio/netuio.vcxproj.user new file mode 100644 index 000000000..771ce8681 --- /dev/null +++ b/mk/exec-env/windows/netuio/netuio.vcxproj.user @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file From patchwork Thu Aug 13 23:21:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75520 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2FFFCA04B1; Fri, 14 Aug 2020 01:22:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DCBD91C0D8; Fri, 14 Aug 2020 01:22:47 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 2F6041C0D1 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 8D89920B490D; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D89920B490D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=BOEXUhRcsq2HNz1ifCt6ibnBfHs17ZdMZKbfATT/tgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2DOca/GuMfge3dNtm+zeEPy4MeH2nR++n+8PxIm+4o5DhAiHOiAMGT48zuHiD4u4 a2q2XQUdPs0b7cLEIRcdmv1NLGjaq58buPZGvxPwb7X2CHtC17FjL/xh13Ze3/5SiN iiThyq17EJ5I7dQoQshIOYdBfASP4spPxz0BiCUQ= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Jason Messer Date: Thu, 13 Aug 2020 16:21:26 -0700 Message-Id: <1597360905-74106-4-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 03/22] Added new core libraries for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jason Messer --- mk/exec-env/windows/netuio/netuio.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/mk/exec-env/windows/netuio/netuio.vcxproj index 251b8eb95..9e769b5d0 100644 --- a/mk/exec-env/windows/netuio/netuio.vcxproj +++ b/mk/exec-env/windows/netuio/netuio.vcxproj @@ -66,7 +66,7 @@ false - 0.6.0.2 + 0.6.0.5 @@ -78,7 +78,7 @@ false - 0.6.0.2 + 0.6.0.5 From patchwork Thu Aug 13 23:21:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75523 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72721A04B1; Fri, 14 Aug 2020 01:23:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DA511C11B; Fri, 14 Aug 2020 01:22:51 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 3D9DE1C0D2 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 9A8D520B490F; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9A8D520B490F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=CdgR10xdWUvk7ySyz8OQI3maStv+c4Pk5mMuD30n3Aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noywEGkQr3qkNCnqiZDlBgWu/tBR8KNalb8oSkyvwCcs3tHfxbJi7CuHiWXs/NKk+ jiMR7bjqNB9ikaIc/oLYguIPIfAENOQ7DEH1DqCLQ3Kvmy3LeiEv2z5DNydOSQYeRK Tf7yxyzK4en+IAqOU8EdxQ32FY03ONmUCnOL8K4o= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:27 -0700 Message-Id: <1597360905-74106-5-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 04/22] Windows DPDK libraries and applications have now been updated to the latest public release v18.08, of the main DPDK source. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- mk/exec-env/windows/netuio/netuio.vcxproj | 20 +++++++++---------- .../windows/netuio/netuio.vcxproj.filters | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/mk/exec-env/windows/netuio/netuio.vcxproj index 9e769b5d0..b6564e4e7 100644 --- a/mk/exec-env/windows/netuio/netuio.vcxproj +++ b/mk/exec-env/windows/netuio/netuio.vcxproj @@ -85,22 +85,22 @@ - + - + - - - - - + + + + + - - - + + + diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj.filters b/mk/exec-env/windows/netuio/netuio.vcxproj.filters index 72a397d7c..a21f9ad99 100644 --- a/mk/exec-env/windows/netuio/netuio.vcxproj.filters +++ b/mk/exec-env/windows/netuio/netuio.vcxproj.filters @@ -19,40 +19,40 @@ - + Driver Files - + Resource Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Source Files - + Source Files - + Source Files From patchwork Thu Aug 13 23:21:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75521 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B29B4A04B1; Fri, 14 Aug 2020 01:23:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F0731C10B; Fri, 14 Aug 2020 01:22:49 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 4799B1C0D4 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id A6DD120B4913; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A6DD120B4913 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=VSsg+5AePMc0FUlQlVYZp3l9NjQxoGl37y83Lx+CQt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eY+elmB+0a2dwLtXLSxc94Bt9pL21qgsPGtGoBdrO7GtXUqg/263XezSAHN/FFwh1 S0JJFSxSbFa4+mar2lgzDfMDRc/cNEEZYbvKSxDdiWr4cw8A9+jsgU15kiV6mNQ1AJ CiBzrEny8khIx5lLbQchJEVHtT088Xaxk/l13Qpk= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:28 -0700 Message-Id: <1597360905-74106-6-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 05/22] doc: remove embedded buffer from Windows UIO ioctl X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- mk/exec-env/windows/netuio/netuio.vcxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/mk/exec-env/windows/netuio/netuio.vcxproj index b6564e4e7..b6b11e49a 100644 --- a/mk/exec-env/windows/netuio/netuio.vcxproj +++ b/mk/exec-env/windows/netuio/netuio.vcxproj @@ -68,6 +68,9 @@ 0.6.0.5 + + %(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfLdr.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfDriverEntry.lib;$(DDK_LIB_PATH)\wdmsec.lib + @@ -80,6 +83,9 @@ 0.6.0.5 + + %(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfLdr.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfDriverEntry.lib;$(DDK_LIB_PATH)\wdmsec.lib + From patchwork Thu Aug 13 23:21:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75533 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3901DA04B1; Fri, 14 Aug 2020 01:24:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B02221C1B4; Fri, 14 Aug 2020 01:23:03 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id DBCD21C0CF for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id B3F4120B4916; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B3F4120B4916 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=SLZXc7axZJl04uKHnM5I4NTHS4bojddh/qwBYadFnRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M8GOYlw8FR+VxV5YFp04rlD5FT3x9XLvGEsqeuwP759FHbekPexcp+45zPqlpF+Rc Ugf+oKMOrv57fQAq8/hZFsVYMbBecQGaPVhxON5xW7LLwVfbJXktpT6j4QRmo+vdCK 7Q6Bg9mb9Wcc91QY6oMjxi2sX20NlQTfliSwEvjg= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:29 -0700 Message-Id: <1597360905-74106-7-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 06/22] Windows DPDK libraries and applications have now been updated to the latest public release v18.08, of the main DPDK source. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio.inf | 118 +++++++++ kernel/windows/netuio/netuio.rc | Bin 0 -> 4772 bytes kernel/windows/netuio/netuio_dev.c | 306 +++++++++++++++++++++++ kernel/windows/netuio/netuio_dev.h | 65 +++++ kernel/windows/netuio/netuio_drv.c | 142 +++++++++++ kernel/windows/netuio/netuio_drv.h | 33 +++ kernel/windows/netuio/netuio_interface.h | 69 +++++ kernel/windows/netuio/netuio_queue.c | 271 ++++++++++++++++++++ kernel/windows/netuio/netuio_queue.h | 30 +++ kernel/windows/netuio/resource.h | 14 ++ 10 files changed, 1048 insertions(+) create mode 100644 kernel/windows/netuio/netuio.inf create mode 100644 kernel/windows/netuio/netuio.rc create mode 100644 kernel/windows/netuio/netuio_dev.c create mode 100644 kernel/windows/netuio/netuio_dev.h create mode 100644 kernel/windows/netuio/netuio_drv.c create mode 100644 kernel/windows/netuio/netuio_drv.h create mode 100644 kernel/windows/netuio/netuio_interface.h create mode 100644 kernel/windows/netuio/netuio_queue.c create mode 100644 kernel/windows/netuio/netuio_queue.h create mode 100644 kernel/windows/netuio/resource.h diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf new file mode 100644 index 000000000..0453b371a --- /dev/null +++ b/kernel/windows/netuio/netuio.inf @@ -0,0 +1,118 @@ +; +; BSD LICENSE +; +; Copyright(c) 2010-2018 Intel Corporation. All rights reserved. +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in +; the documentation and/or other materials provided with the +; distribution. +; * Neither the name of Intel Corporation nor the names of its +; contributors may be used to endorse or promote products derived +; from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; +; +; netuio.inf +; + +[Version] +Signature="$WINDOWS NT$" +Class=Net +ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318} +Provider=%ManufacturerName% +CatalogFile=netuio.cat +DriverVer= + +;***************************************** +; Install Section +;***************************************** + +[Manufacturer] +%ManufacturerName%=Standard,NT$ARCH$ + +[Standard.NT$ARCH$] +%F1583.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_1583 +%F158A.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_158A ; I40E_DEV_ID_25G_B +%F158B.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_158B ; I40E_DEV_ID_25G_SFP28 +%F37D0.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_37D0 +%F153B.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_153B + +[netuio_Device.NT] +CopyFiles=Drivers_Dir + +[Drivers_Dir] +netuio.sys + +;-------------- Service installation +[netuio_Device.NT.Services] +AddService = netuio,%SPSVCINST_ASSOCSERVICE%, netuio_Service_Inst + +; -------------- netuio driver install sections +[netuio_Service_Inst] +DisplayName = %netuio.SVCDESC% +ServiceType = 1 ; SERVICE_KERNEL_DRIVER +StartType = 3 ; SERVICE_DEMAND_START +ErrorControl = 1 ; SERVICE_ERROR_NORMAL +ServiceBinary = %12%\netuio.sys + +; +;--- netuio_Device Coinstaller installation ------ +; + +[DestinationDirs] +DefaultDestDir = 12 +netuio_Device_CoInstaller_CopyFiles = 11 + +[netuio_Device.NT.CoInstallers] +AddReg=netuio_Device_CoInstaller_AddReg +CopyFiles=netuio_Device_CoInstaller_CopyFiles + +[netuio_Device_CoInstaller_AddReg] +HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller" + +[netuio_Device_CoInstaller_CopyFiles] +WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll + +[SourceDisksNames] +1 = %DiskName%,,,"" + +[SourceDisksFiles] +netuio.sys = 1,, +WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames + +[netuio_Device.NT.Wdf] +KmdfService = netuio, netuio_wdfsect +[netuio_wdfsect] +KmdfLibraryVersion = $KMDFVERSION$ + +[Strings] +SPSVCINST_ASSOCSERVICE= 0x00000002 +ManufacturerName="Intel" +ClassName = "Intel(R) DPDK netUIO Driver" +DiskName = "DPDK netUIO Installation Disk" +F1583.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Converged Network Adapter XL710-Q2" +F158A.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Network Adapter XXV710 for 25GbE backplane" +F158B.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Network Adapter XXV710-DA1" +F37D0.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Connection X722" +F153B.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Connection I217-V" +netuio.DeviceDesc = "netuio Device" +netuio.SVCDESC = "netuio Service" diff --git a/kernel/windows/netuio/netuio.rc b/kernel/windows/netuio/netuio.rc new file mode 100644 index 0000000000000000000000000000000000000000..4b0b176e6284fcfa65662f7ea6b3b1b36fb85a6d GIT binary patch literal 4772 zcmdUy+iuf95QgU(iFYvR4G7dGEg-mTlQdMM2Q_H`sZsEes0;8MRsUc_R%I5Tf%)|Q`UN{B{sA7Heyz{$6S$J+R(<_ z6V|7U1J)*t;+ygIk@tw1q+QuHG@Ewc?y<|38#h=T^K}IEz|mF;{G0a4Dvny58;^$gd4Sb*>=YhN*0;GAJ@RKCe0BJGzC8Zxhgi_aN5>4T6iFA@eYe;M z$OpOWH3sb>ygMfUMtCYA1|oZi&&SL{9(H*1S((_Qk|;6Z&FT@WXN)Zur(wm@wUB*4uD-G- z$nHS5$BO4!r0Db2XSI(2*|IzWlpj4TdCjhk|E?C4XL*PTjk;@KR!$kY?|azZa+N~V z(flf}yysS(S6}(hBPK4@mAmXwR`DxVtTz=qr*54S(Z2SlS}xOQ=Z+e!y3dBI#{)7= zHO6165oPtJ7;V8v>s3{<+DJpq!>F@gCwzj%G5!ea!IB=?*N3J_o_E|Ce8gOq?~`ZZ z&VC8&;*Ov=Ag`MXG!ZfP#GZ3&eCBqHIOk81*C5;LL|$HMM9h0?aa89VLHfR{9WAsw zq=t0JeeLkgcJN@^(JCs_s-f!Eq~e^BC3!tlNnS$jhJQ#UPQdAQ`f7$==ahEMa~z|e zm;DqSbv>Q)q-b^NXHL-2({0;_0)?-bdAhK7dG@Qm9)ql~si4CYkE=Jk#79@yHpEk7 zw2c??v0Pfni@a3XQni=PrVl*xnVs^KRj2SZj6FQ5E=MR-&|BTmHRs*fz7u)xnGIRj z=}~c->s0ieYm8;r(EFa%$8@i4o&rLQ#4g~s&i7feqn9G zOn7Q+LZLoxg8rgbhpk+b7h?1l{>s3+=$X&nfJv23{5iMAXDi8790*P6s=t9nw7ms0 ztc;PJ;E&bxZX^5BNfrjz@C&g^@R{CtwD?8+Pu=w++t^gI7tZ%V*X5qy1nXUga729x z`y{NMqK7hi;=DD$mQ~O{o@=cf5=tRzG|R^3-=cNGJ~2@><1cDj@I`~&)CH<~ju^FD zL|hJ?O(Tb|w2?<6qE+2v8kKLDt4hV3&#U<`uT^;j*5=Wt2wYYR(w-yaVsRy3V|rLQ zxj|e0U$tiCD@zw?!Yy(5O+iF?>9a^@h_7hM`5HZu>b0-uUf)#P^iAKF_YnW4tIwY2 z>-8?{v$sEaZ~JE}_E76(QC1sSrg<3u_U~Oi?d^Z>0n4lw>-8=Tm&f~ +#include "netuio_drv.h" + +#include + +#ifdef ALLOC_PRAGMA +#pragma alloc_text (PAGE, netuio_create_device) +#pragma alloc_text (PAGE, netuio_evt_device_context_cleanup) +#pragma alloc_text (PAGE, netuio_map_hw_resources) +#pragma alloc_text (PAGE, netuio_free_hw_resources) +#endif + +/* +Routine Description: + Worker routine called to create a device and its software resources. + +Return Value: + NTSTATUS + */ +NTSTATUS +netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) +{ + WDF_OBJECT_ATTRIBUTES deviceAttributes; + WDFDEVICE device; + NTSTATUS status; + + PAGED_CODE(); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); + + // Set the device context cleanup callback. + // This function will be called when the WDF Device Object associated to the current device is destroyed + deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; + + status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); + + if (NT_SUCCESS(status)) { + // Create a device interface so that applications can find and talk to us. + status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_netUIO, NULL); + + if (NT_SUCCESS(status)) { + // Retrieve and store PCI information + status = get_pci_device_info(device); + } + + if (NT_SUCCESS(status)) { + // Create a symbolic link name for user-space access + status = create_device_specific_symbolic_link(device); + } + + if (NT_SUCCESS(status)) { + // Initialize the I/O Package and any Queues + status = netuio_queue_initialize(device); + } + + if (NT_SUCCESS(status)) { + // Allocate physically contiguous memory for user process use. We'll map it later + status = allocate_usermemory_segment(device); + } + } + + return status; +} + +/* +Routine Description: + Free all the resources allocated in AdfEvtDeviceAdd. + +Return Value: + None + */ +VOID +netuio_evt_device_context_cleanup(_In_ WDFOBJECT Device) +{ + free_usermemory_segment(Device); + return; +} + +NTSTATUS +netuio_map_hw_resources(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST Resources, _In_ WDFCMRESLIST ResourcesTranslated) +{ + UNREFERENCED_PARAMETER(Resources); + + NTSTATUS status = STATUS_SUCCESS; + + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(Device); + + if (!netuio_contextdata) + return STATUS_UNSUCCESSFUL; + + PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor; + UINT8 bar_index = 0; + + // Collect device BAR resources from the ResourcesTranslated object + for (ULONG idx = 0; idx < WdfCmResourceListGetCount(ResourcesTranslated); idx++) { + descriptor = WdfCmResourceListGetDescriptor(ResourcesTranslated, idx); + if (!descriptor) { + status = STATUS_DEVICE_CONFIGURATION_ERROR; + goto end; + } + + switch (descriptor->Type) { + case CmResourceTypeMemory: + // Retrieve and map the BARs + netuio_contextdata->bar[bar_index].base_addr.QuadPart = descriptor->u.Memory.Start.QuadPart; + netuio_contextdata->bar[bar_index].size = descriptor->u.Memory.Length; + netuio_contextdata->bar[bar_index].virt_addr = + MmMapIoSpace(descriptor->u.Memory.Start, descriptor->u.Memory.Length, MmNonCached); + + if (netuio_contextdata->bar[bar_index].virt_addr == NULL) { + status = STATUS_UNSUCCESSFUL; + goto end; + } + + bar_index++; + break; + + // Don't handle any other resource type + // This could be device-private type added by the PCI bus driver. + case CmResourceTypeInterrupt: + default: + break; + } + } + + // Allocate an MDL for the device BAR, so that we can map it to the user's process context later... + if (status == STATUS_SUCCESS) { + // Bar 0 is typically the HW BAR + if (netuio_contextdata->bar[0].virt_addr) { + netuio_contextdata->dpdk_hw.mdl = IoAllocateMdl(netuio_contextdata->bar[0].virt_addr, (ULONG)netuio_contextdata->bar[0].size, FALSE, FALSE, NULL); + if (!netuio_contextdata->dpdk_hw.mdl) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + netuio_contextdata->dpdk_hw.mem.size = netuio_contextdata->bar[0].size; + } + } + +end: + return status; +} + +VOID +netuio_free_hw_resources(_In_ WDFDEVICE Device) +{ + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(Device); + + if (netuio_contextdata) { + // Free the allocated MDL + if (netuio_contextdata->dpdk_hw.mdl) + IoFreeMdl(netuio_contextdata->dpdk_hw.mdl); + + // Unmap all the BAR regions previously mapped + for (UINT8 bar_index = 0; bar_index < PCI_MAX_BAR; bar_index++) { + if (netuio_contextdata->bar[bar_index].virt_addr) + MmUnmapIoSpace(netuio_contextdata->bar[bar_index].virt_addr, netuio_contextdata->bar[bar_index].size); + } + } +} + + +static NTSTATUS +get_pci_device_info(_In_ WDFOBJECT device) +{ + NTSTATUS status = STATUS_UNSUCCESSFUL; + + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + if (!netuio_contextdata) + return status; + + netuio_contextdata->wdf_device = device; // Store for later use + + // Obtain the BUS_INTERFACE_STANDARD interface from the Bus Driver + status = WdfFdoQueryForInterface(device, &GUID_BUS_INTERFACE_STANDARD, + (PINTERFACE)&netuio_contextdata->bus_interface, + sizeof(BUS_INTERFACE_STANDARD), 1, NULL); + if (!NT_SUCCESS(status)) + return status; + + // Retrieve the B:D:F details of our device + PDEVICE_OBJECT pdo = NULL; + pdo = WdfDeviceWdmGetPhysicalDevice(device); + if (pdo) { + ULONG prop = 0, length = 0; + status = IoGetDeviceProperty(pdo, DevicePropertyBusNumber, sizeof(ULONG), (PVOID)&netuio_contextdata->addr.bus_num, &length); + status = IoGetDeviceProperty(pdo, DevicePropertyAddress, sizeof(ULONG), (PVOID)&prop, &length); + + if (NT_SUCCESS(status)) { + netuio_contextdata->addr.func_num = prop & 0x0000FFFF; + netuio_contextdata->addr.dev_num = ((prop >> 16) & 0x0000FFFF); + } + // Also, retrieve the NUMA node of the device + USHORT numaNode; + status = IoGetDeviceNumaNode(pdo, &numaNode); + if (NT_SUCCESS(status)) { + netuio_contextdata->dev_numa_node = numaNode; + } + } + + return status; +} + +static NTSTATUS +create_device_specific_symbolic_link(_In_ WDFOBJECT device) +{ + NTSTATUS status = STATUS_UNSUCCESSFUL; + UNICODE_STRING netuio_symbolic_link; + + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + if (!netuio_contextdata) + return status; + + // Build symbolic link name as _BDF (bus/device/func) + CHAR symbolic_link[64] = { 0 }; + sprintf_s(symbolic_link, sizeof(symbolic_link), "%s_%04d%02d%02d", + NETUIO_DEVICE_SYMBOLIC_LINK_ANSI, netuio_contextdata->addr.bus_num, + netuio_contextdata->addr.dev_num, netuio_contextdata->addr.func_num); + + ANSI_STRING ansi_symbolic_link; + RtlInitAnsiString(&ansi_symbolic_link, symbolic_link); + + status = RtlAnsiStringToUnicodeString(&netuio_symbolic_link, &ansi_symbolic_link, TRUE); + if (!NT_SUCCESS(status)) + return status; + + status = WdfDeviceCreateSymbolicLink(device, &netuio_symbolic_link); + + RtlFreeUnicodeString(&netuio_symbolic_link); + + return status; +} + +static NTSTATUS +allocate_usermemory_segment(_In_ WDFOBJECT device) +{ + NTSTATUS status = STATUS_SUCCESS; + + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + if (!netuio_contextdata) + return STATUS_UNSUCCESSFUL; + + PHYSICAL_ADDRESS lowest_acceptable_address; + PHYSICAL_ADDRESS highest_acceptable_address; + PHYSICAL_ADDRESS boundary_address_multiple; + + lowest_acceptable_address.QuadPart = 0x0000000000800000; + highest_acceptable_address.QuadPart = 0xFFFFFFFFFFFFFFFF; + boundary_address_multiple.QuadPart = 0; + + // Allocate physically contiguous memory for user process use + netuio_contextdata->dpdk_seg.mem.virt_addr = + MmAllocateContiguousMemorySpecifyCache(USER_MEMORY_SEGMENT_SIZE, + lowest_acceptable_address, + highest_acceptable_address, + boundary_address_multiple, + MmCached); + + if (!netuio_contextdata->dpdk_seg.mem.virt_addr) { + status = STATUS_NO_MEMORY; + goto end; + } + + netuio_contextdata->dpdk_seg.mem.size = USER_MEMORY_SEGMENT_SIZE; + + // Allocate an MDL for this memory region - so that we can map it into the user's process context later + netuio_contextdata->dpdk_seg.mdl = IoAllocateMdl((PVOID)netuio_contextdata->dpdk_seg.mem.virt_addr, USER_MEMORY_SEGMENT_SIZE, FALSE, FALSE, NULL); + if (netuio_contextdata->dpdk_seg.mdl == NULL) { + status = STATUS_NO_MEMORY; + goto end; + } + + // Store the region's physical address + netuio_contextdata->dpdk_seg.mem.phys_addr = MmGetPhysicalAddress(netuio_contextdata->dpdk_seg.mem.virt_addr); + +end: + return status; +} + +static VOID +free_usermemory_segment(_In_ WDFOBJECT device) +{ + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + if (netuio_contextdata) { + if (netuio_contextdata->dpdk_seg.mdl) + IoFreeMdl(netuio_contextdata->dpdk_seg.mdl); + + if (netuio_contextdata->dpdk_seg.mem.virt_addr) + MmFreeContiguousMemory(netuio_contextdata->dpdk_seg.mem.virt_addr); + } +} diff --git a/kernel/windows/netuio/netuio_dev.h b/kernel/windows/netuio/netuio_dev.h new file mode 100644 index 000000000..a19a4fb42 --- /dev/null +++ b/kernel/windows/netuio/netuio_dev.h @@ -0,0 +1,65 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + +#ifndef NETUIO_DEV_H +#define NETUIO_DEV_H + +EXTERN_C_START + +#include "netuio_interface.h" + +// Constants +#define PCI_MAX_BAR 3 +#define USER_MEMORY_SEGMENT_SIZE (256ULL * 1024ULL * 1024ULL) // 256MB + +struct pci_bar { + PHYSICAL_ADDRESS base_addr; + PVOID virt_addr; + UINT64 size; +}; + +struct mem_map_region { + PMDL mdl; // MDL describing the memory region + struct mem_region mem; // Memory region details +}; + +// The device context performs the same job as a WDM device extension in the driver frameworks +typedef struct _NETUIO_CONTEXT_DATA +{ + WDFDEVICE wdf_device; // WDF device handle to the FDO + BUS_INTERFACE_STANDARD bus_interface; // Bus interface for config space access + struct pci_bar bar[PCI_MAX_BAR]; // device BARs + struct dev_addr addr; // B:D:F details of device + USHORT dev_numa_node; // The NUMA node of the device + struct mem_map_region dpdk_hw; // mapped region for the device's register space + struct mem_map_region dpdk_seg; // mapped region allocated for DPDK process use +} NETUIO_CONTEXT_DATA, *PNETUIO_CONTEXT_DATA; + + +// This macro will generate an inline function called DeviceGetContext +// which will be used to get a pointer to the device context memory in a type safe manner. +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(NETUIO_CONTEXT_DATA, netuio_get_context_data) + + +// Function to initialize the device and its callbacks +NTSTATUS netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit); +NTSTATUS netuio_map_hw_resources(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST Resources, _In_ WDFCMRESLIST ResourcesTranslated); +VOID netuio_free_hw_resources(_In_ WDFDEVICE Device); + + +// Function called for cleanup when device object is being destroyed +VOID netuio_evt_device_context_cleanup(_In_ WDFOBJECT Device); + +// Local function protoyypes +static NTSTATUS get_pci_device_info(_In_ WDFOBJECT device); +static NTSTATUS create_device_specific_symbolic_link(_In_ WDFOBJECT device); +static NTSTATUS allocate_usermemory_segment(_In_ WDFOBJECT device); +static VOID free_usermemory_segment(_In_ WDFOBJECT device); + + +EXTERN_C_END + +#endif // NETUIO_DEV_H diff --git a/kernel/windows/netuio/netuio_drv.c b/kernel/windows/netuio/netuio_drv.c new file mode 100644 index 000000000..d45a9ec4f --- /dev/null +++ b/kernel/windows/netuio/netuio_drv.c @@ -0,0 +1,142 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + + +#include "netuio_drv.h" + +#ifdef ALLOC_PRAGMA +#pragma alloc_text (INIT, DriverEntry) +#pragma alloc_text (PAGE, netuio_evt_device_add) +#pragma alloc_text (PAGE, netuio_evt_driver_context_cleanup) +#endif + + +/* +Routine Description: + DriverEntry initializes the driver and is the first routine called by the + system after the driver is loaded. DriverEntry specifies the other entry + points in the function driver, such as EvtDevice and DriverUnload. + +Return Value: + STATUS_SUCCESS if successful, + STATUS_UNSUCCESSFUL otherwise. + */ +NTSTATUS +DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath) +{ + WDF_DRIVER_CONFIG config; + NTSTATUS status; + WDF_OBJECT_ATTRIBUTES attributes; + + // Register a cleanup callback so that we can call WPP_CLEANUP when + // the framework driver object is deleted during driver unload. + WDF_OBJECT_ATTRIBUTES_INIT(&attributes); + attributes.EvtCleanupCallback = netuio_evt_driver_context_cleanup; + + WDF_DRIVER_CONFIG_INIT(&config, netuio_evt_device_add); + + status = WdfDriverCreate(DriverObject, RegistryPath, + &attributes, &config, + WDF_NO_HANDLE); + + if (!NT_SUCCESS(status)) { + return status; + } + + return status; +} + + +/* +Routine Description: + netuio_evt_device_add is called by the framework in response to AddDevice + call from the PnP manager. We create and initialize a device object to + represent a new instance of the device. + +Return Value: + NTSTATUS + */ +NTSTATUS +netuio_evt_device_add(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit) +{ + NTSTATUS status; + WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; + + UNREFERENCED_PARAMETER(Driver); + + PAGED_CODE(); + + // Zero out the PnpPowerCallbacks structure + WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); + + // Register Plug-aNd-Play and power management callbacks + pnpPowerCallbacks.EvtDevicePrepareHardware = netuio_evt_prepare_hw; + pnpPowerCallbacks.EvtDeviceReleaseHardware = netuio_evt_release_hw; + + WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); + + status = netuio_create_device(DeviceInit); + + return status; +} + +/* +Routine Description : + Maps HW resources and retrieves the PCI BAR address(es) of the device + +Return Value : + STATUS_SUCCESS is successful. + STATUS_ otherwise +-*/ +NTSTATUS +netuio_evt_prepare_hw(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST Resources, _In_ WDFCMRESLIST ResourcesTranslated) +{ + NTSTATUS status; + + status = netuio_map_hw_resources(Device, Resources, ResourcesTranslated); + + if (NT_SUCCESS(status)) { + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(Device); + if (netuio_contextdata) { + DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_NETUIO_INFO_LEVEL, "netUIO Driver loaded...on device (B:D:F) %04d:%02d:%02d\n", + netuio_contextdata->addr.bus_num, netuio_contextdata->addr.dev_num, netuio_contextdata->addr.func_num); + } + } + return status; +} + +/* +Routine Description : + Releases the resource mapped by netuio_evt_prepare_hw + +Return Value : + STATUS_SUCCESS always. +-*/ +NTSTATUS +netuio_evt_release_hw(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST ResourcesTranslated) +{ + UNREFERENCED_PARAMETER(ResourcesTranslated); + + netuio_free_hw_resources(Device); + + return STATUS_SUCCESS; +} + +/* +Routine Description: + Free all the resources allocated in DriverEntry. + +Return Value: + None +-*/ +VOID +netuio_evt_driver_context_cleanup(_In_ WDFOBJECT DriverObject) +{ + UNREFERENCED_PARAMETER(DriverObject); + DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_NETUIO_INFO_LEVEL, "netUIO Driver unloaded.\n"); + PAGED_CODE(); +} diff --git a/kernel/windows/netuio/netuio_drv.h b/kernel/windows/netuio/netuio_drv.h new file mode 100644 index 000000000..39d7f301e --- /dev/null +++ b/kernel/windows/netuio/netuio_drv.h @@ -0,0 +1,33 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + + +#ifndef NETUIO_DRV_H +#define NETUIO_DRV_H + +#define INITGUID + +#include +#include + +#include "netuio_dev.h" +#include "netuio_queue.h" + +EXTERN_C_START + +// Print output constants +#define DPFLTR_NETUIO_INFO_LEVEL 35 + +// WDFDRIVER Events +DRIVER_INITIALIZE DriverEntry; +EVT_WDF_DRIVER_DEVICE_ADD netuio_evt_device_add; +EVT_WDF_OBJECT_CONTEXT_CLEANUP netuio_evt_driver_context_cleanup; +EVT_WDF_DEVICE_PREPARE_HARDWARE netuio_evt_prepare_hw; +EVT_WDF_DEVICE_RELEASE_HARDWARE netuio_evt_release_hw; + +EXTERN_C_END + +#endif // NETUIO_DRV_H diff --git a/kernel/windows/netuio/netuio_interface.h b/kernel/windows/netuio/netuio_interface.h new file mode 100644 index 000000000..b86bf5d3f --- /dev/null +++ b/kernel/windows/netuio/netuio_interface.h @@ -0,0 +1,69 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + + +#ifndef NETUIO_INTERFACE_H +#define NETUIO_INTERFACE_H + +// All structures in this file are packed on an 8B boundary. +#pragma pack(push) +#pragma pack(8) + +// Define an Interface Guid so that any app can find the device and talk to it. +DEFINE_GUID (GUID_DEVINTERFACE_netUIO, 0x08336f60,0x0679,0x4c6c,0x85,0xd2,0xae,0x7c,0xed,0x65,0xff,0xf7); // {08336f60-0679-4c6c-85d2-ae7ced65fff7} + +// Device name definitions +#define NETUIO_DEVICE_SYMBOLIC_LINK_ANSI "\\DosDevices\\netuio" + +// netUIO driver symbolic name (prefix) +#define NETUIO_DRIVER_NAME _T("netuio") + +// IOCTL code definitions +#define IOCTL_NETUIO_GET_HW_DATA CTL_CODE(FILE_DEVICE_NETWORK, 51, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_NETUIO_PCI_CONFIG_IO CTL_CODE(FILE_DEVICE_NETWORK, 52, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + +struct mem_region { + UINT64 size; // memory region size + PHYSICAL_ADDRESS phys_addr; // physical address of the memory region + PVOID virt_addr; // virtual address of the memory region + PVOID user_mapped_virt_addr; // virtual address of the region mapped into user process context +}; + +struct dev_addr { + ULONG bus_num; + USHORT dev_num; + USHORT func_num; +}; + +enum pci_io { + PCI_IO_READ = 0, + PCI_IO_WRITE = 1 +}; + +struct dpdk_private_info +{ + struct mem_region hw; + struct mem_region ms; + struct dev_addr dev_addr; + struct mem_region bar1; +// struct mem_region bar2; + UINT16 dev_id; + UINT16 sub_dev_id; + USHORT dev_numa_node; + USHORT reserved; +}; + +struct dpdk_pci_config_io +{ + struct dev_addr dev_addr; + PVOID buf; + UINT32 offset; + enum pci_io op; +}; + +#pragma pack(pop) + +#endif // NETUIO_INTERFACE_H diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c new file mode 100644 index 000000000..312d4b682 --- /dev/null +++ b/kernel/windows/netuio/netuio_queue.c @@ -0,0 +1,271 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + + +#include "netuio_drv.h" + +#ifdef ALLOC_PRAGMA +#pragma alloc_text (PAGE, netuio_queue_initialize) +#endif + +VOID netuio_read_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, PVOID buffer) +{ + netuio_contextdata->bus_interface.GetBusData(netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + buffer, + offset, + sizeof(UINT32)); +} + +VOID netuio_write_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, PVOID buffer) +{ + netuio_contextdata->bus_interface.SetBusData(netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + buffer, + offset, + sizeof(UINT32)); +} + +static NTSTATUS +netuio_handle_get_hw_data_request(_In_ WDFREQUEST Request, _In_ PNETUIO_CONTEXT_DATA netuio_contextdata, + _In_ PVOID outputBuf, _In_ size_t outputBufSize) +{ + NTSTATUS status = STATUS_SUCCESS; + + WDF_REQUEST_PARAMETERS params; + WDF_REQUEST_PARAMETERS_INIT(¶ms); + WdfRequestGetParameters(Request, ¶ms); + + if (!netuio_contextdata || (outputBufSize != sizeof(struct dpdk_private_info))) { + status = STATUS_INVALID_PARAMETER; + goto end; + } + + struct dpdk_private_info *dpdk_pvt_info = (struct dpdk_private_info *)outputBuf; + RtlZeroMemory(dpdk_pvt_info, outputBufSize); + + dpdk_pvt_info->hw.phys_addr.QuadPart = netuio_contextdata->bar[0].base_addr.QuadPart; + dpdk_pvt_info->hw.user_mapped_virt_addr = netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr; + dpdk_pvt_info->hw.size = netuio_contextdata->bar[0].size; + + dpdk_pvt_info->ms.phys_addr.QuadPart = netuio_contextdata->dpdk_seg.mem.phys_addr.QuadPart; + dpdk_pvt_info->ms.user_mapped_virt_addr = netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr; + dpdk_pvt_info->ms.size = netuio_contextdata->dpdk_seg.mem.size; +end: + return status; +} + +/* +Routine Description: + The I/O dispatch callbacks for the frameworks device object are configured here. + A single default I/O Queue is configured for parallel request processing, and a + driver context memory allocation is created to hold our structure QUEUE_CONTEXT. + +Return Value: + None + */ +NTSTATUS +netuio_queue_initialize(_In_ WDFDEVICE Device) +{ + WDFQUEUE queue; + NTSTATUS status; + WDF_IO_QUEUE_CONFIG queueConfig; + + PAGED_CODE(); + + // Configure a default queue so that requests that are not + // configure-fowarded using WdfDeviceConfigureRequestDispatching to goto + // other queues get dispatched here. + WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queueConfig, WdfIoQueueDispatchParallel); + + queueConfig.EvtIoDeviceControl = netuio_evt_IO_device_control; + queueConfig.EvtIoStop = netuio_evt_IO_stop; + + status = WdfIoQueueCreate(Device, + &queueConfig, + WDF_NO_OBJECT_ATTRIBUTES, + &queue); + + if( !NT_SUCCESS(status) ) { + return status; + } + + return status; +} + +/* +Routine Description: + This event is invoked when the framework receives IRP_MJ_DEVICE_CONTROL request. + +Return Value: + None + */ +VOID +netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, + _In_ size_t OutputBufferLength, _In_ size_t InputBufferLength, + _In_ ULONG IoControlCode) +{ + UNREFERENCED_PARAMETER(OutputBufferLength); + UNREFERENCED_PARAMETER(InputBufferLength); + + NTSTATUS status = STATUS_SUCCESS; + PVOID input_buf = NULL, output_buf = NULL; + size_t input_buf_size, output_buf_size; + size_t bytes_returned = 0; + + WDFDEVICE device = WdfIoQueueGetDevice(Queue); + + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + switch (IoControlCode) { + case IOCTL_NETUIO_GET_HW_DATA: + // First retrieve the input buffer and see if it matches our device + status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_private_info), &input_buf, &input_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + break; + } + + struct dpdk_private_info *dpdk_pvt_info = (struct dpdk_private_info *)input_buf; + // Ensure that the B:D:F match - otherwise, fail the IOCTL + if ((netuio_contextdata->addr.bus_num != dpdk_pvt_info->dev_addr.bus_num) || + (netuio_contextdata->addr.dev_num != dpdk_pvt_info->dev_addr.dev_num) || + (netuio_contextdata->addr.func_num != dpdk_pvt_info->dev_addr.func_num)) { + status = STATUS_NOT_SAME_DEVICE; + break; + } + + // Map the previously allocated/defined memory regions to the user's process context + MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw.mdl); + netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_hw.mdl, UserMode, MmCached, + NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); + + MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl); + netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached, + NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); + + if (!netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr && !netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr) { + status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + // Zero out the physically contiguous block + RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); + + // Return relevant data to the caller + status = WdfRequestRetrieveOutputBuffer(Request, sizeof(struct dpdk_private_info), &output_buf, &output_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + break; + } + ASSERT(output_buf_size == OutputBufferLength); + status = netuio_handle_get_hw_data_request(Request, netuio_contextdata, output_buf, output_buf_size); + if (NT_SUCCESS(status)) + bytes_returned = output_buf_size; + + break; + + case IOCTL_NETUIO_PCI_CONFIG_IO: + // First retrieve the input buffer and see if it matches our device + status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_pci_config_io), &input_buf, &input_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + break; + } + + struct dpdk_pci_config_io *dpdk_pci_io_input = (struct dpdk_pci_config_io *)input_buf; + // Ensure that the B:D:F match - otherwise, fail the IOCTL + if ((netuio_contextdata->addr.bus_num != dpdk_pci_io_input->dev_addr.bus_num) || + (netuio_contextdata->addr.dev_num != dpdk_pci_io_input->dev_addr.dev_num) || + (netuio_contextdata->addr.func_num != dpdk_pci_io_input->dev_addr.func_num)) { + status = STATUS_NOT_SAME_DEVICE; + break; + } + // Retrieve output buffer + status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT32), &output_buf, &output_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + break; + } + ASSERT(output_buf_size == OutputBufferLength); + + if (dpdk_pci_io_input->op == PCI_IO_READ) { + netuio_read_PCI_config(netuio_contextdata, dpdk_pci_io_input->offset, output_buf); + bytes_returned = output_buf_size; + } + else { + netuio_write_PCI_config(netuio_contextdata, dpdk_pci_io_input->offset, dpdk_pci_io_input->buf); + bytes_returned = 0; + } + + break; + + default: + break; + } + + WdfRequestCompleteWithInformation(Request, status, bytes_returned); + + return; +} + +/* +Routine Description: + This event is invoked for a power-managed queue before the device leaves the working state (D0). + +Return Value: + None + */ +VOID +netuio_evt_IO_stop(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request,_In_ ULONG ActionFlags) +{ + // + // In most cases, the EvtIoStop callback function completes, cancels, or postpones + // further processing of the I/O request. + // + // Typically, the driver uses the following rules: + // + // - If the driver owns the I/O request, it calls WdfRequestUnmarkCancelable + // (if the request is cancelable) and either calls WdfRequestStopAcknowledge + // with a Requeue value of TRUE, or it calls WdfRequestComplete with a + // completion status value of STATUS_SUCCESS or STATUS_CANCELLED. + // + // Before it can call these methods safely, the driver must make sure that + // its implementation of EvtIoStop has exclusive access to the request. + // + // In order to do that, the driver must synchronize access to the request + // to prevent other threads from manipulating the request concurrently. + // The synchronization method you choose will depend on your driver's design. + // + // For example, if the request is held in a shared context, the EvtIoStop callback + // might acquire an internal driver lock, take the request from the shared context, + // and then release the lock. At this point, the EvtIoStop callback owns the request + // and can safely complete or requeue the request. + // + // - If the driver has forwarded the I/O request to an I/O target, it either calls + // WdfRequestCancelSentRequest to attempt to cancel the request, or it postpones + // further processing of the request and calls WdfRequestStopAcknowledge with + // a Requeue value of FALSE. + // + // A driver might choose to take no action in EvtIoStop for requests that are + // guaranteed to complete in a small amount of time. + // + // In this case, the framework waits until the specified request is complete + // before moving the device (or system) to a lower power state or removing the device. + // Potentially, this inaction can prevent a system from entering its hibernation state + // or another low system power state. In extreme cases, it can cause the system + // to crash with bugcheck code 9F. + // + UNREFERENCED_PARAMETER(Queue); + UNREFERENCED_PARAMETER(Request); + UNREFERENCED_PARAMETER(ActionFlags); + + return; +} + diff --git a/kernel/windows/netuio/netuio_queue.h b/kernel/windows/netuio/netuio_queue.h new file mode 100644 index 000000000..6a0306516 --- /dev/null +++ b/kernel/windows/netuio/netuio_queue.h @@ -0,0 +1,30 @@ +/*- +* +* Copyright(c) 2017 Intel Corporation. All rights reserved. +* +*/ + + +#ifndef NETUIO_QUEUE_H +#define NETUIO_QUEUE_H + +EXTERN_C_START + +// This is the context that can be placed per queue and would contain per queue information. +typedef struct _QUEUE_CONTEXT { + ULONG PrivateDeviceData; // just a placeholder +} QUEUE_CONTEXT, *PQUEUE_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(QUEUE_CONTEXT, QueueGetContext) + + +NTSTATUS +netuio_queue_initialize(_In_ WDFDEVICE hDevice); + +// Events from the IoQueue object +EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL netuio_evt_IO_device_control; +EVT_WDF_IO_QUEUE_IO_STOP netuio_evt_IO_stop; + +EXTERN_C_END + +#endif // NETUIO_QUEUE_H diff --git a/kernel/windows/netuio/resource.h b/kernel/windows/netuio/resource.h new file mode 100644 index 000000000..9789ffdf3 --- /dev/null +++ b/kernel/windows/netuio/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by netuio.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif From patchwork Thu Aug 13 23:21:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75527 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69F94A04B1; Fri, 14 Aug 2020 01:24:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E605F1C136; Fri, 14 Aug 2020 01:22:56 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id EB4CC1C0D2 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id C090020B4918; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C090020B4918 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=o9F3SfmbvtdoEhQhrzNxos1Y9SEqNdD4/z/Caj2hVVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PCA/d480YIkj4/cfh3e5N6di4amo+0D9obgPBUuW9D+LwJSjsGu+MA2rgsgz8HNli oNB4QNQqdlym7X+4/8I9vx3N5z4iCKH+xZBaszRtXgzfvf1+sLff/+OcuX27ATHOfx VOFhn4A0wB742Lp7JRKIAJiHg21cwF4lvZaIo9h0= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:30 -0700 Message-Id: <1597360905-74106-8-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 07/22] doc: change the Windows UIO driver's default security descriptor to admin only X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio_dev.c | 54 +++++++++++++++++------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/kernel/windows/netuio/netuio_dev.c b/kernel/windows/netuio/netuio_dev.c index 10ff5f903..4d8b9430d 100644 --- a/kernel/windows/netuio/netuio_dev.c +++ b/kernel/windows/netuio/netuio_dev.c @@ -32,37 +32,43 @@ netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) NTSTATUS status; PAGED_CODE(); - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); - // Set the device context cleanup callback. - // This function will be called when the WDF Device Object associated to the current device is destroyed - deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; + // Ensure that only administrators can access our device object. + status = WdfDeviceInitAssignSDDLString(DeviceInit, &SDDL_DEVOBJ_SYS_ALL_ADM_ALL); - status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); + if (NT_SUCCESS(status)) { + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); - if (NT_SUCCESS(status)) { - // Create a device interface so that applications can find and talk to us. - status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_netUIO, NULL); + // Set the device context cleanup callback. + // This function will be called when the WDF Device Object associated to the current device is destroyed + deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; - if (NT_SUCCESS(status)) { - // Retrieve and store PCI information - status = get_pci_device_info(device); - } + status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); + } - if (NT_SUCCESS(status)) { - // Create a symbolic link name for user-space access - status = create_device_specific_symbolic_link(device); - } + if (NT_SUCCESS(status)) { + // Create a device interface so that applications can find and talk to us. + status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_netUIO, NULL); + } - if (NT_SUCCESS(status)) { - // Initialize the I/O Package and any Queues - status = netuio_queue_initialize(device); - } + if (NT_SUCCESS(status)) { + // Retrieve and store PCI information + status = get_pci_device_info(device); + } - if (NT_SUCCESS(status)) { - // Allocate physically contiguous memory for user process use. We'll map it later - status = allocate_usermemory_segment(device); - } + if (NT_SUCCESS(status)) { + // Create a symbolic link name for user-space access + status = create_device_specific_symbolic_link(device); + } + + if (NT_SUCCESS(status)) { + // Initialize the I/O Package and any Queues + status = netuio_queue_initialize(device); + } + + if (NT_SUCCESS(status)) { + // Allocate physically contiguous memory for user process use. We'll map it later + status = allocate_usermemory_segment(device); } return status; From patchwork Thu Aug 13 23:21:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75524 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87F5CA04B1; Fri, 14 Aug 2020 01:23:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 16B8F1C127; Fri, 14 Aug 2020 01:22:53 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id EAC991C0D1 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id CD81020B491B; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CD81020B491B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=ma5/dhu/QqqFP0SwDlvqCW7msGJypeChEExxn8YXr3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bBmvv0h6lJSc07SxsIjRje9fnN6PGfS265SNG5BRWSiNkxeSwwD7tX2T/vn3GlaqU gRUWX2dtgcXLrvQ5L2LQmWQi4T9W/HEDUO5S/zdi1TmJDrPywOuvlgFbDymtYxeYZa DmZZtjdAbNTcVluc+W/8CRKagEjZCUSGNX2FReMI= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:31 -0700 Message-Id: <1597360905-74106-9-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 08/22] doc: remove lower bound on mapped address from Windows UIO driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio_dev.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kernel/windows/netuio/netuio_dev.c b/kernel/windows/netuio/netuio_dev.c index 4d8b9430d..f5d41cb65 100644 --- a/kernel/windows/netuio/netuio_dev.c +++ b/kernel/windows/netuio/netuio_dev.c @@ -28,23 +28,23 @@ NTSTATUS netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) { WDF_OBJECT_ATTRIBUTES deviceAttributes; - WDFDEVICE device; + WDFDEVICE device = NULL; NTSTATUS status; PAGED_CODE(); - // Ensure that only administrators can access our device object. - status = WdfDeviceInitAssignSDDLString(DeviceInit, &SDDL_DEVOBJ_SYS_ALL_ADM_ALL); + // Ensure that only administrators can access our device object. + status = WdfDeviceInitAssignSDDLString(DeviceInit, &SDDL_DEVOBJ_SYS_ALL_ADM_ALL); - if (NT_SUCCESS(status)) { - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); + if (NT_SUCCESS(status)) { + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); - // Set the device context cleanup callback. - // This function will be called when the WDF Device Object associated to the current device is destroyed - deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; + // Set the device context cleanup callback. + // This function will be called when the WDF Device Object associated to the current device is destroyed + deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; - status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); - } + status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); + } if (NT_SUCCESS(status)) { // Create a device interface so that applications can find and talk to us. @@ -263,7 +263,7 @@ allocate_usermemory_segment(_In_ WDFOBJECT device) PHYSICAL_ADDRESS highest_acceptable_address; PHYSICAL_ADDRESS boundary_address_multiple; - lowest_acceptable_address.QuadPart = 0x0000000000800000; + lowest_acceptable_address.QuadPart = 0x0000000000000000; highest_acceptable_address.QuadPart = 0xFFFFFFFFFFFFFFFF; boundary_address_multiple.QuadPart = 0; From patchwork Thu Aug 13 23:21:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75530 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86E55A04B1; Fri, 14 Aug 2020 01:24:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B1CA1C19C; Fri, 14 Aug 2020 01:23:00 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id EA8DF1C0D0 for ; Fri, 14 Aug 2020 01:22:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id D99EF20B491D; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D99EF20B491D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=WJ6ntCn+Z/sRLYQUG9e/b5N02EjyVfEmm9nSeJMvyfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ETZEdMN8rU2DQmZBIbgUg5e/+2LnvXEcwXjiv0rvxxGGCeWBlOsVbYNmRG77wbv0m x8GzfgX4WByxgg0mJy7KKwPwB/NU8J148V7sR5wqey3482o55qheH8jrj2WNY7aeS1 0UGlnF/7/WXFng1G3cBI5tmFBuPqiIZXW/k9UIEg= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:32 -0700 Message-Id: <1597360905-74106-10-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 09/22] doc: remove embedded buffer from Windows UIO ioctl X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio_interface.h | 9 ++++- kernel/windows/netuio/netuio_queue.c | 43 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/kernel/windows/netuio/netuio_interface.h b/kernel/windows/netuio/netuio_interface.h index b86bf5d3f..f84ee895c 100644 --- a/kernel/windows/netuio/netuio_interface.h +++ b/kernel/windows/netuio/netuio_interface.h @@ -59,9 +59,16 @@ struct dpdk_private_info struct dpdk_pci_config_io { struct dev_addr dev_addr; - PVOID buf; UINT32 offset; enum pci_io op; + UINT32 access_size; // 1, 2, 4, or 8 bytes + + union dpdk_pci_config_io_data { + UINT8 u8; + UINT16 u16; + UINT32 u32; + UINT64 u64; + } data; }; #pragma pack(pop) diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c index 312d4b682..929192880 100644 --- a/kernel/windows/netuio/netuio_queue.c +++ b/kernel/windows/netuio/netuio_queue.c @@ -11,22 +11,23 @@ #pragma alloc_text (PAGE, netuio_queue_initialize) #endif -VOID netuio_read_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, PVOID buffer) +VOID netuio_read_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, UINT32 access_size, _Out_ UINT64 *output) { + *output = 0; netuio_contextdata->bus_interface.GetBusData(netuio_contextdata->bus_interface.Context, PCI_WHICHSPACE_CONFIG, - buffer, + output, offset, - sizeof(UINT32)); + access_size); } -VOID netuio_write_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, PVOID buffer) +VOID netuio_write_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, UINT32 access_size, union dpdk_pci_config_io_data const *input) { netuio_contextdata->bus_interface.SetBusData(netuio_contextdata->bus_interface.Context, PCI_WHICHSPACE_CONFIG, - buffer, + (PVOID)input, offset, - sizeof(UINT32)); + access_size); } static NTSTATUS @@ -180,6 +181,15 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, } struct dpdk_pci_config_io *dpdk_pci_io_input = (struct dpdk_pci_config_io *)input_buf; + + if (dpdk_pci_io_input->access_size != 1 && + dpdk_pci_io_input->access_size != 2 && + dpdk_pci_io_input->access_size != 4 && + dpdk_pci_io_input->access_size != 8) { + status = STATUS_INVALID_PARAMETER; + break; + } + // Ensure that the B:D:F match - otherwise, fail the IOCTL if ((netuio_contextdata->addr.bus_num != dpdk_pci_io_input->dev_addr.bus_num) || (netuio_contextdata->addr.dev_num != dpdk_pci_io_input->dev_addr.dev_num) || @@ -188,7 +198,7 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, break; } // Retrieve output buffer - status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT32), &output_buf, &output_buf_size); + status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT64), &output_buf, &output_buf_size); if (!NT_SUCCESS(status)) { status = STATUS_INVALID_BUFFER_SIZE; break; @@ -196,13 +206,24 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, ASSERT(output_buf_size == OutputBufferLength); if (dpdk_pci_io_input->op == PCI_IO_READ) { - netuio_read_PCI_config(netuio_contextdata, dpdk_pci_io_input->offset, output_buf); - bytes_returned = output_buf_size; + netuio_read_PCI_config(netuio_contextdata, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size, + (UINT64*)output_buf); + + bytes_returned = sizeof(UINT64); } - else { - netuio_write_PCI_config(netuio_contextdata, dpdk_pci_io_input->offset, dpdk_pci_io_input->buf); + else if (dpdk_pci_io_input->op == PCI_IO_WRITE) { + netuio_write_PCI_config(netuio_contextdata, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size, + &dpdk_pci_io_input->data); bytes_returned = 0; } + else { + status = STATUS_INVALID_PARAMETER; + break; + } break; From patchwork Thu Aug 13 23:21:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75525 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3162AA04B1; Fri, 14 Aug 2020 01:23:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 547601C12D; Fri, 14 Aug 2020 01:22:54 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 066781C0D4 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id E687220B4920; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E687220B4920 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=aOf8EmcQn/hUQI5C+ip9HjlbSfVaBbC7WRgOSOVlVS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TX3H7oa5THthqxR8V+nqa97TJDfo8AeqZ5HWZH5yrvzZ8BrPXoIvE2R/9FWjAZMmh uOMynMFM1yyGt6NYiYSrF+tbUmzg9BnaWJBvmlnX+C9FRN8ycoNek97lI121P3VDzl /KfFHLFHN5pBcL+DH4eG8cXEjfKTj7IqmcIx8t28= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:33 -0700 Message-Id: <1597360905-74106-11-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 10/22] uio: move SDDL string to INF on Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio.inf | 7 +++++++ kernel/windows/netuio/netuio_dev.c | 15 +++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index 0453b371a..b1696cc50 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -62,6 +62,13 @@ CopyFiles=Drivers_Dir [Drivers_Dir] netuio.sys +[netuio_Device.NT.HW] +AddReg=Device.HW.Registry + +[Device.HW.Registry] +; Ensure that only administrators can access our device object. +HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GA;;;BA)" + ;-------------- Service installation [netuio_Device.NT.Services] AddService = netuio,%SPSVCINST_ASSOCSERVICE%, netuio_Service_Inst diff --git a/kernel/windows/netuio/netuio_dev.c b/kernel/windows/netuio/netuio_dev.c index f5d41cb65..a1fe447f7 100644 --- a/kernel/windows/netuio/netuio_dev.c +++ b/kernel/windows/netuio/netuio_dev.c @@ -33,18 +33,13 @@ netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) PAGED_CODE(); - // Ensure that only administrators can access our device object. - status = WdfDeviceInitAssignSDDLString(DeviceInit, &SDDL_DEVOBJ_SYS_ALL_ADM_ALL); + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); - if (NT_SUCCESS(status)) { - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); - - // Set the device context cleanup callback. - // This function will be called when the WDF Device Object associated to the current device is destroyed - deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; + // Set the device context cleanup callback. + // This function will be called when the WDF Device Object associated to the current device is destroyed + deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; - status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); - } + status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); if (NT_SUCCESS(status)) { // Create a device interface so that applications can find and talk to us. From patchwork Thu Aug 13 23:21:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75526 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12FE4A04B1; Fri, 14 Aug 2020 01:23:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B34201C132; Fri, 14 Aug 2020 01:22:55 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 1139F1C0D5 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id F2F5020B4923; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F2F5020B4923 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360963; bh=D7IqJKq37ZtAWiFl2maJBkbNC+Ud0EwkRyoEw6hMKug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+iTwP5H3E/iy3BUieJZ0xVaYPqQ3tOlg9SI4wGY8HQ12Z9ZiXAZlD34BvciCceFx HBwEk/S/D02AhUq3rtwlKQXZKd6Oq8Qva6XQOFxCLAOgQxKyYsPEFjn2008mTitN1I xiiELroJlLlOJ2FtN4nDkitX+YAVTO0C+bDDRwt0= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Anand Rawat Date: Thu, 13 Aug 2020 16:21:34 -0700 Message-Id: <1597360905-74106-12-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 11/22] Updated Source and Project files to use Clang toolset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Anand Rawat Updated the code for using LLVM toolset. The code still uses msbuild and VS2017. Some header files and windows specific utility functions are removed due to conflicts with Clang intrinsic functions. Project files have been updated to use LLVM and additional project settings for Clang. Change-Id: I274de21379287c664e072f58e94271c654afe603 Signed-off-by: Anand Rawat --- kernel/windows/netuio/netuio_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c index 929192880..760b4a7e5 100644 --- a/kernel/windows/netuio/netuio_queue.c +++ b/kernel/windows/netuio/netuio_queue.c @@ -156,8 +156,8 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, break; } - // Zero out the physically contiguous block - RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); + // Zero out the physically contiguous block + RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); // Return relevant data to the caller status = WdfRequestRetrieveOutputBuffer(Request, sizeof(struct dpdk_private_info), &output_buf, &output_buf_size); From patchwork Thu Aug 13 23:21:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75532 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EA22A04B1; Fri, 14 Aug 2020 01:24:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5DD31C1AC; Fri, 14 Aug 2020 01:23:02 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 14E8E1C0D6 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 0ADE820B4925; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0ADE820B4925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=MAglrWKnKyTwFctSqKDCEUDbabjzxb77NgSYTuH9dBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFvDpbKpjcYZr618gt0DvXyeffL5uKbTGzXAfPYa+hEHqEH5gOIysFvGfuvjptKMq E2KGb7gKTtOZkkWJ/kjEgGKzg4AQNE6lM50bFbNm4Kdwb/KqZwM/Odj4AoQScBWCGu QNnvMkHRxfOi7fGufhsgjvZpI23M3OulOSWS/9QM= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:35 -0700 Message-Id: <1597360905-74106-13-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 12/22] uio: Fix 64 bit BARs mapping X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan --- kernel/windows/netuio/netuio.inf | 12 +- kernel/windows/netuio/netuio_dev.c | 181 +++++++++++++++++------ kernel/windows/netuio/netuio_dev.h | 15 +- kernel/windows/netuio/netuio_drv.c | 43 +++--- kernel/windows/netuio/netuio_drv.h | 1 + kernel/windows/netuio/netuio_interface.h | 10 +- kernel/windows/netuio/netuio_queue.c | 176 ++++++++++++++-------- kernel/windows/netuio/netuio_queue.h | 2 + 8 files changed, 297 insertions(+), 143 deletions(-) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index b1696cc50..4c4d5e047 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -38,7 +38,7 @@ Signature="$WINDOWS NT$" Class=Net ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318} -Provider=%ManufacturerName% +Provider=%Intel% CatalogFile=netuio.cat DriverVer= @@ -47,7 +47,8 @@ DriverVer= ;***************************************** [Manufacturer] -%ManufacturerName%=Standard,NT$ARCH$ +%Intel%=Standard,NT$ARCH$ +%Broadcom%=Broadcom,NT$ARCH$ [Standard.NT$ARCH$] %F1583.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_1583 @@ -56,6 +57,9 @@ DriverVer= %F37D0.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_37D0 %F153B.netuio.Description%=netuio_Device, PCI\VEN_8086&DEV_153B +[Broadcom.NT$ARCH$] +%F16D7.netuio.Description%=netuio_Device, PCI\VEN_14E4&DEV_16D7 + [netuio_Device.NT] CopyFiles=Drivers_Dir @@ -113,7 +117,8 @@ KmdfLibraryVersion = $KMDFVERSION$ [Strings] SPSVCINST_ASSOCSERVICE= 0x00000002 -ManufacturerName="Intel" +Intel = "Intel" +Broadcom = "Broadcom Corporation" ClassName = "Intel(R) DPDK netUIO Driver" DiskName = "DPDK netUIO Installation Disk" F1583.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Converged Network Adapter XL710-Q2" @@ -121,5 +126,6 @@ F158A.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Network Adapter XX F158B.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Network Adapter XXV710-DA1" F37D0.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Connection X722" F153B.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Connection I217-V" +F16D7.netuio.Description = "DPDK netUIO for Broadcom P225p NetXtreme-E Dual-port 10Gb/25Gb Ethernet PCIe Adapter" netuio.DeviceDesc = "netuio Device" netuio.SVCDESC = "netuio Service" diff --git a/kernel/windows/netuio/netuio_dev.c b/kernel/windows/netuio/netuio_dev.c index a1fe447f7..3b5c95e84 100644 --- a/kernel/windows/netuio/netuio_dev.c +++ b/kernel/windows/netuio/netuio_dev.c @@ -27,16 +27,28 @@ Return Value: NTSTATUS netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) { - WDF_OBJECT_ATTRIBUTES deviceAttributes; - WDFDEVICE device = NULL; NTSTATUS status; + WDFDEVICE device = NULL; + + WDF_OBJECT_ATTRIBUTES deviceAttributes; + WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; + WDF_FILEOBJECT_CONFIG fileConfig; PAGED_CODE(); - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); + // Register PnP power management callbacks + WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); + pnpPowerCallbacks.EvtDevicePrepareHardware = netuio_evt_prepare_hw; + pnpPowerCallbacks.EvtDeviceReleaseHardware = netuio_evt_release_hw; + WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); + + // Register callbacks for when a HANDLE is opened or closed. + WDF_FILEOBJECT_CONFIG_INIT(&fileConfig, WDF_NO_EVENT_CALLBACK, WDF_NO_EVENT_CALLBACK, netuio_evt_file_cleanup); + WdfDeviceInitSetFileObjectConfig(DeviceInit, &fileConfig, WDF_NO_OBJECT_ATTRIBUTES); // Set the device context cleanup callback. // This function will be called when the WDF Device Object associated to the current device is destroyed + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); @@ -88,63 +100,112 @@ netuio_map_hw_resources(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST Resources, _In_ { UNREFERENCED_PARAMETER(Resources); - NTSTATUS status = STATUS_SUCCESS; + NTSTATUS status; PNETUIO_CONTEXT_DATA netuio_contextdata; netuio_contextdata = netuio_get_context_data(Device); - if (!netuio_contextdata) + if (!netuio_contextdata) { return STATUS_UNSUCCESSFUL; + } - PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor; - UINT8 bar_index = 0; + PCI_COMMON_HEADER pci_config = {0}; + ULONG bytes_returned; - // Collect device BAR resources from the ResourcesTranslated object - for (ULONG idx = 0; idx < WdfCmResourceListGetCount(ResourcesTranslated); idx++) { - descriptor = WdfCmResourceListGetDescriptor(ResourcesTranslated, idx); - if (!descriptor) { - status = STATUS_DEVICE_CONFIGURATION_ERROR; - goto end; + // Read PCI configuration space + bytes_returned = netuio_contextdata->bus_interface.GetBusData( + netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + &pci_config, + 0, + sizeof(pci_config)); + + if (bytes_returned != sizeof(pci_config)) { + status = STATUS_NOT_SUPPORTED; + goto end; + } + + // Device type is implictly enforced by .inf + ASSERT(PCI_CONFIGURATION_TYPE(&pci_config) == PCI_DEVICE_TYPE); + + PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor; + ULONG next_descriptor = 0; + ULONGLONG bar_addr = 0; + ULONG curr_bar = 0; + ULONG prev_bar = 0; + + for (INT bar_index = 0; bar_index < PCI_MAX_BAR; bar_index++) { + prev_bar = curr_bar; + curr_bar = pci_config.u.type0.BaseAddresses[bar_index]; + if (curr_bar == 0 || (prev_bar & PCI_TYPE_64BIT)) { + // Skip this bar + netuio_contextdata->bar[bar_index].base_addr.QuadPart = 0; + netuio_contextdata->bar[bar_index].size = 0; + netuio_contextdata->bar[bar_index].virt_addr = 0; + + netuio_contextdata->dpdk_hw[bar_index].mdl = NULL; + netuio_contextdata->dpdk_hw[bar_index].mem.size = 0; + + continue; } - switch (descriptor->Type) { - case CmResourceTypeMemory: - // Retrieve and map the BARs - netuio_contextdata->bar[bar_index].base_addr.QuadPart = descriptor->u.Memory.Start.QuadPart; - netuio_contextdata->bar[bar_index].size = descriptor->u.Memory.Length; - netuio_contextdata->bar[bar_index].virt_addr = - MmMapIoSpace(descriptor->u.Memory.Start, descriptor->u.Memory.Length, MmNonCached); + // Find next CmResourceTypeMemory + do { + descriptor = WdfCmResourceListGetDescriptor(ResourcesTranslated, next_descriptor); + next_descriptor++; - if (netuio_contextdata->bar[bar_index].virt_addr == NULL) { - status = STATUS_UNSUCCESSFUL; + if (descriptor == NULL) { + status = STATUS_DEVICE_CONFIGURATION_ERROR; goto end; } + } while (descriptor->Type != CmResourceTypeMemory); - bar_index++; - break; + // Assert that we have the correct descriptor + ASSERT((descriptor->Flags & CM_RESOURCE_MEMORY_BAR) != 0); - // Don't handle any other resource type - // This could be device-private type added by the PCI bus driver. - case CmResourceTypeInterrupt: - default: - break; + if (curr_bar & PCI_TYPE_64BIT) { + ASSERT(bar_index != PCI_TYPE0_ADDRESSES - 1); + bar_addr = ((ULONGLONG)pci_config.u.type0.BaseAddresses[bar_index + 1] << 32) | (curr_bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK); + } + else + { + bar_addr = curr_bar & PCI_ADDRESS_MEMORY_ADDRESS_MASK; } - } - // Allocate an MDL for the device BAR, so that we can map it to the user's process context later... - if (status == STATUS_SUCCESS) { - // Bar 0 is typically the HW BAR - if (netuio_contextdata->bar[0].virt_addr) { - netuio_contextdata->dpdk_hw.mdl = IoAllocateMdl(netuio_contextdata->bar[0].virt_addr, (ULONG)netuio_contextdata->bar[0].size, FALSE, FALSE, NULL); - if (!netuio_contextdata->dpdk_hw.mdl) { - status = STATUS_INSUFFICIENT_RESOURCES; - goto end; - } - netuio_contextdata->dpdk_hw.mem.size = netuio_contextdata->bar[0].size; + ASSERT((ULONGLONG)descriptor->u.Memory.Start.QuadPart == bar_addr); + + // Retrieve and map the BARs + netuio_contextdata->bar[bar_index].base_addr.QuadPart = descriptor->u.Memory.Start.QuadPart; + netuio_contextdata->bar[bar_index].size = descriptor->u.Memory.Length; + netuio_contextdata->bar[bar_index].virt_addr = MmMapIoSpace(descriptor->u.Memory.Start, + descriptor->u.Memory.Length, + MmNonCached); + if (netuio_contextdata->bar[bar_index].virt_addr == NULL) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; } - } + + // Allocate an MDL for the device BAR, so we can map it to the user's process context later. + netuio_contextdata->dpdk_hw[bar_index].mdl = IoAllocateMdl(netuio_contextdata->bar[bar_index].virt_addr, + (ULONG)netuio_contextdata->bar[bar_index].size, + FALSE, + FALSE, + NULL); + if (!netuio_contextdata->dpdk_hw[bar_index].mdl) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + + netuio_contextdata->dpdk_hw[bar_index].mem.size = netuio_contextdata->bar[bar_index].size; + } // for bar_index + + status = STATUS_SUCCESS; end: + if (status != STATUS_SUCCESS) { + netuio_free_hw_resources(Device); + } + return status; } @@ -155,15 +216,21 @@ netuio_free_hw_resources(_In_ WDFDEVICE Device) netuio_contextdata = netuio_get_context_data(Device); if (netuio_contextdata) { - // Free the allocated MDL - if (netuio_contextdata->dpdk_hw.mdl) - IoFreeMdl(netuio_contextdata->dpdk_hw.mdl); - - // Unmap all the BAR regions previously mapped for (UINT8 bar_index = 0; bar_index < PCI_MAX_BAR; bar_index++) { - if (netuio_contextdata->bar[bar_index].virt_addr) + + // Free the allocated MDLs + if (netuio_contextdata->dpdk_hw[bar_index].mdl) { + IoFreeMdl(netuio_contextdata->dpdk_hw[bar_index].mdl); + } + + // Unmap all the BAR regions previously mapped + if (netuio_contextdata->bar[bar_index].virt_addr) { MmUnmapIoSpace(netuio_contextdata->bar[bar_index].virt_addr, netuio_contextdata->bar[bar_index].size); + } } + + RtlZeroMemory(netuio_contextdata->dpdk_hw, sizeof(netuio_contextdata->dpdk_hw)); + RtlZeroMemory(netuio_contextdata->bar, sizeof(netuio_contextdata->bar)); } } @@ -246,13 +313,16 @@ create_device_specific_symbolic_link(_In_ WDFOBJECT device) static NTSTATUS allocate_usermemory_segment(_In_ WDFOBJECT device) { - NTSTATUS status = STATUS_SUCCESS; + NTSTATUS status; PNETUIO_CONTEXT_DATA netuio_contextdata; netuio_contextdata = netuio_get_context_data(device); if (!netuio_contextdata) - return STATUS_UNSUCCESSFUL; + { + status = STATUS_INVALID_DEVICE_STATE; + goto end; + } PHYSICAL_ADDRESS lowest_acceptable_address; PHYSICAL_ADDRESS highest_acceptable_address; @@ -287,7 +357,14 @@ allocate_usermemory_segment(_In_ WDFOBJECT device) // Store the region's physical address netuio_contextdata->dpdk_seg.mem.phys_addr = MmGetPhysicalAddress(netuio_contextdata->dpdk_seg.mem.virt_addr); + status = STATUS_SUCCESS; + end: + if (status != STATUS_SUCCESS) + { + free_usermemory_segment(device); + } + return status; } @@ -299,9 +376,15 @@ free_usermemory_segment(_In_ WDFOBJECT device) if (netuio_contextdata) { if (netuio_contextdata->dpdk_seg.mdl) + { IoFreeMdl(netuio_contextdata->dpdk_seg.mdl); + netuio_contextdata->dpdk_seg.mdl = NULL; + } if (netuio_contextdata->dpdk_seg.mem.virt_addr) + { MmFreeContiguousMemory(netuio_contextdata->dpdk_seg.mem.virt_addr); + netuio_contextdata->dpdk_seg.mem.virt_addr = NULL; + } } } diff --git a/kernel/windows/netuio/netuio_dev.h b/kernel/windows/netuio/netuio_dev.h index a19a4fb42..59956720e 100644 --- a/kernel/windows/netuio/netuio_dev.h +++ b/kernel/windows/netuio/netuio_dev.h @@ -12,7 +12,6 @@ EXTERN_C_START #include "netuio_interface.h" // Constants -#define PCI_MAX_BAR 3 #define USER_MEMORY_SEGMENT_SIZE (256ULL * 1024ULL * 1024ULL) // 256MB struct pci_bar { @@ -29,13 +28,13 @@ struct mem_map_region { // The device context performs the same job as a WDM device extension in the driver frameworks typedef struct _NETUIO_CONTEXT_DATA { - WDFDEVICE wdf_device; // WDF device handle to the FDO - BUS_INTERFACE_STANDARD bus_interface; // Bus interface for config space access - struct pci_bar bar[PCI_MAX_BAR]; // device BARs - struct dev_addr addr; // B:D:F details of device - USHORT dev_numa_node; // The NUMA node of the device - struct mem_map_region dpdk_hw; // mapped region for the device's register space - struct mem_map_region dpdk_seg; // mapped region allocated for DPDK process use + WDFDEVICE wdf_device; // WDF device handle to the FDO + BUS_INTERFACE_STANDARD bus_interface; // Bus interface for config space access + struct pci_bar bar[PCI_MAX_BAR]; // device BARs + struct dev_addr addr; // B:D:F details of device + USHORT dev_numa_node; // The NUMA node of the device + struct mem_map_region dpdk_hw[PCI_MAX_BAR]; // mapped region for the device's register space + struct mem_map_region dpdk_seg; // mapped region allocated for DPDK process use } NETUIO_CONTEXT_DATA, *PNETUIO_CONTEXT_DATA; diff --git a/kernel/windows/netuio/netuio_drv.c b/kernel/windows/netuio/netuio_drv.c index d45a9ec4f..554629c98 100644 --- a/kernel/windows/netuio/netuio_drv.c +++ b/kernel/windows/netuio/netuio_drv.c @@ -62,25 +62,8 @@ Return Value: NTSTATUS netuio_evt_device_add(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit) { - NTSTATUS status; - WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; - UNREFERENCED_PARAMETER(Driver); - - PAGED_CODE(); - - // Zero out the PnpPowerCallbacks structure - WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); - - // Register Plug-aNd-Play and power management callbacks - pnpPowerCallbacks.EvtDevicePrepareHardware = netuio_evt_prepare_hw; - pnpPowerCallbacks.EvtDeviceReleaseHardware = netuio_evt_release_hw; - - WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); - - status = netuio_create_device(DeviceInit); - - return status; + return netuio_create_device(DeviceInit); } /* @@ -140,3 +123,27 @@ netuio_evt_driver_context_cleanup(_In_ WDFOBJECT DriverObject) DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_NETUIO_INFO_LEVEL, "netUIO Driver unloaded.\n"); PAGED_CODE(); } + +/* +Routine Description : + EVT_WDF_FILE_CLEANUP callback, called when user process handle is closed. + + Undoes IOCTL_NETUIO_MAP_HW_INTO_USERMODE. + +Return value : + None +-*/ +VOID +netuio_evt_file_cleanup(_In_ WDFFILEOBJECT FileObject) +{ + WDFDEVICE device; + PNETUIO_CONTEXT_DATA netuio_contextdata; + + device = WdfFileObjectGetDevice(FileObject); + netuio_contextdata = netuio_get_context_data(device); + + if (netuio_contextdata) + { + netuio_unmap_address_from_user_process(netuio_contextdata); + } +} diff --git a/kernel/windows/netuio/netuio_drv.h b/kernel/windows/netuio/netuio_drv.h index 39d7f301e..5dc778625 100644 --- a/kernel/windows/netuio/netuio_drv.h +++ b/kernel/windows/netuio/netuio_drv.h @@ -27,6 +27,7 @@ EVT_WDF_DRIVER_DEVICE_ADD netuio_evt_device_add; EVT_WDF_OBJECT_CONTEXT_CLEANUP netuio_evt_driver_context_cleanup; EVT_WDF_DEVICE_PREPARE_HARDWARE netuio_evt_prepare_hw; EVT_WDF_DEVICE_RELEASE_HARDWARE netuio_evt_release_hw; +EVT_WDF_FILE_CLOSE netuio_evt_file_cleanup; EXTERN_C_END diff --git a/kernel/windows/netuio/netuio_interface.h b/kernel/windows/netuio/netuio_interface.h index f84ee895c..82fb1cb50 100644 --- a/kernel/windows/netuio/netuio_interface.h +++ b/kernel/windows/netuio/netuio_interface.h @@ -22,8 +22,8 @@ DEFINE_GUID (GUID_DEVINTERFACE_netUIO, 0x08336f60,0x0679,0x4c6c,0x85,0xd2,0xae,0 #define NETUIO_DRIVER_NAME _T("netuio") // IOCTL code definitions -#define IOCTL_NETUIO_GET_HW_DATA CTL_CODE(FILE_DEVICE_NETWORK, 51, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_NETUIO_PCI_CONFIG_IO CTL_CODE(FILE_DEVICE_NETWORK, 52, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_NETUIO_MAP_HW_INTO_USERMODE CTL_CODE(FILE_DEVICE_NETWORK, 51, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_NETUIO_PCI_CONFIG_IO CTL_CODE(FILE_DEVICE_NETWORK, 52, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) struct mem_region { UINT64 size; // memory region size @@ -43,13 +43,13 @@ enum pci_io { PCI_IO_WRITE = 1 }; +#define PCI_MAX_BAR 6 + struct dpdk_private_info { - struct mem_region hw; + struct mem_region hw[PCI_MAX_BAR]; struct mem_region ms; struct dev_addr dev_addr; - struct mem_region bar1; -// struct mem_region bar2; UINT16 dev_id; UINT16 sub_dev_id; USHORT dev_numa_node; diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c index 760b4a7e5..9c7ff7d06 100644 --- a/kernel/windows/netuio/netuio_queue.c +++ b/kernel/windows/netuio/netuio_queue.c @@ -11,54 +11,113 @@ #pragma alloc_text (PAGE, netuio_queue_initialize) #endif -VOID netuio_read_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, UINT32 access_size, _Out_ UINT64 *output) -{ - *output = 0; - netuio_contextdata->bus_interface.GetBusData(netuio_contextdata->bus_interface.Context, - PCI_WHICHSPACE_CONFIG, - output, - offset, - access_size); -} - -VOID netuio_write_PCI_config(PNETUIO_CONTEXT_DATA netuio_contextdata, ULONG offset, UINT32 access_size, union dpdk_pci_config_io_data const *input) -{ - netuio_contextdata->bus_interface.SetBusData(netuio_contextdata->bus_interface.Context, - PCI_WHICHSPACE_CONFIG, - (PVOID)input, - offset, - access_size); -} - -static NTSTATUS +static void netuio_handle_get_hw_data_request(_In_ WDFREQUEST Request, _In_ PNETUIO_CONTEXT_DATA netuio_contextdata, _In_ PVOID outputBuf, _In_ size_t outputBufSize) { - NTSTATUS status = STATUS_SUCCESS; - WDF_REQUEST_PARAMETERS params; WDF_REQUEST_PARAMETERS_INIT(¶ms); WdfRequestGetParameters(Request, ¶ms); - if (!netuio_contextdata || (outputBufSize != sizeof(struct dpdk_private_info))) { - status = STATUS_INVALID_PARAMETER; - goto end; - } + ASSERT(outputBufSize == sizeof(struct dpdk_private_info)); struct dpdk_private_info *dpdk_pvt_info = (struct dpdk_private_info *)outputBuf; RtlZeroMemory(dpdk_pvt_info, outputBufSize); - dpdk_pvt_info->hw.phys_addr.QuadPart = netuio_contextdata->bar[0].base_addr.QuadPart; - dpdk_pvt_info->hw.user_mapped_virt_addr = netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr; - dpdk_pvt_info->hw.size = netuio_contextdata->bar[0].size; + for (ULONG idx = 0; idx < PCI_MAX_BAR; idx++) { + dpdk_pvt_info->hw[idx].phys_addr.QuadPart = netuio_contextdata->bar[idx].base_addr.QuadPart; + dpdk_pvt_info->hw[idx].user_mapped_virt_addr = netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr; + dpdk_pvt_info->hw[idx].size = netuio_contextdata->bar[idx].size; + } dpdk_pvt_info->ms.phys_addr.QuadPart = netuio_contextdata->dpdk_seg.mem.phys_addr.QuadPart; dpdk_pvt_info->ms.user_mapped_virt_addr = netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr; dpdk_pvt_info->ms.size = netuio_contextdata->dpdk_seg.mem.size; +} + +/* +Routine Description: + Maps address ranges into the usermode process's address space. The following + ranges are mapped: + + * Any PCI BARs that our device was assigned + * The scratch buffer of contiguous pages + +Return Value: + NTSTATUS +*/ +static NTSTATUS +netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdata) +{ + NTSTATUS status = STATUS_SUCCESS; + + // Map the scratch memory regions to the user's process context + MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl); + netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache( + netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached, + NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); + + if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + + // Map any device BAR(s) to the user's process context + for (INT idx = 0; idx < PCI_MAX_BAR; idx++) { + if (netuio_contextdata->dpdk_hw[idx].mdl == NULL) { + continue; + } + + MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw[idx].mdl); + netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache( + netuio_contextdata->dpdk_hw[idx].mdl, UserMode, MmCached, + NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); + + if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + } + end: + if (status != STATUS_SUCCESS) { + netuio_unmap_address_from_user_process(netuio_contextdata); + } + return status; } +/* +Routine Description: + Unmaps all address ranges from the usermode process address space. + MUST be called in the context of the same process which created + the mapping. + +Return Value: + None + */ +VOID +netuio_unmap_address_from_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdata) +{ + if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr != NULL) { + MmUnmapLockedPages( + netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr, + netuio_contextdata->dpdk_seg.mdl); + netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = NULL; + } + + for (INT idx = 0; idx < PCI_MAX_BAR; idx++) { + if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr != NULL) { + MmUnmapLockedPages( + netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr, + netuio_contextdata->dpdk_hw[idx].mdl); + netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr = NULL; + } + } +} + /* Routine Description: The I/O dispatch callbacks for the frameworks device object are configured here. @@ -123,7 +182,7 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, netuio_contextdata = netuio_get_context_data(device); switch (IoControlCode) { - case IOCTL_NETUIO_GET_HW_DATA: + case IOCTL_NETUIO_MAP_HW_INTO_USERMODE: // First retrieve the input buffer and see if it matches our device status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_private_info), &input_buf, &input_buf_size); if (!NT_SUCCESS(status)) { @@ -140,35 +199,29 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, break; } - // Map the previously allocated/defined memory regions to the user's process context - MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw.mdl); - netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr = - MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_hw.mdl, UserMode, MmCached, - NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); - - MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl); - netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = - MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached, - NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); - - if (!netuio_contextdata->dpdk_hw.mem.user_mapped_virt_addr && !netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr) { - status = STATUS_INSUFFICIENT_RESOURCES; + if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr != NULL) { + status = STATUS_ALREADY_COMMITTED; break; } - // Zero out the physically contiguous block - RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); - // Return relevant data to the caller status = WdfRequestRetrieveOutputBuffer(Request, sizeof(struct dpdk_private_info), &output_buf, &output_buf_size); if (!NT_SUCCESS(status)) { status = STATUS_INVALID_BUFFER_SIZE; break; } + + // Zero out the physically contiguous block + RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); + + status = netuio_map_address_into_user_process(netuio_contextdata); + if (status != STATUS_SUCCESS) { + break; + } + ASSERT(output_buf_size == OutputBufferLength); - status = netuio_handle_get_hw_data_request(Request, netuio_contextdata, output_buf, output_buf_size); - if (NT_SUCCESS(status)) - bytes_returned = output_buf_size; + netuio_handle_get_hw_data_request(Request, netuio_contextdata, output_buf, output_buf_size); + bytes_returned = output_buf_size; break; @@ -206,19 +259,22 @@ netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, ASSERT(output_buf_size == OutputBufferLength); if (dpdk_pci_io_input->op == PCI_IO_READ) { - netuio_read_PCI_config(netuio_contextdata, - dpdk_pci_io_input->offset, - dpdk_pci_io_input->access_size, - (UINT64*)output_buf); - - bytes_returned = sizeof(UINT64); + *(UINT64 *)output_buf = 0; + bytes_returned = netuio_contextdata->bus_interface.GetBusData( + netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + output_buf, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size); } else if (dpdk_pci_io_input->op == PCI_IO_WRITE) { - netuio_write_PCI_config(netuio_contextdata, - dpdk_pci_io_input->offset, - dpdk_pci_io_input->access_size, - &dpdk_pci_io_input->data); - bytes_returned = 0; + // returns bytes written + bytes_returned = netuio_contextdata->bus_interface.SetBusData( + netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + (PVOID)&dpdk_pci_io_input->data, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size); } else { status = STATUS_INVALID_PARAMETER; diff --git a/kernel/windows/netuio/netuio_queue.h b/kernel/windows/netuio/netuio_queue.h index 6a0306516..90fdb4008 100644 --- a/kernel/windows/netuio/netuio_queue.h +++ b/kernel/windows/netuio/netuio_queue.h @@ -17,6 +17,8 @@ typedef struct _QUEUE_CONTEXT { WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(QUEUE_CONTEXT, QueueGetContext) +VOID +netuio_unmap_address_from_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdata); NTSTATUS netuio_queue_initialize(_In_ WDFDEVICE hDevice); From patchwork Thu Aug 13 23:21:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75528 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5FE79A04B1; Fri, 14 Aug 2020 01:24:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26F0F1C193; Fri, 14 Aug 2020 01:22:58 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 1A98E1C0D7 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 178AB20B493F; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 178AB20B493F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=M1KGEZ37I/oGZsP5sAUD+0E0PJ4CfkBfvYSnODzqkjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBrstfwKjucK8qT0QigrLPFRZLTY4FiIq3u0OTDwtp/B4Gg+sbQMnGKzjz/eWQSto XptCD6yrfQGuZiFDusx+U1BeSo8CSMJ6tKpxeuaKF7nkrQGPoAI0LWgPfnUGXHQzqX nBWV3mwyOiA73NBgE+SIgOjT7uXMb1zbDmDH3PbA= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:36 -0700 Message-Id: <1597360905-74106-14-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 13/22] Update .gitignore and create .gitattributes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile Add build folders and .vs/ to .gitignore. Create .gitattributes to handle line endings correctly. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- .gitattributes | 4 ++++ .gitignore | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..13482db3d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto + +*.sln text eol=crlf +*.vcxproj text eol=crlf diff --git a/.gitignore b/.gitignore index e69de29bb..543281e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +x64/ +.vs/ From patchwork Thu Aug 13 23:21:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75529 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58845A04B1; Fri, 14 Aug 2020 01:24:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 773B61C198; Fri, 14 Aug 2020 01:22:59 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 2331E1C0D8 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 23F6120B4760; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 23F6120B4760 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=kpu2mTpqUX97mKwdYJWlMz97ZJgGt7vbqm3ijdoc1Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mx5bMWy+8xfqKLwaTnHJEubMhTild9/rmAHwTOr+Q94NaqcTh0mzuJT+rlZlltDXZ 5M51lsl9aqzRpoq41SYFggN5HtEDHs5e++UtSLidz4XXPyMiHd2y2Mddm+zjP1r4oD iLQH7a3JVjcHa0fY2hXYwVlft3xaZCB8WQBTMC+4= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:37 -0700 Message-Id: <1597360905-74106-15-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 14/22] uio: Use local time when verifying INF DriverVer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- mk/exec-env/windows/netuio/netuio.vcxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/mk/exec-env/windows/netuio/netuio.vcxproj index b6b11e49a..60058fcd6 100644 --- a/mk/exec-env/windows/netuio/netuio.vcxproj +++ b/mk/exec-env/windows/netuio/netuio.vcxproj @@ -51,11 +51,13 @@ DbgengKernelDebugger $(SolutionDir)..\..\..\..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ $(SolutionDir)..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + true DbgengKernelDebugger $(SolutionDir)..\..\..\..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ $(SolutionDir)..\$(Platform)\$(ConfigurationName)\$(MSBuildProjectName)\ + true From patchwork Thu Aug 13 23:21:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75531 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BDBBA04B1; Fri, 14 Aug 2020 01:24:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B6EC1C1A6; Fri, 14 Aug 2020 01:23:01 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 2A7571C0D9 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 309DA20B4762; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 309DA20B4762 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=iYHD9BFRDa5Yfa5n/EnQaBsfJ0IuGkCUFPec4xf72vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RchGcsuFBKs22JPGtslerVEH+itMnLnNrcgMdjUyHf1DH+Gy1yn0agMh/Mi6gjQlU Lsu4EQloWawKUJ7SCCHL2SWnrZMAhD3tFplQ1MMewaVL/E8IxB2PMjVmSfMrOeN6EK uxT3uSCHkXH+D4h78moUvD5nf6PrNl6KlqTF5li4= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:38 -0700 Message-Id: <1597360905-74106-16-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 15/22] uio: Remove co-installers section from inf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile Co-installers are no longer needed. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- kernel/windows/netuio/netuio.inf | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index 4c4d5e047..35fe7c85c 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -85,30 +85,14 @@ StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %12%\netuio.sys -; -;--- netuio_Device Coinstaller installation ------ -; - [DestinationDirs] DefaultDestDir = 12 -netuio_Device_CoInstaller_CopyFiles = 11 - -[netuio_Device.NT.CoInstallers] -AddReg=netuio_Device_CoInstaller_AddReg -CopyFiles=netuio_Device_CoInstaller_CopyFiles - -[netuio_Device_CoInstaller_AddReg] -HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller" - -[netuio_Device_CoInstaller_CopyFiles] -WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll [SourceDisksNames] 1 = %DiskName%,,,"" [SourceDisksFiles] netuio.sys = 1,, -WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames [netuio_Device.NT.Wdf] KmdfService = netuio, netuio_wdfsect From patchwork Thu Aug 13 23:21:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75538 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF434A04B1; Fri, 14 Aug 2020 01:25:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B11CB1C1DC; Fri, 14 Aug 2020 01:23:08 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id BD9081C0D5 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 3D59520B476E; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3D59520B476E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=nx76Tcz5cHRIkPOyvXwLEjE8DjreYmPGtBVLHUeNEag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLTHjQfJwdnCxU8rXnRrRbUFB/p/FmnVjmjQQs4POyI+gXY6XWsBjRnB/yzM5Rv46 aGSgO9kc359s05Ez/mbvaglQhRYX0uiKoV1xDbCIwY9vMigh/RDJrXgEpHd/4vMXh3 BlhQL4pqYGLv28wGoHwAXYa4ep7Rv6lb/Sy75UaY= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:39 -0700 Message-Id: <1597360905-74106-17-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 16/22] uio: Wrap call into try/except block X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile MmMapLockedPagesSpecifyCache can raise an exception when it cannot map the specified pages. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- kernel/windows/netuio/netuio_queue.c | 36 ++++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c index 9c7ff7d06..c2bc998dc 100644 --- a/kernel/windows/netuio/netuio_queue.c +++ b/kernel/windows/netuio/netuio_queue.c @@ -53,13 +53,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat // Map the scratch memory regions to the user's process context MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl); - netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = - MmMapLockedPagesSpecifyCache( - netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached, - NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); + __try { + netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_seg.mdl, UserMode, + MmCached, NULL, FALSE, NormalPagePriority); - if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) { - status = STATUS_INSUFFICIENT_RESOURCES; + if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + } + __except (EXCEPTION_EXECUTE_HANDLER) { + status = GetExceptionCode(); goto end; } @@ -70,13 +75,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat } MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw[idx].mdl); - netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr = - MmMapLockedPagesSpecifyCache( - netuio_contextdata->dpdk_hw[idx].mdl, UserMode, MmCached, - NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute)); - - if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) { - status = STATUS_INSUFFICIENT_RESOURCES; + __try { + netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr = + MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_hw[idx].mdl, UserMode, + MmCached, NULL, FALSE, NormalPagePriority); + + if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) { + status = STATUS_INSUFFICIENT_RESOURCES; + goto end; + } + } + __except (EXCEPTION_EXECUTE_HANDLER) { + status = GetExceptionCode(); goto end; } } From patchwork Thu Aug 13 23:21:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75534 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8F524A04B1; Fri, 14 Aug 2020 01:25:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B79AA1C1BA; Fri, 14 Aug 2020 01:23:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 628A11C0D1 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 49D4220B4770; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 49D4220B4770 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=YdHrOXqwJlgVU1bwecanFuEJn1xmuUcmut2e5AZfCOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YIZXzzNMrZv2moc4pu+OpUgAczTPRa7x9PsCrLLUud6Dr0yFTB/gwDSmnJ0eiyNwc pI5IjaqiVNqWq2efr6sc1WzAVYqF1mf3qFCb81AHzqy+DVk6OyRXaOjwfPtTyh2arM hcJY9I9MXxuu1pCiI/mPABKalipQCBteN8HUXMRs= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:40 -0700 Message-Id: <1597360905-74106-18-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 17/22] uio: Use request handler that guarantees execution in correct context X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile Use EvtIoInCallerContext to assure the requests are handled in the right user thread context. If the request does not need to be handled in a specific context, send it back to framework. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- kernel/windows/netuio/netuio_dev.c | 1 + kernel/windows/netuio/netuio_dev.h | 1 - kernel/windows/netuio/netuio_queue.c | 242 ++++++++++++++++----------- kernel/windows/netuio/netuio_queue.h | 2 + 4 files changed, 145 insertions(+), 101 deletions(-) diff --git a/kernel/windows/netuio/netuio_dev.c b/kernel/windows/netuio/netuio_dev.c index 3b5c95e84..e4e4570bc 100644 --- a/kernel/windows/netuio/netuio_dev.c +++ b/kernel/windows/netuio/netuio_dev.c @@ -50,6 +50,7 @@ netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit) // This function will be called when the WDF Device Object associated to the current device is destroyed WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&deviceAttributes, NETUIO_CONTEXT_DATA); deviceAttributes.EvtCleanupCallback = netuio_evt_device_context_cleanup; + WdfDeviceInitSetIoInCallerContextCallback(DeviceInit, netuio_evt_IO_in_caller_context); status = WdfDeviceCreate(&DeviceInit, &deviceAttributes, &device); diff --git a/kernel/windows/netuio/netuio_dev.h b/kernel/windows/netuio/netuio_dev.h index 59956720e..6a9b1ff82 100644 --- a/kernel/windows/netuio/netuio_dev.h +++ b/kernel/windows/netuio/netuio_dev.h @@ -58,7 +58,6 @@ static NTSTATUS create_device_specific_symbolic_link(_In_ WDFOBJECT device); static NTSTATUS allocate_usermemory_segment(_In_ WDFOBJECT device); static VOID free_usermemory_segment(_In_ WDFOBJECT device); - EXTERN_C_END #endif // NETUIO_DEV_H diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c index c2bc998dc..7714a4d3a 100644 --- a/kernel/windows/netuio/netuio_queue.c +++ b/kernel/windows/netuio/netuio_queue.c @@ -168,135 +168,177 @@ netuio_queue_initialize(_In_ WDFDEVICE Device) /* Routine Description: - This event is invoked when the framework receives IRP_MJ_DEVICE_CONTROL request. + This routine is invoked to preprocess an I/O request before being placed into a queue. + It is guaranteed that it executes in the context of the process that generated the request. Return Value: None */ +_Use_decl_annotations_ VOID -netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, - _In_ size_t OutputBufferLength, _In_ size_t InputBufferLength, - _In_ ULONG IoControlCode) +netuio_evt_IO_in_caller_context( + IN WDFDEVICE Device, + IN WDFREQUEST Request +) { - UNREFERENCED_PARAMETER(OutputBufferLength); - UNREFERENCED_PARAMETER(InputBufferLength); - + WDF_REQUEST_PARAMETERS params = { 0 }; NTSTATUS status = STATUS_SUCCESS; PVOID input_buf = NULL, output_buf = NULL; size_t input_buf_size, output_buf_size; size_t bytes_returned = 0; + PNETUIO_CONTEXT_DATA netuio_contextdata = NULL; - WDFDEVICE device = WdfIoQueueGetDevice(Queue); + netuio_contextdata = netuio_get_context_data(Device); - PNETUIO_CONTEXT_DATA netuio_contextdata; - netuio_contextdata = netuio_get_context_data(device); + WDF_REQUEST_PARAMETERS_INIT(¶ms); + WdfRequestGetParameters(Request, ¶ms); - switch (IoControlCode) { - case IOCTL_NETUIO_MAP_HW_INTO_USERMODE: - // First retrieve the input buffer and see if it matches our device - status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_private_info), &input_buf, &input_buf_size); - if (!NT_SUCCESS(status)) { - status = STATUS_INVALID_BUFFER_SIZE; - break; - } + // We only need to be in the context of the process that initiated the request + //when we need to map memory to userspace. Otherwise, send the request back to framework. + if (!((params.Type == WdfRequestTypeDeviceControl) && + (params.Parameters.DeviceIoControl.IoControlCode == IOCTL_NETUIO_MAP_HW_INTO_USERMODE))) + { + status = WdfDeviceEnqueueRequest(Device, Request); - struct dpdk_private_info *dpdk_pvt_info = (struct dpdk_private_info *)input_buf; - // Ensure that the B:D:F match - otherwise, fail the IOCTL - if ((netuio_contextdata->addr.bus_num != dpdk_pvt_info->dev_addr.bus_num) || - (netuio_contextdata->addr.dev_num != dpdk_pvt_info->dev_addr.dev_num) || - (netuio_contextdata->addr.func_num != dpdk_pvt_info->dev_addr.func_num)) { - status = STATUS_NOT_SAME_DEVICE; - break; + if (!NT_SUCCESS(status)) + { + WdfRequestCompleteWithInformation(Request, status, bytes_returned); } + return; + } - if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr != NULL) { - status = STATUS_ALREADY_COMMITTED; - break; - } + // First retrieve the input buffer and see if it matches our device + status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_private_info), &input_buf, &input_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + goto end; + } - // Return relevant data to the caller - status = WdfRequestRetrieveOutputBuffer(Request, sizeof(struct dpdk_private_info), &output_buf, &output_buf_size); - if (!NT_SUCCESS(status)) { - status = STATUS_INVALID_BUFFER_SIZE; - break; - } + struct dpdk_private_info* dpdk_pvt_info = (struct dpdk_private_info*)input_buf; + // Ensure that the B:D:F match - otherwise, fail the IOCTL + if ((netuio_contextdata->addr.bus_num != dpdk_pvt_info->dev_addr.bus_num) || + (netuio_contextdata->addr.dev_num != dpdk_pvt_info->dev_addr.dev_num) || + (netuio_contextdata->addr.func_num != dpdk_pvt_info->dev_addr.func_num)) { + status = STATUS_NOT_SAME_DEVICE; + goto end; + } - // Zero out the physically contiguous block - RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); + if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr != NULL) { + status = STATUS_ALREADY_COMMITTED; + goto end; + } - status = netuio_map_address_into_user_process(netuio_contextdata); - if (status != STATUS_SUCCESS) { - break; - } + // Return relevant data to the caller + status = WdfRequestRetrieveOutputBuffer(Request, sizeof(struct dpdk_private_info), &output_buf, &output_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + goto end; + } - ASSERT(output_buf_size == OutputBufferLength); - netuio_handle_get_hw_data_request(Request, netuio_contextdata, output_buf, output_buf_size); - bytes_returned = output_buf_size; + // Zero out the physically contiguous block + RtlZeroMemory(netuio_contextdata->dpdk_seg.mem.virt_addr, netuio_contextdata->dpdk_seg.mem.size); - break; + status = netuio_map_address_into_user_process(netuio_contextdata); + if (status != STATUS_SUCCESS) { + goto end; + } - case IOCTL_NETUIO_PCI_CONFIG_IO: - // First retrieve the input buffer and see if it matches our device - status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_pci_config_io), &input_buf, &input_buf_size); - if (!NT_SUCCESS(status)) { - status = STATUS_INVALID_BUFFER_SIZE; - break; - } + netuio_handle_get_hw_data_request(Request, netuio_contextdata, output_buf, output_buf_size); + bytes_returned = output_buf_size; - struct dpdk_pci_config_io *dpdk_pci_io_input = (struct dpdk_pci_config_io *)input_buf; +end: + WdfRequestCompleteWithInformation(Request, status, bytes_returned); - if (dpdk_pci_io_input->access_size != 1 && - dpdk_pci_io_input->access_size != 2 && - dpdk_pci_io_input->access_size != 4 && - dpdk_pci_io_input->access_size != 8) { - status = STATUS_INVALID_PARAMETER; - break; - } + return; +} - // Ensure that the B:D:F match - otherwise, fail the IOCTL - if ((netuio_contextdata->addr.bus_num != dpdk_pci_io_input->dev_addr.bus_num) || - (netuio_contextdata->addr.dev_num != dpdk_pci_io_input->dev_addr.dev_num) || - (netuio_contextdata->addr.func_num != dpdk_pci_io_input->dev_addr.func_num)) { - status = STATUS_NOT_SAME_DEVICE; - break; - } - // Retrieve output buffer - status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT64), &output_buf, &output_buf_size); - if (!NT_SUCCESS(status)) { - status = STATUS_INVALID_BUFFER_SIZE; - break; - } - ASSERT(output_buf_size == OutputBufferLength); - - if (dpdk_pci_io_input->op == PCI_IO_READ) { - *(UINT64 *)output_buf = 0; - bytes_returned = netuio_contextdata->bus_interface.GetBusData( - netuio_contextdata->bus_interface.Context, - PCI_WHICHSPACE_CONFIG, - output_buf, - dpdk_pci_io_input->offset, - dpdk_pci_io_input->access_size); - } - else if (dpdk_pci_io_input->op == PCI_IO_WRITE) { - // returns bytes written - bytes_returned = netuio_contextdata->bus_interface.SetBusData( - netuio_contextdata->bus_interface.Context, - PCI_WHICHSPACE_CONFIG, - (PVOID)&dpdk_pci_io_input->data, - dpdk_pci_io_input->offset, - dpdk_pci_io_input->access_size); - } - else { - status = STATUS_INVALID_PARAMETER; - break; - } +/* +Routine Description: + This event is invoked when the framework receives IRP_MJ_DEVICE_CONTROL request. + +Return Value: + None + */ +VOID +netuio_evt_IO_device_control(_In_ WDFQUEUE Queue, _In_ WDFREQUEST Request, + _In_ size_t OutputBufferLength, _In_ size_t InputBufferLength, + _In_ ULONG IoControlCode) +{ + UNREFERENCED_PARAMETER(OutputBufferLength); + UNREFERENCED_PARAMETER(InputBufferLength); + + NTSTATUS status = STATUS_SUCCESS; + PVOID input_buf = NULL, output_buf = NULL; + size_t input_buf_size, output_buf_size; + size_t bytes_returned = 0; + + WDFDEVICE device = WdfIoQueueGetDevice(Queue); - break; + PNETUIO_CONTEXT_DATA netuio_contextdata; + netuio_contextdata = netuio_get_context_data(device); + + if (IoControlCode != IOCTL_NETUIO_PCI_CONFIG_IO) + { + status = STATUS_INVALID_DEVICE_REQUEST; + goto end; + } + + // First retrieve the input buffer and see if it matches our device + status = WdfRequestRetrieveInputBuffer(Request, sizeof(struct dpdk_pci_config_io), &input_buf, &input_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + goto end; + } + + struct dpdk_pci_config_io *dpdk_pci_io_input = (struct dpdk_pci_config_io *)input_buf; + + if (dpdk_pci_io_input->access_size != 1 && + dpdk_pci_io_input->access_size != 2 && + dpdk_pci_io_input->access_size != 4 && + dpdk_pci_io_input->access_size != 8) { + status = STATUS_INVALID_PARAMETER; + goto end; + } - default: - break; + // Ensure that the B:D:F match - otherwise, fail the IOCTL + if ((netuio_contextdata->addr.bus_num != dpdk_pci_io_input->dev_addr.bus_num) || + (netuio_contextdata->addr.dev_num != dpdk_pci_io_input->dev_addr.dev_num) || + (netuio_contextdata->addr.func_num != dpdk_pci_io_input->dev_addr.func_num)) { + status = STATUS_NOT_SAME_DEVICE; + goto end; + } + // Retrieve output buffer + status = WdfRequestRetrieveOutputBuffer(Request, sizeof(UINT64), &output_buf, &output_buf_size); + if (!NT_SUCCESS(status)) { + status = STATUS_INVALID_BUFFER_SIZE; + goto end; + } + ASSERT(output_buf_size == OutputBufferLength); + + if (dpdk_pci_io_input->op == PCI_IO_READ) { + *(UINT64 *)output_buf = 0; + bytes_returned = netuio_contextdata->bus_interface.GetBusData( + netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + output_buf, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size); + } + else if (dpdk_pci_io_input->op == PCI_IO_WRITE) { + // returns bytes written + bytes_returned = netuio_contextdata->bus_interface.SetBusData( + netuio_contextdata->bus_interface.Context, + PCI_WHICHSPACE_CONFIG, + (PVOID)&dpdk_pci_io_input->data, + dpdk_pci_io_input->offset, + dpdk_pci_io_input->access_size); + } + else { + status = STATUS_INVALID_PARAMETER; + goto end; } +end: WdfRequestCompleteWithInformation(Request, status, bytes_returned); return; diff --git a/kernel/windows/netuio/netuio_queue.h b/kernel/windows/netuio/netuio_queue.h index 90fdb4008..68fdaa296 100644 --- a/kernel/windows/netuio/netuio_queue.h +++ b/kernel/windows/netuio/netuio_queue.h @@ -27,6 +27,8 @@ netuio_queue_initialize(_In_ WDFDEVICE hDevice); EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL netuio_evt_IO_device_control; EVT_WDF_IO_QUEUE_IO_STOP netuio_evt_IO_stop; +EVT_WDF_IO_IN_CALLER_CONTEXT netuio_evt_IO_in_caller_context; + EXTERN_C_END #endif // NETUIO_QUEUE_H From patchwork Thu Aug 13 23:21:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75535 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7199A04B1; Fri, 14 Aug 2020 01:25:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF72E1C1C1; Fri, 14 Aug 2020 01:23:05 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 754221C0DA for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 5644520B4771; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5644520B4771 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=0XJyAZY5W1nDOfY9ELXHIRyyUgchqFXcZ94XObtV7V8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYhIDZbIRNPfRtKq27DyQP7coxG2oThQ55WcUpjkQqqyxfJus89imljtFaI5lrShS J9CizvgmrEXUC6sH8MOvEXhX0vzeNvgM2sZfGJgOJfwr6YYFoFlS8yppSaqNgD45vC MqIwDoq6oPf8EM/MEaZ03lmA7gfUK5Z6WYnmMKc8= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:41 -0700 Message-Id: <1597360905-74106-19-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 18/22] uio: Change the device setup class to a custom one X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile The netuio driver doesn't meet the necessary criteria to be in the Net class. Update Class to a custom defined value. Signed-off-by: Narcisa Vasile Reported-by: Dmitry Kozlyuk --- kernel/windows/netuio/netuio.inf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index 35fe7c85c..4f0dae114 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -36,12 +36,19 @@ [Version] Signature="$WINDOWS NT$" -Class=Net -ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318} +Class=%ClassName% +ClassGuid={78912BC1-CB8E-4B28-A329-F322EBADBE0F} Provider=%Intel% CatalogFile=netuio.cat DriverVer= +[ClassInstall32] +Addreg=netuioClassReg + +[netuioClassReg] +HKR,,,0,%ClassName% +HKR,,Icon,,-5 + ;***************************************** ; Install Section ;***************************************** @@ -103,7 +110,7 @@ KmdfLibraryVersion = $KMDFVERSION$ SPSVCINST_ASSOCSERVICE= 0x00000002 Intel = "Intel" Broadcom = "Broadcom Corporation" -ClassName = "Intel(R) DPDK netUIO Driver" +ClassName = "Windows UIO" DiskName = "DPDK netUIO Installation Disk" F1583.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Converged Network Adapter XL710-Q2" F158A.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Network Adapter XXV710 for 25GbE backplane" From patchwork Thu Aug 13 23:21:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75537 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F652A04B1; Fri, 14 Aug 2020 01:25:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A85581C1D3; Fri, 14 Aug 2020 01:23:07 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id E1A0E1C0D2 for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 62B8120B4773; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 62B8120B4773 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=KrawuhdR8dnh5xvIya3X+lJ0PVA/+dFrH1MI2hio5Kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lD6ZhgDToM1L7sO4TrASDFINg4Mfsx4+mYRh/keJdQ5jUXwCgtUtX3pVzA5N0xZE8 jLteoo7gN+ojyBdxZGIUSd3qKRsUzGuspEcW7YuG5rX5086HQZj+DE2llw/4iWMKFX ShWAmDwgR/HxTS7MGQU7Vu+84M1kG+SCcfDI0uhQ= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:42 -0700 Message-Id: <1597360905-74106-20-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 19/22] Enable DMA remapping through INF directive X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile --- kernel/windows/netuio/netuio.inf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index 4f0dae114..419da53d3 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -91,6 +91,7 @@ ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %12%\netuio.sys +AddReg = DMAr.reg [DestinationDirs] DefaultDestDir = 12 @@ -120,3 +121,6 @@ F153B.netuio.Description = "DPDK netUIO for Intel(R) Ethernet Connection I217-V" F16D7.netuio.Description = "DPDK netUIO for Broadcom P225p NetXtreme-E Dual-port 10Gb/25Gb Ethernet PCIe Adapter" netuio.DeviceDesc = "netuio Device" netuio.SVCDESC = "netuio Service" + +[DMAr.reg] +HKR,Parameters,DmaRemappingCompatible,0x00010001,1 From patchwork Thu Aug 13 23:21:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75540 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 73617A04B1; Fri, 14 Aug 2020 01:26:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C41041C1EE; Fri, 14 Aug 2020 01:23:10 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 192D11C0D0 for ; Fri, 14 Aug 2020 01:22:46 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 6F5B620B4775; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6F5B620B4775 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=jmOUX/CUWzrHK2GLOn2KsDzc72Am7ZOpxWZJ4b61Uwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OHuY92XqmqPn9c7ThDNdhn7OgOipdG+OqfImUNkKFwH+Rt5gKdhcEsi8ZSk6Wd89w rjq1SfDF9hA+qEq1K0nnyavgo0jAQJ4yejkniirKV4IhcWNtMNcpl4VDWPOqWOOsfW 8HCc0si1z4UzEQTlMnLe5rE9yKZxtjp4oGwLSO30= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:43 -0700 Message-Id: <1597360905-74106-21-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 20/22] license: update headers with BSD 3-clause license: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan Signed-off-by: Harini Ramakrishnan --- kernel/windows/netuio/netuio.inf | 3 +- kernel/windows/netuio/netuio.rc | Bin 4772 -> 8098 bytes kernel/windows/netuio/netuio_dev.c | 32 +++++++++++++++++++-- kernel/windows/netuio/netuio_dev.h | 32 +++++++++++++++++++-- kernel/windows/netuio/netuio_drv.c | 34 ++++++++++++++++++++--- kernel/windows/netuio/netuio_drv.h | 32 +++++++++++++++++++-- kernel/windows/netuio/netuio_interface.h | 34 ++++++++++++++++++++--- kernel/windows/netuio/netuio_queue.c | 34 ++++++++++++++++++++--- kernel/windows/netuio/netuio_queue.h | 34 ++++++++++++++++++++--- 9 files changed, 208 insertions(+), 27 deletions(-) diff --git a/kernel/windows/netuio/netuio.inf b/kernel/windows/netuio/netuio.inf index 419da53d3..9ccc59f8c 100644 --- a/kernel/windows/netuio/netuio.inf +++ b/kernel/windows/netuio/netuio.inf @@ -1,8 +1,7 @@ ; ; BSD LICENSE ; -; Copyright(c) 2010-2018 Intel Corporation. All rights reserved. -; All rights reserved. +; Copyright (c) Microsoft Corporation. All rights reserved ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions diff --git a/kernel/windows/netuio/netuio.rc b/kernel/windows/netuio/netuio.rc index 4b0b176e6284fcfa65662f7ea6b3b1b36fb85a6d..63908e5bf29bb3de0cf1e768049b1ad501639363 100644 GIT binary patch literal 8098 zcmdU!TW{M&5QX=-K>q`)yd-JhOK#}pNtR^CsBF2q*a;B8h;OL@TQVfMZh-#ww&$DC zn50Anv6BZE1VwVWJA3BLWrwSO|5;5>)A#AS^lQrO*hsz9)LlDmr$%a}T|KvEJ&OGr zX_T(gr!-FI>0|mMO*Q6mI!;e?-BH`I-i*>j=b62u|5zjV{h*d}-3`-NT~oN9p=jZl*bg8kMOHDVgRQ>K8oM>V0f&(dWqCeo*@- z^*J+)m+JdWPd9oum42DE=FiBPmYBO#j}!Gi(|KIb5h=(9#g%@?>C$9Qbq~TTwTz_Y zxt_d*`QRwCnHdKrSQ;6gp%~9J2MjV}usJE=i8(JNb((&uU=WKx)%iIlu?04q=Z@LI zn@Jlu1}!>Hh1|JD3*LW7N9v0e9dp@hiazBYm`SUV>4cSF4@uZL69aDVz*NOSZu>w` z#U8v(#NmbEg`=^&aURW=u;bcR`_Mc)ZtD{<<{lUb|34ggB+c`LNJI6{k|P@qA0 z+P3L(DrA}RVpT44zeSgM8F>sbQ#ne*=iQTwsF{P2FhgECGBlpg$Qx6k$kav-@V<@~ z1kM~8i7XS(?sp)_EOz0#m|X*lU(YoENV6B?FY@_~FnLA`i+DaHOOWG^CE4?!&rP-m z*NuMR0954TJReRpGS&pQYSFg+^hWDZPa}G%lQvU79cbO?YGul1?R$Faq2T-k@RZl?Veh?>anG^zS`cXt!@3gCcCcHj*;};RS)`Zq=D`_y6=^;LrwF82UIm( zV=PzZZKb!G4}?AIhXi`>sFk(VF}fCA8{N0oo@KmkNolCxKzO*{vR22E>A53JMShUD zqq9Gg3t}>7X#XYiW*W1pF*}mc)$DI(sOsWi+c5V{v(R+Y=G(p1aMM^SqN+>Uo}_ez zgKAd14z z3<|f&GHc^OV1rvYXxo!(>GsCXAO?Fwcwii)Rc#Hu!85@P;%6oM^~41-n2C4pKdqU! zz|K2sEh2`w-^HWL^pW7HYgAnxgXd9`eJfw`2*Zl#i*4Kn?lnENQ#)emzV7kFOei`! znuf%&gSu;RN_E+@y0dM509uzdP3>emxT)G55Xt ztp~v&nFo)`y{|0IHTAqy&IDEVCURP`1<3FVatqdRDdZAIb)fe!4=?x}PjI)TXRg5j z+SF$nW9iU5vW@dshc@%If$@DE(7eIJHS`YPTmV|B!iXX z!7G5LY1Lv6e5*RDzgPCP8ckHiP>W!vA9ZA^yIHrW6sXU=T4xRBGYqME37i|~>4V=ZM~SlJUJL>O77lMZF4mT`rTwq=z=y?>|p z+|b*$?n6&7JiH^&#g&|~$Z@$Afd}IGt$vHy4ZnD8ub*{^D4@Aa)@Iok`#EEbBCp(Mj;d@^o9*JbhkCxLrT5A|@8!{+`*W1b5WTo3 zqPx!X$nvr8Yy~QEL{+|7^tQ0k!^$c}G$7P6}g*4;z% zF1`&IO@$Y4V1#x?XS$<~i)u6aWb(OZ>9tO-uV#I{zHKVnsRYYXGx@ytX2jZ@^i9hy zTf)GXKu@vH41c8;S|!@n7q2|KT{p;XE!7JHMM)WFF3BaV-;QS|gq_vT_g^dY_r1!q zxehSMbr4#A0RZyEQRqQx<9(o7AaOAtf?cCu5gstS8@F zXDyGNKkrS2&2BbU@SSdt!294VM{nR;QziadC)Za?EK#k0usIe!z6R#mb`7rOH6zKM z$R3kB$#09Vk0u!o%Ddx%e(??UPs8ew=hA6C{baTetjjIGA}ho{E?r^v|86E~?V5ez z-S-4n?xaP>?EFy@ou%*^o{GNtwQTK~hr~|iye*oVjVh4uLw5F=jc>qH(~192t_%&H zmdRVG9&@ieF!b!E-rUiKWmMH3xIXhfJaAbq$ZL-9#l@C#j@g%%ETG X-Patchwork-Id: 75539 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48E27A04B1; Fri, 14 Aug 2020 01:25:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D376C1C1E4; Fri, 14 Aug 2020 01:23:09 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 82AF81C0DB for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 7BEFA20B4778; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7BEFA20B4778 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=zOQVng3+CMOkXh+ELZMEn3lvp8FNzd/0/MmkQ0/GAGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pKq13cFCTbgxG3lJnA0QDk+BWGiVmdoH5hJcMJ5rmbk0cSz7ODfdey6Q/983JwsDS 7faiDok2fYZhcEo0PUuPnhYgjjJ+GLXD+peLZBEdrnCJdGofYDQfuRten7LhKML6nf fEX8mpKUp4OTa6toRju5RqGluncd0aUepfBpSgQU= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Harini Ramakrishnan Date: Thu, 13 Aug 2020 16:21:44 -0700 Message-Id: <1597360905-74106-22-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 21/22] doc: updating REAME for NetUIO driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Harini Ramakrishnan Signed-off-by: Harini Ramakrishnan --- kernel/README_NetUIO.rst | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 kernel/README_NetUIO.rst diff --git a/kernel/README_NetUIO.rst b/kernel/README_NetUIO.rst new file mode 100644 index 000000000..9b21a4a8b --- /dev/null +++ b/kernel/README_NetUIO.rst @@ -0,0 +1,63 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2020 Microsoft Corporation. + +Compiling the NetUIO Driver from Source +======================================= + +Operating System +~~~~~~~~~~~~~~~~ + +The NetUIO source has been validated against the following operating systems: + +* Windows Server 2016 +* Windows Server 2019 + +Hardware Requirements +~~~~~~~~~~~~~~~~~~~~~ +The NetUIO driver has been validated using the following network adapters on the Windows platform: + +* +* + +Software Requirements +~~~~~~~~~~~~~~~~~~~~~ + +* Install Microsoft Visual Studio 2017 or Visual Stuido Studio 2019 Enterprise from https://visualstudio.microsoft.com/downloads/ + * During installation ensure following components are selected: + Windows 10 SDK (10.0.15063.0) + Windows 10 SDK (10.0.17763.0) + Windows Drivers Kit + +* Install WDK for Windows 10 (10.0.17763.1) from https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk + +Building the NetUIO Driver +-------------------------- +Follow the steps below to build the NetUIO driver and install the driver for the network adapter. + +* Clone the dpdk-kmods repository: git clone git://dpdk.org/dpdk-kmods +* Navigate to \dpdk-kmods\windows\netuio\mk\exec-env\windows\netuio +* Load netuio.sln in Microsoft Visual Studio 2017 or 2019 +* Choose Release as the configuration mode and Build the solution +* The resultant output files can be found in \dpdk-kmods\windows\netuio\x64\Release\netuio + +Installing netuio.sys Driver for development +-------------------------------------------- +NOTE: In a development environment, NetUIO driver can be loaded by enabling test-signing. +Please implement adequate precautionary measures before installing a test-signed driver, replacing a signed-driver. + +To ensure test-signed kernel-mode drivers can load on Windows, enable test-signing, using the following BCDEdit command. + +C:\windows\system32>Bcdedit.exe -set TESTSIGNING ON + +Windows displays the text “Test Mode” to remind users the system has test-signing enabled. +Refer to the MSDN documentation on how to Test-Sign a Driver Package. + +To procure a WHQL signed NetUIO driver for Windows, please reach out to dpdkwin@microsoft.com + +* Go to Device Manager -> Network Adapters. +* Right Click on target network adapter -> Select Update Driver. +* Select “Browse my computer for driver software”. +* In the resultant Window, select “Let me pick from a list of available drivers on my computer”. +* Select “DPDK netUIO for Network Adapter” from the list of drivers. +* The NetUIO.sys driver is successfully installed. + \ No newline at end of file From patchwork Thu Aug 13 23:21:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Narcisa Ana Maria Vasile X-Patchwork-Id: 75536 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBC02A04B1; Fri, 14 Aug 2020 01:25:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B1CB81C1C8; Fri, 14 Aug 2020 01:23:06 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 83B521C0DC for ; Fri, 14 Aug 2020 01:22:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1059) id 8898020B477C; Thu, 13 Aug 2020 16:22:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8898020B477C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1597360964; bh=5sY3l2rv69m/94fYdV8zHsjpUtxhYv+50OZTBGihUUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMQFZRol0QwOpRROJ3+OZ2IdiLhYStHvqsClXjLK0Yy+pSyirXNYg9cFhCSjUjJOw THVVNgiNkD1rT7/3miAMVrV4shPhE2ooANY0UNQnrXo9QYU367+ddJkr8pgoZjW3UJ fJguKF0M5G0H9xL90S9CJepcVAkW2rRyRMnWHW9c= From: Narcisa Ana Maria Vasile To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com, ocardona@microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: ranjit.menon@intel.com, dmitrym@microsoft.com, Narcisa Vasile Date: Thu, 13 Aug 2020 16:21:45 -0700 Message-Id: <1597360905-74106-23-git-send-email-navasile@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> References: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com> Subject: [dpdk-dev] [PATCH 22/22] Move all files under windows folder X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Narcisa Vasile --- {kernel => windows/netuio/kernel}/README_NetUIO.rst | 0 .../netuio/kernel}/windows/netuio/netuio.inf | 0 .../netuio/kernel}/windows/netuio/netuio.rc | Bin .../netuio/kernel}/windows/netuio/netuio_dev.c | 0 .../netuio/kernel}/windows/netuio/netuio_dev.h | 0 .../netuio/kernel}/windows/netuio/netuio_drv.c | 0 .../netuio/kernel}/windows/netuio/netuio_drv.h | 0 .../kernel}/windows/netuio/netuio_interface.h | 0 .../netuio/kernel}/windows/netuio/netuio_queue.c | 0 .../netuio/kernel}/windows/netuio/netuio_queue.h | 0 .../netuio/kernel}/windows/netuio/resource.h | 0 .../netuio/mk}/exec-env/windows/netuio/netuio.sln | 0 .../mk}/exec-env/windows/netuio/netuio.vcxproj | 0 .../exec-env/windows/netuio/netuio.vcxproj.filters | 0 .../mk}/exec-env/windows/netuio/netuio.vcxproj.user | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename {kernel => windows/netuio/kernel}/README_NetUIO.rst (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio.inf (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio.rc (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_dev.c (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_dev.h (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_drv.c (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_drv.h (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_interface.h (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_queue.c (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/netuio_queue.h (100%) rename {kernel => windows/netuio/kernel}/windows/netuio/resource.h (100%) rename {mk => windows/netuio/mk}/exec-env/windows/netuio/netuio.sln (100%) rename {mk => windows/netuio/mk}/exec-env/windows/netuio/netuio.vcxproj (100%) rename {mk => windows/netuio/mk}/exec-env/windows/netuio/netuio.vcxproj.filters (100%) rename {mk => windows/netuio/mk}/exec-env/windows/netuio/netuio.vcxproj.user (100%) diff --git a/kernel/README_NetUIO.rst b/windows/netuio/kernel/README_NetUIO.rst similarity index 100% rename from kernel/README_NetUIO.rst rename to windows/netuio/kernel/README_NetUIO.rst diff --git a/kernel/windows/netuio/netuio.inf b/windows/netuio/kernel/windows/netuio/netuio.inf similarity index 100% rename from kernel/windows/netuio/netuio.inf rename to windows/netuio/kernel/windows/netuio/netuio.inf diff --git a/kernel/windows/netuio/netuio.rc b/windows/netuio/kernel/windows/netuio/netuio.rc similarity index 100% rename from kernel/windows/netuio/netuio.rc rename to windows/netuio/kernel/windows/netuio/netuio.rc diff --git a/kernel/windows/netuio/netuio_dev.c b/windows/netuio/kernel/windows/netuio/netuio_dev.c similarity index 100% rename from kernel/windows/netuio/netuio_dev.c rename to windows/netuio/kernel/windows/netuio/netuio_dev.c diff --git a/kernel/windows/netuio/netuio_dev.h b/windows/netuio/kernel/windows/netuio/netuio_dev.h similarity index 100% rename from kernel/windows/netuio/netuio_dev.h rename to windows/netuio/kernel/windows/netuio/netuio_dev.h diff --git a/kernel/windows/netuio/netuio_drv.c b/windows/netuio/kernel/windows/netuio/netuio_drv.c similarity index 100% rename from kernel/windows/netuio/netuio_drv.c rename to windows/netuio/kernel/windows/netuio/netuio_drv.c diff --git a/kernel/windows/netuio/netuio_drv.h b/windows/netuio/kernel/windows/netuio/netuio_drv.h similarity index 100% rename from kernel/windows/netuio/netuio_drv.h rename to windows/netuio/kernel/windows/netuio/netuio_drv.h diff --git a/kernel/windows/netuio/netuio_interface.h b/windows/netuio/kernel/windows/netuio/netuio_interface.h similarity index 100% rename from kernel/windows/netuio/netuio_interface.h rename to windows/netuio/kernel/windows/netuio/netuio_interface.h diff --git a/kernel/windows/netuio/netuio_queue.c b/windows/netuio/kernel/windows/netuio/netuio_queue.c similarity index 100% rename from kernel/windows/netuio/netuio_queue.c rename to windows/netuio/kernel/windows/netuio/netuio_queue.c diff --git a/kernel/windows/netuio/netuio_queue.h b/windows/netuio/kernel/windows/netuio/netuio_queue.h similarity index 100% rename from kernel/windows/netuio/netuio_queue.h rename to windows/netuio/kernel/windows/netuio/netuio_queue.h diff --git a/kernel/windows/netuio/resource.h b/windows/netuio/kernel/windows/netuio/resource.h similarity index 100% rename from kernel/windows/netuio/resource.h rename to windows/netuio/kernel/windows/netuio/resource.h diff --git a/mk/exec-env/windows/netuio/netuio.sln b/windows/netuio/mk/exec-env/windows/netuio/netuio.sln similarity index 100% rename from mk/exec-env/windows/netuio/netuio.sln rename to windows/netuio/mk/exec-env/windows/netuio/netuio.sln diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj b/windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj similarity index 100% rename from mk/exec-env/windows/netuio/netuio.vcxproj rename to windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj.filters b/windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj.filters similarity index 100% rename from mk/exec-env/windows/netuio/netuio.vcxproj.filters rename to windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj.filters diff --git a/mk/exec-env/windows/netuio/netuio.vcxproj.user b/windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj.user similarity index 100% rename from mk/exec-env/windows/netuio/netuio.vcxproj.user rename to windows/netuio/mk/exec-env/windows/netuio/netuio.vcxproj.user