From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0088.outbound.protection.outlook.com [104.47.0.88]) by dpdk.org (Postfix) with ESMTP id 718875B2C for ; Fri, 8 Jun 2018 13:12:48 +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:X-MS-Exchange-SenderADCheck; bh=FG+akwlSgJ13cM2D/ucNdxZYQ0tux9AUzvF+mKM8pF8=; b=MEpYvELtrloDKyIuYEmbFz5ocFGaibXuDnPoXvT9bRfDJN0Z9epDNvRe/xhcjiCGIwKHFHC6pWaGpaeI546PaaFImC+WnoVCenJF/HUM8vsMl6U42EnPwC882ajAL7S5eIcdfrVWdq9HbeQZaKKzKiv0yYygVSYMMccGeEbtH18= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.40.129] (14.142.187.166) by DB6PR0402MB2774.eurprd04.prod.outlook.com (2603:10a6:4:96::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.13; Fri, 8 Jun 2018 11:12:43 +0000 To: Qi Zhang Cc: thomas@monjalon.net, anatoly.burakov@intel.com, konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20180607123849.14439-2-qi.z.zhang@intel.com> From: Shreyansh Jain Message-ID: <856a4948-756a-16e7-95c8-c61ecf52916e@nxp.com> Date: Fri, 8 Jun 2018 16:42:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180607123849.14439-2-qi.z.zhang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: SG2PR02CA0023.apcprd02.prod.outlook.com (2603:1096:3:17::35) To DB6PR0402MB2774.eurprd04.prod.outlook.com (2603:10a6:4:96::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0402MB2774; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2774; 3:DJgzB124TAFrw6H9Jg+or0UXDAOy9xk8p8vKDgldolOQ1ppnhcty8jCTY+WF9BhEM9ypwKv7RmionXgS6It3+cAfo6dOXsbwSCZqRZzIl1/AWT/rGhol2VbhgYz97WVumm6M/mR0R5Cqh/uqEExyxnw1tFtyBrHh5+Tq9tPI0RiPAVuO1KWePBcZl6ZCMJ5VEGw1HFZPSB6vTqiri6sZAVp9tLn22TqFx/MDqYC1j8GJpskY/iEURXD5Rj9F9+ge; 25:z8FBnZe6Yp2d6Vf4LKTq0wz8GuJDv1jRTCCobIaRF6FLVRtuOc9q/tXdoREOGDlQyKKKEUtEh3WohYaYPNF4E3h0qQLoQGqqNEKvQEr9Knj7Omgc+IKHGf3fQEApUSI3SmY6fYBt5vec17GX3v+gNKIxqJiw5LM7SJAeG1cUa6YGw085eevPRst3+Fx8XloB7Fz3y3Y+tTIc63bJFumvvrmq5S6WPxiWKXe/+FsMUvUfxwR9IttWmnlHqHyA/volfqN7guojO2RTbyXD+mgwlDEbPX70F4xzg4cB7z8oj/msrn5pjJUQGQVKZtdm/h1Eoe8DeQB61wvQ4X+xCRetWw==; 31:9H5dNNysu/qS77uOhO0RaaAKwkA5lW2bdKYIA3v2o5hN8belxuMtzxcV84phHL2LRbIsS4zkBKysowgExVib/MXOOiI6m3lck1l61Kp8mZAz/GtdVIhmi9JSZZVr8ChLEHU5aMNYknzElEfIC45uyKuqqu5sCdN6dOriOq4YzCzWclre0oFwcBRdtWPiX55YzUAIfml+yLmR3/D8hn78AGcfC5rnOHK6GEt/+PQNRYE= X-MS-TrafficTypeDiagnostic: DB6PR0402MB2774: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2774; 20:crla4htVxBC0zeiDB0I7Z19bpZJWsWHYv3sBQuimyWXA/avCXF7Ucucdy+AY555kMlrAHyKtDVwvGSbeNGJQUeE7icF9G3ztCnTtSWw3vndEFSR2wwO5wXV9qVr/ANn3oldfNJl4mCxy5LEtDDffDGX0abca3kvUwil+drchHUnKoqc/YHDLAgbAb/JCb2q4TGuUTHnBejL0Da0xNHbB9E7uDKpLFBDQiRjw3zr9lXdMiaLwajTRu3+x/p4ALdBec+XhPajiHpZ87/yT2y1g4viPgE7aYXPIoGZ+GfCUrnc741q6C844f0zJ2UC0SmjIqLUlp6WJbAaArtt5N881JWCB0315wsEGFroXz+myIinwcLBo4fDb76lo2FU5/+qu8Ah8GgsbhHDmsgslhFDUK6qnLkJ5PIgmhJHcNlpVLDhNRvQdjs8CmI8D1PB/bFUqkLUt0jxZk+ZISzjpgfrALzejqwrCsYe4kgDNeCEr5fdX/o7qzDrJ2O6SceDTPhWv; 4:CxMcYqzZdGlb/gfz40XuGI9sEIYXNsLzYpx5qpIipjijr/zyw7gEQDzEljB7QD/lc0Q9mg5K5oCETVtklHQANQ8G5DdL9iRvn55ihUgZ4N9kM0DWOzbzEpCt8TK0Ri854WMD7MYd0VmyxeOD7nA1XemkgLFDVePeVhgaqV/3TJksmnrUrKtp3zxK1HYbBOeCGWYRwIk//OjgrzqRm0df+iDTjMKK/2PCwwIN8mBKCPwnjVTuOWYT2lxqeMLBK0BChlX/ozzucDYBhI3H0t88hoTyI2z/13j8KyB2MtvWREKtXTmLqaX6ZAAwBy/zw7+u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:DB6PR0402MB2774; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0402MB2774; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(39380400002)(346002)(39860400002)(366004)(396003)(376002)(199004)(189003)(31686004)(5660300001)(65826007)(3260700006)(3846002)(6116002)(44832011)(186003)(476003)(5890100001)(2616005)(956004)(16526019)(81156014)(31696002)(230700001)(81166006)(86362001)(5009440100003)(8676002)(8936002)(486006)(6486002)(47776003)(229853002)(68736007)(478600001)(52146003)(23676004)(2486003)(2906002)(50466002)(305945005)(64126003)(67846002)(7736002)(316002)(66066001)(6666003)(4326008)(58126008)(16576012)(36756003)(446003)(55236004)(53546011)(76176011)(386003)(25786009)(106356001)(11346002)(77096007)(105586002)(26005)(6246003)(53936002)(97736004)(52116002)(65806001)(65956001)(6916009)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0402MB2774; H:[10.232.40.129]; 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-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA0MDJNQjI3NzQ7MjM6VlA3M1I4aDBVaXRNaXpXa2FGdVJMdnNo?= =?utf-8?B?U21IY1VHeXlsWUF4YW9odFRUMmxkcmZnek95VDZsNTE2b0xMbzZpYU1YWkhi?= =?utf-8?B?Nmp1WnhJWmhxd21wYmk4czQ5S09GZGpENHlmbFRWNzdsZGNYMVp2YmlQWXR1?=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CQ/+OVyyK1Yh0doFultXbAfLoaWQp34SjK9Uk2Da1I27M=; 24:oHCHtB7FNc2fvq0/buwzV5+OC8kmacY53zT0XxPv55G/kQZCPbKkOFMX/FaXyS6VYzgAhYk5cFN3CYPuj8G4nGPsaseUMIDA6Oe+JYWa/j4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2774; 7:tcLrpWFmtqBbSTusTFKcZIBFEUt51ATnF+dc5wqLMSG4piYA1JYguvtMNMBDCNBah2M8KJ3YovE2Tr4y4v7hEGOrR6vfrYtX2b8zVIqYgTv60SP8oBs21UsYXW66g+LSWMxSjR2yZjSJXOax468OfKb3dulwZN1xdl+HT4ECWaBZsWiQbif3hhPXCDzCIqEJdqL03bGNqeJbgPN5mgXITHcqH9E+Ec5ix19LgGo++yLGkmmVon2KwTuosdglz7zW X-MS-Office365-Filtering-Correlation-Id: d87824d1-7084-4151-eb3c-08d5cd30c358 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 11:12:43.0996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d87824d1-7084-4151-eb3c-08d5cd30c358 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2774 Subject: Re: [dpdk-dev] [PATCH 01/22] eal: introduce one device scan 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: Fri, 08 Jun 2018 11:12:48 -0000 On 6/7/2018 6:08 PM, Qi Zhang wrote: > When hot plug a new device, it is not necessary to scan everything > on the bus since the devname and devargs are already there. So new > rte_bus ops "scan_one" is introduced, bus driver can implement this > function to simply the hotplug process. ^^^^^^^^^ simplify > > Signed-off-by: Qi Zhang > --- > lib/librte_eal/common/eal_common_dev.c | 17 +++++++++++++---- > lib/librte_eal/common/include/rte_bus.h | 4 ++++ > 2 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > index 61cb3b162..1ad033536 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -147,11 +147,20 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn > if (ret) > goto err_devarg; > > - ret = bus->scan(); > - if (ret) > - goto err_devarg; > + /** > + * if bus support to scan specific device by devargs, > + * we don't need to scan all devices on the bus. > + */ > + if (bus->scan_one) { > + dev = bus->scan_one(da); > + } else { > + ret = bus->scan(); > + if (ret) > + goto err_devarg; > + > + dev = bus->find_device(NULL, cmp_detached_dev_name, devname); > + } > > - dev = bus->find_device(NULL, cmp_detached_dev_name, devname); > if (dev == NULL) { > RTE_LOG(ERR, EAL, "Cannot find unplugged device (%s)\n", > devname); > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > index eb9eded4e..b15cff892 100644 > --- a/lib/librte_eal/common/include/rte_bus.h > +++ b/lib/librte_eal/common/include/rte_bus.h > @@ -83,6 +83,7 @@ enum rte_iova_mode { > */ > typedef int (*rte_bus_scan_t)(void); > > +typedef struct rte_device *(*rte_bus_scan_one_t)(struct rte_devargs *); You should add comments over the declaration, just like the other similar declarations. And, a new line should be here. > /** > * Implementation specific probe function which is responsible for linking > * devices on that bus with applicable drivers. > @@ -95,6 +96,8 @@ typedef int (*rte_bus_scan_t)(void); > */ > typedef int (*rte_bus_probe_t)(void); > > + > + And please remove the extra lines added above in next version of patch. > /** > * Device iterator to find a device on a bus. > * > @@ -204,6 +207,7 @@ struct rte_bus { > TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */ > const char *name; /**< Name of the bus */ > rte_bus_scan_t scan; /**< Scan for devices attached to bus */ > + rte_bus_scan_one_t scan_one; /**< Scan one device by devargs */ I think you mean "Scan one device using devargs" rather than "Scan one device by devargs". > rte_bus_probe_t probe; /**< Probe devices on bus */ > rte_bus_find_device_t find_device; /**< Find a device on the bus */ > rte_bus_plug_t plug; /**< Probe single device for drivers */ >