From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0049.outbound.protection.outlook.com [104.47.34.49]) by dpdk.org (Postfix) with ESMTP id D45122BF6 for ; Sun, 4 Dec 2016 11:09:14 +0100 (CET) Received: from BN3PR0301CA0002.namprd03.prod.outlook.com (10.160.180.140) by MWHPR03MB2477.namprd03.prod.outlook.com (10.169.200.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Sun, 4 Dec 2016 10:09:13 +0000 Received: from BL2FFO11FD039.protection.gbl (2a01:111:f400:7c09::184) by BN3PR0301CA0002.outlook.office365.com (2a01:111:e400:4000::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 10:09:12 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD039.mail.protection.outlook.com (10.173.161.135) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 10:09:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:701; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uB4A8pK9019825; Sun, 4 Dec 2016 03:09:09 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Sun, 4 Dec 2016 15:41:20 +0530 Message-ID: <1480846288-2517-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> References: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253197528028694; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(336004)(339900001)(189002)(199003)(4326007)(2906002)(105606002)(104016004)(81156014)(106466001)(85426001)(81166006)(92566002)(5003940100001)(48376002)(50466002)(2351001)(626004)(2950100002)(47776003)(5660300001)(110136003)(97736004)(69596002)(68736007)(76176999)(50986999)(6916009)(38730400001)(6666003)(39410400001)(50226002)(39400400001)(7846002)(39380400001)(189998001)(8936002)(8676002)(77096006)(305945005)(39450400002)(36756003)(8666005)(33646002)(86362001)(356003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2477; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD039; 1:fTEq3bFHNg4/NLhjDiDFlK50ba/LNGm3NTwzGy5fv3+dbCz+wmP6OQFZhoQE9JgY7t0bSHS0RBTwYFOTHf8T1DHJ/YJ7cst/E1nJkuTSAiqbxF7tApHfli3RVrA664eV4SOcgjXBFre5qoj1XaDuD0dfgXunF09mVHU/cPecaIWJeQ0jSOa/EUxH8nFIRKJfqlKc0LCmp2uEVctQkzRJjq5q09yFnr4qKKlTvDe0XvCwkgrySUHGVmILwNwaOV7mr66jOzrLbnfjFE3rdgJHdS63M1fYQfw+p+9uu5T6vLs4rhSq7v7MZqedavR+oKrg6uwg70mtLVaTFvzMq9SjY2SPFNf5FnzSoMva+9tHEDpWZNHTA9B0Aoe//lZiKCqAC/k6Ro848AhuDAr/+TEHAmvloazwAihYmz0en0stfEvu45X/njIfsM7YY7xnZAc+etk26+t3jgwaXbpoxF2jjHV4CwHisg2vCE/jPrF+BB7tRKIOmJZrdCbpFkDFy4bgak/6+7kBXkYNc1lnrtNvJ+0w47KvhoDZJib6Ig2EOfaMTJlgwb9mHJRuHyyqTeJiqZ56JQkMyVRLxRRGTz+uuXh/KimuO1oJuG6AuuNbilpQaL1J5zmCLil+UHU1uzQ3r8hEkScrAdrSyI45HAB53RlYJ9HG1Oomi1dpaQqUH838SeCfriMcHp081od6Fas/30QmsjAQ/BBXLJ7/2zUFw2Sz36dd+urQMAUKYRPkanA= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: caefec1f-9f33-4ee2-69bf-08d41c2d98ac X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 3:2+GsEoUf6EjtbhM0Q38vR/ISSlzJ0xg1LTdcW8Jj3SSbfpGLbwCnCz9s4xpasK30D7LMvnMRDI+Mc8NrWNF8i394d7s2NOc4/HRZFwMTX8EqEhHXLDZ7L1E2Xlz52R7FS38hWpm+adsNMDKMU73bwqJ1NpWZyeJhSfzGxw8FWKVK2eDq8RE0cQjEytGZ9S5+nGBwB3NbR5enQ9X7JahUAYNbYce5G5W7t4yMjcSUpo/sIxrEHzKsMBxAomq8fguW5hKwkAdlyJTi+DLLH+und3NvT99wivWjYWUlmzImzk2KE3vhS8CvNdKpq5L3zCSe852gX8/0zqMtzksdM+PFTKQgR7rBKwL1pxsqUkjyp5qYlQeEfnuRI9BhulgtWEQq; 25:ucTyvS2LaU31XdYZyIKRO0/EkWqcBrKeOazFk7K2j4EGvl17xl2h5K6AWw0uQ9Ud20decRDqoQW3uOKvU2xqVEkK6AlQnKgeKi+ZYUzuvqEHAtSsqMukqk/05mWbQEWjRKC2yPMG9qMHihwZqz7WQrWEQH4j7Bcbfy+aXOEPOq94gy8mnLRwmSjMnmQZ+041Mo2R3ZhZ0xNMMLC86rbm+g589M5RaUfZE1P9tDuP2tNO8BAmBVioK9jAku7TfGJP8rpdDcGrI2E2Wd/KpO5HfgHmfUtsZtBSX+o6G0U45+r6+1W7IZ903fknVdnb0oVAoJHFwFmhO9PWUH6T5Q0fuCGW0dYsDkZSakf4qIw8QiURIx8DQrlXm+C2Fw6QkGqcZUrZAhd9eILrsE64hOSpGFDtDxq1hlIwujlVS+aboh7q3hKzBqgSJrpfMjcA4sc1+O/iEfWLBf6i4HuzzaX83A== X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 31:ykPo55N8Mby8C+aVJ9kzRHem7BNOxHWmkNOhVxNNqssQvBQC/jLBLaF/6/R4VNWQQs0IhefO8viUUCVsCfGKkAF1oL6vhcOVEgZx7DdUd55cIn65ZTQBUn2kzC+Oo0GJY2qwAO8BZoo873ittIwDmlrgaBXi35r47376AuRCLbJU79JZ6x6aqej58IXgiyTZa45G3p4IJxjoijrOzic/0VLTMkjKpI6DVqFdw8OiHuEVSe1Bx/vB2IZkdTVz8lw18QeQS6kijP82lWAvbJhGIA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13015025)(13017025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123559025)(20161123561025); SRVR:MWHPR03MB2477; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 4:FSgIUMRTgdb9URbUJcPFYUYt4QZyvCtfvOefVkysVevJLqbCWSYs3Cjwax/rrkI/aB9LbbdxAeOppoZO0O3rKGGF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UEQGO+GDD1GznDXDr2mMayWBYqEVOqk2Ww9v36MqaL?= =?us-ascii?Q?S2+rFBPS4cmjVAFl6GCCJxZIkzK3gPoUxg3jPUhmwZWxdomKdHPLNXIgpTfu?= =?us-ascii?Q?4QsUiLCr3ZSe/7a3zg=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 6:+6wnvjTw8OSBYVTyIk6D8h/Ih2cWMuW8bGtvREh4oUMwJsAVJDSkAZj8hLDkkfizX0ZW6Miq1YnpwhXA8UzSv7wrdCf0mEnmaBrRxwEGlH7K0rnq86awQX0PKLhk4djTv38yl4K99zn6zB6ejpZrIgrbpVAjWcKs0OUw8fAAOi5/kYZjHmZPH9cf2dJ/qzO189NTldcpWdWXDZU/o11NEz/0B+qNrdMEgAHNfCtct/Uuh5SkjFrI49ppqwsV9JJeTBeHEWxYZQx0zWBjpCeTwXNyVci/x2BO/+2+PDWCJ8aLK+aVcSzXC2JbOzF9WiTJ8RjhiITtTqK9EOx4KwitbNq0euzDOI68hSUoEXQ95V6RhWj27liSa5LY0yatp59UmRX81/EPb0R7QVUBGiJK3FxOqenBGkxvAHoq6VmWq+skCI9wtigEuqn+sEVdYLJA; 5:Minle1+wufq0mudlWZ3Kgjd8yaKdcdqKi9S4EYFpaYXD0a3KvtfbXG7n4uj5sEP3ImaHWEZF5DR9iBjuQ58GY+W813q88alBBXO3k86u2HO8t/1R9wu+tjtCdsdSQVSn124BpXjD8Xxto0Uhl/za2l5wgmEUbgEuvCAHk7ZSMtFNW6pXWP8rgEyJHT9qu4rq; 24:qjU63Ok0QVlvC8XYav9EnFpt51iNLaL+qN0ahPlni3EzLBTEoIVuTxJEP6HeId7HAkqOdmCJFdbZDfglVfgmHQuvL446e0WsRaKN86uvLGQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 7:ofFH98RarkO3HawSD6tnpEXdb4adHq56YO7BXT5lU8rvToOAqcYdjTVwUzKKuCidRa0Ie759sVDigWVXagZUsZrhkd89gPTiztSheTcQJA0rqNbY/FWqXrT45sZYSyOzEXaJuwWpPQ3KElx+UWnTzDQg4KqnRQ/miTTn4oABuPvDukj2brfAthL/godGVWqoW2ZtIcnw2mjBJTjWPeJNGq2QrzUQ8gLKmNIw1CeLuc0etg8dOMNAI+t/TtDmDpmCDVkIxif+sWyOMblQ7f6ssCql6DY04IHiPxD5wCuwf+g4Ygbs6ZIv927oRTSC5Jm61gzrqLWWqtkvnOUztfMOZ+pd9m3/NVAjJ0bhlwfrCzW3z0OAtnZKu7kDHDq8v/Inzvr2/I46TbMvth9gib7cY53fi1V2bQCUgfVwKpY55xK5alMT+XmfstJXk36fpGZSOYMLDYY9M+VeTwpM29XRqg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 10:09:12.4284 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2477 Subject: [dpdk-dev] [PATCH 05/13] eal/bus: add support for inserting a device on a bus 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: Sun, 04 Dec 2016 10:09:15 -0000 Rather than adding a device to tail, a new device might be added to the list (pivoted on bus) at a predefined position, for example, adding it order of addressing. Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_bus.c | 11 +++++++++++ lib/librte_eal/common/include/rte_bus.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 2473fe4..3be9c77 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -58,6 +58,17 @@ rte_eal_bus_add_device(struct rte_bus *bus, struct rte_device *dev) dev->bus = bus; } +void +rte_eal_bus_insert_device(struct rte_bus *bus, struct rte_device *old_dev, + struct rte_device *new_dev) +{ + RTE_VERIFY(bus); + RTE_VERIFY(old_dev); + RTE_VERIFY(new_dev); + + TAILQ_INSERT_BEFORE(old_dev, new_dev, next); +} + /** @internal * Remove a device from its bus. */ diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index b41105c..d1bd2e8 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -128,6 +128,24 @@ void rte_eal_bus_add_device(struct rte_bus *bus, struct rte_device *dev); /** @internal + * Rather than adding a device to tail, insert at a predefined location. + * This is specifically useful for update device cases, or where addition + * of devices in the list needs to be ordered (addressing, for example). + * + * @param bus + * Handle for bus on which device is to be added + * @param old_dev + * Existing rte_device object before which new device needs to be added + * @param new_dev + * Object for device to be added before old_dev + * @return + * void + */ +void +rte_eal_bus_insert_device(struct rte_bus *bus, struct rte_device *old_device, + struct rte_device *new_device); + +/** @internal * Remove a device from its bus. * * @param dev -- 2.7.4