From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0060.outbound.protection.outlook.com [104.47.41.60]) by dpdk.org (Postfix) with ESMTP id 6C3155587 for ; Fri, 18 Nov 2016 14:03:06 +0100 (CET) Received: from BN3PR0301CA0067.namprd03.prod.outlook.com (10.160.152.163) by CY4PR03MB2471.namprd03.prod.outlook.com (10.168.165.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Fri, 18 Nov 2016 13:03:05 +0000 Received: from BL2FFO11FD013.protection.gbl (2a01:111:f400:7c09::167) by BN3PR0301CA0067.outlook.office365.com (2a01:111:e400:401e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8 via Frontend Transport; Fri, 18 Nov 2016 13:03:04 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=fail action=none header.from=nxp.com; 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 BL2FFO11FD013.mail.protection.outlook.com (10.173.160.221) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.721.5 via Frontend Transport; Fri, 18 Nov 2016 13:03:04 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:993; Count:14 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uAID31Kc002798; Fri, 18 Nov 2016 06:03:01 -0700 From: Shreyansh Jain To: Jan Blunck References: <1479360605-20558-1-git-send-email-shreyansh.jain@nxp.com> <1479360605-20558-7-git-send-email-shreyansh.jain@nxp.com> X-Mozilla-News-Host: news://news.gmane.org CC: David Marchand , Message-ID: Date: Fri, 18 Nov 2016 18:35:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-IncomingHeaderCount: 14 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131239477842514100; (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)(339900001)(336004)(199003)(54094003)(189002)(377454003)(24454002)(4001350100001)(8676002)(77096005)(47776003)(92566002)(31686004)(8936002)(305945005)(31696002)(2906002)(76176999)(626004)(64126003)(4326007)(54356999)(38730400001)(7846002)(50986999)(81156014)(356003)(81166006)(104016004)(189998001)(105606002)(6666003)(229853002)(65826007)(97736004)(65956001)(87936001)(85426001)(65806001)(110136003)(68736007)(230700001)(23676002)(86362001)(33646002)(106466001)(2950100002)(50466002)(36756003)(6916009)(5660300001)(83506001)(21314002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD013; 1:lG50b/TluidT5nsi2ioXpWuduR+79pNKLYHn3QUdVW4sGXAwjW3Ukxh+KkUodyR6uRv1AvABlbLq8KON9mnOWHtPSSKhxzUum6RHlVsMAjr1WzQlhQDLp/2DBugzf4Z1FJHUl6sq37GQCinINUdiB/arl9HXkVTCkNSzGZCJfMYJ9a/woVhAaNlBrNP5l2WE6jJVDAIyMrStxM7DOfcX5AjJmOVRG/uDOvheDnnHyf8BdwGFu9VC5RTKaqnYEWFIvsgggWuZ3YjnnzuuSNmS3zJzfgwNxmYhiDHTbv0se9GQ/q6iJZngOQE8hm7nRDZpkm1nJ+wcXvmje+f3H1J9sxbWZQ1cI1Pdw4TVQas7ZEx8EtRsVpzeSDQhEh0ZQD+Xo2xZsSWxhF8r/FD2ztzxs3lADvzAEI4j7rjmIKQMdAcLtpCQnSsc30r59XhgCoEQ2cnF2yCp65SHkSrjYJyweaUCtqjlklruBxyg4otndyMheMTsEzuGoaxU3rOpBB5nnK3YBIpb8mMcIToEKXZDuSnxEn1Qijz+yw8hc1G+h6Ye3p2s1rc5Tc+k/yQMzkGWRyGKNeF62aSuxcZLcYcfgGfpU4QYL7dFu7FzJnSex0A= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 2:UHrnW3LlGtoC/Y9yjwwQYasfaBQNbgNxI680Q+FBVEcCGQi1MhTU8at6C5qdpGzQzO5M0Q6alABdIvxMuejrF+cZNRdtI786GV1GZKgQfsyDSNkSOZefNdy0kAWb5LblpsZ4/H+e+pbFANL+GQPVdDLH+Di8HZutLzfV3gwr1iE=; 3:d1IXSzpd8DMcYzsqEEb5ealaAOSMUQ6l+PetGlj0Uf2c6qSvYtdhjCvuqM27D601iwkWwPWY4jqmJd/2faPK2G69hviwULFwGFJcgFJqIfhk8DsZ3Ff8tbub3avEFX0ueN/lEpiRLd5F+Ym2T07a9IY6bw5CwLVeTYVwzdFKznNgkGitd2imQJzLq59OMbdGEsGfDPHDqPUecGQxQ2FQLzQ0h+qEzb9O45J+jcG0BmF2dqDs9iOQ273NOB2ZR6NgCBrvxF/4mVeZ9MwXeaO2kQ== X-MS-Office365-Filtering-Correlation-Id: a4a7a972-dbb2-4fe8-2f53-08d40fb33bc4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 25:hw2ApH/3HAx7hWMxQtMpPH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1Tel3IGzVaNQg==; 4:80AXNXOnMDsHw5UgvdSLaqwEhSFllv+/7qZLQBoUGIfgaqRF85RrsV/Hh+O8R8BFn89P79prIkBxSDvHF2DQ4IEo9RtV3wtb0O0F0RwgGD+1r2znoeInE33Niz6/oFpuTIZ4R+JN5eRYbvgK2nRDaw/tlaHP9+n++zvrRoLef5jUTG4MZzPpDGXJBb0yMDHTWI6PIksmOYhGjQixISFFiaGm0KwbuFch1C3ev3xCu2/2tAxbRGJ3ge8zoYyOqGMtXNOYhLJ5lL7nV7ak36BnMZyG/+/el7BEP5pP5Pj3bNcQJ58qB7RYs1PbDc5ZTQRHmiE4id0mxuKkpDhLipdhJ6h8nv/8e7LPITB0t5KJj0RxyIt+8WWwD/qflu0EkfIuRS5TB9MkAvTTHklzRVya6OrBlqJw5ArjjJA2XBVj2NDwE8YuDzyVolN/LKVXAMj9saTxDyxXF7CIVPXRHwKvu8K05AWBjtN7bj/wU4K5fbUAHbcRVRms3WWCuP02Q79kOAXrq4cMVt+wPtck1o3BZt21UbpKp2WX+vZJbFg+3UpGyr3HiR59Tv/kUhvLVKdX/oMZtSqlaqRH3Rp7LFx5MMfqOLuQ8li5mKzJ9B75oOs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095035)(601004)(2401047)(13024025)(13015025)(8121501046)(13017025)(13023025)(5005006)(13018025)(3002001)(10201501046)(6055026)(6096035); SRVR:CY4PR03MB2471; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2471; X-Forefront-PRVS: 01304918F3 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjAzTUIyNDcxOzIzOjY2b1lhM1plL3FOZzU1UXBnYitMWkExZVhP?= =?utf-8?B?OXpobWR3ZmxKZjh6ci85Y0hHbkNOeHhPeTlsQmRURmw4Z01MRkZ4clBiRTQw?= =?utf-8?B?UVk2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5Ymsm00MjkgaCtAc7kRPOPboGtw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2016 13:03:04.0642 (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: CY4PR03MB2471 Subject: Re: [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: , X-List-Received-Date: Fri, 18 Nov 2016 13:03:07 -0000 sorry for delay in responding; somehow I didn't notice this email. On Thursday 17 November 2016 06:23 PM, Jan Blunck wrote: > On Thu, Nov 17, 2016 at 6:30 AM, Shreyansh Jain wrote: >> 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 > > Hmm, from my perspective this moves struct rte_driver a step closer to > struct rte_eth_dev instead of decoupling them. It is up to the > rte_driver->probe if it wants to allocate a struct rte_eth_dev, > rte_crypto_dev or the famous rte_foo_dev. That 'closeness' was my intention - to make rte_eth_dev an implementation of rte_device type. rte_eth_dev == rte_cryptodev == rte_anyother_functional_device - for the above context. All would include rte_device. As for rte_driver->probe(), it still comes in the rte_driver->init()'s role to initialize the 'generic' functional device associated with the driver. And, allowing bus specific driver (like PCI) for its individual initialization using rte_xxx_driver->probe. > > Instead of explicitly modelling rte_eth_dev specifics like init, unit > or dev_private_size I think we should delegate this to the > rte_driver->probe instead. Most of what is in rte_eth_dev_pci_probe() > today is anyway a rte_eth_dev_allocate_priv() anyway. I already have > some patches in this area in my patch stack. Can be done - either way rte_pci_driver->probe() ends up calling driver->init() (or erstwhile eth_driver->eth_dev_init()). But, I still think it is better to keep them separate. A PCI device is type of rte_device, physically. A ethernet device is type of rte_device, logically. They both should exist independently. It will help in splitting the functionality from physical layout in future - if need be. > > >> - 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. */ > > We already the situation that virtual devices don't set the pci_dev > field. I wonder if it really makes sense to replace it with a struct > rte_device because that is not adding a lot of value (only numa_node). Sorry, I couldn't understand which way you are pointing: - continuing with 'rte_pci_device' in rte_eth_dev_info. - completely removing both, rte_pci_device and rte_device In either case, I am ok. I went through the code usage of rte_eth_dev_info and it is mostly being used for getting information. I couldn't point out a situation where based on available info (rte_eth_dev_info), we need to extract back the device it is representing. Is that understanding correct? If yes, I can remove this (after checking that this member is not being used). > If we break ABI we might want to add numa_node and dev_flags as > suggested by Stephen Hemminger already. If we choose to not break ABI > we can delegate the population of the pci_dev field to dev_infos_get. > I already have that patch in my patch stack too. We can't avoid the ABI breakage - it is anyway going to happen. As for 'dev_flags', I am assuming you are referring to moving 'drv_flags' from rte_pci_driver. And you are suggesting moving that to 'rte_driver' - is that correct understanding? I don't know if drv_flags have any significance in rte_device. I thought they are driver specific flags (mmap, etc). Or, maybe they are just placed in driver for acting on all compatible devices. > > The problem with rte_eth_dev_info is that it doesn't support > extensions. Maybe its time to add rte_eth_dev_info_ex() ... or > rte_eth_dev_xinfo() if you don't like the IB verbs API. I have no idea about IB verbs. And as for extensions, I will have to see - I don't prefer mixing that with current set. Though, the idea is nice. > > >> 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; >> /** >> -- >> 2.7.4 >> > - Shreyansh