From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0073.outbound.protection.outlook.com [207.46.100.73]) by dpdk.org (Postfix) with ESMTP id 50C299E7 for ; Wed, 16 Dec 2015 15:14:38 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from localhost.localdomain (80.82.22.190) by BY2PR07MB1441.namprd07.prod.outlook.com (10.162.76.143) with Microsoft SMTP Server (TLS) id 15.1.355.16; Wed, 16 Dec 2015 14:14:35 +0000 To: References: <1449588833-485-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1449667198-27218-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> From: Kamil Rytarowski Message-ID: <567171BC.1090105@caviumnetworks.com> Date: Wed, 16 Dec 2015 15:14:20 +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: <1449667198-27218-1-git-send-email-Kamil.Rytarowski@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: VI1PR02CA0038.eurprd02.prod.outlook.com (25.162.7.176) To BY2PR07MB1441.namprd07.prod.outlook.com (25.162.76.143) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1441; 2:LeKgAtzrUh2tmB26Bj7kLfDGBK1xsBFf+wurKq6+wwyLjUwY7/lNlcAvLxNqPJJjlc4zrZNgX3vBNpY0oKIHRcFbIMvqWVAwAR4pY0BwEcWdU/PjBDP8AAdpzhLt1HxwFeC6QSejSe0p+jzV6/egIA==; 3:F105JOftU4R6p7rlzZMYIuEnDcJhQ+ryDii3KVmQLjh3fy38VnLHXYpXon5QVXV6g9AhrMZYp53Dtf4XknWXD/BhMRYIHQoPnDkaJo86GiCUPXAoICo+JKWW/X3TpGyj; 25:MMk7GWMWXsqP0YrPO6ugjeZWmOadwLMQ/MbFOKe5gaMxi5NLdFn0BFifR5n3GZdC52kL7aRFZpwLdGLSrqAaTZy4RM1PxOZ7BigOePnDAIscqG5cHIXg2f28iX5QqzSBAZ9Urx1h3LPSBLiSCthyaJfcJeayVyw5Rr1V1N655n3PZtu0dOqUI4H/PYfSTDX7i+QGrGaXiTqBlNDcHYXT75zhtL1MYXyVaIAfBme1XhsXUcsb6gAjNhLxJsq95bcTTb6kN6B+gWbDEyDh989rEQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB1441; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1441; 20:zTcHqf2hoZdT+KH65SPqeUMc1EqRtDF46YzTXSahj1JTPS3uNvLZuG0gkPc1ebxN8rvMamkileKoQv79YCYCHNXZ3DQ9nnAqz3jtp4OKOSZIeJMALKIc/1cKrJdaxWQtucXauru74bZWF0FQq1bpYPvb7EVQOSnPK8UPIS9w5+YvdcbaAvLIz+JilFdgh2juYCrVElNwYEHzZB5zwXPuXhUewiGKs9Rhl/z9WRpvY0/G10INOFACNvSMfEKwrRwppmLu7xqZ3Ugibz7ZFRnooCyphuOQcS71L+uq3Z4ZiBZqZ8L85mtRvjhcAwePkrGSCK1QNbn2lzn6vBv57GEUfz8VCHlCusTNdhKP8fRQ1EKKvblLwZGlvNUEiw+EM33tbG4RysegK0/qDjDTG240KfmdUcw+rL/+yn3XfSlcxUPFT2/Mlhwj28fdlmWspdAspwXihZUS/GzAUVwVr2GbZNmXsdAOmGl/I6pYbSpeFk/pzljKO2+4zb/EBwAb1FwYpS/061UwTmX6OcFNCjSCfmFpC2R/OOotXSa34cR6ug77ZqexD+C8kvY7LHwZJea4cyI19eGQLvVAPErQPnldxwHQJSKRf08CvrRmxYxqpVE= 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:BY2PR07MB1441; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB1441; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1441; 4:C6WdmEVCMSFVxMm0xgDI2SMBjjUxL1p96EtWLa0L0J0PReWPKDcr1p03/KC9f7Nu0RM973Z3SD+iaI9ZPcDKo2iwAHtmpGheUU4VPtPgp4eUOwIXfKMTZp1EHV8GmM9SSSGt9JgDmZfjOh/OBPYII7nJWvmX8QJTZsG+3qYVB/RTLPop+/eQvNB1qbyDtenectWniOkIn9zE3SFVVMZRseBeDlS24DevtcztELPbSw+obkgqClFEAuVaKsjCowFjV1L3Z0hmjudM1KNxqxQ+1G6KMQUj9TTST1n2ZOKcvTKlY6GilkeTYndnD4pyubeff0ADTQJqJAmhcBCSW+Rr4gKSidDGkPQYKPcEeKcTDnsFTrFXkY/VV11Kml9gy4EFEBK0OG7OCnvxgzrHgW6YiVvaI/afKdKjnTF1bHOg0FUZfoMUn/RMpvGvGuhFvUOc X-Forefront-PRVS: 0792DBEAD0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(189002)(199003)(80316001)(19580405001)(19580395003)(47776003)(87976001)(65956001)(65806001)(64126003)(99136001)(66066001)(2351001)(59896002)(3846002)(586003)(6116002)(230700001)(122386002)(106356001)(105586002)(40100003)(189998001)(1096002)(110136002)(92566002)(5001960100002)(81156007)(97736004)(4001350100001)(2950100001)(54356999)(50986999)(87266999)(77096005)(76176999)(65816999)(5008740100001)(33656002)(101416001)(42186005)(5004730100002)(50466002)(36756003)(83506001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1441; 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; BY2PR07MB1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Atb?= =?iso-8859-2?Q?Yj035XDDb4HCjq8bcq5ZAl4Ux63ZxVAdWhL68JUC2BaTtaweoGw/IQPlig?= =?iso-8859-2?Q?m216nS5P1jLFEprso5uet3bHSysbGzxgA6KDpOeM435y3o6JPnbRVbG05L?= =?iso-8859-2?Q?2XwpAKit8JeoLSmbYl8ifimMD1OmXjWKYprlsBKM865l1lNki8UF9Ep4pD?= =?iso-8859-2?Q?lppE9EKHNKv/edMAfXX2Roy5SMkJAcAkZMQQAFmSH+9lM6l6B5JRyt2iBx?= =?iso-8859-2?Q?ueu/Le8ljdMObnoAxJSUutgr+2wR7F1DQwN87aV45mfMoG76yovN9lbpCF?= =?iso-8859-2?Q?/on+L6rJ1Ah7G4VtO9KhX0MArR2iHj8HkouENY5m4o8rD8Nwlh3Dkeu9ZL?= =?iso-8859-2?Q?frSlxdiYMTh0C5zI8mDwl5yqlS01+5MGrXmsFZw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1441; 5:GIv70sPr8GnTRRbLfpLUdLZa3lrxFfSa8Yxj5pATCPVq07lLg26Q2m8ASUuadqx3rAHgy3BUPqy9oAA5a0ebKVL6+oqR8GP3RhQFBHYR39fDgs07T49HbovZGfijzX3xKsTTwClZmQMGyrDkoK2jBQ==; 24:EGrsYRSWNAegdQgvTUIoqRq2WoD2jfuIEQXIqEKTKz1SXa+COWpKlEgaeZpnrasrdWUUGguf/bRMmZx1b86lJrI0AmLrtmOEq8fIB0Lrh8U= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2015 14:14:35.9595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1441 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: Wed, 16 Dec 2015 14:14:39 -0000 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: