From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0041.outbound.protection.outlook.com [104.47.33.41]) by dpdk.org (Postfix) with ESMTP id D4F15FA7D for ; Tue, 20 Dec 2016 08:12:42 +0100 (CET) Received: from BN3PR0301CA0028.namprd03.prod.outlook.com (10.160.180.166) by DM5PR03MB2475.namprd03.prod.outlook.com (10.168.233.21) 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 07:12:41 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::140) by BN3PR0301CA0028.outlook.office365.com (2a01:111:e400:4000::38) 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 07:12:41 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; networkplumber.org; dkim=none (message not signed) header.d=none; networkplumber.org; dmarc=fail action=none header.from=nxp.com; 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 BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) 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 07:12:41 +0000 Received: from [10.232.14.87] ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBK7Cchw012957; Tue, 20 Dec 2016 00:12:39 -0700 To: Stephen Hemminger References: <20161219215944.17226-1-sthemmin@microsoft.com> <20161219215944.17226-5-sthemmin@microsoft.com> CC: , Stephen Hemminger From: Shreyansh Jain Message-ID: <3017fb08-e1f2-376a-e748-7151810b440e@nxp.com> Date: Tue, 20 Dec 2016 12:46:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161219215944.17226-5-sthemmin@microsoft.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266915615401134; (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)(336005)(7916002)(39840400002)(39860400002)(39380400002)(39450400003)(39850400002)(39410400002)(39400400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(377454003)(24454002)(356003)(47776003)(230700001)(626004)(8666005)(65956001)(23746002)(77096006)(86362001)(31696002)(38730400001)(229853002)(110136003)(5660300001)(189998001)(106466001)(2950100002)(8676002)(69596002)(305945005)(65806001)(81156014)(6916009)(8936002)(81166006)(6666003)(105606002)(64126003)(4326007)(36756003)(50986999)(50466002)(54356999)(104016004)(4001350100001)(68736007)(83506001)(31686004)(2906002)(33646002)(92566002)(65826007)(85426001)(76176999)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2475; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD033; 1:pwb4Fo4hDIAViab77J4b3oDC7UT+rlfeKyTI+JrPM118TsU2Atd6o/jfYUpW+yWw2IhgdLsjaujZB5GZedevTnoEm7ep5dgZqaI8MBlwC9jDWxitWAiS9tqHl9DBiuzDoAUbghpWtXZ8CIcNT72pUkT9PABM6sizp9O5LmmJCfCFXjKvkQEeX66iHURPYm6ZKaHg1Ib0Qg8gz/DI/3WlMluZ9TO2kaTEcimorBqA0NlOQ86V6w/ldHhsC0u/9ExEm85WdG1o1rRdXuqn9t17Jt10UWYosnAoRxm8GXFMjECK2e9M7bkID15EqSiTXrj5fr1X+DEg/oYR0AsmDagx49dSp6lfwdInoTx4CJACMA0Knpvlxw0mq5bCjwHBn4M12JIeOcBXtDFIqaOTFlxo0wWPYrvW8jeQ2Bq/99bS6rvJZMFy9rzRo+Oj5XLpnrHM8BoFNKuTQHlWJ3t90BRHlSzrDycmmZ+QNu0jEWK36EGppvSG/9J8KqhoP4W99T3QRMAxHYiBdvQdgAlbrLVMLZYWkEKvzgdEFy7zROUq9WwrH2x4lUJl5Ct1YFaUsWOq+WySu47z7fB5CTMuQRzj5BHu2yBlIAhNTZBom+yoqlw= X-MS-Office365-Filtering-Correlation-Id: 07b2885a-1c09-4af3-f845-08d428a79665 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2475; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 3:SGFxXiatUAcsbHjKJdYwTuNUwdHfBvMKsSP2ck5Hv/EaqOkxBFu4c3lUzNymMXt3Y+PSdwjEGLFky1ckKDq+X3P13W2oJuUhBNWy1BU4QJw858YPOXaECQd/pQKyFbTsYXbPnPEKB63dTHSlgW27YL8k29ycy3nBBU5esuFttZKGIHKGopUDLtfmZwbbr1wXGtA84YXvqo/tkBJVQMNck1wgmXiOu+XyMMrdJBKAYgBOK0jgMhP9F6bEcbUORVpp3Tvf+2SfqPiDLDmU0XgtFBoQiX8IuX35rHB12YbGxGAzF5dB2L4C16Gx02MHqdF7xJ51RghetFNDwcE2ya94tyIX/sx0FGYacWSv+EoUQpE=; 25:Xg3BheCtQ7sN6OSpWAOTFCTQSqWInC40QnJKPiciAO7WdffmAJAXu4eTPCY1UlOICzpKuUkaxRdwAg4TMp9fjryhVR2E8dzTcBY44ZdPeyOhgKmVLofBwqBNmzUxve5FKK9ZcA+2iinPGinlZZg72yKuhS4D90mXrMe1/LPP9VzNw0Cu0Drh2JuVyrSIM+HIjt7Nbn2HpO1e9RiA+SvHxN7VVMKG5xd8oYgemawKhaJBMW9QY9yWtLWCejfgQlCarLcd3kww/9va3VD7pD7RWuKVKtD0LtRbQy3jOz8hQZwbs1sYb56LsYmgdr97H3w926s7W4UYHi1ywsF63OIe/SLh4PKw+ANE9E+Fo+0MPKboxFNPOIw/lU0q+nhIMXfxZStLqD5RN/fndce8pIZpn5iIi9OPeE8yFab6p9RvRAVXTe53Mmpnl6fYiqtmqpRpmNWLoXlEKKC295Eeq6NceA== X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 31:kJaWKqIIfVB1rz2Sg1JtPMRxZUHqmNWjMiaJL6m/6CRGiBcX9KU3/eX9TYPJSIIHifPO5FI9YCuBVo937fZ6W4h8JbodqPgpJkd2vPoamH5XMN8IUwlqTLFI01jlj+7k59dLVP/XxXH0oLZRGaXjPvko4HQ8sjTQWeu2o2/XBkI87rmB8unITLElBjFq+X3//hrlNQMXCjGt5SBqwqe7X5yC8lKVofrM14K0LeDoD53jnx7AwbuDYZEWzzz/TWyjsOe+ypsgcsCL4Mkt4qfCmw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13024025)(13015025)(13017025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559025)(20161123565025)(20161123563025)(20161123556025); SRVR:DM5PR03MB2475; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2475; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 4:a0uPLSvCIGpfasXjhjiP5Ynz55fvzihFOTp7GeVM8d8aRoq4kScdxju83EuGkaP0Bm/Jy8c6EIpF36dFLbxyw3IXVL6L5r9sN41F1J0OOK3tcXyN4zR5dqQppB/gaigQuIndvym7XYY/zod9OFiBPEKNZFYEVWtjYzSSGuYKuHhAezxpTPByKh1ocgQC05gYAAVrCSqpYRWci0UFVpXayxwwFv3QLMLLaJ4YjZXQPvlFxX/q+x2/bnQgPvcft9FfTSgbxrQkPfBTKZoKwsWLEhbl86YsG+9aDL3Pq3awwyXjscakMvUZSWBT9mUUbchcPj5VMRoQQtszyDjymqfGyVLXHw4SP1sgP9QmxnRk/7vYwX9bo3F36Tbks8PQD0d4nZ3y9BFYaCY26N3dGrVs7SXAtE+uUOWKcrw3HvmRH4O0HK/lvEJR7UbKISO0r11WOGwyk+imnVF5UjjC3ZR8eprLjSZt4FT6nxjD87z4SuLzjXZ8TpfxJC0JQzahNw6lBIF9RXhogFREeUd7Zedw2Jwl+WTZ+Erh/S6jh5PBkKYJjjskXpZ7NpXNoYcRE0aUOPBkNGAirWVMZ3eom6YauQkDiNRFWvcrgQyAPsxN0eymhcN7jebNlbnYp6Y/yygLrEEjBwLc5i52quDDVXS0cnBYU3mtT3LLNWPA3faFDswUFWkY2Ue+tHTLteF4uQx4vpVbbLla+iwNEqJea5nTMw== X-Forefront-PRVS: 0162ACCC24 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR03MB2475; 23:2sG01KCzqD2tvC3a1zfI7Zn3oUwmlUIR2n/Db?= =?Windows-1252?Q?oIjrxk2O4MX4Pj+YP7E0Ak5osnixGA9fcT136e7OExBeIia2x+2S7oSX?= =?Windows-1252?Q?ued8HJb3E/FRVUbosjzDphrEQspVoCooQ/t/JNhv+7zC15S4fbD1nrgI?= =?Windows-1252?Q?OIfS+bv6Wd0qR8m0rxtKHawK1HGWJ4RppKpNWWNUWz3G1OgQHlC2KPZW?= =?Windows-1252?Q?iaZ142OW08+jfwzM7XcMHtCfoMhF/Y9UZfeGDen3hSi6gcUDT7hRPTyj?= =?Windows-1252?Q?fOGPllls+FVUdOSzHvFmHjh6XkbdmoSPkQhhtLniRxknf8YVlaeJ3KgS?= =?Windows-1252?Q?0nsMg+KifuuzHGjXe07CVtdbThcsNhcCwoT+wd2wGa+fRvH8I5aJZO1l?= =?Windows-1252?Q?Us+oo1qSfaGiDLN110xrDeN932tn1xAu0x1DB5aT7VBLXiL9GqQLjZeG?= =?Windows-1252?Q?xBAr+ZCS9egJ0BamswVdbYhyWWxS5//7lRixJw3uswoemK+rDf5LVWp1?= =?Windows-1252?Q?SPlve4esZE9fO+O4tZ+2R8gvJCqjzV2ZoljmmpbVA8KK9/8H33XfY92g?= =?Windows-1252?Q?zqsDXkzSghhbiGmH3WckHptrGAx6c8MEK/4pv0lq3a1vZzCQoYf5leyI?= =?Windows-1252?Q?nijPU4BRj1pdEbZoAU/0qGagBRHNu0oFvoaw/VzStR5NKRJD2miFe4JD?= =?Windows-1252?Q?a7Po1uliadjOw6OsmitgBCXegBhPHIIekBeMtCuSvyGm6noKhKAUJGpT?= =?Windows-1252?Q?OK95yccaofHtGRaQSm4Uj3S8nbOfs8aQtZHo8oHMyDxiOcq9XFu01BPj?= =?Windows-1252?Q?ZIAMe2UnxT0cnT+XR2TzCQLAsp8gtdCvrAR0lmlT3WYRHpEpv4vhffeW?= =?Windows-1252?Q?T3bf9Gytwk/Mhb5WgWkSdamjyRnol9uvEBHtKmU6++iu+b1JH1hVixkD?= =?Windows-1252?Q?np/LWWHSVYWSI/SV8y+hlYBEyIjwFv85LFQ5StJXja9fZwp/bIzypA61?= =?Windows-1252?Q?RPGDyaMWUjfpwXZDiffZPpGcijxfVJR6XKy8PenGMwCqSP5VDLD1aIio?= =?Windows-1252?Q?oxLgebI05JT8/hBQKWc56HHRBdJ3Gt98qe2F77B8p/oJQFbphHypR/iB?= =?Windows-1252?Q?C0zz+84puVTY0ssTyGoFz25wLSPXyibJHH67JzYrL0iUovqkH6CiSOD7?= =?Windows-1252?Q?D6G9ZRbPXpuPkNjlT4/QHbkVIWBzs0QaOzjVK4vrBHuBRVZjVPelP4J0?= =?Windows-1252?Q?0WYHBqYCLKyDMkajgqZG1tknXuKGKRcfNgfX9uI2i9oTMO/oFiOBK15U?= =?Windows-1252?Q?SEb0GkQjt0ZMB6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j4DjD/N2J5peF6dltFD6zEpXcnax+xB+9izC0QbwmQTEc6W9bA7BOQHsR6ZqfLmTJajwJAA9CVUU5M9UTwha4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2475; 7:/sFaTezjVwlnhl0VnsUBFre+K4y69ZAvwNZs914Wwceiq3cXiU+Sb9HZ8qarA6oBwUVPPMKMDpRPFT7ujnXIeSRjfmOzWCteSwJt0fNGDlBzhGKwbTOJXQaPogszPU1OINvtDRBSjW5uvUbczqQuI4/OEx/SHwuRhbvcevZLm+AuB+WiXOZwesPSoUfRsh84CH6PviTVTxjCpZBdO8Lec1JxsHUTru0PPqBM0fI+4GVd88n1n1twZ3RhndWwvdH6p3VMY4Jn6z/KiaENYSbQWtMnn+fXlQQOoC1oh3O+p08vcrWlHbWNRpMs4XQG6OCfC0/YgqN+1xvOdw2KTS6O3RxXpfmENzA5K+1deyLUAuZSf7kXCfPkRmNb6JUPZzsBxqh8WEYTCxaFGADm2DaJqiTkk3DTTdsI1qK6HWIMGhiiuWfPTzZgYPyHwe3H/Fxo4Kmu5JZLgsZUahuoBk/DXA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2016 07:12:41.1813 (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: DM5PR03MB2475 Subject: Re: [dpdk-dev] [PATCH 04/13] eal: introduce driver type 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 07:12:43 -0000 On Tuesday 20 December 2016 03:29 AM, Stephen Hemminger wrote: > Since multiple buses and device types need to be supported. > Provide type field in driver. > --- > lib/librte_eal/common/include/rte_dev.h | 15 ++++++++++++--- > lib/librte_eal/common/include/rte_pci.h | 1 + > lib/librte_eal/common/include/rte_vdev.h | 1 + > 3 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h > index e5471a22..3f4e26e6 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -144,12 +144,21 @@ void rte_eal_device_insert(struct rte_device *dev); > void rte_eal_device_remove(struct rte_device *dev); > > /** > + * Type of device driver > + */ > +enum rte_driver_type { > + PMD_VIRTUAL, > + PMD_PCI, > +}; So the expectation is that if a new device type is introduced (anything other than virtual or PCI), this enum is expanded? Broadly, we have two possible ways being discussed on ML for device relationship with PMD/APIs: 1. the way you have done: each device belongs to a particular type (enum rte_driver_type) and based on its type, operations would be performed on it (using conditional operators, for example). We continue to have a common device list containing all type of devices. 2. disassociating the device (rte_device) completely from its type and basing it on a Bus type. So, we have separate buses for each device type and hence no need for separation of logic based on device type. I think implementation similar to (1) existed before it was removed in 6751f6de. I have an (obvious) inclination towards (2) because that helps plugging in more drivers/device types without expecting the contributor to change the EAL - however trivial the change is. > + > +/** > * A structure describing a device driver. > */ > struct rte_driver { > TAILQ_ENTRY(rte_driver) next; /**< Next in list. */ > - const char *name; /**< Driver name. */ > - const char *alias; /**< Driver alias. */ > + const char *name; /**< Driver name. */ > + const char *alias; /**< Driver alias. */ > + enum rte_driver_type type; /**< Driver type. */ > }; > > /** > @@ -243,4 +252,4 @@ __attribute__((used)) = str > } > #endif > > -#endif /* _RTE_VDEV_H_ */ > +#endif /* _RTE_DEV_H_ */ > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h > index 9ce88472..d377d539 100644 > --- a/lib/librte_eal/common/include/rte_pci.h > +++ b/lib/librte_eal/common/include/rte_pci.h > @@ -492,6 +492,7 @@ RTE_INIT(pciinitfn_ ##nm); \ > static void pciinitfn_ ##nm(void) \ > {\ > (pci_drv).driver.name = RTE_STR(nm);\ > + (pci_drv).driver.type = PMD_PCI; \ > rte_eal_pci_register(&pci_drv); \ > } \ > RTE_PMD_EXPORT_NAME(nm, __COUNTER__) > diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h > index 784e837d..98fb5bb5 100644 > --- a/lib/librte_eal/common/include/rte_vdev.h > +++ b/lib/librte_eal/common/include/rte_vdev.h > @@ -88,6 +88,7 @@ static void vdrvinitfn_ ##vdrv(void)\ > {\ > (vdrv).driver.name = RTE_STR(nm);\ > (vdrv).driver.alias = vdrvinit_ ## nm ## _alias;\ > + (vdrv).driver.type = PMD_VIRTUAL;\ > rte_eal_vdrv_register(&vdrv);\ > } \ > RTE_PMD_EXPORT_NAME(nm, __COUNTER__) >