Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A33AFC61DA4 for ; Tue, 7 Mar 2023 02:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbjCGCZM (ORCPT ); Mon, 6 Mar 2023 21:25:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjCGCZI (ORCPT ); Mon, 6 Mar 2023 21:25:08 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF0A53018E for ; Mon, 6 Mar 2023 18:24:58 -0800 (PST) Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id BFBF53F11A for ; Tue, 7 Mar 2023 02:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1678155896; bh=YLunr5J1c1bIAsAVRp+OmMD+b/lWN8gWAq4G89jVn0A=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VHjTCScvqE49wejrMD3nheUqIMta/3CKw7ZqLuUX/D13g0itrLoHmi2IxZeFXcblF OC2CYtBigV5PD4+fUQAlqhuf4BQX6jQFbAxBk6ue7Lqk7n9Bb/d1X7POKM8Z+f66Zf w6cEhIY2zAOLtAJ6xcJME0I+sqQw46X4KIEydoC9eTlm2UJTKcMU2Xa7pDqo4vZRjc uwlZrlMnswMAgR1ujtgOR9uwARtv/xJR5hHDZvvLiCwc6eSj1coecGi6yO/B3TFZ5E RAr8vAELOCeZN1pXOEWPB8ccGFleGR03ARNHPpK+bCxA6hMJgr/Z5BbL0ZWN+9A69g IdBZdI6i42F7g== Received: by mail-ot1-f69.google.com with SMTP id v30-20020a056830091e00b0069445a671b6so5162676ott.10 for ; Mon, 06 Mar 2023 18:24:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678155895; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YLunr5J1c1bIAsAVRp+OmMD+b/lWN8gWAq4G89jVn0A=; b=A1ywPsJxfguLct2CyVED5qVCLUYEQddZKvPMOPNLghnyb3KiGqpL/UQjsLSG6qlX9M 5JtuOnRLKhmkYwtkU/SEyWZQpqO43eeHIypDOkGwc5xVwMo+261WF6I8hCv3efDzC7L6 Er9LHcIutRJ5xC54dVVATS6+3jHXSP/4m2fS0znIP0SZJIWkoGusSENVIbijLjxo/ds8 9+km39rTjc8EtB2DxWNlbYQZgtbonkDwtXjMNZP/uLOp4GVjye/9RwrbBhFDq24Zuhkv oRRlTh+IOyxOx5Qm1hDvy3dk9l0tlgGAUIMD7mXNJjokkP19t2cpSsaUPxRF0WgqdQO0 TjoQ== X-Gm-Message-State: AO0yUKXArXMxWmqW0J7Pd8OFr01WISdwVHVADY8vPjtZtfLDPim5r6D0 OKqMU9KN5nUGJxEKRkkFWgBVac38d61dFS9oYABmNm2ymZo6Lh9sqoPt6WYPKVfBc8jLeJDwiQJ HGG41sD3lcYTnebs22eSnJm0MFAihfCH5MpzMkJ3ajdFkrCGC/Nt7xQ86 X-Received: by 2002:a05:6870:7703:b0:176:6a34:52a3 with SMTP id dw3-20020a056870770300b001766a3452a3mr4458215oab.1.1678155895651; Mon, 06 Mar 2023 18:24:55 -0800 (PST) X-Google-Smtp-Source: AK7set8dNGzH+2+FXQMV7z43aszo63H5jBjXcdILWUXcwc3QbZH6PYy4VQmDlL7eSfcZAOgNG5EsmD02ZM2ApU6hYsA= X-Received: by 2002:a05:6870:7703:b0:176:6a34:52a3 with SMTP id dw3-20020a056870770300b001766a3452a3mr4458205oab.1.1678155895347; Mon, 06 Mar 2023 18:24:55 -0800 (PST) MIME-Version: 1.0 References: <20230306111959.429680-1-po-hsu.lin@canonical.com> <20230306103316.3224383e@kernel.org> In-Reply-To: <20230306103316.3224383e@kernel.org> From: Po-Hsu Lin Date: Tue, 7 Mar 2023 10:24:25 +0800 Message-ID: Subject: Re: [PATCH] selftests: net: devlink_port_split.py: skip test if no suitable device available To: Jakub Kicinski Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, idosch@mellanox.com, danieller@mellanox.com, petrm@mellanox.com, shuah@kernel.org, pabeni@redhat.com, edumazet@google.com, davem@davemloft.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 7, 2023 at 2:33=E2=80=AFAM Jakub Kicinski wro= te: > > On Mon, 6 Mar 2023 19:19:59 +0800 Po-Hsu Lin wrote: > > The `devlink -j dev show` command output may not contain the "flavour" > > key, for example: > > $ devlink -j dev show > > {"dev":{"pci/0001:00:00.0":{},"pci/0002:00:00.0":{}}} > > It's not dev that's supposed to have the flavor, it's port. > > devlink -j port show Ah yes, it's using output from this command, thanks for catching this. > > Are you running with old kernel or old user space? > Flavor is not an optional attribute. This was from a s390x LPAR instance with Ubuntu 22.10 (5.19.0-37-generic) iproute2-5.15.0 $ devlink -j port show {"port":{"pci/0001:00:00.0/1":{"type":"eth","netdev":"ens301"},"pci/0001:00= :00.0/2":{"type":"eth","netdev":"ens301d1"},"pci/0002:00:00.0/1":{"type":"e= th","netdev":"ens317"},"pci/0002:00:00.0/2":{"type":"eth","netdev":"ens317d= 1"}}} > > > This will cause a KeyError exception. Fix this by checking the key > > existence first. > > > > Also, if max lanes is 0 the port splitting won't be tested at all. > > but the script will end normally and thus causing a false-negative > > test result. > > > > Use a test_ran flag to determine if these tests were skipped and > > return KSFT_SKIP accordingly. > > > > Link: https://bugs.launchpad.net/bugs/1937133 > > Fixes: f3348a82e727 ("selftests: net: Add port split test") > > Signed-off-by: Po-Hsu Lin > > Could you factor out the existing skipping logic from main() > (the code under "if not dev:") and add the test for flavors > to the same function? It'll be a bit more code but cleaner > result IMHO. Sure, will do with V2. Thanks!