From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8AE5FA0540; Mon, 8 Aug 2022 22:40:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75D934014F; Mon, 8 Aug 2022 22:40:27 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 30BFD40141 for ; Mon, 8 Aug 2022 22:40:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659991225; x=1691527225; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=ZAdSblZIWt+CCykzfZ1FBFJOxgGPUGThaccZKdbu8ds=; b=CF/+a4mHy9TTQ3V2ZYNHgcAq2TQddQBPNz8raLkNQWZdpIZnsniyOK+s O7zNdXANBVvGdwT0TK1/7bzreFEwix1z6qKOyWwc8+qPJfQNmqGKl//Lm K+eDr306KORWpXaRgqimzcAQ8E19ltIe7DrTwl73sfMRCzU8RwnV/oAfj /faoxc/Wx7FrQtGptqIYaCd2QOfKm3EoNv9LkjBEcx95EbG5k86w7U6c9 Tt4ZpeFENgu08GFKMfsbelWapjl7tLCIL6IRKHoqeRZbLlvKaVYIcNEIq p/OHv/qOSIL+qZeqhU/6RrgP3L/6UAjuScNWs+BXePPCyDbuxPjCe2CPK g==; IronPort-Data: A9a23:0spseazTTActaBxuTBZ6t+dhxyrEfRIJ4+MujC+fZmUNrF6WrkUGm DcaDW+AMv+Ja2Hwf9B/aYiy/UoFv57TnNRqTAc+/y00HyNBpPSeOdnIdU2Y0wF+jyHgoOCLy +1HMoGowBUcFyeEzvuLGua99SEUOYagH+KgU7Ws1hhZHFMiEmF54f5as7ZRqpZyhtSkCB+6t 9r3osnOUHeowDcc3lg8sspvkzsy+qW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0oN gtMcxT5fhzp4EtHORA7dw6MLyK41z2MGbx2V2pUCLa/YE8SjnwQs3Mkf8IDaeRCcU18Kc= X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="354688318" X-IronPort-AV: E=Sophos;i="5.93,222,1654585200"; d="scan'208,217";a="354688318" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 13:40:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,222,1654585200"; d="scan'208,217";a="664129245" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 08 Aug 2022 13:40:23 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 8 Aug 2022 13:40:22 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 8 Aug 2022 13:40:22 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Mon, 8 Aug 2022 13:40:22 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Mon, 8 Aug 2022 13:40:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LITOgMI7ih/n5ngHzwkFguozW09gKRSlDr2y6E03wWXkRdqol3be+oECauVYMe89/bihQL/83N2D/5YD0c3LuLHSf+eBNp/KRJNpJCWUwVO08JVmaeDGI3xdlf7HsO9aFGqlkYrWfwoTK576sAfafkcG6QN2492L8siu9QC9TrgR0wDFaEbhiu5gyPXqOqcyVhY/eJmd9pcDc3T5YMdiAw+noB5xOylAzubyLiruK8cd3Mi9IboYhW7Xwh7kRTldtVWVH5/xPQ2Mkdjs+WFjPfoHpdbxXPFoHeCbENK1dCWkyzCNnIfkiotUuM3dST0BXUHBEuDIQD8CbUvODmBogA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=poBQa9HyLGiy2tiU1BjrTx6Y1+rfAY6eDKHZzCllwz0=; b=LhTzsFmekuwc5qDDm1AD/FnIeNWNOKxCaYyqQ7R23fV/nTA5HVVsyOCSCgVN4DX1dfLD9QaE0GbZ908eVr8SapwaidmT1V6erEczvtmzlbb3pM7lWCtMylVQMzTuqwmejz3vpm4ahKgeIznaups+9lsM+qUBI8k0myy3+zxK26AfE7S1BPWW3HkE9/ydj9lb6twDWAMjxFFopySaTKFGPLz+w9DtcZcSg03fZeogyNz78oIV7XPjHwzuAw2uc9M7FXUmeybzmi/jwfC3fd5A/+gXtcqsRv5dM5ffSX6FFEImicFaLqT7s8k7tBrSZ6zcheEeqA8bU7rzgqaRStgKBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW5PR11MB5858.namprd11.prod.outlook.com (2603:10b6:303:193::20) by BN9PR11MB5241.namprd11.prod.outlook.com (2603:10b6:408:132::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Mon, 8 Aug 2022 20:40:20 +0000 Received: from MW5PR11MB5858.namprd11.prod.outlook.com ([fe80::9f7:4b13:97b2:af8d]) by MW5PR11MB5858.namprd11.prod.outlook.com ([fe80::9f7:4b13:97b2:af8d%4]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 20:40:20 +0000 Content-Type: multipart/alternative; boundary="------------JRzDHnLrnRXWlj8g9D0OtKAu" Message-ID: Date: Mon, 8 Aug 2022 13:40:17 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [dpdk-kmods] windows/netuio: fix bar parsing Content-Language: en-US To: Dmitry Kozlyuk CC: , , , , , References: <20220802191058.1779-1-pallavi.kadam@intel.com> <20220807000113.4f773581@sovereign> From: "Kadam, Pallavi" In-Reply-To: <20220807000113.4f773581@sovereign> X-ClientProxiedBy: SJ0PR13CA0042.namprd13.prod.outlook.com (2603:10b6:a03:2c2::17) To MW5PR11MB5858.namprd11.prod.outlook.com (2603:10b6:303:193::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6a00d9e-cad1-4340-3a70-08da797e3597 X-MS-TrafficTypeDiagnostic: BN9PR11MB5241:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YTxdOl9ZWG58SHkF6c6AahtQR0zhi+TYx5CUPf1uhWTpqw6I0drYlAQCoOwFKFYyCysh3c+cpd+7CxIuCZfan1+30W2K/q3I7xbBHopVyfpoVd1Q8fhXy1D4nKmYNbYzH17Od5Xt7ww3gsja7y3i/tqSQhD70nGCO69xFa+rrJWtIxnh+ZwD4vN8UJpQA9XyBdSRk/xRiBFJfrvx6eS+hhp8VLBlqjKavr/Kr1iWp8r11zUphoo5gpStpk1mYJhx69KVuyYW7HORNdJmpUh/Pcw5IVdQ8I5xohJYTn8yPhqiNCif0kSER/+cqprUUGcLkqxv/abbiYWAB9uvN7r8Hb2cVkS3VNE3BZjGNvvetEgSjdWEOoDec1Cht2fniFUN5XIXsCef+IYcfJ2GUUgO7AykWLhglrjqlAxt1hxKMqiXR83n5f/vX/C+b9D0LRn8seBKDxoI+654V2NqbOYBOHLJOsUnjaoXnYRQqRvaqUgrYnq9g37/F2Y56no9+CdMyTXXs/K/tVrXO04h6IVPNFFf66WG4hWiYBRSHhGa3VUWr8sLoAIGe+IMsa7M0IwBOm/lIURyDFdyp71xvjmIFZVC7dEaoVYu6AtaJAeqNKCo0Ow9r6bxI5cqFDraReE+FEGL/GRxOfk9BJTrgKUaH93q/V7JwqMthGv9JXYJVzoOB7DgQB6rzaxy7RLMwY7wHY9Dp590bq4xNpSxyPCc1i0TtvhA+l7DEJInpUSEi3rmkCTb4fGmZdTrjyni/j1C2ozOQdy4HIQdO1TEe9OUwo1reTvAhWXDAzJfDvY6cuZeIRieonYbWLrzoLcIP35rc2T62PVTM1BEwhVEl7FJTw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW5PR11MB5858.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(39860400002)(136003)(396003)(346002)(376002)(33964004)(31696002)(6506007)(41300700001)(86362001)(53546011)(6512007)(38100700002)(26005)(6666004)(2616005)(8936002)(186003)(107886003)(83380400001)(82960400001)(31686004)(66556008)(5660300002)(8676002)(66476007)(316002)(36756003)(4326008)(45080400002)(6916009)(2906002)(6486002)(478600001)(66946007)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-M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HJmNGgwOEhRNUdINk5HN0l3K3VMZmk4?= =?utf-8?B?UUNZMllQeGlJc0NLWnlFSmNuN0lhODR2OVMyZkRKanB6cFpxQytIQTd1dWor?= =?utf-8?B?QUsyL3FRRU03REU1Z1FBMFNTVE1Zd001SVRCaWxRbDZwQTIxdEpvcGpsRW9M?= =?utf-8?B?ZkttbTlSMjhoK0I3b3dEWTF4Q1dhUjFoT1drcWdyeXo0L3d6eHd1VHdsVE1D?= =?utf-8?B?T3B0R1ByUTgzcHZLS1NpMGhsUnhqUHNDR2JwSU1wdlQvMDRuV2szYmpSRTMr?= =?utf-8?B?TERXeUtIdXNnT0pTMUw3bnlHNlJyM3pRdUJYb1FBTnN6VkdnaHpBOWxEc0Nn?= =?utf-8?B?WTlickEzdzA4T3RjYitXTExhN2tGYTBnTGwwbG9CdVZJOUtiSDFrWmNzczUw?= =?utf-8?B?cWc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: b6a00d9e-cad1-4340-3a70-08da797e3597 X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5858.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 20:40:19.9852 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TYZ1P3C0/eG6DCtMqzX/x7LpmBY+zbWxT+DXWx2pxE96kzvdujPfhtM33bAgoY5gRuykTK8OwvN4lXecO5PXcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5241 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --------------JRzDHnLrnRXWlj8g9D0OtKAu Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Hi Dmitry, On 8/6/2022 2:01 PM, Dmitry Kozlyuk wrote: > 2022-08-02 12:10 (UTC-0700), Pallavi Kadam: >> For certain PCIe devices, BAR values are not continuous. >> This patch maps all the BARs and avoids skipping the next BAR addresses. >> >> Fixes: e28aabd88279 ("windows/netuio: introduce NetUIO kernel driver") >> Cc:navasile@microsoft.com >> >> Signed-off-by: Qiao Liu >> Signed-off-by: Pallavi Kadam >> --- >> windows/netuio/netuio_dev.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c >> index b2deb10..e2cac3e 100644 >> --- a/windows/netuio/netuio_dev.c >> +++ b/windows/netuio/netuio_dev.c >> @@ -172,6 +172,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R >> ULONG next_descriptor = 0; >> ULONG curr_bar = 0; >> ULONG prev_bar = 0; >> + BOOLEAN bar_done = FALSE; >> >> /* >> * ResourcesTranslated report MMIO BARs in the correct order, but their >> @@ -197,7 +198,8 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R >> 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)) { >> + if (curr_bar == 0 || ((prev_bar & PCI_TYPE_64BIT) && (bar_done))) { >> + bar_done = FALSE; >> continue; >> } >> >> @@ -219,6 +221,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R >> ctx->bar[bar_index].virt_addr = MmMapIoSpace(descriptor->u.Memory.Start, >> descriptor->u.Memory.Length, >> MmNonCached); >> + bar_done = TRUE; >> if (ctx->bar[bar_index].virt_addr == NULL) { >> status = STATUS_INSUFFICIENT_RESOURCES; >> goto end; > Hi Pallavi, > > In the first place, it was wrong to always test `prev_bar & PCI_TYPE_64BIT` > because only the first BAR slot of a 64-bit BAR contains flags. > The current code has a state to track (curr_bar, prev_bar), > and the fix is complicating it even more without solving the root cause. > I suggest a simpler fix (not tested!) > that eliminates both the incorrectness and the state to maintain: Thank you for these changes. Will test the patch and let you know. > > diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c > index d4662b6..8761d31 100644 > --- a/windows/netuio/netuio_dev.c > +++ b/windows/netuio/netuio_dev.c > @@ -273,8 +273,6 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST > Resources, WDFCMRESLIST R > > PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor; > ULONG next_descriptor = 0; > - ULONG curr_bar = 0; > - ULONG prev_bar = 0; > > /* > * ResourcesTranslated report MMIO BARs in the correct order, but their > @@ -298,9 +296,9 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST > Resources, WDFCMRESLIST R > * searching for the next MMIO resource each time. > */ > 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)) { > + ULONG bar_value = pci_config.u.type0.BaseAddresses[bar_index]; > + > + if (bar_value == 0) { > continue; > } > > @@ -339,6 +337,11 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST > Resources, WDFCMRESLIST R > } > > ctx->dpdk_hw[bar_index].mem.size = ctx->bar[bar_index].size; > + > + // Skip the next BAR slot used by the current 64-bit address. > + if (bar_value & PCI_TYPE_64BIT) { > + bar_index++; > + } > } // for bar_index > end_of_loop: --------------JRzDHnLrnRXWlj8g9D0OtKAu Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 7bit

Hi Dmitry,

On 8/6/2022 2:01 PM, Dmitry Kozlyuk wrote:
2022-08-02 12:10 (UTC-0700), Pallavi Kadam:
For certain PCIe devices, BAR values are not continuous.
This patch maps all the BARs and avoids skipping the next BAR addresses.

Fixes: e28aabd88279 ("windows/netuio: introduce NetUIO kernel driver")
Cc: navasile@microsoft.com

Signed-off-by: Qiao Liu <qiao.liu@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
---
 windows/netuio/netuio_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c
index b2deb10..e2cac3e 100644
--- a/windows/netuio/netuio_dev.c
+++ b/windows/netuio/netuio_dev.c
@@ -172,6 +172,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R
     ULONG next_descriptor = 0;
     ULONG curr_bar = 0;
     ULONG prev_bar = 0;
+    BOOLEAN bar_done = FALSE;
 
    /*
     * ResourcesTranslated report MMIO BARs in the correct order, but their
@@ -197,7 +198,8 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R
     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)) {
+        if (curr_bar == 0 || ((prev_bar & PCI_TYPE_64BIT) && (bar_done))) {
+            bar_done = FALSE;
             continue;
         }
 
@@ -219,6 +221,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R
         ctx->bar[bar_index].virt_addr = MmMapIoSpace(descriptor->u.Memory.Start,
                                                      descriptor->u.Memory.Length,
                                                      MmNonCached);
+        bar_done = TRUE;
         if (ctx->bar[bar_index].virt_addr == NULL) {
             status = STATUS_INSUFFICIENT_RESOURCES;
             goto end;
Hi Pallavi,

In the first place, it was wrong to always test `prev_bar & PCI_TYPE_64BIT`
because only the first BAR slot of a 64-bit BAR contains flags.
The current code has a state to track (curr_bar, prev_bar),
and the fix is complicating it even more without solving the root cause.
I suggest a simpler fix (not tested!)
that eliminates both the incorrectness and the state to maintain:
Thank you for these changes. Will test the patch and let you know.

diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c
index d4662b6..8761d31 100644
--- a/windows/netuio/netuio_dev.c
+++ b/windows/netuio/netuio_dev.c
@@ -273,8 +273,6 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST
Resources, WDFCMRESLIST R
 
     PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor;
     ULONG next_descriptor = 0;
-    ULONG curr_bar = 0;
-    ULONG prev_bar = 0;
 
    /*
     * ResourcesTranslated report MMIO BARs in the correct order, but their
@@ -298,9 +296,9 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST
Resources, WDFCMRESLIST R
     * searching for the next MMIO resource each time.
     */
     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)) {
+        ULONG bar_value = pci_config.u.type0.BaseAddresses[bar_index];
+
+        if (bar_value == 0) {
             continue;
         }
 
@@ -339,6 +337,11 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST
Resources, WDFCMRESLIST R
         }
 
         ctx->dpdk_hw[bar_index].mem.size = ctx->bar[bar_index].size;
+
+        // Skip the next BAR slot used by the current 64-bit address.
+        if (bar_value & PCI_TYPE_64BIT) {
+            bar_index++;
+        }
     } // for bar_index
 end_of_loop:
--------------JRzDHnLrnRXWlj8g9D0OtKAu--