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 B051EA0540; Tue, 9 Aug 2022 02:33:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 595ED410E5; Tue, 9 Aug 2022 02:33:58 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C803C40143 for ; Tue, 9 Aug 2022 02:33:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660005237; x=1691541237; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=b1UOe0EhgOM/iqUqRvgFU/gLCz9qy3/EItsmEHmq2HA=; b=lRpIrz/wjq9Jp9YUtXAY3EMHYo7W45hrSNEOpsex4Fa3tdpIBKi32dAD bidnN4HbG3ef6hmUke7/jpLiKdWUC910E0eLFCf/U6pNMhlsoA9aT5+Mm Qg9csv7VMBzSeN0nae+aYCWEi+yGjlTg3k2S4S1tZhLfM7d+nYf/P2EFl rzgZJjJ/xMb5/By1Rb+CugDf7eJ8zsWwxZQ+jE7E2Md5SMxnXVZf4vWnw +lQ11yzouelbMXGDsw7eeN0QSINwm2+1L3cB5AOFFgldU/w1OxtJ0PrFt Ge0Ql3QYdQCLpFnbvOJ/o+6B01gC34f7V9DD6iU/q/vC0/2s7hnPM8+ND Q==; IronPort-Data: A9a23:iNTkfKDKIRiXvRVW/2Liw5YqxClBgxIJ4kV8jS/XYbTApGt30jUEn 2IcWjjTaP6MMGD2Kt92Po2+8kwBu5TRmoBgTANkpHpgcSl2pJueD7x1DKtR0wB+jCHnZBs/t 63yv/GZdJhcoln0+Ev1atANilEljf3THdIQMMadZmYrA1cMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMTdJ4RYtWo4vw//F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w zGWp4Y3Y2mAPVmK56VP91xNvdfOla9NS4kD1jiV2gPNJt3cE4l+KSHqondotvaIaA18A== X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="291508977" X-IronPort-AV: E=Sophos;i="5.93,223,1654585200"; d="scan'208,217";a="291508977" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 17:33:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,223,1654585200"; d="scan'208,217";a="608027664" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 08 Aug 2022 17:33:54 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 17:33:54 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX607.amr.corp.intel.com (10.22.229.20) 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 17:33:54 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx609.amr.corp.intel.com (10.22.229.22) 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 17:33:54 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) 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 17:33:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dDlKSWyKVfez1VpodFrSiVZPBtWkzzo9kl58CN5MPO3DWWExhKiVteCodSwicdiaiszh+2GOHdXxgz+9Qq7Wt/TEKNwsLCrUFzgNqcwxDCFsOC+zGG/7qATskmmCGFG10xYCmoh9+aj97svNXCYuNC0qkvwCOBRh0WL59X4wrn4nKKVlnvioXW6b43x0h3emBWwXnXCuEkuQFlwetDpMe/OFLTy3QUcghKqaU+mbcf2QWO3JwiqHTjE96oKC0owJ22J1Y7/oEQPNHzkgjvnjJyRXNZOeCIh5tpOZTByleTJ+3x2ts+wART71kDvcVdOEiBCg/AfOH376xDFZu1skSg== 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=KjqOFpgX+5oEqw99MdGCjil174y/7CxyPg1N7/E018U=; b=jjGbkVgQ243MuOcJXTO30OXbL2sO1IvDwy/ff1RzSv1qSyVtDlfJ8TWws+Qv7A/oZ+4Ck/7WnZv6VRVEkOFah6ZnIJB6p4Ro0bXs51q0Il6XnlYIeAXba1y+SYLKR9r1xzTtuAAnncQ6sL2cLZIwEnlZLkfXKV7LEEnQ+f3/c21EJLB/h/njD8XfGeGoD4cBVSrpiUGyyByBjp35TSlkgf7WMEl/0hbbycGl8FPaNpVKDawrEZ/Dht2TQeYAzVpk06+4sDBLQbw7nIVtOkkxkV/Bn8V9gIsjMs6YgRrFz+IE3S6mXBvM/IrszA40mCBDk8Tb6TismGioVYfId0mV1Q== 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 DM4PR11MB5551.namprd11.prod.outlook.com (2603:10b6:5:392::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Tue, 9 Aug 2022 00:33:52 +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; Tue, 9 Aug 2022 00:33:52 +0000 Content-Type: multipart/alternative; boundary="------------gcgLBw7ggojAkTKCPr4KbP0I" Message-ID: Date: Mon, 8 Aug 2022 17:33:49 -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: BYAPR01CA0054.prod.exchangelabs.com (2603:10b6:a03:94::31) 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: 5c903fbc-fa80-4f7e-4834-08da799ed566 X-MS-TrafficTypeDiagnostic: DM4PR11MB5551:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GqBBVhyOnBiapHQpIQc+gl12Y0mrL5OnPVbRGEjHLdxY0rEwhhtGCuOHY5S+OsD9PxM9mXYHvkrsPCcFQJ/T6y6n0F8WZ6gHsvrKg70xqSUSLcPm1vUzZWnQh/0XmC4KomXDsj/o8G2OtYwCI9bf8NRshZ0QjAMLSQ58ceBFMR7P63/e6emz91X6PSuK3ET37VgVrk5wuqH5oGzZyWaiqk5JMy7y6sfB3/jmFJsqACfrS/20nZ2FWW8UZ+flEY47uVsm+gKOG7KSK07N2zgThqtLYeqxsU0qUDBkf1J3188o70G9UEARpozDtpaGNd6bAQBG+ZlIdIYl/jMETMY4iQhcmGIBgFJZcNHowTripVPSNkgRGD+DGgPyq3uEPtsaw7GZbjZ1k0uIftPK3oRS06Oaq1tLl1DgZDNeZQXt9w4wpBZKUCs//T4oRYTl+48Lv7Q+pb28okn6gYxWG61DkGmXminWtBGjzERUTs1jQ9eZC72iVrwXGNqqQNrjUwFWsn+rrZjvGbjw2kp4eOC4kpQV5LeKnWGlg9GhGa1MVTdHI3UqxnPdlMTn7mBHWE9VV3dRjm6CLHJ5lBAguf9cXwMhYFXHzd2CcO72X9gcDiY7vWkIZLgeHtw2lD2vlQ1HA6X++sxp46l1q4G0kcvIEdtBKSV0GdPmR14pdgAetWwnu7SNJcOZMld31WhNmS4Dr36erQymFur2OEBwKmB2J7nUZJjEZOhy+Psinl8kiEMnIhRQUN2Ou+2p/Yr7w2BZut91LV1wPWKIshX+VPQIzRku+/p8e2T1uA0i2GU1dWAWWG1b0DTqH3O36e9QpMT4GemNHtTJ7vfkTQCcgvhEww== 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)(396003)(366004)(39860400002)(376002)(346002)(136003)(8676002)(8936002)(45080400002)(66556008)(66476007)(36756003)(4326008)(6486002)(478600001)(66946007)(316002)(6916009)(31696002)(5660300002)(31686004)(186003)(86362001)(41300700001)(26005)(6666004)(6512007)(83380400001)(33964004)(53546011)(6506007)(82960400001)(2906002)(38100700002)(107886003)(2616005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData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ejNhenVRcGN2dlVPcGhuekE2VERhRlBJNWs1ZmtR?= =?utf-8?B?WXZOUzFjVGkyd2RGelpPZm1rRkRhZ3E2UjYrS05mVkYyN1NKKzV5dGxnYTkr?= =?utf-8?B?bElMVitBaWlOMjFqRGVKWlJUdlcyTXZHQXk4VlE1Y3hkZFB1Nlo3MTdFVEFO?= =?utf-8?B?cjBzb1RVbWhYOExMczc0U0t3bGRDdGUyM3NQZ2U5eHFqdEErQWw5OGlMYzZ1?= =?utf-8?B?MnZhZFZibVFSbFNhOFhhdkFURUtUdnVJUEhWc1NHOTBwMEl0RDYybzZDWTJi?= =?utf-8?B?a0NMNDdHUDZVUE9maHFBQmRYbGVMMEozWFJnaVlFb0orOFNpT2FoNmhmNHpm?= =?utf-8?B?aTJvcTNUNmViRVY2anN5NFEyc2piUklSYWtEOEtITHF0TUhsanh6S0dmaDBu?= =?utf-8?B?ZkE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5c903fbc-fa80-4f7e-4834-08da799ed566 X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5858.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 00:33:51.9327 (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: xq73h+xv5xOqhDe9bLX9lfn5QORu/kD7N8qpgKw3zoslMRVQacUQkmqIAJN71wfbmLMDcXTt5jfnebLPmNCcTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5551 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 --------------gcgLBw7ggojAkTKCPr4KbP0I 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. This change works for us. Please let me know if you would like to submit this change as a new patch or if I should include it as a v2 of this same patch. > > 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: --------------gcgLBw7ggojAkTKCPr4KbP0I 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. This change works for us.
Please let me know if you would like to submit this change as a new patch or if I should include it as a v2 of this same patch.

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:
--------------gcgLBw7ggojAkTKCPr4KbP0I--