From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0080.outbound.protection.outlook.com [104.47.37.80]) by dpdk.org (Postfix) with ESMTP id 1D1F35A69 for ; Fri, 26 Aug 2016 15:57:55 +0200 (CEST) Received: from BN3PR0301CA0060.namprd03.prod.outlook.com (10.160.152.156) by BY2PR03MB1880.namprd03.prod.outlook.com (10.164.114.20) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 26 Aug 2016 13:57:52 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:195) by BN3PR0301CA0060.outlook.office365.com (2a01:111:e400:401e::28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Fri, 26 Aug 2016 13:57:51 +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 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 26 Aug 2016 13:57:52 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7QDvHpl023630; Fri, 26 Aug 2016 06:57:49 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Fri, 26 Aug 2016 19:26:48 +0530 Message-ID: <1472219823-29486-11-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131166934728085781; (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)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(104016004)(77096005)(8936002)(4326007)(105606002)(229853001)(15650500001)(33646002)(2906002)(92566002)(50226002)(586003)(76176999)(5660300001)(68736007)(50986999)(97736004)(47776003)(8676002)(2950100001)(19580395003)(36756003)(189998001)(2351001)(86362001)(356003)(85426001)(48376002)(81156014)(106466001)(305945005)(110136002)(81166006)(19580405001)(5003940100001)(626004)(7846002)(8666005)(50466002)(87936001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB1880; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:xhpcWjhAICOP4cy1e0cdZIUosCjWg5/n80RkqnTyfbQvdvRPp16hy2x3ITEpb9u+cAyCjZXWiZ6eZcrwu7sQgt6cy5lYjpDZZ7WGIfigRn+ofY/RtyVKc07/VouQ2sd9ROHWfCBmuES+mzBs0UKrmmMIgtLZv2TqWRV+e+eXEL+6LEPQVS84HiA0Ha9tgM12sLyLntlmvy6I7eWB1IMX14C/NylM1G9+b8crI0T9sW8hlna2TCWKtIgI152ib6bs/G68LJ8cFnaEdbGtBOXVYkhzE7yYrryWtA2g9N6mRtJnkKCAvyNRX5pjTscFQ56TE+kd8J7SDUniTprtGCbK3e8fNXeOaBKRPMszkHDyeDJCDXm+MTYa3XKPnenUEaYnvcuqJLIya+DD/gSojbQRV+JsAJtSzkUsr0HLzB16qdgRyy0CzLvzfQiv1/Irfi1fu5SD7Z9TjzRr/mxKn2pYcTrIf19L1kNOWRgeVDLHI42bUW3TGtmfw/LFMArgi1/RjLG9vKgWSmHf9LTMid5lv7zLcdygCHQvSROnXjqmLycPpX5aGISoKFklfg61JI65NoJ26Thvj8Lz0o8UyKGkH+rKXT6wgXCqOehgLrTuBz3Zzvd+KP9Npgr3mMpwK2uMhPkiFJzo2ScgayEPgZ9hsSLxQ7tBDo8Nm/33DTm4f5kCx8sVTnnX7p1DO0uPH8Obycz9NC70KK2jZozrGL0TPpIRiahWdjR33OvKAxWri5w= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3114e644-4d5e-46a7-ce57-08d3cdb8f930 X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB1880; 2:tULtJMqj+L3TgbMedo5vDkHo8fMETqlZJR+mjFy/RBCrLvpRtxNTB0Q2PzJ2n0sYNuGqCna60vgzIzeGnifjtzQYbc4F74ctzcSIkr/b8ybEGH0FPNFuaLOLauMJX8cySHlz+6E96MVPwUMhbpGc0H1DxUpTUK1KfIiGtHZ+KM9aV28gOVL4ssEVg8bxk8gi; 3:Y+B0LlZ6YLJyaO1ODytGKivF1LuBOUyVQ0bcKoP5e2vEU3AA8lLocM/NjqELaE3vZPL1MuAcsB8Pdn/GcmpaJafO8H/j/qRs5GVXJ+tTgcgUXy+ygXZOLvCGUVzU5knr2XBGpUuprZirJ8Vdp/+4UKTFktyXQFvfT3ItuaDlJkWwPHrL+86oGiws/WDCjI4BhqoqtnK5I+SwjmYeunTWS4AePa2OLrIV7G4jLl7zlyg=; 25:eDSo7X0xhx13ELnmBnrHRJ79+4FK6mxPSQmNhm1I+Tc57CYHVv9UpJh9wyMZu6Qxpp+QSW7cbAhhZWOCZzLQCeFzfpPImbeu92n7Mvfp66dCAwbTFCJmO/DSmywjdy+EkFLtFKGqBfACfqKPIKTqWjzbD85OsDSXIyOdviDLqg0clM3lEwjMPSCSAgfxdvNQEEA/RB8UqiFLybl3eSMOX0zfrdt23oXr8EiZVhA0WcpvDsYjBMaNFpIrxjLXGc5lkrBuPlIMbA4gMI12Ob0E6O8DB7ig36D+JurXxnQ8WbXG4zDCg63hw3nx4T+DPWzDwq+Y4LIdSf5Yo62YnBCmp0bm9ErKeG+qtmt+rzHEMgG9KypwCqynQamGsakk0K7iwr+iGTZZTyJoUx+aDHG4kCf8BQvkKRiNfVbT1U5d7i4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB1880; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13023025)(13024025)(13018025)(13017025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR03MB1880; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB1880; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB1880; 4:e2l/BL8liKEhrvgknwKwDumemCRc5SQqA+4QTAqql4lHTUQjtnsIZqeE+vQu8en1QDtB0GI5Og3m3GeVXyOxiyxSo8hCBXKZsEW7VorjYnT3e9vZp35Op+NjaEG2m8FT2TNABS10g9RnQLfU+2GX1hemJY15SpNeda/xsLVOtWJ1P5nnSUsdZy+vSAApWR8ueK2w8AQ8pW56Bsz2g+46b+20tfmAezR+qXHvFtDY7NyiYvh40/E9ziVhaYSzrpO7YlhV0hdwRd0Gtok/l15cGoUn3m4z9M7W+TBlwqszsn4o/XQpnoVjLMLo/b1poM3YFTZvWVta0ctNx2G7KcCtm2Tvx3G0VCVqfv0QZvzu4tP7gNASiV0icL2zpRv6C7xcDXw4lrJV2dqa07OKMngSocCHZHRMGknzwPTuUxDf8e5Suu5GmAd1XQwguKTmMoNMKiHx7N7odOF2ZvdGgUXVtBCQ9vpsoyqRZ1DeTCpIxowXVgnChMEXrdB9koYkIsScDSSj0McKcaJfvBi0IqtdHDjME10l8GSY8YNkQpje2QU= X-Forefront-PRVS: 00462943DE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR03MB1880; 23:9k74dsfmuxDCJ3TNP2a7UnPem15smcvuhdxAda+Yc?= =?us-ascii?Q?MkhTkJ8nU4/3tP0ziBgZS34Pbk76275VMXQpzlVHajbtpLqS9BRANlB0Wrcm?= =?us-ascii?Q?aOuhJBRlFxSKSuWt1IcKN+Cr7dARJ2HjZuXOkhx8GQaK7J8nSeYU0qNgesom?= =?us-ascii?Q?awAhPoj8HnL4+PHYhsq5DrVVbnrtKnZMhN7usBQm7x+P5X7XlfHqUoX0xfVL?= =?us-ascii?Q?tyc5gcVcagzxoOLvI4+mwW/WxJGvBPTvSUyO+ow04lKAfVbnIo40u5NqsRiV?= =?us-ascii?Q?Z5LVGmnnyebFk54kcxWQbowrAJsDaaawAghJQy2kcZcU0SWRG9Ndv88+EvTj?= =?us-ascii?Q?pjqyXLimxjA+nPmQfA1b0XbEjGx4CivO8yrLaY2K+IOJ5zCj5gp0TgDiwInj?= =?us-ascii?Q?Jq8RGxEml9YjX/wulWa/d+GQqKJPiVVytkBYGi18SKrWwfqd/CdVaHzHnKSB?= =?us-ascii?Q?fDzmmeeyBOyvDFYrXEPZYyF3En0gKu9pLERaIY3U5teuQX0DbF0hzFS3eII0?= =?us-ascii?Q?jb9GYcP1fJ1wXe9nfSDgPGXLkFl/dxiG8qwezJJUxaRmXK3LF0879+LRHTx3?= =?us-ascii?Q?MZOaV9/r6OEsq9UiGiMe9fqGU/+gwnUmDRLSLSCtJCSIN22NhDwKm7+1Mp9y?= =?us-ascii?Q?dBO2iDSiG9Y0gdMNrHfE+DiVPkJiKH/t5U8/lZFk/yX/ZpKo6k1i3kksX54D?= =?us-ascii?Q?JogA4gmilDR7E8zQnZDx1nLSj1R5/5cbyI2cqCYYe4f5vjmO/Vi32zJRyxCW?= =?us-ascii?Q?/aIM8nlUWFpzRgN9Q8Zy6TL2fvrP0aK4mls+sHm/4nT+CjSwHnWxwu8rXBhK?= =?us-ascii?Q?8TBYQM022IuXSbtvtHjzoY9HugNqpjxH464IyeTm3kHX0Tmuy6CT2PN0QCZu?= =?us-ascii?Q?GUBQ6DPssi1638xfqcuhgTsi2sKGHlG41rcRBlPwus8C0YCxn1huS5BQWKNJ?= =?us-ascii?Q?O1tI8ExGNx+/6GFLgJTOferSS5M7YYsHKfQ+AStBj2psMHiGtGWXEgUOEY8L?= =?us-ascii?Q?zC12HotAiVgMg3BFzkiZjQ258A577p+THv+x/L78jCglWu0a2/7ucyuv63VX?= =?us-ascii?Q?WpPCvBnu5gig5QQF+oi2939BGmndnUPdAa7MiSBuvk4UkFp16a5IRT7r9LRg?= =?us-ascii?Q?Vt1kFlLWAr5kmWABfLSGRlBbj5yfagKlgAKJ/X+jU1jbBe7cE7wBQzOtEmtq?= =?us-ascii?Q?6boG2jcuqJzjCepHDi2NSyCgG7CsbeOP3gS?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB1880; 5:zz3qSQHKHUnU45xbhOn0fk3ZLJYSb57yF8umOtsNEdRZa8CPAhE21X/0By2bLceMduw/USR2cDjCEk31N92O3xROftWrFf3UmXMQ/ZdwBquzqPP9AEHyzXGEjUHM36HfTgY9CdR2QY89rFqA9Zd/IlaXyKtAhalwZ0c/rhdUvDU=; 24:C5/AFATiuR40h8r7iskO26NFRZhJtoRDQyb2O3OH8FDbjq6jL38yJfqYXXAYRSsdTG/GzC/8wdNizQrTs6UD9zPoXJIwimu82Tvhv+CyeGQ=; 7:sgw4HkDpxmZeYoj5fD0SD7CxRyjP9ipWZw6Jca0voppi2KMhbl1CumFVmxRJNBaY41wPP6fh6EqiqA0NPOmro5Bxh4hJeN9P2jx5zrdORfg56Rl7WmQ+cCH0VoAxLGJ0m3sMU6pMkndVvg8GAasThwrIL1+xZlFfAUoiYY0QcoPa5fZ5kLcP5ZQqaZVdxWPm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 13:57:52.5745 (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: BY2PR03MB1880 Subject: [dpdk-dev] [PATCH v8 10/25] eal/pci: Helpers for device name parsing/update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 13:57:56 -0000 - Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common method, can be used across crypto/net PCI PMDs. - Remove crypto specific routine and fallback to common name function. - Introduce a eal private Update function for PCI device naming. Signed-off-by: David Marchand Signed-off-by: Shreyansh Jain --- lib/librte_cryptodev/rte_cryptodev.c | 27 +++--------------- lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 13 +++++++++ lib/librte_eal/common/include/rte_pci.h | 26 +++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci.c | 13 +++++++++ lib/librte_ether/rte_ethdev.c | 24 +++------------- 6 files changed, 109 insertions(+), 43 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 2a3b649..c81e366 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -365,23 +365,6 @@ rte_cryptodev_pmd_allocate(const char *name, int socket_id) return cryptodev; } -static inline int -rte_cryptodev_create_unique_device_name(char *name, size_t size, - struct rte_pci_device *pci_dev) -{ - int ret; - - if ((name == NULL) || (pci_dev == NULL)) - return -EINVAL; - - ret = snprintf(name, size, "%d:%d.%d", - pci_dev->addr.bus, pci_dev->addr.devid, - pci_dev->addr.function); - if (ret < 0) - return ret; - return 0; -} - int rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev) { @@ -444,9 +427,8 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, if (cryptodrv == NULL) return -ENODEV; - /* Create unique Crypto device name using PCI address */ - rte_cryptodev_create_unique_device_name(cryptodev_name, - sizeof(cryptodev_name), pci_dev); + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name, + sizeof(cryptodev_name)); cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id()); if (cryptodev == NULL) @@ -501,9 +483,8 @@ rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev) if (pci_dev == NULL) return -EINVAL; - /* Create unique device name using PCI address */ - rte_cryptodev_create_unique_device_name(cryptodev_name, - sizeof(cryptodev_name), pci_dev); + rte_eal_pci_device_name(&pci_dev->addr, cryptodev_name, + sizeof(cryptodev_name)); cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name); if (cryptodev == NULL) diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index a73cbb0..1d91c78 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -406,6 +406,55 @@ error: return -1; } +int +pci_update_device(const struct rte_pci_addr *addr) +{ + int fd; + struct pci_conf matches[2]; + struct pci_match_conf match = { + .pc_sel = { + .pc_domain = addr->domain, + .pc_bus = addr->bus, + .pc_dev = addr->devid, + .pc_func = addr->function, + }, + }; + struct pci_conf_io conf_io = { + .pat_buf_len = 0, + .num_patterns = 1, + .patterns = &match, + .match_buf_len = sizeof(matches), + .matches = &matches[0], + }; + + fd = open("/dev/pci", O_RDONLY); + if (fd < 0) { + RTE_LOG(ERR, EAL, "%s(): error opening /dev/pci\n", __func__); + goto error; + } + + if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) { + RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n", + __func__, strerror(errno)); + goto error; + } + + if (conf_io.num_matches != 1) + goto error; + + if (pci_scan_one(fd, &matches[0]) < 0) + goto error; + + close(fd); + + return 0; + +error: + if (fd >= 0) + close(fd); + return -1; +} + /* Read PCI config space. */ int rte_eal_pci_read_config(const struct rte_pci_device *dev, void *buf, size_t len, off_t offset) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index ca1aec6..431d6c2 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -130,6 +130,19 @@ struct rte_pci_driver; struct rte_pci_device; /** + * Update a pci device object by asking the kernel for the latest information. + * + * This function is private to EAL. + * + * @param addr + * The PCI Bus-Device-Function address to look for + * @return + * - 0 on success. + * - negative on error. + */ +int pci_update_device(const struct rte_pci_addr *addr); + +/** * Unbind kernel driver for this device * * This function is private to EAL. diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index cf673e4..8227232 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -82,6 +82,7 @@ extern "C" { #include #include +#include #include TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */ @@ -95,6 +96,7 @@ const char *pci_get_sysfs_path(void); /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */ #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 +#define PCI_PRI_STR_SIZE sizeof("XXXX:XX:XX.X") /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */ #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 @@ -308,6 +310,30 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr) } #undef GET_PCIADDR_FIELD +/** + * Utility function to write a pci device name, this device name can later be + * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_* + * BDF helpers. + * + * @param addr + * The PCI Bus-Device-Function address + * @param output + * The output buffer string + * @param size + * The output buffer size + * @return + * 0 on success, negative on error. + */ +static inline void +rte_eal_pci_device_name(const struct rte_pci_addr *addr, + char *output, size_t size) +{ + RTE_VERIFY(size >= PCI_PRI_STR_SIZE); + RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT, + addr->domain, addr->bus, + addr->devid, addr->function) >= 0); +} + /* Compare two PCI device addresses. */ /** * Utility function to compare two PCI device addresses. diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index f0215ee..62da4d4 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -417,6 +417,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, return 0; } +int +pci_update_device(const struct rte_pci_addr *addr) +{ + char filename[PATH_MAX]; + + snprintf(filename, sizeof(filename), "%s/" PCI_PRI_FMT, + pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid, + addr->function); + + return pci_scan_one(filename, addr->domain, addr->bus, addr->devid, + addr->function); +} + /* * split up a pci address into its constituent parts. */ diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 3bccf20..a1bb043 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -220,20 +220,6 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type) return eth_dev; } -static int -rte_eth_dev_create_unique_device_name(char *name, size_t size, - struct rte_pci_device *pci_dev) -{ - int ret; - - ret = snprintf(name, size, "%d:%d.%d", - pci_dev->addr.bus, pci_dev->addr.devid, - pci_dev->addr.function); - if (ret < 0) - return ret; - return 0; -} - int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) { @@ -257,9 +243,8 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, eth_drv = (struct eth_driver *)pci_drv; - /* Create unique Ethernet device name using PCI address */ - rte_eth_dev_create_unique_device_name(ethdev_name, - sizeof(ethdev_name), pci_dev); + rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, + sizeof(ethdev_name)); eth_dev = rte_eth_dev_allocate(ethdev_name, RTE_ETH_DEV_PCI); if (eth_dev == NULL) @@ -310,9 +295,8 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) if (pci_dev == NULL) return -EINVAL; - /* Create unique Ethernet device name using PCI address */ - rte_eth_dev_create_unique_device_name(ethdev_name, - sizeof(ethdev_name), pci_dev); + rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, + sizeof(ethdev_name)); eth_dev = rte_eth_dev_allocated(ethdev_name); if (eth_dev == NULL) -- 2.7.4