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 2287742BE2; Tue, 30 May 2023 13:48:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0E3040A82; Tue, 30 May 2023 13:48:52 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2071.outbound.protection.outlook.com [40.107.244.71]) by mails.dpdk.org (Postfix) with ESMTP id C9C76406BC; Tue, 30 May 2023 13:48:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljSpqqgm/ER7ORsUewzfzCEjAWkdk3izDSHycZkcW6q94AGL7Sj7HDNDL79rBsCjAHVMp1WAOpdK+uUqei3xaCnUd06djG3rGwOn2gEhaTrkS/m35mwhWGysXEq0SbKSXcT//VhIQtRpuVXyWip31w0+I7GpEkgRvP6Ia0TmGgzxSrsjNotSDucmli/vIeNO6VuuFVHbuVrXmPntMQ9FmcfBJdopV5CTVMSHyqV6G6vKvQD5CfhjqanYCi14qje+RBL/OJT4XlGlI5Y8FCa9bLBmm/ZyY9OPScIBpHlq00WTXQqBt5INmYwETcqe6gnsRjBRbsHkfv9lwqaNGSk6Gg== 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=X7knUDpWcBg4o6mr5ed1HZSOl59YNFqjLFYevvmH/Ww=; b=crLB2BCzgxL40kDg/oYUoZ590qdYkNThy89C5etWBlnn2p6Cn6WRRc2bkZSYjSBqy1tesZOMP16wwwV0KEtYfAsEinFcYluyn8GJ7+mJwIIx4Ec29CMBErWrVEh+JTu8fK7CLWlx7zVB8QzwW0si9TpuAVJff7es/tYyQfrqgVcdluTYGjC/W8OngYSF/9QDf4a/J9WX4an0hLvihkB0TNTmkDXoZLnrl+CSP4CUPfCFrDOB4+GLi4z/vbfF/5A1OmF6DlWHe6KD6jyEd5n1Csm2djR1KjOgLoNaERnki0ons4bRKecYvFjloNNxkZkhTop/m4x0qjVNpdCb0bmwIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X7knUDpWcBg4o6mr5ed1HZSOl59YNFqjLFYevvmH/Ww=; b=rE6f4Ni7ZJrr4Ml1n4nFiSue/YA0fzuyFVEuDBzbjX31Phxts7SnIei55YhmsAfJh6oZ1Q0o9qAImqNym9yJm3CkJZJl8fUGCOhzggfVR4rvHEpv+hJ4XHZ258HFbtuzeMDKN22vCd/PeN5UkZ2A+hBZMLR3lGpG9R1DdXi1nvz5p7PUesHmCR8xzLy+9+qVAsAN1MkEdu7tm2MHR+BLuX5PRxdP1b8ElJyu+MHPUR5J0XKQqtgEOSAMxRUPSJorODMsZnfkU2ruFogJNgsCuWC39yhEhx+kykrCfCX5HMuW3XH7VJfS6JR+5wJsun16xy0Kg/7f9+dySvs6fXFIBA== Received: from BN0PR02CA0012.namprd02.prod.outlook.com (2603:10b6:408:e4::17) by MW4PR12MB6949.namprd12.prod.outlook.com (2603:10b6:303:208::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Tue, 30 May 2023 11:48:49 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e4:cafe::c0) by BN0PR02CA0012.outlook.office365.com (2603:10b6:408:e4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23 via Frontend Transport; Tue, 30 May 2023 11:48:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.21 via Frontend Transport; Tue, 30 May 2023 11:48:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 30 May 2023 04:48:37 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 30 May 2023 04:48:36 -0700 From: To: CC: , , , , Elena Agostini Subject: [PATCH v1] bus/pci: get PCI address from rte_device Date: Tue, 30 May 2023 11:42:02 +0000 Message-ID: <20230530114202.850814-1-eagostini@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|MW4PR12MB6949:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ed6554d-517b-4fd6-f58a-08db6103d53b X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f58qjGqEpcQNdLFSGYeNiagyQyZYCJB7o4S0cBz79vBv+Rx2vaub40ck6sQ495om0i39Vn64Mf30QLyIWLGYjbD/kP/XkJqSr2z9xFXrAa4aMwtO/QfqHs7a2rF8j9of+oLR7igs1tu5HbigvFm/9aBKMf7sD5NwjBNUCUTSxkdZ2g3t1WIz0jmIwMpkSN1A3nWhYaOuqdXoDKnZycMIihMmy+pokLx8QSNQBxKbPF9VqhprgAZ+u+15KIIuUM/rg2ha+KIcZeubZemKVznlkryZQ3XmOOG+Js2KZ5z7xBPTNuW8pIXsMt3XzYh5omsZELX+7cQvGll+X/VRtd8dJUQnzdDb9kt8R4Lm8jZwdmdo7Aen8iQ8z11Bxs2A1mpgAkzJkJeF7Pj7SSApXrHXYEj6CaxqIiWwqUooNxVb5aY07aLrRGmiGpZHjms12LU4p1kAsfvqSP5I9UUC+cwP7lDBedkyZvUaQcnZrjiyP/qwyuAH/AR8hn34lvWRQJN3FnWTQRn+76+aSyeFsPCqwRbHM/Yhm8OWn6TsV959AMi7wzlQU/yXsAxk39BsJoKKPpAEYCFVAXCUrG6Utpz93N/N1jDczlXs2VsPA2naX+UyqfIhBFWhzD+0rx70T+yLjva/tOriF2Vg+AWM0VmJ5moVMvFJwjzqMmRZYumKF06KofTFRL46hT5EmDxXzVDgkmv1JtXydzqKXPIGzhTtc3IHV6ZGnJq7rwRpQHoEWAfR7vQo90TjTguoDsppyjih X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(54906003)(478600001)(40460700003)(8676002)(8936002)(5660300002)(2906002)(2876002)(36756003)(82310400005)(86362001)(82740400003)(7636003)(6916009)(4326008)(70206006)(70586007)(356005)(316002)(55016003)(40480700001)(41300700001)(107886003)(36860700001)(26005)(1076003)(336012)(426003)(186003)(6286002)(16526019)(83380400001)(47076005)(2616005)(6666004)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2023 11:48:49.1454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ed6554d-517b-4fd6-f58a-08db6103d53b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6949 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 From: Elena Agostini In DPDK 22.11 pci bus related structure have been hidden internally so the application doesn't have a direct access to those info anymore. This patch introduces a get function to retrieve a PCI address from an rte_device handler. Signed-off-by: Elena Agostini --- drivers/bus/pci/pci_common.c | 15 +++++++++++++++ drivers/bus/pci/rte_bus_pci.h | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index e32a9d517a..9ab5256543 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -884,6 +884,21 @@ rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) return 0; } +const struct rte_pci_addr * +rte_pci_get_addr(const struct rte_device *dev) +{ + const struct rte_pci_device *pci_dev; + + if (!dev) { + rte_errno = EINVAL; + return NULL; + } + + pci_dev = RTE_DEV_TO_PCI_CONST(dev); + + return &pci_dev->addr; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index b193114fe5..e18ddb7fd7 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -68,6 +68,19 @@ void rte_pci_unmap_device(struct rte_pci_device *dev); */ void rte_pci_dump(FILE *f); +/** + * Return PCI device address of an rte_device + * + * @param dev + * A pointer to a rte_device structure describing the device + * to use + * + * @return + * PCI address of the device on success, NULL if no driver + * is found for the device. + */ +const struct rte_pci_addr * rte_pci_get_addr(const struct rte_device *dev); + /** * Find device's extended PCI capability. * -- 2.34.1