From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0084.outbound.protection.outlook.com [104.47.41.84]) by dpdk.org (Postfix) with ESMTP id BAAFAFB69 for ; Tue, 20 Dec 2016 13:37:33 +0100 (CET) Received: from CY4PR03CA0007.namprd03.prod.outlook.com (10.168.162.17) by DM5PR03MB2473.namprd03.prod.outlook.com (10.168.233.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Tue, 20 Dec 2016 12:37:31 +0000 Received: from BL2FFO11FD031.protection.gbl (2a01:111:f400:7c09::134) by CY4PR03CA0007.outlook.office365.com (2603:10b6:903:33::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Tue, 20 Dec 2016 12:37:31 +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 BL2FFO11FD031.mail.protection.outlook.com (10.173.160.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Tue, 20 Dec 2016 12:37:31 +0000 Received: from [127.0.0.1] ([10.232.133.65]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBKCbFW1017506; Tue, 20 Dec 2016 05:37:24 -0700 To: Shreyansh Jain , , References: <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> <1481893853-31790-3-git-send-email-shreyansh.jain@nxp.com> CC: , , From: Hemant Agrawal Message-ID: Date: Tue, 20 Dec 2016 18:07:14 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1481893853-31790-3-git-send-email-shreyansh.jain@nxp.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131267110513328634; (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)(336005)(39840400002)(39450400003)(39410400002)(39850400002)(39380400002)(39400400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(377454003)(24454002)(199003)(189002)(81166006)(31696002)(31686004)(65956001)(64126003)(2906002)(97736004)(2201001)(7126002)(86362001)(50466002)(81156014)(4326007)(68736007)(6666003)(5001770100001)(8666005)(47776003)(65806001)(2950100002)(229853002)(8936002)(69596002)(4001350100001)(356003)(38730400001)(8676002)(7246003)(305945005)(54356999)(77096006)(92566002)(626004)(120886001)(104016004)(105606002)(65826007)(83506001)(36756003)(50986999)(5660300001)(76176999)(189998001)(33646002)(230700001)(106466001)(23746002)(85426001)(7059030)(21314002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2473; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD031; 1:Ttj1FLYOhCBI+SpdJuBAkSCiSlNDbo+RRSUkTw9nxJtZ1GsxgsK1Kb1LL9tI8xro4W1yX5jyC6T35hg/h6rMsmUXkqd7hDT5L2gGXE3mY2IwrZKBVsbIJ4HlpplLRE1zbefr4C4psZGcJdgMB0B13WmlE7szBkeIVVW4cWzEAikVS0hZN3kPrqkqVGgbghSZOsB+38IruHEPBJVxc04xr6PJOUVguKqIw5f+geKWtBX4F8edfn+Kg6Q3TFWNc8RGw2EsgpQqPS5OBayd3txCmV/3gpdBfKuzuqhpM1MQBjk4WNhB/qAhsx/E0sje6B9q/UgMLWwQMrJxkRpy2TWJukGZ8LrdlLo4uvzrMaI2trLny8txSP/j8n83Tt0qjcv2hF0ADV0KbdHZXfUI2QejDYSVK9K4DoXqM4IvPSbiJgd4wxRhCnzaTQLaN2wcB0Ya/u5K71gZGJWaairNkcQLdmFMLJlUNXs5iEPSRIXtQ7rY3pp8t4AfFkRTQt1mtIiYBazIK0PPHDWIVScthBLYlzK2olSnxZI/j+JiU2eh2FESQTau49RCSxkhxmCLsLiKJVyWQrTPmlIq5ElMe9az+06DcCXcrulcHdh0EBGr6djgkwpjRIQqkXBvGKKrdLew6wSHYMqPW77X/mQ5G7KAi+4vrPtVvlrA0aMDTL0/kvEm7PoGtvdnmKUzT/4Ny2uTlDQyeWNg1jtwHoRKQtaZOngM3N64/OcvvFVJMqwbQuWzbc6BY48+WUSDdmPQpZP7 X-MS-Office365-Filtering-Correlation-Id: fd72b365-832e-443b-6099-08d428d4f74b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2473; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 3:MSkuSyDDDJC1WpXM4TWc5577hzlHpLXu4ddOAXzp3ojQR4AA8v+lxEWINpc+z1CaqaWSyuBG7Lyxq1mEMcMRUauUoA72oN2CkwiekI+kCj9ydzi5KCH14/NFurYoEH0Y4lQ/JhviE1MyCicCkKm8hTc5zrLQq+UPw0zkvTiWmyKuHjo4hCsnnGzlNlwOnmgUJdE0iMdnOPun1voOI8/zp/ALYR6h4+ffF3HY/Hcw6HOM/v60Yx28MxrBmgT0AVl5BEgIuOECKl6pXWVUBfWkObwITl3EX2jHiYy8cjfdKIHnTySy2ph0cJYCzMLKG3QH0+18j85hQVNwnMgVneJQZKvgnwHQ1dY9u84KfzLDH17arWriPNd45MVk8w3SIFAX X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 25:CODSUYEaIBY9VvHjVhcGcteuiTbWu4jd0JAKZmDGTnIJ59V4zXsA9Ae939tXeP3JtZN9KeccYHNNT1FypylY4+fdDVC0MKUzzNYdPqgWqMcH4BBYMkA7hzJiQjRQYX5HXyVdhKuijU6KZOOQvzyUJWhWG7DPFjC7gHPuTeWMihlKcgpwrAZohQF7j6sQT+0tHsHpD2ICZXjQIY5SxHouOxOdOZBkbc6/6ki6Onzo++eMN6e1w1hjs70VHfn7KiF5x5Ka9O9sVld9c3svFNMX8kU2f3oGxybwDruVOKEK1r3HzhyCwORrG6QjLRl+AGj2MCo9ygSFmgBuJinRnEiHQDEQLq5io27pkCGOyV42eejlj+TXASCrZ5P2ItLGltfMJlKh5CmAuxcCO1AtfDzsM6dJO1qDLA2JRpaphWekZw9rVxezk+6DuegGoFNfd3Pq7NPbKGpBc/pu69uJRm8U/vYZXW8hp5iizN/yxJAR3O3iYwUGi037dU3k8gqrWx1r3jAkyV/x1M8ewxKYKndkWlowXeESBUBzLcsDxk/fyVs1AgtIywyMdRibvDencsXP4p6uNvBCYuF3pnUlkGkoJjVWH0LOOxzl9iHixiRNrMzcFwKwnz0K8u3kX7mqCXEqfdBhgAhNCCqbsNjed/pdfmHObheYAHWZiDRCsgCRYod2K4fXjSUiop2EVgifYULVUmm8DyZJinzLv+RoFDWTY8ipTvMreywCeY/28uHcLJmmVDmdGIWJEC6Jd22z7UhAnQ1IqCZn6WFr81/CJwO6g3wACjQxtOwexAdSESDXtsNRSAUW5HfnCP9Ip0iiD74P X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 31:PsPEcM0KNw9oL8Jk0MS9aTqKCq/to0gbKxHDOH/OEyPnRkIwCFTzsXkZIl91ie0s2OF+RERKA07JUH2Eao1cruTtXg55MYNYJ/cCXk2R+IJWmWb5rZiDKaeOM7k+xiHsO7nXVJk5P7+Bhe7kWks/eCjv348Y9xyItwLKO5M6DA9AUeV9TPBBA0V80dKYG/4I0+QjWW5uEKpSAZkd5bFC/ZPYui/KwVFD/nH7CUZbntPvDXB4Mpus/CC3fAgn79IhOL55HzoF46SUU8X17eH1Xw== 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)(13024025)(13015025)(13017025)(13018025)(13023025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123556025)(20161123565025)(20161123559025); SRVR:DM5PR03MB2473; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2473; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 4:U72v/6h15QwaOEopW8Xo9/F9WXcOMSotqY5FwyQeWob4+2x1JYMUe/D9rklEKTLrGybGkbqgOl5tIXIva4cyrwKV3KbpINlFe1r2NXCAJx8bSuK/riRgroiiTFc6r4ouVfXFgFD9pQdE756Fh5YYPaN9WwoWV2w0NwFsaaYj4SKoUIo+WOKz5n90BN6uRavplUhJAhQAGaRR9RLU44P8WDNgfZqSgIJVK2wGK6Ki55/V9Z5yv9KHNZaf5pLmw4avm6lbiNheCnKo0uLkCxE6eEE2lXCS2kt07xHeyq2+wKbVUy1jWBuXCr23cKSM9bDF4ZebDR7GT/Q3WDohNtr3hfFDpV6lzENUfXqkMBcmoy+w59iBkxTpxS993Y7dcJDe1W/VkrxZOH8crqvn4KrBzAshF6AkNqOLQfUcbEdq3W8am3FpyPXpgEW9hK+6/o2tbGGJYzQ/TB4WAvIs3IuSVY+Z+n4yMLsPczr4N9DpQQNtsLUPhB4ciZyBg/v+s2vLadWxsCCoqwc4Xw0t7LPPeP7AqSUb8W/wNe0d6cxDrQLQ8dAO0DQec4bqwysDZntanxel0Xf5+RMax6okPHX5nHDV6N4Y5/RE10IIUWZfS54R8OTS+1g67I+mVmUmqAWb9/0yVyAn+UoALTDhFgSlHphbhs2kGku3zp5QAra+CymlmeMb344g9VtigSipN/+54zmb3Tb8/MBzXH11fgwJ44f0YMF0lG+H4GhAmt1uiYYznR7qFXj40B1hz1J2Mqfg X-Forefront-PRVS: 0162ACCC24 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR03MB2473; 23:PFaDRq5ydUXKO2yyjsvmtlYb6d7WSdRxOUs5q?= =?Windows-1252?Q?Fq2kowHY2XyObfiymxhk/V1rxtftJ9K9TmPNNPRBaDp6lLY6aCXCifAA?= =?Windows-1252?Q?fAb1HQ8H7Wh3a/jLWv5Ffu1FBRbNsDd0XvFY6o/pt4FjO8B51K0q6/3d?= =?Windows-1252?Q?R0AU2mbcWpyqmSIdAQKHKgJFWHBeSN89A6mxGzom17QoFeemmxZKfbAD?= =?Windows-1252?Q?xA0M90dUIxbTsshAEF9j/t26RUGv4NnElk6QS/5HKC+OcyfQMHLX+dW+?= =?Windows-1252?Q?YYh6RhMuz38Szd5R7Hxzvjpa7ADgZc164cgnMmSFlQMrEQ+bjCiMyYrl?= =?Windows-1252?Q?wnEnUnvixkeL/QLtu9HezkJAC3YMcPNhKqOAJuc2XKuBSujff9csUprv?= =?Windows-1252?Q?IdgG56b4XPA7SEIvwNKPqH6UR9a0E5h0fmuqa7KI9KtQIRpqWwcs5VhJ?= =?Windows-1252?Q?SMOwn0NMg/1DLyS3ego+UbKLg6sBzwwKB82O39rRD9x2N1CCtoa3uNxu?= =?Windows-1252?Q?sQMUc5ZNdk7SoZJIrDwgW3efiITFEWVeK+hWinBSMjujhdHvqH4PLawn?= =?Windows-1252?Q?XrfniLVRyURf1NpqhZz3JBGAwksI+fiXj+dnapW/dPrgoAuGnmNrGPAv?= =?Windows-1252?Q?dkpESn7K80DCLNRxRPiBMSa+G276ZBjs+LeohzZ3dXNR8qp9oHF7Y8fC?= =?Windows-1252?Q?UJmkR+8J3unQWLZQ/pG7KawQPfDnBAYjJrC/bvfNqzThSIcdHZw5847Z?= =?Windows-1252?Q?rRYmKdLtJvC8qKOSBMhWj88QMhz27RKD1YXS7DW3MKhS2mwqMNQ2nRIr?= =?Windows-1252?Q?ha53KMLauS+m4fzWw9QDqmK8ruCQ6gEh+ZcR8cjds/7ZCllP4a00e3zi?= =?Windows-1252?Q?sheTQcGqakw8Cu9KAjqK5/h/RjP7STJqVFMjZPq/mD2chBMM0KZNUBNY?= =?Windows-1252?Q?3m5vU9YPbXWlAlGIKOgEu+p/23muWefc/vayPezyhELYNljWxer6EAgO?= =?Windows-1252?Q?HBlXKcZ+0ajLocyBLR6MID4IhGqI71v19HSs59pRoPlZHMYa+hs5p0jQ?= =?Windows-1252?Q?sButmjru6Hp0leABgN0hk9dGee7HqIZlO0qkKskieccRVBuyXZBJ7xMG?= =?Windows-1252?Q?7gZnvHveA43fmVvLaH0ZsbT+jTVm14VB+uFmpGY7IvSqMTFF0qWPlrF4?= =?Windows-1252?Q?quN6Cp4giD8CabOMmrhx/PvLwsB2K8asEJ7ofNvXVidbGb0lTY3X5pg3?= =?Windows-1252?Q?kMkGiajQj3+y6vp9flO4Ji0ifRo3n/a0IaKfu93a835zHEvF3W9pQJMy?= =?Windows-1252?Q?vxtCYOi361qvtj+ejScXIvnt4NLfFs/8anTD8c/MENPN2uQfs3sLaR6R?= =?Windows-1252?Q?UTjrsrN7Y5HotXyDVCSnnYEv6lGbi40xZeiEeD0rN/R5tbaw3Ht4KGg+?= =?Windows-1252?Q?Uv5rvDrONw9NgFy3pNaxe/I++UsUVbskyLjISeqXex50Vna0BROf//G1?= =?Windows-1252?Q?g1q+bfPsaurVbAGba/e3uXeFkwmc6j2er59LKe9CqzPtF0NlWwQqF4TB?= =?Windows-1252?Q?M3U1pcS1mfYblZjKybQX7rsOfB1gf8LGn/+SGndPn+LwLpKmEMMoIbbu?= =?Windows-1252?Q?MUKrOaptbsM7A06Wm8yJDXOk75yW3jNTETBfk+Val3ELHuoZ35UOwXT7?= =?Windows-1252?Q?1XoJQsrKUGGw5WUZ9DmuJxU5xk514XjyaR33WLGzLsmR8uD0EhMuXYxF?= =?Windows-1252?Q?OrOTqUk5mBC2VSvbKu/1fe7A1mF4phIY44AKeQ=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 6:IKSx6d9O3IfXIJhl5g3laBsA2x0CXpYn4og2WrJtltM17bOec1mGcxA1ZYlEJTALSrCBacdVf9Wiv72bNcScNAZQX3VQ2XUrAPPdeWUbUPRSeCpyd+v1R8I1UVD/uGgvIDH+ryt1Ug9A/8VHqNFQ5GjPyRBrrjptqO1Y5j4v5cGeY4Oojbc00A0vUlsHid/vSPBoUJWRLDzyRmoqzH6DQ2rR60o4Zc0D3wlvKe8uGFjLo9cdjErSIUpqWW+6REVDNoPX9XV1tDfIJvZ7UYiadp1quBO/zGPC38DPiECsDJWJXZUQu0jdC/+seZvcrrdI328XUyNqBAcSMvzPHDCwgMgHD8POK4N2qrc+1j04DdwPbLwuqs9HRxpUe9iKCiEPYUUAgwr1rEYl3l489wjN3LRDe+63adl54MD4JhImprWa64Kjaj9mfWMbSfS8JPyi; 5:Jj0k4TMOJzPdwfKteM68aj7XsDL/NJEJxgriIYq33ijKf9rU3ALOidUWoFPw6ZEK1ziW1EVunsTEr6OtjcStcv9Ul3mjwPrSbVpTOde7/4Su+R7Sg1+jyf8cUA+kMp8PM+VOMvV/ZGcMoIrR4p5cVsit123p7ZVUgYwa6Oe898PLxbZsCTSe8uxUcB31U9t7; 24:KN90OcgCE3swbHty2oggGY0q5ihVyEvQb7bcNBiZy6y1uU8qpmrr49zYeLzi1A8IdbUmTpsQdPy28O+F5ni4VMk5pkF/u733ePxHJ2y6l6M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2473; 7:asR7+/KfmteaQIah6vBIsYgk1qZV9yyIh3VfA/uKZbOyFRlHxpGkKoZRn4u+Z4J3M7FmkCUdgUysKGztW2JrZ8ldXTATzFGt29zpRLUpPcOiD4llwnR39fQO8uxuB4Szf5jOlMduAOALSzHYD1d9/b+VcJvbtnyJavlXmo00io1oLxcj1+cC9x3seqmFhB+qoMQwWhuZn0wjDQCqJd12fmJEXV3EEDkhZcfGBSLJvH7OavGCfpEenXOjfz1Szd07Ab01RmIbPpNP6gEc9mP0YBV+QehCZvWnUSFpVT2cXFd4ZT5L3rxVvwecRucN6b24ZmNNWQOKTEBwy1BVtwiE5OKHZRlwxK3ibzzlBOmDAScPSo3TDk5AI3QI4ATNSng8TvWFhW6UOq2dC5nOdAlUJm7ascs1q+eVMHk2qbMw+DhIkhy7GntN/wIyC/BOWbGJ+HgkAx4s8K9Y/TbHBJPPCg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2016 12:37:31.0364 (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: DM5PR03MB2473 Subject: Re: [dpdk-dev] [PATCH v3 02/12] eal/bus: introduce bus abstraction 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: Tue, 20 Dec 2016 12:37:34 -0000 On 12/16/2016 6:40 PM, Shreyansh Jain wrote: > This patch introduces the rte_bus abstraction for devices and drivers in > EAL framework. The model is: > - One or more buses are connected to a CPU (or core) > - One or more devices are conneted to a Bus > - Drivers are running instances which manage one or more devices > - Bus is responsible for identifying devices (and interrupt propogation) > - Driver is responsible for initializing the device > > This patch adds a 'rte_bus' class which rte_driver and rte_device refer. > This way, each device (rte_xxx_device) would have reference to the bus > it is based on. As well as, each driver (rte_xxx_driver) would have link > to the bus and devices on it for servicing. > > __ rte_bus_list > / > +----------'---+ > |rte_bus | > | driver_list------> List of rte_bus specific > | device_list---- devices > | | `-> List of rte_bus associated > | | drivers > +--|------|----+ > _________/ \_________ > +--------/----+ +-\---------------+ > |rte_device | |rte_driver | > | rte_bus | | rte_bus | > | rte_driver | | ... | > | ... | +---------...-----+ > | | ||| > +---||--------+ ||| > || ||| > | \ \\\ > | \_____________ \\\ > | \ ||| > +------|---------+ +----|----------+ ||| > |rte_pci_device | |rte_xxx_device | ||| > | .... | | .... | ||| > +----------------+ +---------------+ / | \ > / | \ > _____________________/ / \ > / ___/ \ > +-------------'--+ +------------'---+ +--'------------+ > |rte_pci_driver | |rte_vdev_driver | |rte_xxx_driver | > | .... | | .... | | .... | > +----------------+ +----------------+ +---------------+ > > This patch only enables the bus references on rte_driver and rte_driver. > EAL wide global device and driver list continue to exist until an instance > of bus is added in subsequent patches. > > This patch also introduces RTE_REGISTER_BUS macro on the lines of > RTE_PMD_REGISTER_XXX. Key difference is that the constructor priority has > been explicitly set to 101 so as to execute bus registration before PMD. > > Signed-off-by: Shreyansh Jain > > -- > v2: > - fix bsdapp compilation issue because of missing export symbols in map > file > --- > lib/librte_eal/bsdapp/eal/Makefile | 1 + > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 15 ++ > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/eal_common_bus.c | 192 ++++++++++++++++++++++++ > lib/librte_eal/common/include/rte_bus.h | 174 +++++++++++++++++++++ > lib/librte_eal/common/include/rte_dev.h | 2 + > lib/librte_eal/linuxapp/eal/Makefile | 1 + > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 15 ++ > 8 files changed, 401 insertions(+), 1 deletion(-) > create mode 100644 lib/librte_eal/common/eal_common_bus.c > create mode 100644 lib/librte_eal/common/include/rte_bus.h > > diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile > index a15b762..cce99f7 100644 > --- a/lib/librte_eal/bsdapp/eal/Makefile > +++ b/lib/librte_eal/bsdapp/eal/Makefile > @@ -78,6 +78,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_cpuflags.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_string_fns.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_hexdump.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_devargs.c > +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_bus.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_dev.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_options.c > SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_thread.c > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > index 2f81f7c..23fc1c1 100644 > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > @@ -174,3 +174,18 @@ DPDK_16.11 { > rte_eal_vdrv_unregister; > > } DPDK_16.07; > + > +DPDK_17.02 { > + global: > + > + rte_bus_list; > + rte_eal_bus_add_device; > + rte_eal_bus_add_driver; > + rte_eal_get_bus; > + rte_eal_bus_dump; > + rte_eal_bus_register; > + rte_eal_bus_remove_device; > + rte_eal_bus_remove_driver; > + rte_eal_bus_unregister; > + > +} DPDK_16.11; > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > index a92c984..0c39414 100644 > --- a/lib/librte_eal/common/Makefile > +++ b/lib/librte_eal/common/Makefile > @@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h > INC += rte_tailq.h rte_interrupts.h rte_alarm.h > INC += rte_string_fns.h rte_version.h > INC += rte_eal_memconfig.h rte_malloc_heap.h > -INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h > +INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h > INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h > INC += rte_malloc.h rte_keepalive.h rte_time.h > > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c > new file mode 100644 > index 0000000..612f64e > --- /dev/null > +++ b/lib/librte_eal/common/eal_common_bus.c > @@ -0,0 +1,192 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 NXP > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of NXP nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include "eal_private.h" > + > +struct rte_bus_list rte_bus_list = > + TAILQ_HEAD_INITIALIZER(rte_bus_list); > + > +/** @internal > + * Add a device to a bus. > + */ > +void > +rte_eal_bus_add_device(struct rte_bus *bus, struct rte_device *dev) > +{ > + RTE_VERIFY(bus); > + RTE_VERIFY(dev); > + > + TAILQ_INSERT_TAIL(&bus->device_list, dev, next); > + dev->bus = bus; > +} > + > +/** @internal > + * Remove a device from its bus. > + */ > +void > +rte_eal_bus_remove_device(struct rte_device *dev) > +{ > + struct rte_bus *bus; > + > + RTE_VERIFY(dev); > + RTE_VERIFY(dev->bus); > + > + bus = dev->bus; > + TAILQ_REMOVE(&bus->device_list, dev, next); > + dev->bus = NULL; > +} > + > +/** @internal > + * Associate a driver with a bus. > + */ > +void > +rte_eal_bus_add_driver(struct rte_bus *bus, struct rte_driver *drv) > +{ > + RTE_VERIFY(bus); > + RTE_VERIFY(drv); > + > + TAILQ_INSERT_TAIL(&bus->driver_list, drv, next); > + drv->bus = bus; > +} > + > +/** @internal > + * Disassociate a driver from bus. > + */ > +void > +rte_eal_bus_remove_driver(struct rte_driver *drv) > +{ > + struct rte_bus *bus; > + > + RTE_VERIFY(drv); > + RTE_VERIFY(drv->bus); > + > + bus = drv->bus; > + TAILQ_REMOVE(&bus->driver_list, drv, next); > + drv->bus = NULL; > +} > + > +/** > + * Get the bus handle using its name > + */ > +struct rte_bus * > +rte_eal_get_bus(const char *bus_name) > +{ > + struct rte_bus *bus; > + > + RTE_VERIFY(bus_name); > + > + TAILQ_FOREACH(bus, &rte_bus_list, next) { > + RTE_VERIFY(bus->name); > + > + if (!strcmp(bus_name, bus->name)) { > + RTE_LOG(DEBUG, EAL, "Returning Bus object %p\n", bus); > + return bus; > + } > + } > + > + /* Unable to find bus requested */ > + return NULL; > +} > + > +/* register a bus */ > +void > +rte_eal_bus_register(struct rte_bus *bus) > +{ > + RTE_VERIFY(bus); > + RTE_VERIFY(bus->name && strlen(bus->name)); > + > + /* Initialize the driver and device list associated with the bus */ > + TAILQ_INIT(&(bus->driver_list)); > + TAILQ_INIT(&(bus->device_list)); > + > + TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); > + RTE_LOG(INFO, EAL, "Registered [%s] bus.\n", bus->name); > +} > + > +/* unregister a bus */ > +void > +rte_eal_bus_unregister(struct rte_bus *bus) > +{ > + /* All devices and drivers associated with the bus should have been > + * 'device->uninit' and 'driver->remove()' already. > + */ > + RTE_VERIFY(TAILQ_EMPTY(&(bus->driver_list))); > + RTE_VERIFY(TAILQ_EMPTY(&(bus->device_list))); > + > + /* TODO: For each device, call its rte_device->driver->remove() > + * and rte_eal_bus_remove_driver() > + */ > + > + TAILQ_REMOVE(&rte_bus_list, bus, next); > + RTE_LOG(INFO, EAL, "Unregistered [%s] bus.\n", bus->name); > +} > + > +/* dump one bus info */ > +static int > +bus_dump_one(FILE *f, struct rte_bus *bus) > +{ > + int ret; > + > + /* For now, dump only the bus name */ > + ret = fprintf(f, " %s\n", bus->name); > + > + /* Error in case of inability in writing to stream */ > + if (ret < 0) > + return ret; > + > + return 0; > +} > + > +void > +rte_eal_bus_dump(FILE *f) > +{ > + int ret; > + struct rte_bus *bus; > + > + TAILQ_FOREACH(bus, &rte_bus_list, next) { > + ret = bus_dump_one(f, bus); > + if (ret) { > + RTE_LOG(ERR, EAL, "Unable to write to stream (%d)\n", > + ret); > + break; > + } > + } > +} > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > new file mode 100644 > index 0000000..f0297a9 > --- /dev/null > +++ b/lib/librte_eal/common/include/rte_bus.h > @@ -0,0 +1,174 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 NXP > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of NXP nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _RTE_BUS_H_ > +#define _RTE_BUS_H_ > + > +/** > + * @file > + * > + * RTE PMD Bus Abstraction interfaces > + * > + * This file exposes APIs and Interfaces for Bus Abstraction over the devices > + * drivers in EAL. > + */ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include > +#include > + > +#include > +#include > + > +/** Double linked list of buses */ > +TAILQ_HEAD(rte_bus_list, rte_bus); > + > +/* Global Bus list */ > +extern struct rte_bus_list rte_bus_list; > + > +struct rte_bus { > + TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */ > + struct rte_driver_list driver_list; > + /**< List of all drivers on bus */ > + struct rte_device_list device_list; > + /**< List of all devices on bus */ > + const char *name; /**< Name of the bus */ > +}; > + > +/** @internal > + * Add a device to a bus. > + * > + * @param bus > + * Bus on which device is to be added > + * @param dev > + * Device handle > + * @return > + * None > + */ > +void > +rte_eal_bus_add_device(struct rte_bus *bus, struct rte_device *dev); > + > +/** @internal > + * Remove a device from its bus. > + * > + * @param dev > + * Device handle to remove > + * @return > + * None > + */ > +void > +rte_eal_bus_remove_device(struct rte_device *dev); > + > +/** @internal > + * Associate a driver with a bus. > + * > + * @param bus > + * Bus on which driver is to be added > + * @param dev > + * Driver handle > + * @return > + * None > + */ > +void > +rte_eal_bus_add_driver(struct rte_bus *bus, struct rte_driver *drv); > + > +/** @internal > + * Disassociate a driver from its bus. > + * > + * @param dev > + * Driver handle to remove > + * @return > + * None > + */ > +void > +rte_eal_bus_remove_driver(struct rte_driver *drv); > + > +/** > + * Register a Bus handler. > + * > + * @param driver > + * A pointer to a rte_bus structure describing the bus > + * to be registered. > + */ > +void rte_eal_bus_register(struct rte_bus *bus); > + > +/** > + * Unregister a Bus handler. > + * > + * @param driver > + * A pointer to a rte_bus structure describing the bus > + * to be unregistered. > + */ > +void rte_eal_bus_unregister(struct rte_bus *bus); > + > +/** > + * Obtain handle for bus given its name. > + * > + * @param bus_name > + * Name of the bus handle to search > + * @return > + * Pointer to Bus object if name matches any registered bus object > + * NULL, if no matching bus found > + */ > +struct rte_bus *rte_eal_get_bus(const char *bus_name); > + > +/** > + * Dump information of all the buses registered with EAL. > + * > + * @param f > + * A valid and open output stream handle > + * > + * @return > + * 0 in case of success > + * !0 in case there is error in opening the output stream > + */ > +void rte_eal_bus_dump(FILE *f); > + > +/** Helper for Bus registration. The constructor has higher priority than > + * PMD constructors > + */ > +#define RTE_REGISTER_BUS(nm, bus) \ > +static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \ > +{\ > + (bus).name = RTE_STR(nm);\ > + rte_eal_bus_register(&bus); \ > +} > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_BUS_H */ > diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h > index 8840380..4004f9a 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -122,6 +122,7 @@ struct rte_driver; > */ > struct rte_device { > TAILQ_ENTRY(rte_device) next; /**< Next device */ > + struct rte_bus *bus; /**< Device connected to this bus */ > struct rte_driver *driver; /**< Associated driver */ > int numa_node; /**< NUMA node connection */ > struct rte_devargs *devargs; /**< Device user arguments */ > @@ -148,6 +149,7 @@ void rte_eal_device_remove(struct rte_device *dev); > */ > struct rte_driver { > TAILQ_ENTRY(rte_driver) next; /**< Next in list. */ > + struct rte_bus *bus; /**< Bus serviced by this driver */ > const char *name; /**< Driver name. */ > const char *alias; /**< Driver alias. */ > }; > diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile > index 4e206f0..aa874a5 100644 > --- a/lib/librte_eal/linuxapp/eal/Makefile > +++ b/lib/librte_eal/linuxapp/eal/Makefile > @@ -87,6 +87,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_cpuflags.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_string_fns.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_hexdump.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_devargs.c > +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_bus.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_dev.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_options.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_thread.c > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > index 83721ba..c873a7f 100644 > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > @@ -178,3 +178,18 @@ DPDK_16.11 { > rte_eal_vdrv_unregister; > > } DPDK_16.07; > + > +DPDK_17.02 { > + global: > + > + rte_bus_list; > + rte_eal_bus_add_device; > + rte_eal_bus_add_driver; > + rte_eal_get_bus; This should be rte_eal_bus_get Also you are missing rte_eal_bus_insert_device > + rte_eal_bus_dump; > + rte_eal_bus_register; > + rte_eal_bus_remove_device; > + rte_eal_bus_remove_driver; > + rte_eal_bus_unregister; > + > +} DPDK_16.11; >