From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E92C245E21;
	Tue,  3 Dec 2024 23:16:38 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 9730F40261;
	Tue,  3 Dec 2024 23:16:38 +0100 (CET)
Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com
 [209.85.210.178])
 by mails.dpdk.org (Postfix) with ESMTP id 846F54025D
 for <dev@dpdk.org>; Tue,  3 Dec 2024 23:16:37 +0100 (CET)
Received: by mail-pf1-f178.google.com with SMTP id
 d2e1a72fcca58-724f0f6300aso6801495b3a.2
 for <dev@dpdk.org>; Tue, 03 Dec 2024 14:16:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733264197;
 x=1733868997; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:from:to:cc:subject:date
 :message-id:reply-to;
 bh=BtmUdPlsL2rkrhWQ8oVP1ImHcgG2VK5j8iyay07VZX0=;
 b=u4n5YLc5KLjlZdUJ+O1y6PcyCTiZOEflpI+f+b8WgQvv7+ZBcK0tpmGAl9f255RYrN
 NB69wRvZgrnU0nLkfA/5Z6C4TQsSBLIYtRcNQYVAmMjtN4qgOX8tEI3/AWVKO8E/nS6z
 sulno53s6cw1M1X+DP22NsDSPqOgfDDzhUqYjf5hQPcfLS69BjF207LQC4SU9R+NjVfa
 qbyPEpBiAZKlIDZ5drAZNmSNfgNjJWnPyT4mIScXJKgxXx/Z/gwmdZSTPxFFUJgVxm8Y
 uWtJi6LK/aaTLHJWlLR3qfSg5Yt5GWn1V/3Y04Vu2GNe+xbTWnsO8lZaFIYFSwQeWecB
 ykhQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1733264197; x=1733868997;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=BtmUdPlsL2rkrhWQ8oVP1ImHcgG2VK5j8iyay07VZX0=;
 b=IylvBc30XsdFA7+cB5W2+jdFiSUFpzdNm8SdcMvAVj/ruumI23qSU8jgQrmtw2twjL
 wWsEVJlbFy/yL+bgH5JoOtjHE0ZbM8K5dSYjeME6or9cqFNzzyPxBLVtDlsteF3rbS2x
 2Rn3FFiiWAhTS46/h2FzLd76SSnXaUAxaIS/p5J6n7628hTWJ4Idom2HIor9fQRexsGm
 AHBfCTrG+FJY1m0h/R6sE7paqjuuJ4jVZ6e8+ZhQqA0fl+5jI6BC4t045XgoyRHCkCRa
 vaKPYzAMxhXGLaKpRnmGFhSa/9KUV2YBIwlhh9baM/wSem8p0cdSINaa2SlsXiUCRF08
 wtEw==
X-Gm-Message-State: AOJu0YxxGzVfyHwh+cQzfDrmgu2jTY59tY+0GssA4cSp8PMjDEl4dJWa
 nJCxN9ZzGWRCbx7W8VtClHHo/WbtI47xNrFaOj4IoTBBFKt9eGFHr7ONldbd7yk=
X-Gm-Gg: ASbGncv5bUhG+r5g61DudBzQMHXhv/RbcrDjVCyJPybCE6r9xbNreryf5NzqdM9XXZK
 nvFyjMnao+l4yVgb1pz/o+EBDlfMVX2JV/xzoow5vp7eJr9ZvNxrrX8+eZpqsX/A/yd4Bx3UAld
 5kNjByl5zca1983ix02as2CEvVWrYKxFyBo8kqFIRJAv3D+hVfbETO1NKa8hzZv7JoktwyJMlOF
 E0GavirV5Z08Jqxjl2N+txAPzb7yxEiPoh2q3GhWhtUYbmh8RcIa6jfOTPovmEP7L4uAHf2irxP
 vIBIKgwqdTZlvBU2oGhG5WMTHUM=
X-Google-Smtp-Source: AGHT+IHsKr/2GMOg/tDJbixEqB66S1vTJWvk1RnAVTsCaWBHvIjhbL1w9Xya33ZBGkdljdrzqv/bEw==
X-Received: by 2002:a17:902:d504:b0:215:620f:8de4 with SMTP id
 d9443c01a7336-215bd1b4700mr57199955ad.2.1733264196637; 
 Tue, 03 Dec 2024 14:16:36 -0800 (PST)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-2154dd62179sm72537235ad.122.2024.12.03.14.16.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 03 Dec 2024 14:16:36 -0800 (PST)
Date: Tue, 3 Dec 2024 14:16:32 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, Robin Jarry <rjarry@redhat.com>
Subject: Re: [PATCH v2 1/2] usertools/devbind: update coding style
Message-ID: <20241203141632.34eb2d28@hermes.local>
In-Reply-To: <236299d7081f4a06a6f6d06eb575539582c0344f.1733224995.git.anatoly.burakov@intel.com>
References: <cover.1733151400.git.anatoly.burakov@intel.com>
 <cover.1733224995.git.anatoly.burakov@intel.com>
 <236299d7081f4a06a6f6d06eb575539582c0344f.1733224995.git.anatoly.burakov@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Tue,  3 Dec 2024 11:25:00 +0000
Anatoly Burakov <anatoly.burakov@intel.com> 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 <anatoly.burakov@intel.com>
> ---

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.

Reviewed-by: Stephen HEmminger <stephen@networkplumber.org>