From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0085.outbound.protection.outlook.com [104.47.1.85]) by dpdk.org (Postfix) with ESMTP id 08E36475E for ; Sun, 16 Oct 2016 09:12:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UecrZjEGzIEQPWlPQcvdI0NQrRBPNK8ULTbyJQPAy5M=; b=yK9yNNQsTtke99PjC/jxlorqRhKW1QAGYNqS6RXjbQgVKNfi3FkUulyun7UCtY0VFKdCzyo9YXxJd6eXKcTBELOYJGwOMiCpaaL8jDj4mhxwLPOCa1ia7gJghWO685iTkigFk+64LdD70m6JV0J1qqTfkvDtm23CRTci6lI8MWM= Received: from DB5PR0401MB2054.eurprd04.prod.outlook.com (10.166.11.137) by DB5PR0401MB2053.eurprd04.prod.outlook.com (10.166.11.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.12; Sun, 16 Oct 2016 07:12:14 +0000 Received: from DB5PR0401MB2054.eurprd04.prod.outlook.com ([10.166.11.137]) by DB5PR0401MB2054.eurprd04.prod.outlook.com ([10.166.11.137]) with mapi id 15.01.0669.018; Sun, 16 Oct 2016 07:12:14 +0000 From: Shreyansh Jain To: Jan Viktorin CC: "dev@dpdk.org" , "thomas.monjalon@6wind.com" , "david.marchand@6wind.com" Thread-Topic: [PATCH v4 11/17] eal/soc: add default scan for Soc devices Thread-Index: AQHSJupP4+yergk5lUG4+c3pGof956CqQo8AgABnRPA= Date: Sun, 16 Oct 2016 07:12:13 +0000 Deferred-Delivery: Sun, 16 Oct 2016 07:11:34 +0000 Message-ID: References: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> <1476539108-13170-12-git-send-email-shreyansh.jain@nxp.com> <20161016025658.5182b5b9@jvn> In-Reply-To: <20161016025658.5182b5b9@jvn> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-originating-ip: [122.177.138.244] x-ms-office365-filtering-correlation-id: afb4c594-41e1-48fd-75c1-08d3f593c16c x-microsoft-exchange-diagnostics: 1; DB5PR0401MB2053; 7:Zw0mfYdjFHe7+5d6aq/bwB829JJU7vjdW9fL5/nCF7Gw2Ztf7eSZY4l+RfGdGN9KcWUgurMx8S1AZvgqdSXYBTXg/yFglZY8D+8Y52ClJTa/44+BpgzvuantWAOFysVF2CJns3bv34xwF54L85PRZi6b7bjXqA8qNXSbxft3wbqWWgoIJc4QOggcBS3mkmhyk9ZQNZRBFlUcLfo1vUO8hTYxFCPOeNY9pf8EkuLGeYdO4DosYZTCATKjQ+msq8kgTMPPMMRNSjwAEK5x7OXMaBjxGYbG1K/swScWwPza0r3m+gi1wcMwwBpO8AecPW2pA+ktcbBAThNtn1MM/z5sZgCPr4klBj9sTqmTId4KzP0= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB2053; 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)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DB5PR0401MB2053; BCL:0; PCL:0; RULEID:; SRVR:DB5PR0401MB2053; x-forefront-prvs: 00979FCB3A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(199003)(252514010)(24454002)(13464003)(189002)(377454003)(92566002)(81166006)(81156014)(76176999)(105586002)(19580405001)(19580395003)(3280700002)(86362001)(54356999)(8676002)(68736007)(8936002)(9686002)(15974865002)(6116002)(106116001)(106356001)(102836003)(3846002)(586003)(50986999)(76576001)(122556002)(5002640100001)(93886004)(7736002)(7846002)(110136003)(97736004)(189998001)(305945005)(7696004)(74316002)(5660300001)(33656002)(101416001)(10400500002)(87936001)(11100500001)(4326007)(2900100001)(77096005)(2950100002)(6916009)(3660700001)(2906002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR0401MB2053; H:DB5PR0401MB2054.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2016 07:12:14.2599 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0401MB2053 Subject: Re: [dpdk-dev] [PATCH v4 11/17] eal/soc: add default scan for Soc devices 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: Sun, 16 Oct 2016 07:12:17 -0000 Hi Jan, > -----Original Message----- > From: Jan Viktorin [mailto:viktorin@rehivetech.com] > Sent: Sunday, October 16, 2016 6:27 AM > To: Shreyansh Jain > Cc: dev@dpdk.org; thomas.monjalon@6wind.com; david.marchand@6wind.com > Subject: Re: [PATCH v4 11/17] eal/soc: add default scan for Soc devices >=20 > On Sat, 15 Oct 2016 19:15:02 +0530 > Shreyansh Jain wrote: >=20 > > From: Jan Viktorin > > > > Default implementation which scans the sysfs platform devices hierarchy= . > > For each device, extract the ueven and convert into rte_soc_device. > > > > The information populated can then be used in probe to match against > > the drivers registered. > > > > Signed-off-by: Jan Viktorin > > [Shreyansh: restructure commit to be an optional implementation] > > Signed-off-by: Shreyansh Jain >=20 > [...] >=20 > > + > > +int > > +rte_eal_soc_scan(void) >=20 > What about naming it rte_eal_soc_scan_default? This would underline the > fact that this function can be replaced. Yes, that would be in sync with match default. I will do it. >=20 > Second, this is for the 7/17 patch: >=20 > -/* register a driver */ > void > rte_eal_soc_register(struct rte_soc_driver *driver) > { > + /* For a valid soc driver, match and scan function > + * should be provided. > + */ > + RTE_VERIFY(driver !=3D NULL); > + RTE_VERIFY(driver->match_fn !=3D NULL); > + RTE_VERIFY(driver->scan_fn !=3D NULL); >=20 > What about setting the match_fn and scan_fn to default implementations if > they > are NULL? This would make the standard/default approach easier to use. >=20 > TAILQ_INSERT_TAIL(&soc_driver_list, driver, next); > } I am not in favor of a forced default. What if user never intended it - it = would lead to wrong scan being used and only intimation which can provided = to user is a log. Selecting such functions should be a model of PMD - one which is enforced. >=20 > > +{ > > + struct dirent *e; > > + DIR *dir; > > + char dirname[PATH_MAX]; > > + > > + dir =3D opendir(soc_get_sysfs_path()); > > + if (dir =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n", > > + __func__, strerror(errno)); > > + return -1; > > + } > > + > > + while ((e =3D readdir(dir)) !=3D NULL) { > > + if (e->d_name[0] =3D=3D '.') > > + continue; > > + > > + snprintf(dirname, sizeof(dirname), "%s/%s", > > + soc_get_sysfs_path(), e->d_name); > > + if (soc_scan_one(dirname, e->d_name) < 0) > > + goto error; > > + } > > + closedir(dir); > > + return 0; > > + > > +error: > > + closedir(dir); > > + return -1; > > +} > > + > > /* Init the SoC EAL subsystem */ > > int > > rte_eal_soc_init(void) >=20 >=20 >=20 > -- > Jan Viktorin E-mail: Viktorin@RehiveTech.com > System Architect Web: www.RehiveTech.com > RehiveTech > Brno, Czech Republic Thanks for your quick comments. I have not yet taken all the inputs you had provided in review of v3 - I wi= ll be replying to those soon marking out what I have taken and what I have = not. =20 - Shreyansh