From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E30AB45E2D; Wed, 4 Dec 2024 10:02:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C16ED40648; Wed, 4 Dec 2024 10:02:14 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id 156A440261 for ; Wed, 4 Dec 2024 10:02:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733302934; x=1764838934; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=8GgH5hhJvtYhnv6SXBtDdnr/WZdaBGGJCavLn7jvBSk=; b=nkhD164spgfy5UI1Cot2RqcraU+mTMZYmkXyzI7h/7+grC324UVpvQE6 4Eq9ifFjJUA4vVSwCuTdgop24bvrbQa2DxoejtM5gOOMEj4nf3cmpvnlA Azr5Ev8ezJudHSMYh7XOAEdzsVhNKdz7HctbBleJ7k/acWEexlLneN4HG oVy8xxff0rpsH367Yozwe80bGEwbmStux82SThhmphpygtvdlB3268tZ/ FwG/7rqT1Ox8TgAxfmeWukb1ZyeLUQgJgLOZFWzahlf12Jj+AYv45zUHN mMxIPaEDK6OLB/WnfvOAYdC/4FCvughSvpv0PlAmQu2B6C3j/9nb9/HaH g==; X-CSE-ConnectionGUID: IKMu4xikRBOWQP2xG4MUnA== X-CSE-MsgGUID: OGZEoZnMShW3vntJx5kdJA== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="33703647" X-IronPort-AV: E=Sophos;i="6.12,207,1728975600"; d="scan'208";a="33703647" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2024 01:02:13 -0800 X-CSE-ConnectionGUID: MJp+wUknRsu6Em62VUThlg== X-CSE-MsgGUID: 023vlWY7QhmQdv36hvR1lA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,207,1728975600"; d="scan'208";a="93567132" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Dec 2024 01:02:12 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 4 Dec 2024 01:02:11 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Wed, 4 Dec 2024 01:02:11 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 4 Dec 2024 01:02:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jjGhdWtJhf9sL4zW/15jOiWDZlWBko875D/WzdbUquk4OmAKtZWIPAB/ENZsZMET4PksDgdQp4Y8C+rDOOfE3Fph+rleLB/Omp+wR+gOWlaO5Hz7uNEYfN4wcSLa4odKOoRgNAYUVouvG7r5m/FInLbIZWC76LHGdH3yjEcaJxjJSS7Ta46bc/EQHFesGrn0PAslqaL3ZZDuwiFOkovZ1A0emYBszWPzkggIY7gyobHSsuw1E76WABKsSriNxI3p/mhxUeN3TuUddNP5OOmYOYPidvacgB9JT3AyTn9vOzZONBl/3Td6nRQBB4JycqLhDfVQpqy+Iym42tvvnPg8lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Fj4evCg2iVLgfeI2I5B58FJB/fp1nCYVBOl5k2o+N10=; b=zNMkDhb033MEeS/A7d7IMBJXJ2PToSkBpJDjFHVRjlqtzlwyeluQ+UzN38vyKbhSoyw7ydpXcmdy0XP4XzctXHrE2acVd7wj5vp8jsADsRsvM/H344z2G3WAZ/ZkTlrGwNVBiNwNDMUtCp8C3A1jZl7XmbB0vge17eRGLwfTnYkOWifqs1lu3RzhVNqpUSHCkt534GVNUpMkQVKP79PbnKX7vs3DXxxPhOmanrsIuJ2UtFMCt0xSn1MzL44zpc7Hqsxqyh0D+qc28rrgfNweMUthuKLZdbvVaIcgD/m6tA75QzvAl8Rik69G+8R3G4zEbijRNaH5UgHn+Cz0O6EaUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by CH3PR11MB7179.namprd11.prod.outlook.com (2603:10b6:610:142::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.20; Wed, 4 Dec 2024 09:02:09 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::21e4:2d98:c498:2d7a%3]) with mapi id 15.20.8207.017; Wed, 4 Dec 2024 09:02:08 +0000 Message-ID: Date: Wed, 4 Dec 2024 10:02:03 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] usertools/devbind: update coding style To: Stephen Hemminger CC: , Robin Jarry References: <236299d7081f4a06a6f6d06eb575539582c0344f.1733224995.git.anatoly.burakov@intel.com> <20241203141632.34eb2d28@hermes.local> Content-Language: en-US From: "Burakov, Anatoly" In-Reply-To: <20241203141632.34eb2d28@hermes.local> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DUZPR01CA0244.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b5::13) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|CH3PR11MB7179:EE_ X-MS-Office365-Filtering-Correlation-Id: 9067d0de-820b-488c-4e8f-08dd1442553c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?SnBMeUIwUUZLcUFoM2c1NDFSZHBQVThhaDQwRHpHSk15RGV0OEFhQjlCekxx?= =?utf-8?B?VnRWTmVpZTY5U2J5UFJaWnc4ZnRzZmpXaGNzVEU3ZnRjWFUzcWF2TVlNdU1k?= =?utf-8?B?T1NhaDFhMFpDM25TNVFRVElpYkZmd2ZjSlEyQ1FnY01SN1RTVURJb0hCSDFN?= =?utf-8?B?VHhNS3VkZk9HWnFxZWJSeEJRU1ZncjUvNTl3K2plSGoxYWtnK211bEY0U0Zp?= =?utf-8?B?b1J5bThya1FoNkFtM0hJbnZnWTlKWHVHUDRFa2QvbjdRcldVNERCTjRpTk00?= =?utf-8?B?WGhMZlRHalg0bEZwbTlaVXFuMVgxS0lzNXR4NnR4QkJLQkgwZ2J1RGJwUFdx?= =?utf-8?B?a2hkL1NRZG1yVFR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= =?utf-8?B?NDJIanRBSlh2cVkrL2pzMzFDTk5Kb0F6QlBRaEp4UEhBeUFvU21kb0h1dXNw?= =?utf-8?B?VzlrM3Z5REp1NlJCdWlmaitIcS81Ulg4em94bWdVd1dwTVdmWmtFQ2hKY2xY?= =?utf-8?B?OEQ0N2ZYb2MyQTR0YW10TDJJaFFmeWdSRi94bmltVUIwMWhTbkgwODhmakRa?= =?utf-8?B?cjJEdXVJUFNQalBIWHBUcmFKL0xScDZlYkRuOTJnZjdlcVN6YlZpQ243anYx?= =?utf-8?B?aGxIUzZ4T0R2bTR5djhWZU5KTEtoalBNWjB3WjlFNjVVOHVsUi85NkE4Umpy?= =?utf-8?B?QjNYYUE4bmw1dllSdXdsKzZ1c0N3UE1lRDl4OENQaVU1VldQY09XL2pWTUJu?= =?utf-8?B?eHgvOXBGZlJzZTRGN0w5MkdxTHhONTI1WlhKcjUzTlNJcnE2akdNcG8yTXRD?= =?utf-8?B?UkVXcUZhNlBSSm1TRmhRbmlnV3Y1YXQwK29yK1VFMGxrMmhRank3eDh4OHZx?= =?utf-8?B?S1ZsQ3JvaXdSWGc2ZFA1aXFkbWwvcUtRbG40cUh1SWhMclE0V24yU1E4N3Za?= =?utf-8?B?eXpXdjYrSldXOTltTkFlZz09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OVVtUWdnSHZEOGNkUnN6SXYwZUl4UkM5eWlXdFVHRjBkTFF3SXdtamE2ZnVn?= =?utf-8?B?UUc0NFlDRFJTR2VLbkh4UURrTzlQaS8rbFVQeHhKdG9Bb0tQUHgzWHkvRW5o?= =?utf-8?B?YlIyZDUrSnhaY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RZK3Z1SjdKeEFSbThmc3orakxlTG1lQVBU?= =?utf-8?B?Q0U5cDF4K1pRK3E1cFlNY1hvbktsMnkvZmM3TG5WekkyRUtwMkFEQUtBWkFI?= =?utf-8?B?MkZDbkxvL1M0aHRCMGVEa1NWTWt2TWF6Tm9sbDFtWitncHF3Um9qellUWVdj?= =?utf-8?B?TlJFUmk1QzNQUmw2czFlNXQxLytNbjQwSnNrS1VaR1hlZ1RHakFaL3dmR2JV?= =?utf-8?B?OGlybTlBcUdHMGZGMHpIeWNBK2Q3OHJDWEhOZ2Z4aExPMWpnTnRwcXN1NjA5?= =?utf-8?B?V2c9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 9067d0de-820b-488c-4e8f-08dd1442553c X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 09:02:08.8854 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ltv7TJh8UU7IYpUS6RcbGCW2Blej8vV9G21efYs5eMjRYxuMxTrcFpcHf2T66nRZTWjBPRFtEk5Q0mOwamz0DAjvpe2aQAVjSByb7iB2Gk4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7179 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 12/3/2024 11:16 PM, Stephen Hemminger wrote: > On Tue, 3 Dec 2024 11:25:00 +0000 > Anatoly Burakov wrote: > >> Devbind is one of the oldest tools in DPDK, and is written in a way that >> uses a lot of string matching, no type safety, lots of global variables, >> and has a few inconsistencies in the way it handles data (such as >> differences between lspci calls and parsing in different circumstances). >> >> This patch is a nigh complete rewrite of devbind, with full 100% feature >> and command-line compatibility with the old version (except for dropping >> older kernel support), albeit with a few differences in formatting and >> error messages. All file handling code has also been replaced with >> context managers. >> >> What's different from old code: >> - Full PEP-484 compliance >> - Formatted with Ruff >> - Much better structured code >> - Clean and consistent control flow >> - More comments >> - Better error handling >> - Fewer lspci calls >> - Unified lspci parsing >> - Using /sys/bus/pci/drivers as a source of truth about kernel modules >> - Check for iproute2 package >> - Use JSON parsing for iproute2 output >> - Deprecate --status-dev in favor of optional --status argument >> - Deprecate kernel <3.15 support and only use driver_override >> >> Signed-off-by: Anatoly Burakov >> --- > > Looks great, like it. > > Only suggestion (which you can ignore) would be to make DevbindCtx > an object with methods bind_devices and print_status, that might simplify. The intention was that DevbindCtx is for processing command-line configuration and for keeping reference to Devbind which does actual work. I feel like the only thing it will simplify is instead of passing ctx around we'll be passing self. I will look into it though, maybe there are some opportunities that I'm missing. > > Reviewed-by: Stephen HEmminger Thanks! -- Thanks, Anatoly