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 15631A0540; Fri, 12 Aug 2022 00:19:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1680406A2; Fri, 12 Aug 2022 00:19:32 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id A41DA40697 for ; Fri, 12 Aug 2022 00:19:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660256371; x=1691792371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H56YNDgHeMC6loQqNVL+lqKqDDPUTr/SbLCUixgCt9o=; b=hh6V5fGwWln8bbs05u+Tx1xxmIU/8n0sfgwJRtrnI4yGHcjIW7NrdU1L otGEXFPokqRgMrZD9AWV5d7tWxcOiK6VGqmiMxFS0+uZ7ad0somp5aYO3 ezQWOmJKVLWB4WPeE5N/Z1e5LzDYAZKQeBMQCbrLckRB+YUWRb5ha/TbC stxmj0QAvquLJjTt0wNPx2v7LGFwowG19mgOo9Rc6wxZPWLPrYumfKhXG 9fEhQm7vjG4U3g/+MSwByeaOJDMutc5yBwltW4ZpR1M1U1niv6meUHScK OW+HwKmMU7loPkLw9mO5JpwelScmOIS9Uffi6W722HrIC2lCKnun25sNm A==; IronPort-Data: A9a23:/KA8Xak5d5z+9O7HXk6BwkXo5gzCJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xIWXTrSbKqNZmf1ft93bI7g8UIBsMWAx9ZnSAVqqys3Ri4T+ZvOCOrCEkqhZCn6wu8v7a5EA 2fyTvGZdJhcoqr0/0/1WlTHhScgjfngqp3UUbaYYX4ZqTdMEXtn01Q78wIAqtYAqcCjBA+Qs s/FrcTaOVu0sxZ5KWt8B5ir8XuDh9yv/mJD1rACTaoT5gWGxyBMVMl3yZyZdBMUfKEFRoZWe M6elNlVzkuBlz8xB9WslKrMc0FiatY+6iDV0hK684D76vRzjnRaPpQTbZLwWm8O49m9pO2d/ f0W3XCGYVxwYvCTwrR1vy5wSEmSNYUekFPOzOPWXca7lyUqeFO1qxli4dpf0ST1NY+bDEkXn cH0JgzhYTiBnefs4pufR9J+h+ozIOy6Oa09oCFJmGSx4fYOGfgvQo3N/8Rd0z5o3poIH/iYZ swFZD4pZxPFC/FNEg5PTs14xr/5wCOmG9FbgAv9Sa4f+2HXyAVv0f7uOdbcf/SLQ9lYmgCTo WeuE2HRWUhFaIfOmWDUmp6qrv7e2nnpXY8VL5jm2MJnhkDU5kFPAjRDADNXptH80CZSQel3J 0EK0iY2oat081akJuQRRDW/umWBsRdEA4AWEeN86QeRx66S6AGcboQZcgN8hBUdnJdebVQXO pWhxbsF2RQHXGWpdE+g IronPort-HdrOrdr: A9a23:4+O2/K6kCPGk13fQ2APXwMvXdLJyesId70hD6qm+c3Jom6uj5q aTdZsgtSMc5Ax8ZJhko6HkBEDiewK6yXcK2/hzAV7KZmCP1VdAbrsSibcKqAeAJ8SRzIFgPO BbGJSWDuebMbEDt7eZ3DWF X-IronPort-AV: E=McAfee;i="6400,9594,10436"; a="317439829" X-IronPort-AV: E=Sophos;i="5.93,231,1654585200"; d="scan'208";a="317439829" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2022 15:19:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,231,1654585200"; d="scan'208";a="605710824" Received: from win-dpdk-pallavi.jf.intel.com (HELO localhost.localdomain) ([10.166.188.111]) by orsmga002.jf.intel.com with ESMTP; 11 Aug 2022 15:19:30 -0700 From: Pallavi Kadam To: dev@dpdk.org Cc: thomas@monjalon.net, ranjit.menon@intel.com, dmitry.kozliuk@gmail.com, Narcisa.Vasile@microsoft.com, roretzla@linux.microsoft.com, qiao.liu@intel.com, pallavi.kadam@intel.com Subject: [dpdk-kmods v2] windows/netuio: fix BAR parsing Date: Thu, 11 Aug 2022 15:17:23 -0700 Message-Id: <20220811221723.2124-1-pallavi.kadam@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220802191058.1779-1-pallavi.kadam@intel.com> References: <20220802191058.1779-1-pallavi.kadam@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Current code was always checking the 'prev_bar & PCI_TYPE_64BIT' though only the first BAR slot of a 64-bit BAR contains flags. Also for certain PCIe devices, BAR values were not continuous. This patch fixes this incorrectness and maps the BAR addresses correctly. Reported-by: Qiao Liu Suggested-by: Dmitry Kozlyuk Signed-off-by: Dmitry Kozlyuk Tested-by: Pallavi Kadam --- windows/netuio/netuio_dev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c index b2deb10..073fac8 100644 --- a/windows/netuio/netuio_dev.c +++ b/windows/netuio/netuio_dev.c @@ -170,8 +170,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 @@ -195,9 +193,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; } @@ -236,6 +234,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 status = STATUS_SUCCESS; -- 2.31.1.windows.1