From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0067.outbound.protection.outlook.com [104.47.32.67]) by dpdk.org (Postfix) with ESMTP id D94DE2BB9 for ; Wed, 7 Jun 2017 10:44:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DvlGwSyvKUT+WJmNcmhEh0tQQOXDezDbLMK7HGz6S0g=; b=n/T47Btpagqe/0rm1xKTVs4ezR5TgCE33Dc6HT2Xvsc44C68584qdzFSVw7Y+r+nCpgBTgbXfpKANM2La0wn05nRYrfSy3B2yEF5MKISjgOuJZUcnalnUlnLVWrkX2/e7tknyZymICt9Aeo2MCkC2ZpbCggs9KAPjwm6Dtqo/1I= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Wed, 7 Jun 2017 08:43:56 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, narender.vangati@intel.com, nikhil.rao@intel.com, gaetan.rivet@6wind.com, Jerin Jacob Date: Wed, 7 Jun 2017 14:13:30 +0530 Message-Id: <20170607084333.6338-2-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170607084333.6338-1-jerin.jacob@caviumnetworks.com> References: <20170606141046.32103-1-jerin.jacob@caviumnetworks.com> <20170607084333.6338-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0076.INDPRD01.PROD.OUTLOOK.COM (10.174.208.144) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR0701MB1714: X-MS-Office365-Filtering-Correlation-Id: aaccae03-b999-45cc-64bf-08d4ad81574b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:AiQH/vq6mg8yVd1ZVUYKhhAaip/vbiLGD+eFQ74niKGKZEQghc68dJtZEKQqzFWv8dDSttlDxgYDMKsoqCpW5vMUjzlsvSjJO6I1RtUG3vP9it9VvzhcbPbspG/oRPFPG8SvQK5JdwycFIT+hvd04gMSfvhNh54/OEs9SNc4jc6ax8ayvzJu+KA6zYvGj15eJzJMMDjbfjXkcEnlb2qeZ6RsTm48F2hC0HE2srpI7ua9XC8nuYez7LjNSZqNt+2j39vx01KrqInTZVHqodTfyjxuFStZ4yUVVfdFeVql/4Zlqi7tO0c0ogS7XK2eMoy8jhuMa7bWtbK19FKdUeGSog==; 25:XLjBDZiKA+6tmDzWf9jtP1ln0SUVpOoY83VI/JJDnzPp7mOF2RpEMq6YFFWtTG4eCkpCq2Xwi6ArbSZvKCNYB+ETr3FEuKY5LNrpKTs7uDtdZhuajAjeTpZrfnYtBtKX95FwiNtHOcsvGT1ncKN81ZczXRhHpp4lrUJOUFq1FlPFcgzVvQoQm7IcBud5eVYm6uVrGTQZ7+WVYlyAFjA3Xrb06aavYtmGx8BYgWgw3LCIsMVGMDs5YuHEQLnwxiVdGAO0acjLrktravCB8TpWWYMT1EOMV+KMlG5rRh5DpMIAuIhBpPp0Bs0MkaYbW0RUQaGooOOZBFoGoix9CAKZyl2B3A6/ClvBndnCoodNjVr9hbFhT2FUvZVNXvb9I1RH+p+oJBBziq8Je2eadXuHLQgTGOJ/p11GWQC+GNLOqODnG7qDRcwpwACN0KWnGHjn179lN1OVebFTurLbRvzkRyA8paMGh0weu3zO8OJrDMA= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:AjSQP46Gz02gd3kQuaZuKLY0Mcuk7WLw4nBuWyXd+XteLdqEl23gmArLMcTz3Or+LImBxmQURI6xMSx4tLEb3s7PRcae/TH2atyrLdIuGUWnejU419ddjdfkr+BS4SFsLhDO9HEj2Img489cnmk53WUt6XoSKfgla354WB5Kdr/EMf/fg6WQWKn+bg7SWsoVMpGaYXXNcUOHW82SpDAuGLx3dPjFTYXpOh8xfs8686E=; 20:6irSsMF7wK1sRT/K904o6qyyds1x3hja2Msdsh77pWUReGA62cMMuL4B5SAR2x3QqlPpdWiZERkWEja/0MxIqjpl/I0fQg2K/S9+lmJnXx/xsTG9LaOxVTcw2h3wavTGv3G5obAQj+DoJ9Wt1K79yAN1zRaHLimcKJDOVPY3hhRpXtmY3336RVfGsX6UC3GcW1hRk3idyL2G66Y0Q8BPx0s5C7OPSYXJgqbM+e2qsl/TiD1P6cLF2Orhl7txD+q+CJaAWAj/00aJNJt32fnxqxde1Hw62tqXEiXPd3lMlP6Unrmb4Qi3OO1DYM+3JdFpP6smrFp8fTiQ6IOkhtVoGjsWfwK1+qeLP0aPzvIwfjqtAMKbqEf7BD1OOezERVMBrP7BYILEeatld3dCtUub/L61PI82L6Qgoymohgv0xaw79Wm/1c7iYbvGlVLTc9+J6etXMiYnYFz8UFLqyICLueyQe8MequQLSyMCaaSt5OEq4xufWJDaiBZFVFR7O9nHujLhOrvJ1knfMQn5lF9J/f9EdUnc9aOlWdH2WV/xyhPZdT02mI1weEyF9TjxrDU9SPFa0a2grbeMh57t1QO6j3y9egmByWrnESpIwVF6UUQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 4:QB5Sw2ngTX/JyCumpHsWNJfvg106tR9fFzN429X8?= =?us-ascii?Q?y+YqrEnutWuoJOqXVzAwNMbAL8kP72Z6vHrmaQapeddcL24MXkl8t5s8K12N?= =?us-ascii?Q?s1pKjtDKydWwGR+LDkjUyuuRmAWZOsIb0nzw4/Z+a3APtR6WRFLWYj4/liwb?= =?us-ascii?Q?IeyncbSBjtDweMmJxjgkF578QOuOy3fl4C7+auAEvc+AtsrK4a0Eh8CMEymz?= =?us-ascii?Q?lbkN+Fs40Z0cMOM3B83D40Mi6z4xV1Opynj9WQ+0NEQjNZNCDb9UT5n73tER?= =?us-ascii?Q?+PwKA+/qwsm/qAundjhEUiaOTwkbGU+yZ32yYQu3Ilnk5XEbO1xTxgrBYYJ5?= =?us-ascii?Q?bjyq3ltAWWwHMIr04aEpNfpLWTVat8T0GiByqM/Pcd3Ina97H20cOo1JEhQL?= =?us-ascii?Q?C4AtxV08lgZ9+j2qSSWXE2dZRIIitpo738o0VHbRhG26lutIyHwC5LCgtpfF?= =?us-ascii?Q?G0uKXb0P04YUs/F8ig5DdDayrVj7z0lCrrYHRImAvAK6qf9oxlOELD26mkjB?= =?us-ascii?Q?kH2cOpO+j0SjKzAYak/Fkr2M5qIu1lI3B9VVAJA4bhOCdy6eOhBVEUWJHG7M?= =?us-ascii?Q?USrKsnc00F8imm6my5PMXQawnPoiITpRW7+RzaC2wgyE+a7ZJ5B13UaXKhxr?= =?us-ascii?Q?piD7cgmKIh8/Q4au2l4PczcfikFyFWgKwfzTlUpW7JLrFsACG1rIfNv/D8Tt?= =?us-ascii?Q?tbdPz0fG+mAKemvV586MTgmh6BgL5skQg9Uv6PFZocqiElvjfV8cbdAm9Vhk?= =?us-ascii?Q?TbIE08CPDnOVi1l4oOQl3dVnlJSgdkWDALYHFqeerEBmPgLghQirXBORldiq?= =?us-ascii?Q?mpAfjOqV9DOX2zIYN04b2kvm61uhizWIQrt3PI2OxjaqjP75a84NSjE/yYcp?= =?us-ascii?Q?tdjNMFsfiCmY4nLDw9qeyRmaFNKOLdQY/XF4TzqV65+rORsjE6yxAg/gGFZs?= =?us-ascii?Q?HdchyNHP14UGLZbeqWrIOTwm7SVvWOuq4Y0dPNUsaqmJdGahT3SE4IwsiT/c?= =?us-ascii?Q?9kZ/8oJZcgmu7d+VGtbJh9a+IGpBm/5XXEtKfX6272y3uFIuIafIGrofqjh+?= =?us-ascii?Q?hHZiaSm5I5R90fo9qnworIvZzzPs8zJ3cc+B6xrsfZkBbkw7urlDI96/nBDQ?= =?us-ascii?Q?G5unGSgnnl8=3D?= X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39410400002)(39850400002)(39400400002)(39450400003)(6116002)(47776003)(42882006)(42186005)(575784001)(1076002)(53936002)(110136004)(50226002)(81166006)(8676002)(2906002)(36756003)(189998001)(6916009)(48376002)(72206003)(50466002)(33646002)(5890100001)(6666003)(2950100002)(6486002)(76176999)(4326008)(66066001)(3846002)(6512007)(478600001)(38730400002)(107886003)(25786009)(305945005)(5009440100003)(5660300001)(8656002)(2351001)(2361001)(7736002)(50986999)(53416004)(5003940100001)(6506006); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:jerin.caveonetworks.com; FPR:; SPF:None; MLV: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vSqy8YokzV/11xocYfXzJDbEHSe/kJrxs0A== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 5:UxcpQfIerkeL7ArTdPMMjyzNKryuZUHZsjQV3oeizPV5Cx/7nuJPuxr4/7yZNvD+cvRp1Jvw+KZ0BOPyUtAd8ipMyqquulNNlMaVnqr/EYdguh5+AsAoke6W0hT3D/0IMOai4aI5cSTExpoP+SxpwlLicdR+fGRrQATrQE2vsS8/5G/4NdspwxmKqHvBzcc6lv0bcO6BAqAx91jDg4lEM9JKpcVLgteSYbKoLjj1Wap0UYdDnzME/MAH4peo6kX0vrQ2GUYI4ZPzshj4IyS1uWR98uEcxPiqFNqTW0SmOov1wZFYxLgQZKIMRj68ucSyKuhzfwwSVpa+PZquoHJSvKWtFSqVr0T8L0xM+4ClTbJXdu5Tlob348fF/Udbm37hVNGaC5r6J/FHWbcFLB7NUYOh5x0Weqjy+gUAFHP1HbQy5lWQsCHBvM4sak2SyGUcTvPKAt+UBuRp3Gnglsh3P5RGyxnO6ZKJNVWcpzp40oVW/SJRvtZQNIraZXDecfSj; 24:QBUSbQaJEMgZcES9pBb6UMrEGp/vg/QBcr++JKQkL51EjkeLsNi74pY/un3U1B6Oich0ozJj6WcU6yFKWg/6aEqtHU8k2Kt5HWm/1EtPt24= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:DO5/wP/tMRdQl9sWsXaAHLZNf6RB2+7vc/SPb2Usjg4TKPSBsAtzfFsJBFcs4RwLDphquPv3QDKGnU2LQpdxoX27SvfBxgdficSZfs8n6RdrbacqtcLVjcQHg3U1VBisTj+wRQltqlUIk192thBBJsg7DX/DDHA1QBfaCOKrHvnxTUOiNwmHry3oY1fyTgp6HMzBKoG7IMwkI7QqxNO0uV46GgZPweRZfturKH3PzozTK0NlgL+Q2tRHEJGICavboiwkFifR/iTIrScnACbdjK6mDLRSrFwev1/5El/5sEJDKfQMSgyFEt/7GGa43UZ7z565bM0nhvn70UcJBCIhng== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2017 08:43:56.4427 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v2 1/4] eventdev: remove PCI dependency from generic data structures 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: Wed, 07 Jun 2017 08:44:03 -0000 Remove the PCI dependency from generic data structures and moved the PCI specific code to rte_event_pmd_pci* CC: Gaetan Rivet Signed-off-by: Jerin Jacob --- drivers/event/skeleton/skeleton_eventdev.c | 30 +++++++++----- lib/librte_eventdev/rte_eventdev.c | 38 +++++++----------- lib/librte_eventdev/rte_eventdev.h | 2 - lib/librte_eventdev/rte_eventdev_pmd.h | 63 ++++-------------------------- 4 files changed, 41 insertions(+), 92 deletions(-) diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c index 800bd76e0..34684aba0 100644 --- a/drivers/event/skeleton/skeleton_eventdev.c +++ b/drivers/event/skeleton/skeleton_eventdev.c @@ -427,18 +427,28 @@ static const struct rte_pci_id pci_id_skeleton_map[] = { }, }; -static struct rte_eventdev_driver pci_eventdev_skeleton_pmd = { - .pci_drv = { - .id_table = pci_id_skeleton_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_event_pmd_pci_probe, - .remove = rte_event_pmd_pci_remove, - }, - .eventdev_init = skeleton_eventdev_init, - .dev_private_size = sizeof(struct skeleton_eventdev), +static int +event_skeleton_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev) +{ + return rte_event_pmd_pci_probe(pci_drv, pci_dev, + sizeof(struct skeleton_eventdev), skeleton_eventdev_init); +} + +static int +event_skeleton_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_event_pmd_pci_remove(pci_dev, NULL); +} + +static struct rte_pci_driver pci_eventdev_skeleton_pmd = { + .id_table = pci_id_skeleton_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = event_skeleton_pci_probe, + .remove = event_skeleton_pci_remove, }; -RTE_PMD_REGISTER_PCI(event_skeleton_pci, pci_eventdev_skeleton_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(event_skeleton_pci, pci_eventdev_skeleton_pmd); RTE_PMD_REGISTER_PCI_TABLE(event_skeleton_pci, pci_id_skeleton_map); /* VDEV based event device */ diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 20afc3f0e..fd0406747 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -126,8 +125,6 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info) dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns; dev_info->dev = dev->dev; - if (dev->driver) - dev_info->driver_name = dev->driver->pci_drv.driver.name; return 0; } @@ -1250,18 +1247,18 @@ rte_event_pmd_vdev_uninit(const char *name) int rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) + struct rte_pci_device *pci_dev, + size_t private_data_size, + eventdev_pmd_pci_callback_t devinit) { - struct rte_eventdev_driver *eventdrv; struct rte_eventdev *eventdev; char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; int retval; - eventdrv = (struct rte_eventdev_driver *)pci_drv; - if (eventdrv == NULL) - return -ENODEV; + if (devinit == NULL) + return -EINVAL; rte_pci_device_name(&pci_dev->addr, eventdev_name, sizeof(eventdev_name)); @@ -1275,7 +1272,7 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, eventdev->data->dev_private = rte_zmalloc_socket( "eventdev private structure", - eventdrv->dev_private_size, + private_data_size, RTE_CACHE_LINE_SIZE, rte_socket_id()); @@ -1285,10 +1282,9 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, } eventdev->dev = &pci_dev->device; - eventdev->driver = eventdrv; /* Invoke PMD device initialization function */ - retval = (*eventdrv->eventdev_init)(eventdev); + retval = devinit(eventdev); if (retval == 0) return 0; @@ -1307,12 +1303,12 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, } int -rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev) +rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, + eventdev_pmd_pci_callback_t devuninit) { - const struct rte_eventdev_driver *eventdrv; struct rte_eventdev *eventdev; char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; - int ret; + int ret = 0; if (pci_dev == NULL) return -EINVAL; @@ -1324,22 +1320,16 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev) if (eventdev == NULL) return -ENODEV; - eventdrv = (const struct rte_eventdev_driver *)pci_dev->driver; - if (eventdrv == NULL) - return -ENODEV; - /* Invoke PMD device un-init function */ - if (*eventdrv->eventdev_uninit) { - ret = (*eventdrv->eventdev_uninit)(eventdev); - if (ret) - return ret; - } + if (devuninit) + ret = devuninit(eventdev); + if (ret) + return ret; /* Free event device */ rte_event_pmd_release(eventdev); eventdev->dev = NULL; - eventdev->driver = NULL; return 0; } diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 20e7293e0..c5b2b7453 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1063,8 +1063,6 @@ struct rte_eventdev { /**< Functions exported by PMD */ struct rte_device *dev; /**< Device info. supplied by probing */ - const struct rte_eventdev_driver *driver; - /**< Driver for this device */ RTE_STD_C11 uint8_t attached : 1; diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 4005b3c98..faa6989b4 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -87,60 +87,6 @@ extern "C" { #define RTE_EVENTDEV_DETACHED (0) #define RTE_EVENTDEV_ATTACHED (1) -/** - * Initialisation function of a event driver invoked for each matching - * event PCI device detected during the PCI probing phase. - * - * @param dev - * The dev pointer is the address of the *rte_eventdev* structure associated - * with the matching device and which has been [automatically] allocated in - * the *rte_event_devices* array. - * - * @return - * - 0: Success, the device is properly initialised by the driver. - * In particular, the driver MUST have set up the *dev_ops* pointer - * of the *dev* structure. - * - <0: Error code of the device initialisation failure. - */ -typedef int (*eventdev_init_t)(struct rte_eventdev *dev); - -/** - * Finalisation function of a driver invoked for each matching - * PCI device detected during the PCI closing phase. - * - * @param dev - * The dev pointer is the address of the *rte_eventdev* structure associated - * with the matching device and which has been [automatically] allocated in - * the *rte_event_devices* array. - * - * @return - * - 0: Success, the device is properly finalised by the driver. - * In particular, the driver MUST free the *dev_ops* pointer - * of the *dev* structure. - * - <0: Error code of the device initialisation failure. - */ -typedef int (*eventdev_uninit_t)(struct rte_eventdev *dev); - -/** - * The structure associated with a PMD driver. - * - * Each driver acts as a PCI driver and is represented by a generic - * *event_driver* structure that holds: - * - * - An *rte_pci_driver* structure (which must be the first field). - * - * - The *eventdev_init* function invoked for each matching PCI device. - * - * - The size of the private data to allocate for each matching device. - */ -struct rte_eventdev_driver { - struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ - unsigned int dev_private_size; /**< Size of device private data. */ - - eventdev_init_t eventdev_init; /**< Device init function. */ - eventdev_uninit_t eventdev_uninit; /**< Device uninit function. */ -}; - /** Global structure used for maintaining state of allocated event devices */ struct rte_eventdev_global { uint8_t nb_devs; /**< Number of devices found */ @@ -579,18 +525,23 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, int rte_event_pmd_vdev_uninit(const char *name); +typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev); + /** * Wrapper for use by pci drivers as a .probe function to attach to a event * interface. */ int rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev); + struct rte_pci_device *pci_dev, + size_t private_data_size, + eventdev_pmd_pci_callback_t devinit); /** * Wrapper for use by pci drivers as a .remove function to detach a event * interface. */ -int rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev); +int rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, + eventdev_pmd_pci_callback_t devuninit); #ifdef __cplusplus } -- 2.13.0