From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0064.outbound.protection.outlook.com [207.46.100.64]) by dpdk.org (Postfix) with ESMTP id C059ADE6 for ; Mon, 18 Jan 2016 10:26:59 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from localhost.localdomain (80.82.22.190) by DM2PR07MB1450.namprd07.prod.outlook.com (10.161.139.144) with Microsoft SMTP Server (TLS) id 15.1.365.19; Mon, 18 Jan 2016 09:26:57 +0000 To: References: <1449588833-485-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1449667198-27218-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <567171BC.1090105@caviumnetworks.com> From: Kamil Rytarowski Message-ID: <569CAFD5.50909@caviumnetworks.com> Date: Mon, 18 Jan 2016 10:26:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <567171BC.1090105@caviumnetworks.com> Content-Type: text/plain; charset="iso-8859-2"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [80.82.22.190] X-ClientProxiedBy: AMSPR04CA0052.eurprd04.prod.outlook.com (10.242.87.170) To DM2PR07MB1450.namprd07.prod.outlook.com (25.161.139.144) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1450; 2:O5SSq+Lpt+76laZNx21Bsxrqrpo5uMtGBYJAuxRR2BSuypz5y5IrwkzXl2uT+lhaX9C/3DQR0lekEKu2kmjajG1tlTECHlTK1h1VsIeKarrsUAC5PoB3czXOGBggcTYOHEt88yXDVq2UFphYJHPATw==; 3:eavXVxPx834YqbBaXoB1qybr5g5iq7J8Btv2pSCM5VZ2swwZ0GdRgqoz7j0502B+io+7xaDiElz1PniGzfDIL4vJWAiSwNCxDOCMGboGCWTXIgtpz+cBByChkK9wrzeG; 25:r/kYNNT6fD8nxMKDop8KKkyDZnavbPfwkyaUe5KCYe/dbTwgFSXoMUoOEpu84aDQBrOdMbUqmj1yEeC6vpF2Aad8zOJaZyHCUBM2iiOwdoynmn/0vfoKn6iO9DCLPtvlWiD4NHMHMe1CI2MP1EEvIbA6eZC+yW56Zpmf1vdNGJwBtjeYTj7/PfQY802KBHhI1ZLo9MzH7/iR/r2nPAP2gAkp+Ofuzm+oaPi7sVM8zdTPt6vuQ2YtfBfBZKwpBLmC X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB1450; X-MS-Office365-Filtering-Correlation-Id: f75b8a77-99ad-46b2-869b-08d31fe9831e X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1450; 20:Y9RdN5PLvyNwWrrSgQ5M8LBO/CeRdeb3NInYLzB8x0WzEHJaJW9t3Wd3s+IMHxBdGgv0f+sNzg0iWRdtuO3tV/7OWWtqWRFLDQXbXN0VA6UTpDvtQsL4fX8lrWXHxr69N0pjMLn5qAtk04hz4p5mNXNYkZXmuMvFQhwgf5b4zyhv4mY6Fs17LD5mwmYS3BEHQhxKTLD6f2m/9S+gpC9yRsf28xSCG6xwl8VKYG1McebWf27ZejtZo0hxHWgo2Cpx93zzyeV3HsUEoKQkDKQfBMiDEUGSu1B5NvYmkAp7aB/QaktT8mWugru+mry8NxlhlVZ9R6QHvMjFr/MYYc20FqKy32T6qxi5inO+goAn6zlWV03Y4RuXKoA4eK7FeBV6vy96aAo21VNdKqOZlG35CqrSMvQ/16GisMqnoUn9Hq4TbHaX2cWBdxXUztzx0NdUqbdv+o/2OzayznVE8sfMnRE8seZOgN/EfukiTue6oImj1BWAaLf3MhtRDXB/2+b3mS5q1ctjbwrXNvMHLZj33u2UkmIy72mDzbdKODWzNkMiIzMYL7KTW8UVe/kSv1up1e6noHr24Blp7fO8qPLcFKsdyAswy0tkX+NwU3iN9ao= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:DM2PR07MB1450; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB1450; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1450; 4:W0kZuKNgoupRQRb7My00tCTMWo+Dy0Q5kEoOC7+w19MS/PKc69Ydu4Dlqj/xFu7OdZiTTrDyX5xk+6zQxGM+HtCNWG93KuFKJno0xY2shKhEuSioigMvqSFhZmXVgOlghThRtpzPnM7XKgjakC1qk54FpWcC8M4WrvkRo5JKfwVF4/JAGjsN7CZaacKV2VLtaX381iHZrWi4dNKKTpGPT3IoSnE5TOqhnah3GXfXYOyxvNGbn+N+EzChiIqirPEPZZXag9j7LLcBRsn4+EBHv4oj19hfgB+ldRbMqy0aP/g2MN53A76zctLVU0lM7OjSwLFRx/IC5wII0hXjrFxr4RYtZtzI2shjaWb3ppIBbn5Bol/K6Bd987RC2ti0mvae X-Forefront-PRVS: 08252193F3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(66066001)(64126003)(5004730100002)(19580395003)(107886002)(33656002)(5001960100002)(19580405001)(101416001)(2950100001)(40100003)(110136002)(50466002)(50986999)(54356999)(83506001)(65956001)(81156007)(77096005)(586003)(76176999)(2906002)(97736004)(65816999)(3846002)(36756003)(189998001)(65806001)(106356001)(5008740100001)(47776003)(6116002)(4001350100001)(1096002)(230700001)(2351001)(105586002)(122386002)(87976001)(92566002)(450100001)(42186005)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB1450; 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?Q?1; DM2PR07MB1450; 23:XwEKiEJGC3SUBLMoecnyzSqQOxrgjxc0q+rsvna?= =?i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13Ppmn1l4J7PRseyDALaNyEUF9D?= =?iso-8859-2?Q?UI0yGIiVy73mRoK4PsLDu023pse+bk4RxDJ1egJXk9TQMPN2pgVDFMrjqP?= =?iso-8859-2?Q?GjVuGDO7NVXLk5paWYfm4qM515IHZQIVFuNQJ3VeQ5kYuraKDk/n8zUIuk?= =?iso-8859-2?Q?WETAItSGm0oTfWc91kxpjIpa1n39vAAkKD2H33rN30jwt8KgiHYAKJH8zs?= =?iso-8859-2?Q?Pux7YwYXdBVHjzXOsxOo5cb3bZtEQdcH7UWqNf0vZp+3RQWF3+XivjRkFL?= =?iso-8859-2?Q?qHU7p/OWPHjwxh/IejYYkolk/upDmfL9X+Vl1aR5jGx/YHUcgnOL80hWEj?= =?iso-8859-2?Q?3hiXhZxni705vtf62?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB1450; 5:UKlbOceH7/NtYQDreXm1nkM0QjRaA7/tOmz2Qre5oYvvDaE7vGtjqPAO5zD1o/AfilM9FjbWR8gIjcQReo5sRYoyKEVbesg1DvCY/ZMUAuD1lOx0B8kp2aDao4bPTUSTWih8Vxk0T78TGJQLx2f9JA==; 24:1MewG7mEaemRg/sGHvnLwsoVboXbRSeTeREpOhjRsubq8Oi/bYm/T7nwxIClx3S+2prqlWrlkJ9W7jIQt5qqoD3S6oKhYUBxyGvnMJ5b6pE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2016 09:26:57.2653 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB1450 Subject: Re: [dpdk-dev] [PATCH v5 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: Mon, 18 Jan 2016 09:27:00 -0000 ping? W dniu 16.12.2015 o 15:14, Kamil Rytarowski pisze: > ping? > > W dniu 09.12.2015 o 14:19, Kamil Rytarowski pisze: >> 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 >> Signed-off-by: David Marchand >> --- >> tools/dpdk_nic_bind.py | 27 +++++++++++++++++---------- >> 1 file changed, 17 insertions(+), 10 deletions(-) >> >> diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py >> index f02454e..e161062 100755 >> --- a/tools/dpdk_nic_bind.py >> +++ b/tools/dpdk_nic_bind.py >> @@ -156,22 +156,29 @@ 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: >