From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0055.outbound.protection.outlook.com [104.47.36.55]) by dpdk.org (Postfix) with ESMTP id 2853E695D for ; Wed, 22 Mar 2017 15:12:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=8fKz5PErkDqUmpbOmP5Wy/h6CGlOQN+Y0BBc6glwDWs=; b=nPnXCY1cH9O59FmBUu8wZKsQ+GWG3DQ1N6mhRQnXKwUCT6CzsWCYT3JKq58RtCo5Bpj4Iovdn3oN39IihyLQYn0t6pcTaXqtT1FkfyF6sFY7FTJf7ASOBfBnMdPm0eTnUewNcoPRfptJj3MQi2FeM5ck61aEQIjihlfjXSrQFZ4= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Wed, 22 Mar 2017 14:12:06 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, ferruh.yigit@intel.com, gprathyusha@caviumnetworks.com, Jerin Jacob Date: Wed, 22 Mar 2017 19:41:27 +0530 Message-Id: <1490191892-10396-3-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1490191892-10396-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1490191892-10396-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0061.INDPRD01.PROD.OUTLOOK.COM (10.164.146.161) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 8473ea4f-fcd0-46ec-e991-08d4712d6cc0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:knxrCK9siltnAnJMBDVuXmGK6DpGUHLfq5xoS02DziuUrRpoLitfKc/qTa25RLsDj4mZ21OGHxvrXiK4zgmCP+ia4J6LJArMdYh9lavmCKm98WJEx/lco0tP7575aRFFLeTDIh9bMXzcHVJ8o5A8u+xTFszCS6FfJr6mVdMbF7YTz9I1jgN6RoSx1eDjtO1kRBQKYPRmVY6l8TqEWThZo4togywtBUClOnlQqpuDme7lo7RAarKtJ3dVbFV41GkmeeMJt5M5SRRC565npJsFVA==; 25:1cYwKh5Pf4Pt4q0XctflyAMrEwvACdrFtT56xyXGjWQAq/USZ+KCeCfQeEekcsc1DBtmhnXs6K5y3QZRIlonJ42xoBLSlw7qOY7RmtYpqzhR09dYmUyaSaEBMVkfEJpMarNDmqh5pyVVqGBe9cbdAv9xlBdZStbyh71NeY5uZEh9SeecR3WqGYS+RqIJEtOFFV1ZzAD6wvW3YWMP0AOIBnSM7ZB72UQsu763aOeJ7uvdbGRv25MKL5gOIfVvaXBo9220HlYABA435mcOUpPrMweWnqmBwozcAfye85xox3q8BwvdV4kabvF/94G01fjjdHXSxOjf+d93El7b5dQXmJOyk2xJiYWZVS+bUP5DeTaBItg/xxgxnDteBGeE7XNRBC+JlxhAAEQdKNrLxJ6/c/TFGoqtFMlNmEq5A5PjmyBnjD7VBTMQ3jNX/E9bs1W63h++QC8cx7AKdwVf6YHcrQ== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:DR6xq/ob5lyTzG52s/egXmkJ2laeP+FpGXeK6ccjSW3OnntuE5WHAwz3ydPN5Qpjqzh8cpuSC48JovLOQUYClAmiWvMS4lNA7Z/6qTuFctYAQf/EUNWxZSWYJPokqNzBWHEOwLNg3IUEcgw9y0svhRWyfEy0BtXyCErgWSwh3+UGoVurc9vYauZX7WhzFbJWDmQ+SsU4fJVxpr3Xzid5gLZ9mJSlNvUIB52BRt+0LbY=; 20:zThomK78VBrMPTeuyVPuIC5KqsM8UH3KybDwFurjuC3wDPBIfPcawuiFKNstHLixpDud8d1UZYxbpMb+z+F6vVAkN51asNdBcOqzWIj8IGIMltUykkq6GibjmZn2p6M7V+X2bacUrEI2Ww3I8/z4uxdNIFgh4nGr+76yR8N3u/H1KVE3fbjDvzmPQVqoEDnL51qmnzrFo77a0mw68Q9vzuDL3hgNbFD4u34mhgbpAGot7ZT9XuqQPNSUXl84guA3Gi4F+NA3xMJfQet35JXjVvWgJxQCZeoXj/EwwnhMpwsPXbXiPJ6nKw80PHJSGhJjMqjlMffojmOHBCmUlEAEsxjSQYmdQwjwBZTpNyc40IYhREUR7s8zvB6BrdGc23E/1v7rdsn+i6+BSR/xWlJQcQ2dvL+rtJngjDI2UAASbUGWWGxYn9OJgd9iQKHKt6wRtmQZCTw2LwPG+O5FVNOLPQx0IXrQWu0u6KhIxZApgFINonsN9ZwtaKuiWw/CffwQ8a+LZV8ndKAXb8jxpsWxVV67oh+e0dLR9poPu7yQe+AjJlLnNyd/bW2F7Fy/0x83jK0LcbjxcgzxNTpSIyhXqAu5hIY5/w4mt9zmmCHHFkQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(20161123562025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:oxMSa+AxE63fpONrM1mnCZArjw0WnpCaaHyUQTOxBgx6yUyM1gy6yEp9L1jHEWYDuXrED9ws+m2VxAVaDnXUPmHBVowHwML2Aa4q0zK93h65RC2/IVg7yyN2FkrHiMhEmOo1pKqYJlOPx7bwvwQ526HNrRZawlVmQADJbMUOzCtiGsXyurd0h3IMcpYgEuUoeARNhcGunlZ4FJw+OgmYqdsKOKpkJj9O60Rjr1p0o1z2UdDqo70J6v46178Q6xb+yvPH7tY8PavNqSO3HmDMHaTQvmFG7WlXk2DSLMXb2EM96zAWGVNQiHOWRMAeMLAju7lobYCIzyVTffGnz1x7vf0nehCmP7mX+3quw5OVLakJnBOwRlKpfWIaHsN79QVbKaYGn0PoJ2ZHbDoB1jlHEJmqhAZvw/vAKzZxRiC4OqzVVGbrp+8rmlme8St8h3wImuVUQiAoN0nlckPNBFMGyJeVQ6nvgl/CMmIGIEYxmZs6pSDAqPLVZZwNtjESEW53LOinzWt0djvwkSsrSyySehSpUCI0CTgPI65oO/QpQw0Vm26/KqP4P2uFj7YQb0uXLJE3Y1jC5764ZoaGd6MTP5tCTIIYq05QT0iGFWk8oIs= X-Forefront-PRVS: 02543CD7CD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(6486002)(53936002)(4326008)(6506006)(50466002)(48376002)(189998001)(36756003)(25786009)(6512007)(33646002)(53416004)(2906002)(6666003)(2950100002)(42882006)(47776003)(66066001)(6916009)(76506005)(42186005)(38730400002)(107886003)(110136004)(5660300001)(5009440100003)(50226002)(305945005)(7736002)(2361001)(3846002)(6116002)(81166006)(2351001)(8676002)(50986999)(76176999)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:naQ8GQrVX+M9o9AFpUISDSjQ6MpUWBba/3cvzEI?= =?us-ascii?Q?98kikEzzEFyx4Tde1ZbF1kpLIOEDHBpO4Rxy3r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fY6GStyrnnm2Lv7dWjcfzalchQkb/sFnZ2uhLRztNJVMFqn4M6qjnIXQ2?= =?us-ascii?Q?wz6DtXGO+HSC4NMGHe6xpdjyqirEVr5cELZArYLIsdqrTZw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 6:P6MvoONzP+aROrSFFZ4LYjIo3wwKxc+BW6uTvE7dfSsNqGWKlify+EEY4I27WrXbSx8Zk9cZI+VNMrdOtzhT2Ocpgu9gFIvsP4+fEjGM/aEulkf92pMwO0oWI+m34A47Z99vVynq9FsZB4Sq7Ves+MR+2NS5Wp+eby1x4Awu1wsPvP4myf/SQSdanXxIsa3luM7qOTToBjahnuUPM5gg4Ac/Fy/Q+Ph1tqQT0x/nlSVU7IRfcTQS4rffRR/XaJwNN7kyBMZPUxA31QilHoA4dRTSnEItIlq2THswDnBTZYtFjEddPoxxLlJgD2DgvsKTQvShktuAW7Dc9VMs8imN/mbpuiRkZMWdP6upUy0poX2ljs1JSsDxllR+i3gWFZT5QaxfK4qaOu7fHUkxJW6kNQ==; 5:5go7/mGmuwFmBr/TR4lC6PQpaD+bKPq7ctT2eTCS1z7y3TNurkkAbCA7Td5fIbd95oEHLzXyWG82v3JO/KtsZWXEgbonXndJbzNYe3I3qaT7OGn4zSaWO72JJ4CCS15bj9/dIoFzPJmdUHuR2rk1/A==; 24:tiRb1lZYHviOyZM1zvgcRoqQqwjhlPj0iq7uV6UCw0BU7T5WPZRKuJ663a9HRUrDhith50q9BDH7xz4PxTzN095d6tN+V+DN7c9pW91r1Bg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:FdiNs/qdLvwstyKW7KQXTnPMwT4ro9yhvsl2B7WpZluxnjq3H71LIMlfCoo1dv8v4AVTgJgRam9ZtgJZnSa5OGnMgc5FbquE/SZVvg+uoPKtKhbjfz1eyq5VI31Lei0UQ93XDPC6TS7BIBk33e/IS7diz5xiFDlJwhNECzsvYTE7CeplWN5orNrWn8qUT2mGD/7fzpbcoTM6QnKyAVFP7TPvVXX2TcpwsCjmMO59dbHuZnsWljoS6N6mL1go02AwdStxY8zjhhyx/ODTTHt/Lc3/u0J3+2Xi+hra7DRrJF89wMSdKKpIUx+y/6T52ndsAQYzHYVO2kZQrxp3tBCO3g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2017 14:12:06.1166 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH 2/7] usertools: refactor the show status function 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: Wed, 22 Mar 2017 14:12:09 -0000 From: Guduri Prathyusha Identified and parameterized the common code in show_status() function as show_device_status().This will enable to avoid code duplication when additional devices added to the script. Signed-off-by: Guduri Prathyusha Signed-off-by: Jerin Jacob --- usertools/dpdk-devbind.py | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index 0444b54..83c4c17 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -479,11 +479,7 @@ def display_devices(title, dev_list, extra_params=None): strings.sort() print("\n".join(strings)) # print one per line - -def show_status(): - '''Function called when the script is passed the "--status" option. - Displays to the user what devices are bound to the igb_uio driver, the - kernel driver or to no driver''' +def show_device_status(devices_type, device_name): global dpdk_drivers kernel_drv = [] dpdk_drv = [] @@ -491,7 +487,7 @@ def show_status(): # split our list of network devices into the three categories above for d in devices.keys(): - if NETWORK_BASE_CLASS in devices[d]["Class"]: + if devices_type in devices[d]["Class"]: if not has_driver(d): no_drv.append(devices[d]) continue @@ -501,35 +497,20 @@ def show_status(): kernel_drv.append(devices[d]) # print each category separately, so we can clearly see what's used by DPDK - display_devices("Network devices using DPDK-compatible driver", dpdk_drv, + display_devices("%s devices using DPDK-compatible driver" % device_name, dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s") - display_devices("Network devices using kernel driver", kernel_drv, + display_devices("%s devices using kernel driver" % device_name, kernel_drv, "if=%(Interface)s drv=%(Driver_str)s " "unused=%(Module_str)s %(Active)s") - display_devices("Other network devices", no_drv, "unused=%(Module_str)s") + display_devices("Other %s devices" % device_name, no_drv, "unused=%(Module_str)s") - # split our list of crypto devices into the three categories above - kernel_drv = [] - dpdk_drv = [] - no_drv = [] - - for d in devices.keys(): - if CRYPTO_BASE_CLASS in devices[d]["Class"]: - if not has_driver(d): - no_drv.append(devices[d]) - continue - if devices[d]["Driver_str"] in dpdk_drivers: - dpdk_drv.append(devices[d]) - else: - kernel_drv.append(devices[d]) - - display_devices("Crypto devices using DPDK-compatible driver", dpdk_drv, - "drv=%(Driver_str)s unused=%(Module_str)s") - display_devices("Crypto devices using kernel driver", kernel_drv, - "drv=%(Driver_str)s " - "unused=%(Module_str)s") - display_devices("Other crypto devices", no_drv, "unused=%(Module_str)s") +def show_status(): + '''Function called when the script is passed the "--status" option. + Displays to the user what devices are bound to the igb_uio driver, the + kernel driver or to no driver''' + show_device_status(network_devices, "Network") + show_device_status(crypto_devices, "Crypto") def parse_args(): '''Parses the command-line arguments given by the user and takes the -- 2.5.5