From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14A77A04B5; Tue, 22 Sep 2020 23:36:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8717F1DAE3; Tue, 22 Sep 2020 23:36:54 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 071DD1DAD6 for ; Tue, 22 Sep 2020 23:36:51 +0200 (CEST) IronPort-SDR: rp+OJbvpVZ2ZdxKkxN2A2d8xbKj9RQ0j8tKs8bNemH9wtaXlWzOk37/W/tnpbiuJiFBKh5iqvt K/V0xu/Kt1bg== X-IronPort-AV: E=McAfee;i="6000,8403,9752"; a="224872540" X-IronPort-AV: E=Sophos;i="5.77,292,1596524400"; d="scan'208";a="224872540" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 14:36:50 -0700 IronPort-SDR: VcygbcKoILtsqmrPO6iGD9VGpdW7n416ODgzmE72/e07OWIfjwchNcnWOj+/ZlECKZA2hfc8ws eB5Qw7f4t2AA== X-IronPort-AV: E=Sophos;i="5.77,292,1596524400"; d="scan'208";a="382454149" Received: from rmenon-desk.amr.corp.intel.com (HELO [10.166.30.253]) ([10.166.30.253]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 14:36:50 -0700 To: Narcisa Ana Maria Vasile , dev@dpdk.org, thomas@monjalon.net, ocardona@microsoft.com, haramakr@linux.microsoft.com, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com Cc: dmitrym@microsoft.com, Narcisa Vasile , Harini Ramakrishnan References: <1599676883-11991-1-git-send-email-navasile@linux.microsoft.com> <1600483953-28579-1-git-send-email-navasile@linux.microsoft.com> From: Ranjit Menon Message-ID: Date: Tue, 22 Sep 2020 14:36:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1600483953-28579-1-git-send-email-navasile@linux.microsoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v4] windows/netuio: add Windows NetUIO kernel 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" On 9/18/2020 7:52 PM, Narcisa Ana Maria Vasile wrote: > From: Narcisa Vasile > > The Windows netuio kernel driver provides the DPDK userspace application > with direct access to hardware, by mapping the HW registers in userspace > and allowing read/write operations from/to the device > configuration space. > > Two IOCTLs are defined by the netuio interface: > * IOCTL_NETUIO_MAP_HW_INTO_USERMODE > - used for mapping the device registers into userspace > * IOCTL_NETUIO_PCI_CONFIG_IO > - used to read/write from/into the device configuration space > > Note: > Requests to map the device BARs into userspace need to be processed > in the thread context of the process that initiated the mapping request. > Otherwise, the BARs might end up mapped into an arbitrary process > address space. > EvtIoInCallerContext is used to ensure the requests are handled > in the right user thread context. Other requests (PCI config) > are sent back to the framework and processed by the EvtIoDeviceControl > callback. > > Cc: Harini Ramakrishnan > Cc: Omar Cardona > Cc: Dmitry Malloy > Signed-off-by: Narcisa Vasile > --- > > v4: > Fixed issues reported by DmitryK: > * Fix whitespaces issues > * Fix status not checked > * Remove NULL checks for device and file context getters > * Use %x for BDF > * Add comment for BAR traversing > * Remove complex calculations that were only needed in ASSERT > * Remove netuio_evt_driver_context_cleanup as not needed > * Check GetBusData/SetBusData returned bytes > * General cleanup > > windows/.gitattributes | 4 + > windows/.gitignore | 2 + > windows/netuio/README.rst | 58 +++++ > windows/netuio/netuio.inf | 77 ++++++ > windows/netuio/netuio.sln | 24 ++ > windows/netuio/netuio.vcxproj | 113 +++++++++ > windows/netuio/netuio.vcxproj.filters | 54 +++++ > windows/netuio/netuio_dev.c | 273 +++++++++++++++++++++ > windows/netuio/netuio_dev.h | 66 +++++ > windows/netuio/netuio_drv.c | 131 ++++++++++ > windows/netuio/netuio_drv.h | 30 +++ > windows/netuio/netuio_interface.h | 88 +++++++ > windows/netuio/netuio_queue.c | 334 ++++++++++++++++++++++++++ > windows/netuio/netuio_queue.h | 21 ++ > 14 files changed, 1275 insertions(+) > create mode 100644 windows/.gitattributes > create mode 100644 windows/.gitignore > create mode 100644 windows/netuio/README.rst > create mode 100644 windows/netuio/netuio.inf > create mode 100644 windows/netuio/netuio.sln > create mode 100644 windows/netuio/netuio.vcxproj > create mode 100644 windows/netuio/netuio.vcxproj.filters > create mode 100644 windows/netuio/netuio_dev.c > create mode 100644 windows/netuio/netuio_dev.h > create mode 100644 windows/netuio/netuio_drv.c > create mode 100644 windows/netuio/netuio_drv.h > create mode 100644 windows/netuio/netuio_interface.h > create mode 100644 windows/netuio/netuio_queue.c > create mode 100644 windows/netuio/netuio_queue.h > diff --git a/windows/netuio/netuio_interface.h b/windows/netuio/netuio_interface.h > new file mode 100644 > index 000000000..232b5bc2d > --- /dev/null > +++ b/windows/netuio/netuio_interface.h > @@ -0,0 +1,88 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2020 Microsoft Corporation. > + */ > + > + /** > + * @file netuio kernel driver interface > + */ > + > +#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_UNICODE L"\\DosDevices\\netuio" > +#define NETUIO_MAX_SYMLINK_LEN 255 > + > +/** > + * IOCTL_NETUIO_MAP_HW_INTO_USERMODE is used for mapping the device registers > + * into userspace. It returns the physical address, virtual address > + * and the size of the memory region where the BARs were mapped. > + */ > +#define IOCTL_NETUIO_MAP_HW_INTO_USERMODE CTL_CODE(FILE_DEVICE_NETWORK, 51, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) Not critical, but can we rename this IOCTL code to IOCTL_NETUIO_MAP_HW_INTO_USERSPACE since that seems more appropriate and it is what the comment is referring to? ranjit m.