From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0060.outbound.protection.outlook.com [104.47.33.60]) by dpdk.org (Postfix) with ESMTP id DE674922F for ; Wed, 7 Sep 2016 16:10:29 +0200 (CEST) Received: from BN6PR03CA0050.namprd03.prod.outlook.com (10.173.137.12) by BY2PR0301MB2007.namprd03.prod.outlook.com (10.163.196.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Wed, 7 Sep 2016 14:10:28 +0000 Received: from BN1BFFO11FD054.protection.gbl (2a01:111:f400:7c10::1:173) by BN6PR03CA0050.outlook.office365.com (2603:10b6:404:4c::12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Wed, 7 Sep 2016 14:10:29 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; rehivetech.com; dkim=none (message not signed) header.d=none;rehivetech.com; 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 BN1BFFO11FD054.mail.protection.outlook.com (10.58.145.9) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 7 Sep 2016 14:10:27 +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 u87E8BD9013556; Wed, 7 Sep 2016 07:10:25 -0700 From: Shreyansh Jain To: CC: , Shreyansh Jain , "Jan Viktorin" Date: Wed, 7 Sep 2016 19:38:16 +0530 Message-ID: <1473257297-7221-25-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131177310280662947; (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)(199003)(189002)(81156014)(77096005)(8936002)(8676002)(305945005)(626004)(92566002)(50226002)(586003)(86362001)(5660300001)(575784001)(104016004)(97736004)(50466002)(48376002)(19580405001)(110136002)(81166006)(356003)(2950100001)(68736007)(7846002)(8666005)(4326007)(2906002)(189998001)(19580395003)(76176999)(36756003)(2351001)(33646002)(47776003)(106466001)(50986999)(85426001)(105606002)(5003940100001)(229853001)(87936001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB2007; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD054; 1:fwEyUVp0UP3V4DosUyPfH4uN0vEfGlFf9CnA1F6on1VTr4GjE7vl330xI8JYs63IgOUb2XUIjYwfAEJYg74l+RNRGeZ4PWe3JVkpVt6HSKyxDroZrd1Gw659oeBpgEFFtjbbgSoPTIJgXQ939nYoenraFPL4MtMu9Cc/YOfL9zu7ECgDby3za8S2TilbUSVBHZFwXEr77huLH2cyygTnmh4VNeVoUZvdKG2IcwojNVB3ASjfTZr8t6rPlAAM2BwH9UmCnDhGoIIaABofv5H/AlkAyy8l/nR4UWni73SXTAGsKH8q5TRU0YviLolbxXGP2F3PXCl4E8R6u/F4TEmhWjZnWOux440Mt18Rw5tNMmltdbhHbkgRK7Krhek3tDhHvVhclFGgUcWoUvYeJ2obs0vgx6uQp+B3D1r3U5x18d0D3uVe7oFcwOss63gw+OqVI1axf787aDCpvj7sRM+B16QWy04OVPLMwnZrZazGmRO9i21DdC2Iptx4TY+cnVLSpPnVhaTUThVUv+HX7rYa6lI00cmM/yDe+jCtdccQYx2fLnyJyas+6d51lbMw5nJNUulokBoAbkTgL/1S/POfl9a3F+4vBqd6leYpvqoKODpqmC+25xtQuvmsJ7BuLr5j MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 004e19fc-8d3b-42b9-5e46-08d3d728b853 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2007; 2:VlmjRs5o28v3B9MSZsgrvfpdXlttUZglFh1Sw0MqtQrePnVRilkXjiu+grt0nK+AXFprtZHZt2dbcxnwxsS8WrF6PMXvs0PBWxZnXPBl00mXcgmjmMEJPxZ4c2+iwVmFr10yKAJc4RN/4f2M93KJeqCljS/qi1NC9MxJ33NI4zbyJvBzs1ZxIMJcYWtD9ym5; 3:5R0XZtPaRXofX55vxQyG26QSUdn72cTXlD6Bj/TMZE76yYoojNaYazbxIFUkTZintqZ/l6dHLN0MyCrxDBgpqMqfaJ6TGm+uBedwQ7B1PUAz2K793R7J/6ijOPETsiQrYwTnMgI5JeF0fc9qZUPEubl+pUIXB+g88R9wRParMUdZz/nvw/zddn+d5qqBaXk4mhLJM20vSZWbnqKRSB2xBpQ+7iotdLOd/eYfBM+uuNs=; 25:eS+I6fhijdrMn9BNKxA9uIGjjUcVs7XTbdiJ5stJkvS30+zp/Q/6c2OA4FxHFRFgtgcrmbP8c+kUjRekf43CYAN6GWZeDXydTntHERBHZLKz4RkVhAY8ByOY+Ju1oQ8K0ayJ2GkArbokmCKYF0rJXOpuXDvNRqx5cGZWmSKMB9JSBM66YM/ptka0EgDcsVMrpafvf/+xW7cxpSYZK3bDhZgTXCc6xIDzsKPx+ZhEwKvpgpySrvjZOikxLOruz9W0j3mrXutmicEPEIN6Cn/kTbgIGD01a2vNxScpJ1jfVrNoqmfOWZ8WxHYKxmazx0tvVp0mhjHnYDYy/6pXb3xjIhlttC+AEPkz5ltUJlF6xEmQp601rLjh0FLL5/91Y8KJkE1/LDHK7vCG5k9xMcUQydrv9sWCVL7crvundX6djIU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB2007; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2007; 31:l0zde6KGOTp8sg/mP6WwhnY33QG0Xq9we5JjRP6L/heABjz/TO+MYN7YczS9YKl9zrE3HubmuMknUdFz2YsK/+Kb6kiJn/owLOpB4orpO9Aj+DBCjrhqXqyi6eizQVJgs0vju3vWtt2z04ksrfXNW+N55bplpfUaHIYpOrufTjqcMmqr4+tWDkI30XhaF3DtuYaa+0aJuJ1u5/zUc2DJX1rgIUivbG3j09Yjrp2Rm+U=; 4:Ik/QSwvuMrhD9utaL74NjgaJaV8CRmzhCSvmb1Yp+x/V2uIi/1Ul09mSh/qKvxfJo2fwArE3ZBJwwrtjzqsj3F5DMBFHyEyHShMa/jf6uuNqorzXb4lvfGD4MzhU8lFYb05a02aC3VarQdU741iqS+7BtNJkiIq82NsuF0Ep+tURUpnc5KE/2XO73TYO0DWUDogVtztpM8eZOx02+giQLe7yEolfuCUbx8bsDDJpTIR1mviFrfIXbO3WRgCtjFcqdeJ4m2bqu89F6dZPV7DP0VVMW9C+BGVoS7ab0Md2uNnM21Tf+kkJlr8flV5oeabKd3XA3BNUHP8iiZ5+rNRufeFSi9qicoSYhTBoO3ModV/5d+PQBdG6pJNFf/CjBqy15/BGgE1awz9BKzr3o7d9s0Z9MYT/r5WH7bShwrXlD3H+Gc2uUDCfzk+Qjl1wnxjkkV8yiQ1ZiLBStx5VeDs0KnF8/al1e4ms88cmAtQUsFWWTwWsY/+B63bHq6V0Y2wHXGZIKG9n3vb5pvEySWHdREOVpWi6j4WqOIgkI6dkbLg= 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)(13017025)(13015025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB2007; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB2007; X-Forefront-PRVS: 0058ABBBC7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB2007; 23:xo3fcB7yNP6+3WRHQ3+UlDAtYfKrI6VYKP9/SwI?= =?us-ascii?Q?D1u29CyO9p0Jgv1E/KIqvEg2suAcRSh7+tziuZb1CMWI95r/K75775y7YcpZ?= =?us-ascii?Q?q1BBY7QCIXivog8uV+7tPi0NTWUlknI/aRaKAU3wGsIY2kNA9G/vuXu+312G?= =?us-ascii?Q?ByK8yndT6kirU/dqW7rRsVzJnW4G7TH3w/gG0T7eLNkoJ/zxgH9XQ4vP3MEJ?= =?us-ascii?Q?9Ou9mwWmjnalMbhgmad9+2DRACbT+USLnAe86B3Ea68z9llljK/UGVgFXDnO?= =?us-ascii?Q?3wuBAnQI42kaVGLF7SaA8dwteFaF99Y/lrQ//J/ij5wD9GY33HrFTO5hI1bc?= =?us-ascii?Q?bd/Kinl5MNsEwkiSKZN8LiEC9aSn9WGQaHi01qqqClurILQdRc3p1pK3h2hw?= =?us-ascii?Q?+ooVq7nnzbuEIwRvbKxE6xuc7SRUTe97cBOvIX4g1IyOOUtPm6mJO0+VO9aG?= =?us-ascii?Q?OLEUGvmbAo4w3VtsO1DttQ6BYKKPNvMQifNP/WP+prQvioQEKwTmFG8IzbKv?= =?us-ascii?Q?N6ct9kgjQ8qZKt8uYR4mCjO7UKCtddbiQsESD3fawGIlkDUatVZDmvIvfI+B?= =?us-ascii?Q?iLxBYGpLtD32jmBBt6NLCZs+j++1z6JlwcWTkKdW0wng2ydMmJp26b02Jx6x?= =?us-ascii?Q?FIC/vqNRzC2VuJzIAIM3iijkEhZrgJMDxNpkn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D0wbiqUAt+TsOL6DlrhT9shwCi9OfZopBIW3bGy/1SWkJZ6GYHZ7dPtneQA6G6hawEdps=; 24:aKnrWXdQsPj79Ax2XaXUkw3GGLYemi3SZqJ+YMGY0JEMm9DDQ6JFrbosk+k6YCNURl6PYTYMFq2HqdXsZYSgM/FpGZT/77Q+GrBel5nmd1c=; 7:WjpwzesjoQxFU6DmLcXTBzCaZCUwo+4wBukvm3g/qqrhfOc22oJxyre/n0CVXyT3vaGsTuAkN9DAua9WQxbUdeE0qrrqq7lexdU5r8/SeUF7jNFYD3/YMQBsIbsPlDoysZdWVv1KNnH2QK1gemk4QLIqWEp0NPxUL/iiUnxSVXIo5paNdoLNsEeJeM32Cg+3R2C2zyMde82MEUFE/NI/rnShCK8H9fRFdBR0o0j7PXPVdiW/5rFEGxXgFNSdk5jc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2016 14:10:27.8634 (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: BY2PR0301MB2007 Subject: [dpdk-dev] [PATCH v9 24/25] eal: introduce rte_device 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: Wed, 07 Sep 2016 14:10:30 -0000 Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_dev.c | 13 +++++++++++++ lib/librte_eal/common/include/rte_dev.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index afa33fa..d1f0ad8 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -48,6 +48,9 @@ /** Global list of device drivers. */ static struct rte_driver_list dev_driver_list = TAILQ_HEAD_INITIALIZER(dev_driver_list); +/** Global list of device drivers. */ +static struct rte_device_list dev_device_list = + TAILQ_HEAD_INITIALIZER(dev_device_list); /* register a driver */ void @@ -63,6 +66,16 @@ rte_eal_driver_unregister(struct rte_driver *driver) TAILQ_REMOVE(&dev_driver_list, driver, next); } +void rte_eal_device_insert(struct rte_device *dev) +{ + TAILQ_INSERT_TAIL(&dev_device_list, dev, next); +} + +void rte_eal_device_remove(struct rte_device *dev) +{ + TAILQ_REMOVE(&dev_device_list, dev, next); +} + int rte_eal_dev_init(void) { diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 5c314bf..d159991 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -111,6 +111,37 @@ struct rte_mem_resource { /** Double linked list of device drivers. */ TAILQ_HEAD(rte_driver_list, rte_driver); +/** Double linked list of devices. */ +TAILQ_HEAD(rte_device_list, rte_device); + +/* Forward declaration */ +struct rte_driver; + +/** + * A structure describing a generic device. + */ +struct rte_device { + TAILQ_ENTRY(rte_device) next; /**< Next device */ + struct rte_driver *driver; /**< Associated driver */ + int numa_node; /**< NUMA node connection */ + struct rte_devargs *devargs; /**< Device user arguments */ +}; + +/** + * Insert a device detected by a bus scanning. + * + * @param dev + * A pointer to a rte_device structure describing the detected device. + */ +void rte_eal_device_insert(struct rte_device *dev); + +/** + * Remove a device (e.g. when being unplugged). + * + * @param dev + * A pointer to a rte_device structure describing the device to be removed. + */ +void rte_eal_device_remove(struct rte_device *dev); /** * A structure describing a device driver. -- 2.7.4