From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0062.outbound.protection.outlook.com [104.47.33.62]) by dpdk.org (Postfix) with ESMTP id B46216939 for ; Fri, 26 Aug 2016 15:58:31 +0200 (CEST) Received: from BN6PR03CA0052.namprd03.prod.outlook.com (10.173.137.14) by CY1PR0301MB0714.namprd03.prod.outlook.com (10.160.159.144) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Fri, 26 Aug 2016 13:58:28 +0000 Received: from BY2FFO11OLC003.protection.gbl (2a01:111:f400:7c0c::147) by BN6PR03CA0052.outlook.office365.com (2603:10b6:404:4c::14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.13 via Frontend Transport; Fri, 26 Aug 2016 13:58:28 +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 BY2FFO11OLC003.mail.protection.outlook.com (10.1.15.183) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 26 Aug 2016 13:58:28 +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 u7QDvHq1023630; Fri, 26 Aug 2016 06:58:26 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Fri, 26 Aug 2016 19:27:02 +0530 Message-ID: <1472219823-29486-25-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131166935090880097; (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)(189002)(199003)(626004)(106466001)(5660300001)(229853001)(47776003)(86362001)(575784001)(36756003)(105606002)(33646002)(19580395003)(19580405001)(11100500001)(85426001)(87936001)(4326007)(586003)(50466002)(48376002)(50226002)(2906002)(104016004)(92566002)(110136002)(2351001)(97736004)(68736007)(189998001)(2950100001)(81156014)(7846002)(8676002)(305945005)(76176999)(77096005)(5003940100001)(8936002)(356003)(50986999)(81166006)(8666005)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0714; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC003; 1:8qXlsVsGEM20pg4Q6fZbPxJvY+idri8rckbKu9qgIyBwKu1tN1WM4JzFIcuaoBAEdRvNaJhkMzN2imYVsSZNkD1hOJWgsvZKHEP4yaVfBpZW6Toxkhh2TNjjAwKeoLZluv+Gv1HPqeuIKvLjbah0bALlOL2uQiPskCkjD1RS93jsoEwKzVE72XYjwjaxYvjbuhoVNCDdxVFdg8TezKiU4aRXB0IFXF7E/veob6UGxGppJoQnU+nJ0F+YO0OXVX81s2lYmTkBEEbcyrhKSdDs9w2adEGS7CHKV0kyTOhj7vHJTmL3ysgpzZmrwNNMgd0g0aLh/wKraHAe8hbNsEOqxeH7flDeSTUIgcSVO+Ptnt615YpWanqId+ED7mhRUvS4Tg0R3in54GTS0f230EYnDty+mThwaJ/OdYdK/x/m95gQ2yonsAyJsq3WgSWhmUb9BUMTHSuSKqslqInsrovGxVHiLhf9R2y0NWpwAyUOpGrkvvkmdxb1rJaEdvzQagZDBLxmBxEUgTAIkDRUADN4G0vPgde+7LFa3HCSu1+HJJhe7Cw/+MmBpYSvga50n7kiQkaGL3gDx9TiBPx5E93Mq1/FhjorEyzGMQKMwWN8S1auNnyb1gj5WNUYA58iaWrap6mNsE3Gbbzr8RzOWbIIpomWSYAP4DIYZB56BHmdEKt6x+tc8sWUmhud4GUeffRZ+ZrZpTVLLfexOxedfgJcKBn6MhRtPgKk+381I7O2WQ4= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f8d3423f-666a-4273-f22e-08d3cdb90ebf X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 2:i+SlxacCB9CBXJfB6hUbl1Op9RsDkpCs4zLQNzd6zXKdHDivsKWXeQHZW4V0wgGkw8TkhJ/qSYVpXmnQj49bZitTnH+7M+tATWG61c4WGaRkHmGT5qRRRPKfNNl7uvmTCoHJGlpIjwxJnupmABSRNqsQcmy+7W/fYSMZY8MkRu/5x5ji+5sugFzS8w1vFt6f; 3:xKn7ALyqx/Qu4IMqsKP6Vm85iaSHlaciaiLN4h6sQasgzoIt3OK1tKymtHzqqi+LSXMAdRAP+SxkiTKhetwnurB/Vjy85Wl53xBqPv3T4PRkpnTIqM4sBBNgJCAK0avxFg428fpIzhJGpUIXry0rbG8xqoyC4wvipjRPCTwYyJ7djQXhGUgjf9aMJzf8uakmKvQZECWZ516VmKcwLN94qOLepZS2opm2HCPCnNecD94= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0714; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 25:PKhAxJ/qYjDHxuFt9tY+rb1cD9QSUpCAKCZt/wVBQGNxp2AclpBEXUi3ns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plj8xaTv+PoQJe50kcuwnSNLqfPWnq5r0H7koEthSod9JJp98i3tG3/6otP47GGuT2Zb8A9vOteGIi0OKA5OaLQgoHGXv5h6NHnAx/D7/TFsvm/GKqAGFwq9XVRTsY8vE0StLJEkGihPIFsPZ9nIhVhlkIxR39se8XEeZ3uE39xP2FzuxUKXxv9+X05z3UK3mGLuzF6wgAyRBxRuXZZ1kp8x05AJSDv1Ch4L2lU8NlrikCjRbxFqwURO6Ievctpk+WvP24KEMe5cuCCMzmHMS46thOG2RKkVZUDv+lNqLUGdHufdhoPczH/YNAuxrTdzv4q35p3AcjOyHlCBvlzazaOwVVfvIz51hzL6H9XBPO73wJcH/TkTmibI6lINoTc/XL7p6P/pzhMZRruuL0LsJhamlpNynWwooEAy/F7s7UG0lbIskAlClBmy9j6HivSo= 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)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB0714; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0714; X-Forefront-PRVS: 00462943DE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0714; 23:5B3L6664YWwJ97/OmnfldrbY++TdupGQpN5A+BB?= =?us-ascii?Q?tZyjIeKz9YR6FQ122QUoI9eC8+j/hb90Io4cZyxXEGFjWVgYvx2OI1PZPGum?= =?us-ascii?Q?b3YxVnpPTBlmoL0e+5CUeB4JtPrwcsENlpA6mx/xfqNSofMsFMebizS3AvWC?= =?us-ascii?Q?f5+LsC5PCWMT2dAFuyFBhDaXnL/h6QxUWbxYjIxL2UYX/oz3O5SkaMKT2S/2?= =?us-ascii?Q?chlyGJ70tvGialpfB/Sa0g5zW3FkuCbQNy6EjvvO3HUVk+FPmkaswqhlstt8?= =?us-ascii?Q?d9PIF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I9rN7c+?= =?us-ascii?Q?seYXh/9wzv0QuoSlc+SQQpID+ZXy+WY+yHjVb?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0714; 6:TsLzr91Uv6pdh32EboM8aCaNLYKcyqgpoM/x0RyIsmYTR5n7QGMst9Z9JCrcMtHPQiAtRJtvS90keVHTHRNisuXx5WCHTt8cPmaV5gmyHdarTFRb6yLC1XOui3rPVF/3VEB2I1nfH0bybl3QW2Ir72s4QXWQvWIVHJ0842rgY3x8xvNTsmUCB7VmHhC4ieoBGOxrTRKboFpilY52zGDzNZkTe51RZph8kn/pDIZghmBVIpTAjpaWTxj7Tp+ENS47NVZVvVIpkWocijjpFUqVEMARw2dt03BjE9dvTT74nvA=; 5:nd6vH0fLJz+vQ0sRjbI7F1S/Msj3oxKniQY9KIGp7vbFl4mqOWVogvpvlsQre5RFvnt5YMPedxPpzCDq6f0HW3fPpHD2sbEayMoIEOMZ5zs6G250lBuzWaGms9Cr0V5mqijI48aA+VwOl9OUro6cJWRiNOZBiqgZ0HKYLyP/+JM=; 24:4Ws00f1mj3PmmU5nHI5tBv6UcPz8q7wjLukTwpBk7LjWP+MegdPhgSEa4Kyc50b1ECwwXA6zUz5XC+Z4KYOhBCBJkSYm7mf5hjI3ldnFjEk=; 7:/78TqbbyEsWNLDwmxwldZ0SsekPbt0inIMPpuangBC0EA004nrz+ZHGB5rwxiVInXvHsrxP1DVNdBGlfo4q7HPhEAWOoWiGRzN/EFMRsBHwECWeLJMw8ruSr2r/kT/G5pky+bYsMyZyPPHKuiwuGErHCRpENd7N9WtfWzDyfe1Zp7324OcbUGN/exCnPX/gXDyW8uj/HxProBB5FYB/C5WJgSHwb23kHJzLIebQI/vC9ay4pggUaTzetCAVZUew1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 13:58:28.7604 (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: CY1PR0301MB0714 Subject: [dpdk-dev] [PATCH v8 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: Fri, 26 Aug 2016 13:58:34 -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