From patchwork Thu Nov 17 05:30:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 17059 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 585D368AB; Thu, 17 Nov 2016 06:29:18 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0056.outbound.protection.outlook.com [104.47.34.56]) by dpdk.org (Postfix) with ESMTP id 35E8E5599 for ; Thu, 17 Nov 2016 06:28:18 +0100 (CET) Received: from BN6PR03CA0066.namprd03.prod.outlook.com (10.173.137.28) 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.707.6; Thu, 17 Nov 2016 05:28:16 +0000 Received: from BL2FFO11FD010.protection.gbl (2a01:111:f400:7c09::184) by BN6PR03CA0066.outlook.office365.com (2603:10b6:404:4c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10 via Frontend Transport; Thu, 17 Nov 2016 05:28:16 +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 BL2FFO11FD010.mail.protection.outlook.com (10.173.161.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.721.5 via Frontend Transport; Thu, 17 Nov 2016 05:28:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:646; 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 uAH5S1pv018741; Wed, 16 Nov 2016 22:28:14 -0700 From: Shreyansh Jain To: CC: , Shreyansh Jain Date: Thu, 17 Nov 2016 11:00:05 +0530 Message-ID: <1479360605-20558-7-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> References: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131238340963488350; (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)(1110001)(1109001)(336004)(339900001)(199003)(189002)(106466001)(8936002)(626004)(50466002)(2351001)(110136003)(2950100002)(36756003)(105606002)(50226002)(81156014)(6916009)(6666003)(8676002)(87936001)(33646002)(81166006)(86362001)(97736004)(4326007)(5003940100001)(48376002)(85426001)(2906002)(104016004)(189998001)(356003)(8666005)(77096005)(47776003)(68736007)(5660300001)(92566002)(305945005)(76176999)(50986999)(7846002)(7059030)(21314002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2469; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD010; 1:2d7P848kFaoyFNYrT17OhehJxd5Cdm6K7KBTg3WvscBhpOgxtcbVzMZZz7fkHel19uHQDYED+QzyuoJ9ue1r7oMHElUXm3WxCq3TvexII6nW9KNBS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c/3DaJnK4zsmnVYnVdahIXsZvg9l4Qd0XjgMOsUzB/g== X-MS-Office365-Filtering-Correlation-Id: d3e72bef-8453-4289-525e-08d40eaa8881 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY4PR03MB2469; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 25:mm4/EPrCJIu6QHd/BeTg6fkaNDfayyuBefwPaKfpRqRbAMaMfCtOyXqA9LRfeZKFphk8O7yjk4J4owg6Ntilab4+c1SacR9ajUeyykdPqBQXcxHi3VdIHeOq/Qn01dO4kHUuF3426ADzl/MGRwmjPQpIqvXT/cryrKkqBzvVB9W/c6ZyV21WIrqvCreTBkhPvRMMuenZD/qHQr2o6AzHHNLaeXsbpf9tUDuST8TOct/pcIMRcvds2kScBDKOclz+1vuPuLC4z7yGE0EwJQJ/S50VmkrV/hbyz3aPIhIXq2aVrvgGWIM0HSGYsdYstw19VTfmPg4jgSjh9BFjV3KxSIBbcuoY2zcuCJEaNWx6CEH8SOHlh4D8XsI8QvAd2ZDVmJiz7PnXOu7L4U8HyfnIO3+dv1sMLMeqFJWRvaQSCQEnjE7HIPOjXnT88y7gkivkZrY9WGJZVtxUZdPgm8zcHSHWgMpiBdQvrk5/m45JSC0MunBInQFtY0+JGTHaA5P+YJBBVWOSCFEyW7hCmBayf3/gWwwqiRbxTtJbuOebhh9QuPWHYX6bixzpB+c+WqTpAqitltj/Jf+WhuxG4GDhQVgi6MY8U+oVfXQTkmbibzY5X8GHhPAUIWVQTDjf5MXXRnyahISHR4JbihpNg0tseLx7JFFHZiujU6048g7xVNJO0Z6GoqdmI5jkhx6TBL7TLUi+zrkLeWKGqFKr4hNRCt4VbmvSX0yyV17SKxAnR4zQXYWgby2CcVaYfePqsLMg6SW0yWBPCMDps9zg9kLwUg== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 31:u/HmfAwUFYcXtsYMvgE1k9I+TN9wYn9fHKURT9XD4iwfZUo9KEm/ml7qeN8q/zKsM9/C9ehY9mopLazKvYXrwE10CvhTI+W7lxEHLcD7pBshXQr4FN8LNIEeAYAy6fIQyagHeL3+vdWsRF2/QwW2o0it+cfmeE+610Zq1grE71AK8rAeDrXHNC5Kxi7F/O6r5miDhebm3gPL4MIWucUhvi7aoO0VPY7oULXTbVP3fNmtIeO8Pkt21dBE0cH6qXyfwwYGh8KkAO/wlhyEW/2U2g==; 4:WFbmuJPRUZEGrvfjxpfC+lnX+sgWIwvd8h2LqFNqXu14B4QSGWkXIQYho/VBFKPSQjz1kxOvg60GaiIdqpg9W5EMPRTgWI9ifPBOv3I0ZJvC2yjfJ77p9EHQOUoY2GKlF62MtVjGMIW2US16CcLdNXuWpi84Ef/hk1VvW/cBB54nZw5gowfhyXWMVAYt7fvlICyrwMZnE1oc7PVCeN4oGgEO9EaHzUVCkBMAz7m/EI1bRb5wTlyIvUYbaVawYRjVJI3XY1++jSm3McI4pVp2JNKsjLhFsX7b5WwPEtHPX5uZI7fCZG9hQ5UNhHfWKs55Mn2So2vwzqr7YrPKIdhnTjWvZV2iQZcuC3Zgx06XUsB/RQ68ZkH2b2lFwCkKjIPOP1TF4YCQy2LQpPGX/kg2bqzangc9RFgzULqvLXpdmV52SScU1ZDAC0krYxx2FxvJsznMqz3I5Hkb9hVOQcpICPnQ7z1+E3mFVClzXDmcBaUXDZ5KM2vO4WPbdIcYbTO39RTFESzOQkHNalBZX6xuaIFnNCIkwHawKvKllSDf+8Riv1uur8BuZu9A2gDAKfQg3g8m0gWb0ngY6ezyJ896NQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095035)(601004)(2401047)(13017025)(13018025)(13023025)(13015025)(8121501046)(13024025)(5005006)(3002001)(10201501046)(6055026)(6096035); SRVR:CY4PR03MB2469; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2469; X-Forefront-PRVS: 01294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puOS3WhSSM2PE7S0StI7vsanoEiU6x0GatqixA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 7:lCuYFAwbSjbKX8dycc51hfU98VRPd9fOvBkOejjtn+nUS7Vt760tJ+wDTSgE3ppE1Kelfg8zEpUOXHDH5mGVN7TPKvhH8Mv5jjv3my2mhP2i801ccvW7agIWtNho3tchb1xLLa9KdGl9lQHywujaSeFArkcIZdrehDIzPeYbozVXpdeQPMgDgJEKBcZ5c6g02dzUADvkz21hKpcImq7HrdNm1jyRLo3LVpXt5rdIbkndIsIBZG1wEHznwHchKhOfSmQTmvMfsweO3Ar7buc5Mf647dej9lfJpdljPwVONZeojrnqzKADCIR4YZ8i6DRfjvGAu+UzUozFHI+rEaIa0Z1qyqIPcSxX9o5okHJ8gEM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 05:28:16.1772 (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] [RFC PATCH 6/6] eal: removing eth_driver 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch demonstrates how eth_driver can be replaced with appropriate changes for rte_xxx_driver from the PMD itself. It uses ixgbe_ethernet as an example. A large set of changes exists in the rte_ethdev.c - primarily because too much PCI centric code (names, assumption of rte_pci_device) still exists in it. Most, except symbol naming, has been changed in this patch. This proposes that: - PMD would declare the rte_xxx_driver. In case of ixgbe, it would be rte_pci_driver. - Probe and remove continue to exists in rte_pci_driver. But, the rte_driver has new hooks for init and uninit. The rationale is that once a ethernet or cryto device is created, the rte_driver->init would be responsible for initializing the device. -- Eth_dev -> rte_driver -> rte_pci_driver | `-> probe/remove `--> init/uninit - necessary changes in the rte_eth_dev have also been done so that it refers to the rte_device and rte_driver rather than rte_xxx_*. This would imply, ethernet device is 'linked' to a rte_device/rte_driver which in turn is a rte_xxx_device/rte_xxx_driver type. - for all operations related to extraction relvant xxx type, container_of would have to be used. Signed-off-by: Shreyansh Jain --- drivers/net/ixgbe/ixgbe_ethdev.c | 49 +++++++++++++++++++++------------------- lib/librte_ether/rte_ethdev.c | 36 +++++++++++++++++------------ lib/librte_ether/rte_ethdev.h | 6 ++--- 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index edc9b22..acead31 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1419,7 +1419,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) return 0; } - pci_dev = eth_dev->pci_dev; + pci_dev = container_of(eth_dev->device, struct rte_pci_device, device); rte_eth_copy_pci_info(eth_dev, pci_dev); @@ -1532,7 +1532,9 @@ static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev) { struct ixgbe_hw *hw; - struct rte_pci_device *pci_dev = eth_dev->pci_dev; + struct rte_pci_device *pci_dev; + + pci_dev = container_of(eth_dev->device, struct rte_pci_device, device); PMD_INIT_FUNC_TRACE(); @@ -1562,32 +1564,33 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev) return 0; } -static struct eth_driver rte_ixgbe_pmd = { - .pci_drv = { - .id_table = pci_id_ixgbe_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | - RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, +static struct rte_pci_driver rte_ixgbe_pci_driver = { + .id_table = pci_id_ixgbe_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | + RTE_PCI_DRV_DETACHABLE, + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + .driver = { + .driver_init_t= eth_ixgbe_dev_init, + .driver_uninit_t= eth_ixgbe_dev_uninit, + .dev_private_size = sizeof(struct ixgbe_adapter), }, - .eth_dev_init = eth_ixgbe_dev_init, - .eth_dev_uninit = eth_ixgbe_dev_uninit, - .dev_private_size = sizeof(struct ixgbe_adapter), }; /* * virtual function driver struct */ -static struct eth_driver rte_ixgbevf_pmd = { - .pci_drv = { - .id_table = pci_id_ixgbevf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, +static struct rte_pci_driver rte_ixgbevf_pci_driver = { + .id_table = pci_id_ixgbevf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + .driver = { + /* rte_driver hooks */ + .init = eth_ixgbevf_dev_init, + .uninit = eth_ixgbevf_dev_uninit, + .dev_private_size = sizeof(struct ixgbe_adapter), }, - .eth_dev_init = eth_ixgbevf_dev_init, - .eth_dev_uninit = eth_ixgbevf_dev_uninit, - .dev_private_size = sizeof(struct ixgbe_adapter), }; static int @@ -7592,7 +7595,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, ixgbevf_dev_interrupt_action(dev); } -RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pci_driver); RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map); -RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pci_driver); RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe_vf, pci_id_ixgbevf_map); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..3535ff4 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -235,13 +235,13 @@ int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { - struct eth_driver *eth_drv; + struct rte_driver *drv; struct rte_eth_dev *eth_dev; char ethdev_name[RTE_ETH_NAME_MAX_LEN]; int diag; - eth_drv = (struct eth_driver *)pci_drv; + drv = pci_drv->driver; rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name)); @@ -252,13 +252,13 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, if (rte_eal_process_type() == RTE_PROC_PRIMARY) { eth_dev->data->dev_private = rte_zmalloc("ethdev private structure", - eth_drv->dev_private_size, + drv->dev_private_size, RTE_CACHE_LINE_SIZE); if (eth_dev->data->dev_private == NULL) rte_panic("Cannot allocate memzone for private port data\n"); } - eth_dev->pci_dev = pci_dev; - eth_dev->driver = eth_drv; + eth_dev->device = pci_dev->device; + eth_dev->driver = drv; eth_dev->data->rx_mbuf_alloc_failed = 0; /* init user callbacks */ @@ -270,7 +270,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, eth_dev->data->mtu = ETHER_MTU; /* Invoke PMD device initialization function */ - diag = (*eth_drv->eth_dev_init)(eth_dev); + diag = (*drv->init)(eth_dev); if (diag == 0) return 0; @@ -287,7 +287,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) { - const struct eth_driver *eth_drv; + const struct rte_driver *drv; struct rte_eth_dev *eth_dev; char ethdev_name[RTE_ETH_NAME_MAX_LEN]; int ret; @@ -302,11 +302,11 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) if (eth_dev == NULL) return -ENODEV; - eth_drv = (const struct eth_driver *)pci_dev->driver; + drv = pci_dev->driver; /* Invoke PMD device uninit function */ - if (*eth_drv->eth_dev_uninit) { - ret = (*eth_drv->eth_dev_uninit)(eth_dev); + if (*drv->uninit) { + ret = (*drv->uninit)(eth_dev); if (ret) return ret; } @@ -317,7 +317,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) if (rte_eal_process_type() == RTE_PROC_PRIMARY) rte_free(eth_dev->data->dev_private); - eth_dev->pci_dev = NULL; + eth_dev->device = NULL; eth_dev->driver = NULL; eth_dev->data = NULL; @@ -1556,7 +1556,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); - dev_info->pci_dev = dev->pci_dev; + dev_info->device = dev->device; dev_info->driver_name = dev->data->drv_name; dev_info->nb_rx_queues = dev->data->nb_rx_queues; dev_info->nb_tx_queues = dev->data->nb_tx_queues; @@ -2537,6 +2537,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) { uint32_t vec; struct rte_eth_dev *dev; + struct rte_pci_device *pci_dev; struct rte_intr_handle *intr_handle; uint16_t qid; int rc; @@ -2544,6 +2545,10 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; + /* TODO intr_handle is currently in rte_pci_device; + * Below is incorrect until that time + */ + pci_dev = container_of(dev->device, struct rte_pci_device, device); intr_handle = &dev->pci_dev->intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); @@ -2572,7 +2577,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, const struct rte_memzone *mz; snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - dev->driver->pci_drv.driver.name, ring_name, + dev->driver->name, ring_name, dev->data->port_id, queue_id); mz = rte_memzone_lookup(z_name); @@ -2593,6 +2598,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, { uint32_t vec; struct rte_eth_dev *dev; + struct rte_pci_device *pci_dev; struct rte_intr_handle *intr_handle; int rc; @@ -2604,7 +2610,9 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, return -EINVAL; } - intr_handle = &dev->pci_dev->intr_handle; + /* TODO; Until intr_handle is available in rte_device, below is incorrect */ + pci_dev = container_of(dev->device, struct rte_pci_device, device); + intr_handle = &pci_dev->intr_handle; if (!intr_handle->intr_vec) { RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); return -EPERM; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 38641e8..2b1d826 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -876,7 +876,7 @@ struct rte_eth_conf { * Ethernet device information */ struct rte_eth_dev_info { - struct rte_pci_device *pci_dev; /**< Device PCI information. */ + struct rte_device *device; /**< Device PCI information. */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. Use if_indextoname() to translate into an interface name. */ @@ -1623,9 +1623,9 @@ struct rte_eth_dev { eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */ eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */ struct rte_eth_dev_data *data; /**< Pointer to device data */ - const struct eth_driver *driver;/**< Driver for this device */ + const struct rte_driver *driver;/**< Driver for this device */ const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ - struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ + struct rte_device *device; /**< Device instance */ /** User application callbacks for NIC interrupts */ struct rte_eth_dev_cb_list link_intr_cbs; /**