From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0047.outbound.protection.outlook.com [104.47.40.47]) by dpdk.org (Postfix) with ESMTP id 8929D4CC5 for ; Tue, 13 Dec 2016 14:35:11 +0100 (CET) Received: from BN6PR03CA0070.namprd03.prod.outlook.com (10.173.137.32) by CY4PR03MB2469.namprd03.prod.outlook.com (10.168.163.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Tue, 13 Dec 2016 13:35:10 +0000 Received: from BL2FFO11FD034.protection.gbl (2a01:111:f400:7c09::160) by BN6PR03CA0070.outlook.office365.com (2603:10b6:404:4c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8 via Frontend Transport; Tue, 13 Dec 2016 13:35:09 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD034.mail.protection.outlook.com (10.173.161.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.761.6 via Frontend Transport; Tue, 13 Dec 2016 13:35:09 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:832; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uBDDYRwD005048; Tue, 13 Dec 2016 06:35:06 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 13 Dec 2016 19:07:09 +0530 Message-ID: <1481636232-2300-10-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> References: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131261097094937144; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39380400002)(39850400002)(39400400002)(39840400002)(39450400003)(39410400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(77096006)(38730400001)(50986999)(76176999)(50226002)(105606002)(5660300001)(8936002)(92566002)(68736007)(48376002)(106466001)(81166006)(5003940100001)(33646002)(81156014)(626004)(2950100002)(8676002)(50466002)(97736004)(85426001)(36756003)(5001770100001)(2906002)(8666005)(189998001)(4326007)(305945005)(356003)(104016004)(575784001)(47776003)(86362001)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2469; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD034; 1:ZEm6ejD/j15oU8ujA56ldshDNUz92SM1WXiKNXEj8rjQAZPVaAwng62akGVr4cTJ4QUrQubfq85Pb3UA8fQCaZ9sjMwSinU5V0+aivMF9HaW9B56BvQeKoSqp7dhcIV6T3vJ5DLJoQDJCY2fWy+gFVfGBulEXm8pHcYb5vavpRvkjZ/PGVIBbHVp/lTMgQDb3pPTOvMd9jqtZJE0UD8Iq1i/3RHP97i8tCf1jP87aZV5bMI1QXtwoHwV5WybSQ0+NxW63EB2Vs20xyRXDx1CM9YCslZK1g0UT6+i1TBj5+lqBWqhVYIZM6SXlyrUe2M5HMX3ILDpUQnSmipCZm72UsdC6gGoPPIxZPPpqp9JyJQLVjIxwtJ1LsLXMtDifpDG7ieCR9VXIS3+ZZe2OjRSdozUU+7vmIoIUhwsDkrGdAHhUR/koR8RG1R8J6QQMtFMyQYWcm2/ICgNMghdNRoEhE8TOXF6z0firjbkuVN+d+w+6qQKJ1qhoynUNfqZhVz/BoPW/yyAAfSSmH/TEklIz+RqjEfd86q3TNUaUysGMls0j1rv9MCg9cpdgxoumelBZIStgwCD2I5YbSa1jkkxYcxuDW5ABqtThVXv4V4EmxqUYVndzZmvRjsb7VoAoHfpcP+/bmGcP/WMvGj+8KTezr8RxQk8mhPuFB0ac6Sgx4TocFUFK5bd0BDu4jQfYMNsNsuU4/76DPdf9XDRitULYLMVoaM3Znhl3JKVHBlWeZlocdFnGFKrF5oKMtTOM6UxlfHBWGYopqoAh07WdJ/V1Q== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 13297bc5-1028-4237-98d7-08d4235cdba0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2469; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 3:oxkY5uPozBNb5V1pLgqmk4wlwDb9Ohlo3PvvN0VHp0SiTeEE4cl1syz3leGGtMMA+SaHmGfSTTOlsC0EZ9YmktJ2iMF8EQgpYQ8w/nrUhSYVUkQTJZ8rDVA4kGXXFyZ1dasZozfIKn2baUU2oncgWLf5av0on8npdZF/Cz2Ai9aId7boaD/FnS9It2tZDrYxXoyGF8gHCnkAbd+uKFR7wOgTud4qpRZvxqodHV5tC6oDz+xlp6kBW9z/psDhb4BKqUbnaRqEsP/nq6JRLBXSVf5/PK/WXML9HSyDp5i9nEZQoRbtF9n4UtwI8vncx4lPakjFU676RXCjE3qNRu4Jac3CKzStAUMchqdMGic/DYxUjUPUPXSIjErdYYWkyazw X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 25:h8zBEE1PP7WQeBSmPkRpfBdopSva1Y6r2V2FlQMl6HmciaWpSwAyaNhxF+RxMShmzCAQ4WHk8Xpv6CqGjJxQ2+H1HWM0qnNMPOPcWuNKn7y5ewiMGYvtE6UUW13Uf4Fe2lMWwYa8EAay7rpUD7SLjFWlaD8LW+llrD9COuGI/5bXmUifdtkBM5Z+55NgbfarOa5lHsb8caFIk2KtVip4vr1HAdEsSqqBIYU2oL/fWZ67XUWhNjdowyZMqQB4oaN8bdiK3iHCZJcXuagk94knhSpUpIxaiJWwFpBDh/9F5AHnc1MKUx8rrmEkrXVSSUmnVaDQbcW+v4oxYAsf/idcw3IRMkOvxeULuaoPyofxilD4Qzx0LGBCayr8vLkUR0zKk5ZUkWxnBIO2nWUjLjVbE3ZQRtZCJbufNKwBwvlwudsUf7Ikxdr1NUPga0t7Yo+IOepYq42oxM2E7LV6azpVmYt3P6uqANTDPCZxhe5rIJCWVHhXTP7BuVyck7HUhiB86Ejp6fi359Vm8UHf8z0WOJ0SGxLezeGFCSI8fq6q8wbUV4Js880WzpNPL+2YhZkBJw+uQG0t/BNKeJNt+tYUlnetoN2SDwVjA50nQn92DbHrceK5GCVQO8yYrRtDF8T7TG7VAArBjDkQRnzsvECqs3IU8QcwPIVLhUOiCUcs4XUqkZuEDrb8HNOXguaSiqceoohodO/nzjTB6MYfPzX2lsaNT4TBtZXFEfnZhuPdlCpyA7A7/Zyir2OovyGWVjYMshN9JoRmj643romg8qrhwOnstz5c/KpDd48XIKyon3E= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 31:mEMVeJ8f1P7a5SGI9z8t8EPZWPgpX/YZyxnX//Z30z8xlY1Y4rNrK37JHRt/mV6RcNRfKnwL96SdZyRijBlcmvW+VUIXsEl5SI9SSE0CgSdrWzbeJQT8g7R4QCSsRSlf4dXvDt09RTK8v2Y7tNjYuoSGShNJNPrUFFDirs96AKNUPQky41Urfv3JhCQO3OIUrD36cbtPnp1LNLYQwNkprribN43H0mbWumgLrWUbq0ohKj4mvaLsOlsCbGDKymr03/Hr0fE50StHIpAfebTChg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13015025)(13017025)(13018025)(13023025)(13024025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559025)(20161123561025)(20161123556025); SRVR:CY4PR03MB2469; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2469; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 4:hQAvRkzq13MZhtvdLIYJR0ZeNe27DJMId8mA0VMHnzX5E+ef38r1yJQ5hvYNLDiPRjAuNElSzOWt1XxM2MmW5FfGCjnGKusfp6gADHLzqdwvka9y5UIiL56uEyl2I8sfrtuMQa4Cduo827RcoJFk9ngGkXX1QI/dgPmQoOKRLCsd7EHWrmBp0MjxyEmdfox/iM5FVKHfgXIminWQHzxP5uTZ6OwKEZOXStEEQ0qAwYMuaJc5y/y0S/9ppC9qxIcWajdvwmmCqLOailX+HqNdCM+9wb2dKdZf9Ti1Zot3FQxOvH5PfDhOaZXcuGxoRwTGWUcoPJXmItkHtRQ9nC05aVcQeQ4OktMaxwydb4Gt6vinJiL2VeQSFjlMWN57ozP32J3t52BDN5YbllovVdE563BZEve4i18Oe4MTiSmLRvfnlYXwX5/w60kR4PaPKIAD7hgzGI21rll/FRWCUrGyBMyIUqP3/BPPoibgxTSobrYLAmvq1yaJ60U57ZaW1/WHpwbO1uh1TFYF9trNKZlVcSSilIc1S38rOhUFlwsyvDBw4hrdAJ7BbCDdXtCH8s1Nfv8PheQrLmurhcppu77uX4K8W/zzI54Cl5uyx6uCbZgkKO5sCSEhUCo0jj7cscIWEXt3D29Y9SYdcGjhxVmu6R2LH2568GjgW/9OGJoqb6hMSjr4RrI1BY3ykEVoYIVVUCCHu0tnTR+PiI77yXG3jcI7u9yESBFBS/gj2B8dL/RNFIxw54MJMZjz/9D15NAG X-Forefront-PRVS: 01559F388D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2469; 23:VGcCiwtZDz6VQ8ItXm73g6h2mtcF9elrpvaJvntfb?= =?us-ascii?Q?cC63rJghOzuaVVL3jBa2pCI3NAtAa2JQ9xU7QTfccSVUtAzFUo4AxGA62WgQ?= =?us-ascii?Q?kTd+ngKpWyRtb5D+V7/+gmrjcyS/Lm7sqAQCBcMraALWVPZxRfILJMPVRRAj?= =?us-ascii?Q?8j19DEYz1GXUZh91k4ZiS9SouJM0Tz8SyGJpKIlEaXVdBhnZ2MsGCTPuGQLW?= =?us-ascii?Q?0ugJcmgtYr5e8fV+lVh8RBMZK3A4WmFNQQUUvR5D5pgnoeUzlZrBZEs4v6NL?= =?us-ascii?Q?Al9cH4i8Q3rl7j+L5qoWud9bj4oy5dub46f9vxholNy47XnBkudD7nMkQdOn?= =?us-ascii?Q?Bek9kFPmqVTLTnkur0TV/ldzfL5GenhdO4CcB6QfIFArJf4xFIgOdZfXaW/N?= =?us-ascii?Q?J2AEl0/iCIt4KSzSbbPU7wroPlecrTwWmR0y11nMyFxA4s0GjkFReJWHEaS4?= =?us-ascii?Q?5oT6pHw61ZqE4FvLAIyyo9I8t8jKv9GzHBuX3s6mckjjXMN5iL21N/kR7YSi?= =?us-ascii?Q?r8d3tE7zBA5dVGTlTzbDR0TK6U3225Os8ifdIl3Ggz/2+587AzIGyp9Fu1e6?= =?us-ascii?Q?t5iRE5zkysTrzjb491eIb0Tm9VyPf7NgGMW84RHj2yE1Ivnkt1cDaNI8eovu?= =?us-ascii?Q?ehceeSmSdq9bs3i0zUQvMW1lnN7Prjq7u7SjuWLOHpNtJ0rhFpHmWQeF8McN?= =?us-ascii?Q?tFTUguB2AphhN8dIt2pZJlY4hxbQav2ibGmQOuFAkHss5PF2YJsr3kaT72hn?= =?us-ascii?Q?6lsxbOavrDWnl7yEj1LKDmXmjmOJUWQBUqgiXyD7dAG1jI9aDvUveAI8YMYX?= =?us-ascii?Q?+mA/pXv3N0GOzDi3HqqyMVi0MvToGeNrS1688QVt0s+KRHErQU8zHPEM0TAq?= =?us-ascii?Q?NkLN1sUFusxqBUilOzJ4sVixAKDtarPFD6nlp6dIKYWHgkWY+0JvOff4QbUi?= =?us-ascii?Q?iZO/63LL7z8hnpUqGmp5rAOgdkPgP33iCoKot3KOAsuFCHUuMvTLGhCv4HRc?= =?us-ascii?Q?c3WtunWuK8oLyz/ef3nXS6lV8Z/sZnQ577ttD5GCpRQFr3F3DT3dWkxtDe0P?= =?us-ascii?Q?kZ7qVdqrsoQQ6fXLgWN54e8Ov+dowdLdkvMfrBqddFkd6X8MdhjxcWPJITdG?= =?us-ascii?Q?TAFnY5qhKkGxjS17b57dQLpp0QRzXjJ8V09Z4kNraLbGSkbv2fi97g/mblc9?= =?us-ascii?Q?OL/kcudPeXkaJSNrsRqmI36GggdnJLpByd+lZmA2zTRlF3ucMJBoi+4FALIV?= =?us-ascii?Q?wg1s0hgsZaLEgVuO+qXFIiDq5ENaervbWZYyAeAdhNjmUZh6r2VYUYKhLcmz?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 6:UVlRp6yBzG8NpZxKmmq3WD8DTM6lj5SN/CGJe9IJMhntmw0EoSc2+aMeq4Dz9/Do+jaLDbDeO/7ci5pxwaTeXiGao5wmkRhxQU7I5nDrodukRMk3mu1AAglRk/9tfNTnrwCeReZRVzTZUK90/V3LjKOANqtqIoS0r+hp9y6yRneVmegMmyf3sNU+R/dQpdP0p6s5oHj1rr9yT6QtURo6X/EY3drbVauesICj4YF7/1+zvyN60siymYAUlY4CzGsroCwRjM37HQauuPhXjm9ARlg/+qagKAHXWahwca6E5uyylhPT6fQl8rjOTTNsh7FKTONOfZGYAs8tYAjjVNxowq1GilRRI52G4juK3e5qrx85/X8pEEcXHm7k07rYn7a26kuOODaw00EqvO+p3ji+x/JUx6veZsvzAfRKym9xYBKIPhkQnF6Dc3wUQw67Pdmb; 5:iAcx1ipq2iGX7/EF3za7KUjQiCXJE9IzVQXt2Ieyn4fwOsVZAQPT16DAWZGO/FuMUlpFT0tFG+f8l7+KpWWnD5QhU7OzkM2svucPwMfEP8DuQD/7TRSXT45TwAHUu75EbULTFryyUTjNcJ7ETBbO/682yfafyhe+/N+6D42pf+9oFCtBX5WsG6HJ4EhE+jmG; 24:R/8nWsSXUtmtOX/1lmyvI/Ng+R3Zhy2q4/8UgoxncpeTuq8xckFSIGK4BiD1O/MFVVWd6uFFcaC995SVpXI24kM6qvcrHaboZAwP4RWPSdM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 7:DTcTQ5Noxw0BrtfUQB3caeMpDn++1DmNNjW7B8U92/mqVS4mkzsYdkK1Ei4SaaKQwhIS0Wd6uQn5htCh12RAOR4OJ+LQQUvaDWKnpGwf2VRl34b1e3xw/qs9RKcm5dSJZdpQmvn5/83LsCzdgWHHNkBaJg+t+7rwXQEExPddWF13sX/sc5fhiu5Z7iURjUjziAT2pAyPLJ6g485a5gGY+wpazgX1E7VEM8cm//cIpGGNY2eOuQoTC/JSIrTN2LXUxXzfu1TIFdVnDYB2q2GV+3OU5Yk7iPhnRw8c+AoVZyP1hpMJQLI3SNmLhVk2FLOyqXoXVqCW2HYniqQj2yZ4MeWf6pFcUbwHeOqEpC3f//6MGORe+0qX3y9wFwNVjb6MYJXHuvFMBxOI5CiCvpMqCaCb+TcLgu/HrT+3CrJcPUJ1URInwqnRAoHcpFWwnWuleDu93QzZearIBdAVD8d8EQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 13:35:09.1349 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2469 Subject: [dpdk-dev] [PATCH v2 09/12] eal/pci: generalize args of PCI scan/match towards RTE device/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: , X-List-Received-Date: Tue, 13 Dec 2016 13:35:12 -0000 PCI scan and match now work on rte_device/rte_driver rather than PCI specific objects. These functions can now be plugged to the generic bus callbacks for scanning and matching devices/drivers. Signed-off-by: Shreyansh Jain --- app/test/test_pci.c | 2 +- lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++-- lib/librte_eal/common/eal_common_pci.c | 28 +++++++++++++++++++++------- lib/librte_eal/common/include/rte_pci.h | 17 ++++++++++------- lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++-- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/app/test/test_pci.c b/app/test/test_pci.c index cda186d..f9b84db 100644 --- a/app/test/test_pci.c +++ b/app/test/test_pci.c @@ -180,7 +180,7 @@ test_pci_setup(void) TAILQ_INSERT_TAIL(&real_pci_device_list, dev, next); } - ret = rte_eal_pci_scan(); + ret = rte_eal_pci_scan(NULL); TEST_ASSERT_SUCCESS(ret, "failed to scan PCI bus"); rte_eal_pci_dump(stdout); diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index 8b3ed88..10b234e 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -361,7 +361,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf) * list. Call pci_scan_one() for each pci entry found. */ int -rte_eal_pci_scan(void) +rte_eal_pci_scan(struct rte_bus *bus __rte_unused) { int fd; unsigned dev_count = 0; @@ -676,7 +676,7 @@ rte_eal_pci_init(void) if (internal_config.no_pci) return 0; - if (rte_eal_pci_scan() < 0) { + if (rte_eal_pci_scan(NULL) < 0) { RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__); return -1; } diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 706f91c..562c0fd 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -153,17 +153,22 @@ pci_unmap_resource(void *requested_addr, size_t size) } int -rte_eal_pci_match(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +rte_eal_pci_match(struct rte_driver *drv, + struct rte_device *dev) { int match = 1; const struct rte_pci_id *id_table; + struct rte_pci_driver *pci_drv; + struct rte_pci_device *pci_dev; - if (!pci_drv || !pci_dev || !pci_drv->id_table) { - RTE_LOG(DEBUG, EAL, "Invalid PCI Driver object\n"); + if (!drv || !dev) { + RTE_LOG(DEBUG, EAL, "Invalid Device/Driver\n"); return -1; } + pci_drv = container_of(drv, struct rte_pci_driver, driver); + pci_dev = container_of(dev, struct rte_pci_device, device); + for (id_table = pci_drv->id_table; id_table->vendor_id != 0; id_table++) { /* check if device's identifiers match the driver's ones */ @@ -201,11 +206,15 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev) { int ret; + struct rte_driver *driver; + struct rte_device *device; struct rte_pci_addr *loc; if ((dr == NULL) || (dev == NULL)) return -EINVAL; + driver = &dr->driver; + device = &dev->device; loc = &dev->addr; RTE_LOG(INFO, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n", @@ -222,11 +231,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, } /* The device is not blacklisted; Check if driver supports it */ - ret = rte_eal_pci_match(dr, dev); + ret = rte_eal_pci_match(driver, device); if (ret) { /* Match of device and driver failed */ RTE_LOG(DEBUG, EAL, "Driver (%s) doesn't match the device\n", - dr->driver.name); + driver->name); return 1; } @@ -268,12 +277,17 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr, struct rte_pci_device *dev) { int ret; + struct rte_driver *driver = NULL; + struct rte_device *device; struct rte_pci_addr *loc; if ((dr == NULL) || (dev == NULL)) return -EINVAL; - ret = rte_eal_pci_match(dr, dev); + driver = &(dr->driver); + device = &(dev->device); + + ret = rte_eal_pci_match(driver, device); if (ret) { /* Device and driver don't match */ return 1; diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index c9b113d..10108a4 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -363,25 +363,28 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, * Scan the content of the PCI bus, and the devices in the devices * list * + * @param bus + * Reference to the PCI bus + * * @return * 0 on success, negative on error */ -int rte_eal_pci_scan(void); +int rte_eal_pci_scan(struct rte_bus *bus); /** * Match the PCI Driver and Device using the ID Table * - * @param pci_drv - * PCI driver from which ID table would be extracted - * @param pci_dev - * PCI device to match against the driver + * @param drv + * driver from which ID table would be extracted + * @param dev + * device to match against the driver * @return * 0 for successful match * !0 for unsuccessful match */ int -rte_eal_pci_match(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev); +rte_eal_pci_match(struct rte_driver *drv, + struct rte_device *dev); /** * Probe the PCI bus for registered drivers. diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 876ba38..bafb7fb 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -485,7 +485,7 @@ parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain, * list */ int -rte_eal_pci_scan(void) +rte_eal_pci_scan(struct rte_bus *bus_p __rte_unused) { struct dirent *e; DIR *dir; @@ -763,7 +763,7 @@ rte_eal_pci_init(void) if (internal_config.no_pci) return 0; - if (rte_eal_pci_scan() < 0) { + if (rte_eal_pci_scan(NULL) < 0) { RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__); return -1; } -- 2.7.4