From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0065.outbound.protection.outlook.com [104.47.36.65]) by dpdk.org (Postfix) with ESMTP id 173097CBF for ; Thu, 1 Jun 2017 18:42:12 +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=rEsSTDyiU8RkzopJZ8MJvBIuJJ8B63p1cAYT2gYXS5c=; b=MIUfuWzlzk9jbZUa2k/l4V5vtmQTaIAYKPB/eLayLxO2qZnAltmjZx/NTgmqVs4u+D5bdl+8rapqBz5TAlHdJVSqbzo9YR6hxKwsWfW1PjwpwKb2VS2qGlnfcmesEg3FgQgyax3Mcn5h4xmzFJ4556JB/UWrT2JGYP1L7/yBKsE= 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.domain.name (171.76.113.102) by BLUPR0701MB1715.namprd07.prod.outlook.com (10.163.85.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Thu, 1 Jun 2017 16:42:07 +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, Jerin Jacob , Gaetan Rivet Date: Thu, 1 Jun 2017 22:11:46 +0530 Message-Id: <20170601164146.13501-1-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.113.102] X-ClientProxiedBy: BM1PR01CA0096.INDPRD01.PROD.OUTLOOK.COM (10.174.208.12) To BLUPR0701MB1715.namprd07.prod.outlook.com (10.163.85.141) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR0701MB1715: X-MS-Office365-Filtering-Correlation-Id: d3d6f3ea-dd21-41c4-ff17-08d4a90d2603 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1715; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1715; 3:1wnarF+iehw4eiLBxVvTBsSN+GVomMQoGPbRaDYnN9kz2RT96uJ3JUlWP3f1mZF97gJfk7zb8ppUETl2SbIO5dWcNXogqDJb/Q4Hs8nnWIhrLdLwFAwswnqAGwpC9N9FMdara1kvBjy6eReG3m1VMVD5s6lLOYK6vVEjl7lnmNuPVXYYt7OJt8E5D/0IEVWI9E0/Pkx5cstTYj/0kKQEos2R17Xn3OfuMQZq7IYIL/sRDndEnQQOxyHb5ghF8s2Rf+lHkaUIRS5KGDVWBnpKCiQZwpBniq92jk1RKR05slRLM3wJ6o/jHkb5nEwnbQ1sfvqljuZX5EOId66OlUjWUw==; 25:D1/FsOBJ3ADnd3qGGQMIPVYujE8e2QKJwzP9/e3ybHXs6etHcQwbZ3TAnFiOzcod/tfoDYcYfdzAo2Fhd9hyzxTQ9yy/KjbJZvbagiFfF9KdY2xO/1RC8rAGiDzdYdNE9jslQxOIxq4hc2RHqqbhf6RFP07e5bSMHUtP8Qp3evA80jtqx7x0q9YKNYEpKBk2BWQmTl49zBEa9aAUsvyeQTUwbmidR7IEG5r43mrxI4MaI3O/Dx3+iUtR8d2HX2GszIDf1HoEphTs/rXMb3A5tf0D9H4kVzAhE7kKH+xjdudNyxWlEL6OXKRnllzDesvoLVCJiSdAsk8R2RdCzCQVYF0OAkv4hmhzeoYmXEzNdzWgXZ8kehCWsspr6t8dKbkrjcdBNHsTlYBlRW1s1XTMm+INAmj9sIYjwZrqD2X9LVOZYHiRCB2rzX0MOObyIk6AFoyYwcBPOLB2LffswgPRSq2k0ttDIheEpjIcZ4C6HrU= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1715; 31:rCYVKLQHME4iiys1HX6c4GFNuenTOZThzn+LZqhrr4ust8Vj5Elqi2NXZ0cYQaN8heCCCX0D5rE6hwi/+jhgbvhGvwD4d8ui469MnMu3evt2RxxedXcB/zsMIZVGKZ9VUpx5ZFnvlQqb3MqXhQArRjWDH8xp1XhcVfZR2U9LJ1SBUuHMVgKoZxuZLn4s6PkvDPuKZ2fgayMI2KQRwnIIBzgCxUCdMWjxMGHn28Ad6JY=; 20:zrAp2mOhvupzAdtSbUk5GUaXOI70c6lklGWzNk+IPKmce1cFqu2w0gsfjsfso00H6E/NM3lrlWYQ5tf8cSDotz5ekNyR7a2BeQqBq41uCyCKUuFWJUiaJjqb1w+5/wDjfWT1HCIk8s/9a4NJTVO3Ah4WcPaEiLxSUeD5lfDQM9k5FMeNW2Phz2PVaw8CHqu0MuwdHmYKalKWP6poGWqBe12kjtqxrx3FgeAR4UJrYe8a+3CuCrkqQ5ZcLHh94aYQJHvLZzb36/DcREd8Rb0584F4PBIm07ube0NIyUOtRnevW69XeDqXTR8MArDsrwCF+VQuy8y7wjMgDLA3v5uJY89KBsEJuV10HzP6ZInXbM4vUzPC/wsaehl4ybAqjsxiRjn7IBYa4qjS9yk50SYMeqdjhR12WThzAdI4a3mN1fp3EVBwfaA5fcFZErGaRmSIWlD+4NNAc5hoOsbPiQjHn5zwT0hPnWjxrc0tb+1zO8l/nfoUgJa6TvgYWVUO2MVXBHVT6J6jQxjyrtYOHR2RBeoWghxgJ0Z2NOfOU+wJTmYn9w+knQJIotM9W01CEmWRimNX/3WZ3emqaOHuUEeJX7f6InKRs9e4FW8QoNDiZGI= 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)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(10201501046)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR0701MB1715; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR0701MB1715; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1715; 4:GNvAePRbKmFBtSYuYDyaNS9VW8wGxFWYQijJfiUf?= =?us-ascii?Q?7R5mG/7EwzUMUZDyOhcBng+vSynGrFf6B13PDNka+3OFJSi/dXvRLRhFjYNb?= =?us-ascii?Q?3RMsL5pxLLNRUHoj+Yu/GVnvA4HZgIntKEzNiEOcteOYXHmeQzp+w8nLeyUf?= =?us-ascii?Q?YiBWwYlQRFiK12plliksTNMZi37R+D4FXEWFGYeXI96qCvs93z6C3x4hH3tS?= =?us-ascii?Q?LZP29i8lhWtCyARIz82aKKdk135Y2vYJeWW8CAARu0F1XZdG4BYt/nafE3n+?= =?us-ascii?Q?tD64Bfoq/UOL+X/k7TzxjqGJYdL1Y2gaBBlxWKMRJceHsL1rw8kXDrFltbkN?= =?us-ascii?Q?C7ve6eutGtvNrzMwCBXNZae0qCMsynj9ld7WgdA0Q+JFlvb3KCJIQWT0i+xb?= =?us-ascii?Q?3U9Utztnrd0acL9prrNvPnCXthiunQDspyyzPQhH7OSNs60W7PwBB/rM5iMY?= =?us-ascii?Q?x4EpRu3FaSel4t+BXoIEpC6g/eZTIMEKKwo/HT0rhZdNLPdEipRLX2NsUbZ7?= =?us-ascii?Q?zYAAaDwhXldkPTxXAIsO971jxac9aK4B3IUbGDs97DDXDTCkHkbpp2BuKUJl?= =?us-ascii?Q?FsyKwuy4Zr5A9QzAkzzV7Qi6ZnObbL8dRGT6L/lboY9QncTOpYbTT6rmKt2C?= =?us-ascii?Q?caZpO8kY+CBc211+mocMc27gjXHnUxgAEOAtgV3xaWgRkORu0EBp9S5CeR7D?= =?us-ascii?Q?z1fisAE+bWFIrApF6Id/qYkGCoVndmwpciP8/rPF+30O+EU+/Wn77atLnRWy?= =?us-ascii?Q?QEWkcIo/qrct3hzFM/4QUABzEw1UcEt8SnzVEL7tQQTjgoMAQa6/m5y6j6va?= =?us-ascii?Q?ebu0GgoXXYG44JIG8mTIxTcxxBujcGkvmaE7mIyQ85gL8es7sJPA2YYtmfU0?= =?us-ascii?Q?pzZACgBbacjj3JuLzmG0cq1Uk3rvMqN0UQjK3UnlkklQFMbaBu33+NGEtex/?= =?us-ascii?Q?3aoSI+oN0DY9925RSNeRw+YsIQrawJHM/+6tseYuYYIoNzKtCz3fIduUgPGo?= =?us-ascii?Q?563Kflp0J+Cia+93J2mh9g3HwiOJVQHZM/aou+xjrR3GqCkO0/95qIYzoBLe?= =?us-ascii?Q?f/kw7K58GFyWtvADb96nwGVWKWhZniV/z7NBDJKBUzsNnXS7nAvS+Wlh8vdX?= =?us-ascii?Q?BsIJyzRCAps=3D?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39410400002)(39400400002)(39450400003)(39840400002)(39850400002)(6512007)(110136004)(2906002)(48376002)(50466002)(575784001)(6666003)(36756003)(50986999)(42882006)(5890100001)(6916009)(6486002)(3846002)(6116002)(1076002)(6506006)(33646002)(5003940100001)(2351001)(66066001)(2361001)(47776003)(478600001)(72206003)(8676002)(53416004)(81166006)(50226002)(8656002)(54906002)(38730400002)(53936002)(42186005)(189998001)(5660300001)(305945005)(7736002)(25786009)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1715; H:jerin.domain.name; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1715; 23:zRWUYNBtoh+i3YCjy4Uw78ASHRXQ/jFnV1Zaixa?= =?us-ascii?Q?WpDeVmZ+NJturX1Yxayq8JsERIfowiCbep0PUmUsVmYiAh/9UByzjSF9aYC+?= =?us-ascii?Q?sdjZNzMy84Ra099gXwedBsIB9at2BqgpcyE4BGMgXIoHtIS9QKWJv052or6N?= =?us-ascii?Q?/S80oNL04fOGyxzkiYRBivp05PZDGLCFZyz6DuO8Mar3Oa4ACae84KA9bN69?= =?us-ascii?Q?Q8BaVFnzms8aU0kwqOv4qVv0bUW97wuFFKP4dhx2d91No6WGcSbKJPCB9cSt?= =?us-ascii?Q?CSAxaO1jWTwqI/LtNj0yf0HVg7hJe6KNFHeosyxBalq+u89IuYkWHqJsXyXc?= =?us-ascii?Q?cr/iAMeaOGwGNYIhBR3S9sYSzJWmxOvHQuyHbWVHDBe9nxF4/c5tmQbIlr3q?= =?us-ascii?Q?NtUEQxYxBrW9eHtRAeoN80piDbVadCdIQdfB2yu9v8cNTv1kc/kRSstbMh9Q?= =?us-ascii?Q?QSXVjks+TQFOzRsH3749FWn5szOEZnJzWppxYaxgiVFsFQwKENZ8busEdbVR?= =?us-ascii?Q?EKPQYJMSrzi1uS+dq8Zg7Yg0NIfVz7vCsGoMk78kElxszvPvNiqJOZviyqkw?= =?us-ascii?Q?QuSOXONEt5AYYRnBmtZ8fpjg5R4lf/VD4IxYxpwYPEvb+g9yZPCZYhU9Saif?= =?us-ascii?Q?9a1YGPPThQHUdGM0ug4kJjvHOLGhVLSIRRWS8Rp267ELHo70IYEl9F8kBIrk?= =?us-ascii?Q?d2AgcFC42Knt/9LkUIqAUmmteGa+PBrljxUGz4pICOFVOK3UmwwR7xUxXL0g?= =?us-ascii?Q?XT8oymj1qsglUkEaxyirkKrOXJsGu8C7gCLl//+rF0vFvBNgIdTWfl4MajRE?= =?us-ascii?Q?2IzLjMuTuZSz3gZLbQHBmla50a7OC5JA8DMkJhOLmnAnXENID/wB88IMklrd?= =?us-ascii?Q?m1hSc9yhiEl18gvKajr6M82X6ET99Cbr/ImijA01A4V0Mojb+yE5cbnywa+E?= =?us-ascii?Q?OBiHzBy8TezJh121SBjzgRCJ/BFE+qrf4zhQ2ASqnajbsguklpGRMk+l6owP?= =?us-ascii?Q?Uzkqs21Q/LMhqMmrFsfVeUUaieiukTOBhmRpak7AstNJRce5REw4qpjvPctx?= =?us-ascii?Q?vcIqAJyIzvOo0uK5jNcfSRfqm78uCrWkwDmZZwrb8OiF8irTRAvZoY53po09?= =?us-ascii?Q?Czufz7Wruxr4wrNro0awgfkhhGoqV5NpCo+Ltq9AYbooEdMRnBd8+hQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1715; 6:H5GCp3DQfxGC21bqzJiZkv1EgZyXZd4SMBGg4SMAUrNgEI9NkVOn0Z/xLLklL+yV5Rh3il+9n1873mJ+LuUMyHiisMGCv0kXYc2iRwpXVUhdZLqn6cAuKbde3YRp9Y+mNdwYTIXGW+lVws3yZMMwPhwUkVpqLOW3QV/ymzvRqYAl4+mHkvV4CbLUQVGoOUsc9t43dztqF+p6Os8yf6q/4Drt9Ex9XdsE2XhZnFJ6QPgqankMQbPhJphtgV9h+aTIGNoRbE6NI2L5UJ1y8bGqTw3c6Pq9yZnaVMvtUeb4CPb0kse1ZsB29L/m+cuCbjPgsPbiCweslMxPwXbl5yNSgjO0zEMutdjkZCjdx592LjAwt4SirtUP3qBfW0ySd7pbTZ262yxVk975N9k4z26fp1qHPN3/m+Xbhu9Soe+RmY4rNz2D2D2+dDdvJT7HCJTonFB1bT3cDrflPWRVRngZhjAdncr818j2qJZoG9UFtn7KIhyyDE6i8QE/dMIXnN1mhqCGo9TOjasiNpfjwohv+A== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1715; 5:3TwPVLPeVQIDC2J69oIO1DsZ/O6uAWjv2ropGaUMhUug1WUolSv7y+BoOuQMUsvuNPszIdBLLpBTvaFOB5qsUPpnvvp/jtDvEWnVBMTmvoUHBXu6tIw4l7ElGm112M+kXg0RW2vEH+iKoeR0Hpnky/n/BIysuug7knSLCN9JyRFmV4+81e94YFVXXzjLJomj7638fwLjegDY1F4oQqUguUsFznKG+Ey2c03LRJOuoynB0Qa1T4eivJKRmI7N3DYH2D0E2rXzgblUrw3YHVojRhWbIH8Ykro+fFvTZtO8hGKFGucNGcKwYLTw1Mn7g+d1nEhYOGBJkFhW0396Kwzb+z66qAq0PQSsfCLrjcQaHvaYQjcSZoVXbyOMnate++OZ+0GGSiH4nSOyHJSsG5B5KdKN1SVSWhdJ9yJp+E3Iiq7o71ggHECAgTkVXbp2APzIjUj14Nt6HOU9uE2eJVmOn+eei8VdisghQUURfsA+3Zcjofa4QSSaJ3VBgiDbJU+b; 24:egq6r8BBhDTr15sz7SNFQzA2GYbXT2JHQpqXirlAh7Dy0DQ7tPL0wqzmjkJa1HvMYgDRt6rTuQBWvrlL2OccJNFaSWQ4b0ILuYiC19MO2fg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1715; 7:XZcvnVyvWymieNa+sk5Plx5GPPgw6k6XqbjkN5nNmLuVKc1ifXSIttOaaE36tpK+VKA7j+S3RXEiD09AnayUlQZqdF1z+cjMk0LbHSXLk9T0LKll3jmxCFClaNJXaZPqgpfPRtMpvuArq7zYk7H8E7IrzQpiI0yrWVaN7hhPlrenbyqWsU0uapgCOih5hoxjggUGwobyNR5od+iARAnQLETWPIddkgQ2LsqhflKR/bAxwP5rrdHcI+zGk65KgHRTjHp5tBma2CWqclKWg91zPMgjmBZQESRkSRmL3jN6OR6SF+YRC4sQoQ+f/4sBuNm4IfDyVVLYVmmyNm5cceu/Tw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 16:42:07.3180 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1715 Subject: [dpdk-dev] [PATCH] eventdev: remove PCI dependency 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: Thu, 01 Jun 2017 16:42:13 -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 | 37 +++++++----------- lib/librte_eventdev/rte_eventdev.h | 2 - lib/librte_eventdev/rte_eventdev_pmd.h | 63 ++++-------------------------- 4 files changed, 41 insertions(+), 91 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..91f950666 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -126,8 +126,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 +1248,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 +1273,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 +1283,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 +1304,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 +1321,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