From patchwork Thu Dec 27 06:23:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 154551 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6604724ljp; Wed, 26 Dec 2018 22:23:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN5G3F3qaDqNQWqO4lQfljpjO8suX8oR3xfY++W4dKaz9whxdvILUcEsFTIEZ7NvakBsz97T X-Received: by 2002:adf:9061:: with SMTP id h88mr20489473wrh.65.1545891834482; Wed, 26 Dec 2018 22:23:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545891834; cv=none; d=google.com; s=arc-20160816; b=rEUkiFg4ebIFjm9SnYpXU7mnyw3hBe+0EzV/sXRAVJ7pz4Vcx/tZR0ad/D8Rxom1ml ixM1gYzmrliOICs2Cq9bSsVKy8OEMiVfv9KyekGIFmv4IX8vKP8WDeoVp9h3pHza/CEA qcEVT/2jNVB2wlm7M4GB9zBFz8O9N3cYE0QGDMrzoxpWFj26UzKsTs0AZ/iHP8qPfWRf 9pnsoXe0+QOvRZ4EBivC9kL2VDnQmyuBaYpoqiz6SUKFY98cj4hv8ZYHLX6ffH/Te16q dTCMvb2O8a5BKf4MPDaQnpZfjhIeBaGUJmeL0AyLCCOOTLrCSCkDG6HGLd3aSP7pY4FH wVQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version :content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:cc:to:from :dkim-signature; bh=I0bsTyjNVHaT9Ai4Obi5phGJNXVmnnIhnzD7HILujSY=; b=c4AhmAo51Du98nX1PsXVGchggRVdgD1CInmEoa8UadtPOOYIcb8fGXzBktF4DgaNck K9FIngqAdhizobai8IYI+2H9KnJLeQxQOwXhSFKncRSyHUddOM20I1mJLJg+CMQbzxmB LLRNOH4s0Cq55TwSi9UwFejEGZjtvIqLWKeU/VPlzmyUOIiqPJ1QK3HyckrV05nK/GPW ETNyzlfVTeu8NPrpetk+fp2s4v1aSdzYlknTddbju8vWRwQQL6zDrwbSA2PCBK+yC729 +HzRs98JPa//94juGAo5NqdmBPIVIS/cVokd3pfVZtzRydIe39aGpgrwGPg5KrlPlzhA +m+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b="k5vo4R3/"; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id b1si11594844wrj.176.2018.12.26.22.23.54; Wed, 26 Dec 2018 22:23:54 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b="k5vo4R3/"; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1FE5D532C; Thu, 27 Dec 2018 07:23:09 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140082.outbound.protection.outlook.com [40.107.14.82]) by dpdk.org (Postfix) with ESMTP id 6EC224C9D; Thu, 27 Dec 2018 07:23:01 +0100 (CET) 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:X-MS-Exchange-SenderADCheck; bh=I0bsTyjNVHaT9Ai4Obi5phGJNXVmnnIhnzD7HILujSY=; b=k5vo4R3/kDXo0u+u/UFzepV1If/yHt68b9ZA36t116Xj5I9idNzs+PDB4f+T/MUyO0K9dmROpK6iwaTzETTtTolLGOejXakQUoFLg0eY2PaZIAG+8ekJykw6DPUGRIEvmjj9P1DFjfTJuZBXAdNFDUYGd4Ztzlc+12khyMn+wmg= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2382.eurprd04.prod.outlook.com (10.169.134.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Thu, 27 Dec 2018 06:23:00 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4%2]) with mapi id 15.20.1471.019; Thu, 27 Dec 2018 06:23:00 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Shreyansh Jain , "stable@dpdk.org" Thread-Topic: [PATCH 06/20] bus/fslmc: fix parse method for bus devices Thread-Index: AQHUnaydCsxuxzBDukyUp3XV4RzuuA== Date: Thu, 27 Dec 2018 06:23:00 +0000 Message-ID: <20181227062233.30781-7-hemant.agrawal@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> In-Reply-To: <20181227062233.30781-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.30.134] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0401MB2382; 6:hSM8N7fwrJRbNvgF2D8wZCWYatmvG/TjishRNsRtOo4bKcuDd3MeHoDWlQPKfsNKqmgU2cOWxTJFBCMVzI9seDTUNy9KQVOrBfaduBca95ophs2xRwfUiI6AtMLeyyeNrigrGxWZiP54DgXo1m85A9mjeatGLkNvh3JUan4evMTuy05bB6N/Vx1BbkB4eftkX5gO9Wl1ovqCiFhlZpElhlI6itlMxMTHNMEvsYBR57vgmzdESL6iDAxAN7YiHW5Dr+SfYKjfSAmbJiwI9ZhhDrpGI4uDp2qe5ellvTTKncEly5YtUhNlH7Y11nkN2PhXGCz0AfpnV5+GJJTf0J/ywzPa8fgwVOXArEmUxm3Zu49PmE42iWGTPFUAhbNAlTQoZ1DjZlQQml0F7lS4KYmaNTTLC9i2tVEvbaO5xGzn72YihXX6ncvSVOfCSgkkQcUwm2BRtu91yPY2anvouHdk1Q==; 5:AZdiYt3MNXGwJvxfauSVGdaxcRyHoRKEiBZ0vfgWGjWr4x5Imd7nQvUL/DoXwgB8aTJ/E5Jyf37CNokshcz+H1UdYtE+zP0PR0MI8OaOtT/OnH1eiLEdIuAVTKr7OWeuTyTnRKehn4D1NLJYBPkOslniu3/5Nul60XtB3g398Mk=; 7:gDkQJSg8ToGguyJ2yiL81pU4dnuZhsTSh4DE7M/xfg2c8s2PqB6SLh4kEDeqvdEzloxByb1x31OmUgriRw7nUeIZ0UQhxJsqPSd1TK9Ww3+1/ifgVBODk0kzodWk07b7X4KVdm8A/YPGLexRGt1Upw== x-ms-office365-filtering-correlation-id: cae1144a-9eba-40ab-4aee-08d66bc3bfd9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2382; x-ms-traffictypediagnostic: VI1PR0401MB2382: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR0401MB2382; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2382; x-forefront-prvs: 0899B47777 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(376002)(39860400002)(346002)(199004)(189003)(5660300001)(1076003)(26005)(76176011)(186003)(71200400001)(256004)(25786009)(105586002)(4326008)(6436002)(305945005)(11346002)(106356001)(446003)(44832011)(476003)(7736002)(55236004)(102836004)(78486014)(486006)(386003)(68736007)(52116002)(86362001)(6506007)(2616005)(71190400001)(66066001)(316002)(54906003)(6116002)(3846002)(2906002)(14454004)(36756003)(99286004)(50226002)(8936002)(1730700003)(81156014)(81166006)(8676002)(6512007)(53936002)(478600001)(97736004)(6486002)(6916009)(5640700003)(2351001)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2382; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6uC+Nd0yW73j7s52jCxE1WBhPKg7SVtcnDkbiCMBhtrBG3shuLnSkqK8yhpkvzmA0NKwJKlc+W1En8/xvL23kSpTf0ZXIbzqLm+7IDuJn1CA6QNFD6FRrx2ZbRmisMZVY1u5Y0BZOBXIDQ5dcID+KaiN+trqVmtZUtNHEepgNopPdOeEN7b6DqPN1qbEo+zH5gtwXHKw7TO3DR6obL09AzxwY7Mc15azjkRo/VEIrNFStKRGIWeyny6iNeMLbHiM2aRXyhSkj9WsUn+JStnMT6bm4tDUJ7xoIQsqsB8oqIB/UeIhzdKP1IXpztjKwCrd spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cae1144a-9eba-40ab-4aee-08d66bc3bfd9 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2018 06:23:00.3956 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2382 Subject: [dpdk-dev] [PATCH 06/20] bus/fslmc: fix parse method for bus devices 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Shreyansh Jain Current code expects that bus->parse() would get a string containing the name of the bus. That is incorrect. bus->parse() is expected to have strings like: dpni.1,key=val dpio.2,key=val when user passed: -b fslmc:dpni.1,key=val This commit fixes this behavior. Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting") Cc: stable@dpdk.org Signed-off-by: Shreyansh Jain --- drivers/bus/fslmc/fslmc_bus.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 89af9385a..565e0148f 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2016 NXP + * Copyright 2016,2018 NXP * */ @@ -227,20 +227,16 @@ static int rte_fslmc_parse(const char *name, void *addr) { uint16_t dev_id; - char *t_ptr; - char *sep = strchr(name, ':'); + char *t_ptr = NULL, *dname = NULL; - if (strncmp(name, RTE_STR(FSLMC_BUS_NAME), - strlen(RTE_STR(FSLMC_BUS_NAME)))) { - return -EINVAL; - } + /* 'name' is expected to contain name of device, for example, dpio.1, + * dpni.2, etc. + */ - if (!sep) { - DPAA2_BUS_ERR("Incorrect device name observed"); + dname = strdup(name); + if (!dname) return -EINVAL; - } - - t_ptr = (char *)(sep + 1); + t_ptr = dname; if (strncmp("dpni", t_ptr, 4) && strncmp("dpseci", t_ptr, 6) && @@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr) strncmp("dpmcp", t_ptr, 5) && strncmp("dpdmai", t_ptr, 6)) { DPAA2_BUS_ERR("Unknown or unsupported device"); - return -EINVAL; + goto err_out; } t_ptr = strchr(name, '.'); if (!t_ptr) { DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr); - return -EINVAL; + goto err_out; } t_ptr = (char *)(t_ptr + 1); if (sscanf(t_ptr, "%hu", &dev_id) <= 0) { DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr); - return -EINVAL; + goto err_out; } + free(dname); if (addr) - strcpy(addr, (char *)(sep + 1)); + strcpy(addr, name); + return 0; +err_out: + free(dname); + return -EINVAL; } static int