From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0082.outbound.protection.outlook.com [65.55.169.82]) by dpdk.org (Postfix) with ESMTP id 2EE259212 for ; Tue, 26 Jan 2016 10:31:30 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from localhost.localdomain (213.17.239.108) by DM2PR07MB1449.namprd07.prod.outlook.com (10.161.139.143) with Microsoft SMTP Server (TLS) id 15.1.365.19; Tue, 26 Jan 2016 09:31:26 +0000 To: References: <1449667198-27218-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1453283317-1078-1-git-send-email-krytarowski@caviumnetworks.com> From: Kamil Rytarowski Message-ID: <56A73CE3.7010801@caviumnetworks.com> Date: Tue, 26 Jan 2016 10:31:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1453283317-1078-1-git-send-email-krytarowski@caviumnetworks.com> Content-Type: text/plain; charset="iso-8859-2"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [213.17.239.108] X-ClientProxiedBy: DB5PR01CA0029.eurprd01.prod.exchangelabs.com (25.162.149.167) To DM2PR07MB1449.namprd07.prod.outlook.com (25.161.139.143) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1449; 2:SXyAsJSfaPlxYKUy+mzXCtA6qb9tpGz+eVz7qkxw+hM8LnbpFuPMQYqNYtV7yx5rpDlfdAd6jeYeY+hJP8O7R5hzXxgS7oILTBcO/B9DXJ0ju21CdaTNv3TU9JfFMj9HpamZ1Ko4osh9BCUFPvvAgA==; 3:7V/w4QUasAhEkVPQokclDqisrgmM7H/U2pBT8WeW0l7bEX7FTt9MoNom2wgCpuE0G889VHBr+BcSDx05k5yxeJ0TSGk7LaCOVHTliPud+fPJMDlEr4LcwUKxp93uepZr; 25:AoqYU+79o6L0xCepfcZDtI/mf0L78oPefz7Nk8cQ+k0/2KlIPvvNDOPxb+SXXx256VXyk1QRObzcUxI4XoPxKRmY9ocN0WgyXArqGbYKVZSE9sL9/TljgKManQuNDnB8ePq0WhIlB6/P1bt9xpz+vacnjLnIjm4WKZ9SNpujtTgEpDDnvHRjVq+NueeDeGbwCK0FOVOaSBf5OWh1wFCFHxnWgt+BOsBDZ2v6jXEzTIOajam0T5ElE6b+mP4tWYzX X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB1449; X-MS-Office365-Filtering-Correlation-Id: a3415183-1026-45af-3f8c-08d3263376e1 X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1449; 20:VZ7nMo+Gc+nQCa4+J7NvyEPZXiy+QGFZWwIk2UYoc8jZPbeyIWhECE9eFTA/CH9urLoQ3ir/1isSkR7T1jK+Dsl3WXtv579jIRZwoGH83pJj3xTVJGhvQmQ+H3eYU/6p/lbSsCi3kVl5oL949IK00WmdPAg1RjlliBArrQb9gMUV6ynWtlqV2QuoSV7z7wOMeqTpYx5H0Y8Lk9+hZfvCEuIsvMoruHvch8eHc+ZHx23qkXIbpy94/+oo7/dFpFZr8I8BLGv3xbttH8+OyIKKRSTBa3naROJTlsBGpIbW1XHAvZWJmLteZrqqLH1LELdT2mlG8jzOzdP7JfRV4DU9tZIaRFp7XdkvizZ5deauc3zOzcFa15K1rzJCGakcollci5LyVNmGhAE0MV2cyjCgfPeGZhzIPeBz6CDswxtQUhYTQ75EltAMinlSIhZN12nbRXAcVUN/DSQxy/XJRzD5SfbA/GuCb5XqWLyG7DfhAsYPMOkA47g/hoyvIOpMulmC9pyVq68a+UzwQhiOUiw14P8OKKgPZRxCecz1Tq8vtDjLFc09isdxVSft9qgJnlE/bBJlyc1dGabJ9X1frDSVbzDz+M53Fe0jUQSmcglZWcQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM2PR07MB1449; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1449; 4:ehxeB2X8k6Ya2A3QA1R8ecff6vE8MzWaMbDpJpslNVGA5gcGxtj46DVm2Zf3kEAETt8D5hjFVahYeCS637buv5DzTErn2dEJtz3qb77Hhb3UGaO5RlTsnbaIzuRjfhsOVcepril11aJe4MCEDl6EpitCgYTo6kunpG2SBFWkRgONnj2GygTQSaaSVRHQzHT6ao9m1Kcd5izwVZoVC0yDsmQ8NNk7jImbgDWupVvh7Vsx3+1+A4uzfnkilx05wZrOgRHweMocRSexOq48IlpAIuaM6NWJUuOdZ51xpIHWVZrt52NzB7e/WZ0NbCySKlvQDbDp+QUmcctVkhsW1Zq6EJX8SyDhrjKRMkDB0OdpONu6TupQ7n+eGDzI5wnMYXrxpHsM6IJLerMz+TTpcsULRJTaMiYxfaNAoc6tLosyckvOQCs3ismHjrmB6qp4jVfF X-Forefront-PRVS: 08331F819E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(189002)(199003)(80316001)(4326007)(19580405001)(2906002)(50466002)(122386002)(83506001)(42186005)(92566002)(64126003)(40100003)(36756003)(87976001)(5004730100002)(59896002)(110136002)(77096005)(1096002)(2351001)(230700001)(5001960100002)(87266999)(2950100001)(54356999)(3846002)(81156007)(66066001)(101416001)(19580395003)(4001350100001)(6116002)(76176999)(97736004)(65806001)(33656002)(5008740100001)(47776003)(106356001)(105586002)(50986999)(65816999)(586003)(189998001)(65956001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB1449; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?iso-8859-2?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k7LWIb9mA7p19Ok26Y5U9J9?= =?iso-8859-2?Q?fqiaLnwQM5JcY2zNSCXMrIW0WZP2POIWCFz0DspFrFgWEOfBTp5UjQsnFg?= =?iso-8859-2?Q?QkyMJ1WST3xHwayRYUX461XzNQMyTcFxXUXyiXyCTXKj0dmXMK/4HOEzTi?= =?iso-8859-2?Q?MATN3Y4IWb8j6edEU5+O21n1FmpGYVR29l3cxTP8PEvL0Lu8fylmqaT2KG?= =?iso-8859-2?Q?Ea0jQkYUkAWH+hwvM6A3TzfUBm5lF+yv8eMAx7xYspgAc6k4m0HzZ6nUp1?= =?iso-8859-2?Q?WJIjmMPB5hiW5y6FX8Sh1KMMEoGSbd8LUpA6Y+zfaCbhCsEnopuDbUpMNc?= =?iso-8859-2?Q?/3ib15BkumnUyVEDbgMO7vUT+jiXDhiQUTsv7okx/NQkeyf/kADUjckr7N?= =?iso-8859-2?Q?5xKYyMZCYh5k6EUnWcz0trDUpGbYasAyuYP0HDw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1449; 5:XKskG8jZAlAqxnJMRdF7jWTuZga0s/RHgrJpQ4dHZgOyJ0RPUNOXV27KQgXuzxB7DOd701yDa6/n5+K14QxEFlSEEoDusbZhzDvhc/iZ0AjBfLBS097NI3R2pwk+8KEJ8K2Y9MdcGk/0aTTU+m0TpQ==; 24:MESVQKFDecX73o/xYmCzf0uUFX1ic6dVQp4gxp2YsgTkLxbJiRgMOslPMQWoWVS8FLSEY1uaiUxRP0djMwGGPAjNN6Nmq0KfjDJw4XpgFyg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2016 09:31:26.0282 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB1449 Subject: Re: [dpdk-dev] [PATCH v6 1/2] tools: Add support for handling built-in kernel modules 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: Tue, 26 Jan 2016 09:31:30 -0000 ping? W dniu 20.01.2016 o 10:48, krytarowski@caviumnetworks.com pisze: > From: Kamil Rytarowski > > Currently dpdk_nic_bind.py detects Linux kernel modules via reading > /proc/modules. Built-in ones aren't listed there and therefore they are not > being found by the script. > > Add support for checking built-in modules with parsing the sysfs files. > > This commit obsoletes the /proc/modules parsing approach. > > Signed-off-by: Kamil Rytarowski > Acked-by: David Marchand > Acked-by: Yuanhan Liu > --- > tools/dpdk_nic_bind.py | 30 ++++++++++++++++++++---------- > 1 file changed, 20 insertions(+), 10 deletions(-) > > diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py > index f02454e..1d16d9f 100755 > --- a/tools/dpdk_nic_bind.py > +++ b/tools/dpdk_nic_bind.py > @@ -156,22 +156,32 @@ def check_modules(): > '''Checks that igb_uio is loaded''' > global dpdk_drivers > > - fd = file("/proc/modules") > - loaded_mods = fd.readlines() > - fd.close() > - > # list of supported modules > mods = [{"Name" : driver, "Found" : False} for driver in dpdk_drivers] > > # first check if module is loaded > - for line in loaded_mods: > + try: > + # Get list of syfs modules, some of them might be builtin and merge with mods > + sysfs_path = '/sys/module/' > + > + # Get the list of directories in sysfs_path > + sysfs_mods = [os.path.join(sysfs_path, o) for o > + in os.listdir(sysfs_path) > + if os.path.isdir(os.path.join(sysfs_path, o))] > + > + # Extract the last element of '/sys/module/abc' in the array > + sysfs_mods = [a.split('/')[-1] for a in sysfs_mods] > + > + # special case for vfio_pci (module is named vfio-pci, > + # but its .ko is named vfio_pci) > + sysfs_mods = map(lambda a: > + a if a != 'vfio_pci' else 'vfio-pci', sysfs_mods) > + > for mod in mods: > - if line.startswith(mod["Name"]): > - mod["Found"] = True > - # special case for vfio_pci (module is named vfio-pci, > - # but its .ko is named vfio_pci) > - elif line.replace("_", "-").startswith(mod["Name"]): > + if mod["Found"] == False and (mod["Name"] in sysfs_mods): > mod["Found"] = True > + except: > + pass > > # check if we have at least one loaded module > if True not in [mod["Found"] for mod in mods] and b_flag is not None: