From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0091.outbound.protection.outlook.com [157.56.110.91]) by dpdk.org (Postfix) with ESMTP id 53E669A8A for ; Mon, 7 Dec 2015 17:58:16 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from cavium1.semihalf.local (80.82.22.190) by BY2PR07MB1442.namprd07.prod.outlook.com (10.162.76.144) with Microsoft SMTP Server (TLS) id 15.1.331.20; Mon, 7 Dec 2015 16:58:13 +0000 From: Kamil Rytarowski To: Date: Mon, 7 Dec 2015 17:57:39 +0100 Message-ID: <1449507460-32038-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449499771-31466-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> References: <1449499771-31466-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [80.82.22.190] X-ClientProxiedBy: HE1PR01CA0030.eurprd01.prod.exchangelabs.com (25.163.2.168) To BY2PR07MB1442.namprd07.prod.outlook.com (25.162.76.144) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 2:WpR8QSiAu6R4hK/+WUgWc1EOO0fKF6FTrRGRv00jGmhn2y18s0XqrJZBQA/PJzgjyOaitQwzHoUpq1yesUBqV7fYHx0GngmDSPP/ii2JLrMJQlnCHvof5RHXlzXaUVfwtSFBiTHuI/ecF0IB2YyhGQ==; 3:jegiXoh+CxNhUXQaHsY142Zs+igCcMrWD2vSSc5vl1zj+ilCiByn8JqP/lNvON4K1H00FikHcwyHZQ9rMxD3BaxiPxAEEkkByU9e+3Zqt+JcxtbWX14CN7PyQ2LIn7vS; 25:DrU4JMwH2ggsK2/wOje/RGMyvKYCljPyE3mk2CKYCMpu2tQlLW4X4jf6eifU+Ti/cC5q6Kf6D+LxoYIv0z62nGZGryxho5z8GKfcTZ36d2R62ni789ifWRCU7hxWbIVIa0mQzB3JIviGPN/8p8q+gcNHD/s6OsFK1gfnnHAqKSDQ8GE6fIykTXjUZQ8QdDqrg8T8YCEdd5Qa1IbdSQf3mYwg16qUYl/l3ikRtTyUuua9i8IfDnx9PbGxSfi8jbvQ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB1442; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 20:GYyQdgvF8R1IvrcyKS7SFSDUgRSj11PZtyUveAOSAyNYk8TVfUeXU9ZmxQ8LyIKIDoc+FhyrX8OBWgS5BAw6r5hziKnz5vcS4y9+4sL6BRXzlFMUUHkcKPB8g+Ju5+v46lGKyVCT37O2PZLGm6T2mLudSePRc3G1pYCWGBtiY58QcLsBK29L582kkssZxDzfWBpvVDP25nPbGMmnEvGvaY11V7IoHUxsE715E/4ZsUhiNOb/ROr6b/YaCodnY4EUrq4llK9mf7zz4euJngAZUHJjrg3kxk8rpD6weYJTV0ZdwmBjEgA4RR97ovNZ01vgMS5bIFlD0vlcM6vLr/inU2QMXWSMZtpxPBYGuBbCiS1ZhQ9sikY6DTp9QH32bDyyqx1fdmHQ4Nofv1EBpT4+wiq7x5gD02HoaLcAHcH6wyQsOHK2hDULCEGReO/VGo1ebkaaqkEmYFgHvEzRAzvUthjL9O0HU1IxPQShscgZRl/u2y0xxe4SaC5kwUSvulk0i9g0IVsFmJLpmsO5zg2wyHdmeLvY+3iUUIabO2B7/TdVC86M/CenP7MyGB9LnHowDExzW8YJx6j2F33v3wKw37btFcfZ+z8/LvGl4p/DGNQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:BY2PR07MB1442; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB1442; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 4:Ohj5t1lasH93uskw0TX/Fy+0AlpTKNpjEq5K80j71AXXyq0fCMNCv8Fike5g7PRss0ab9z88MBFsj10+U3Xw4W6PYpFDNR+sDnzF1w14c8v0BHbCuZRBsTsPwHPeVWTcYne0v3RQ24KMvvnbgWVLwXsUqoyzX4TfZT4i785U3ciZs7LoMPeO97Ww6ODUYb9mCpu8URYcNxSSIc/1ABwW6N+LABBKNRY6356DwSP/B4uRSvJrTx9VtZG0Na9S5GOAo5yjhO9WjzCZmAoJM8oVK6tNlOoprT9WlkHsyMpNMcfM3/BHhn8CzaDfYgsYOvgdqKT9bNdGJbSprX3LowSelWSRkUsr4xOALk8uURG8xax3UyWD+6EMDWbY+tO9XPB9jcPdJCiR54a8CajXlxIdYI54s/JoffkhB9aAzdx9kA4= X-Forefront-PRVS: 078310077C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(81156007)(5008740100001)(110136002)(105586002)(97736004)(42186005)(189998001)(107886002)(47776003)(40100003)(19580395003)(5003940100001)(4001430100002)(5001960100002)(19580405001)(101416001)(66066001)(76176999)(5004730100002)(87976001)(50226001)(86362001)(48376002)(2950100001)(3846002)(586003)(106356001)(6116002)(450100001)(92566002)(229853001)(50466002)(50986999)(2351001)(77096005)(1096002)(122386002)(36756003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1442; H:cavium1.semihalf.local; 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: =?us-ascii?Q?1; BY2PR07MB1442; 23:443ZyimUTkRXY7dIsW/v+wXjTQUKJX9yE7sLT7nXA?= =?us-ascii?Q?FN7GKmOiFnFoNr/WqfFG7FPzMYvoP3Qr/4IgwjlkrqdNpPMxWyT1bYNvdJKV?= =?us-ascii?Q?e+xryzspCLuIn7nkCzi6m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eLgSTPvyCdh+ek2fN6qL9fhnDv9GxUfR+V7mHU8LJKfDja1yuSs7C48n75vB?= =?us-ascii?Q?QDzHJVKo/awUuUpffDMnjO8U0E4AvVC03wRfYbfVgIhyDJivyxT1MOo+A8lL?= =?us-ascii?Q?TFuyJa/nHs=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 5:KQ/9t9A/P5lvPmCTRi04ri55xZ+5bUA4+BeOu2O6M0rI89pctxYqwg3UszDactsJK0sDNRZU9DzZSLUfLr9zIlIRx9KI+LB9k4r22nNnagoJxGIxN03QBRTAy38P34OVlY/t9iXWN3KrmZT6Z+3M0A==; 24:ilpvjEHkC62GfH4Ws0QEt5S8SukdSop6BFAgk4qzZEXstwA7m2+Pbt3f1O25Rov/XoJm3NCuM1GDCnOfdx2EXU1HcK0VxSh85umz0pmVrfQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2015 16:58:13.6077 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1442 Subject: [dpdk-dev] [PATCH v2 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, 07 Dec 2015 16:58:16 -0000 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. Signed-off-by: Kamil Rytarowski --- tools/dpdk_nic_bind.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index f02454e..cb1ac80 100755 --- a/tools/dpdk_nic_bind.py +++ b/tools/dpdk_nic_bind.py @@ -33,7 +33,7 @@ # import sys, os, getopt, subprocess -from os.path import exists, abspath, dirname, basename +from os.path import exists, abspath, dirname, basename, join # The PCI device class for ETHERNET devices @@ -173,6 +173,26 @@ def check_modules(): elif line.replace("_", "-").startswith(mod["Name"]): mod["Found"] = True + 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 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: if b_flag in dpdk_drivers: -- 2.5.0