From patchwork Wed Jul 27 06:37:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12930137 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 B13E8C19F29 for ; Wed, 27 Jul 2022 06:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbiG0Ghh (ORCPT ); Wed, 27 Jul 2022 02:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbiG0Ghe (ORCPT ); Wed, 27 Jul 2022 02:37:34 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4E22A739 for ; Tue, 26 Jul 2022 23:37:33 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id b133so15297107pfb.6 for ; Tue, 26 Jul 2022 23:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=te11IIQuAEJ9Vg04V7UgjgvXPTRkrIu0R3zoFqqABYY=; b=AvEObnHvaNabff2L12ZFUiPB1dsJjIuPHKrwqY3VM12CHtcngdogRoRZSBbHi4DQ03 i3lfEroDvQV3mr6PNGO43irJlK4DJZQKZbTRiOTZpQ72dtON7WKNW1X5h8qzvvOt+ntB yc59DlPw+v9RhcsEOeagolTSkb9um51XsU+VA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=te11IIQuAEJ9Vg04V7UgjgvXPTRkrIu0R3zoFqqABYY=; b=2ezjjMX5tprx1sVf8GHkekHTBcizncJaPBc0jLq5bXUqA4Gq6tOjViV+iMxPpkeUWO bIHSbBloEl1lMpp3w4zfOU8Hg5eJ/aNwm5SSTaBvQsF0Kg3A6EJGgtlddr0vaqUm9r0g kfJFJHlj1ePaHQMhmAZxi95c5AZ+nrdNKg5Bboy2h25KEc7U5U44pPjYDFdNc7Bnm6f3 nuOhYgXr9FV3RKlvozYjoeLctWZPExokaYpfymlWO2y8vlhUcnNmN1DEQlaqXvXoB8Mf +9g0Yc8PcI/5HtSQEQ/azsCDpP7kfLQryhBkx1qY8vQ5ro4p09ik8XTsUEMW/CoRwfAx oi0w== X-Gm-Message-State: AJIora83P7naLJziUmHQrM2UtogulzBmrEew/dkN7gYWCC7lDn7ukcIV SiAodUixeEp6uRliJ4a/PaY2cA== X-Google-Smtp-Source: AGRyM1ubCNuJaq3zWgp+l/xysdZcutCLkrJnGx0EbInqtahvdc+GhfHCuVwcb5mSIX0jx3aPf9W8Ag== X-Received: by 2002:a63:688a:0:b0:412:6728:4bf3 with SMTP id d132-20020a63688a000000b0041267284bf3mr17820662pgc.339.1658903852600; Tue, 26 Jul 2022 23:37:32 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q68-20020a634347000000b0041b36d47940sm1643582pga.23.2022.07.26.23.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 23:37:30 -0700 (PDT) From: Vikas Gupta To: jiri@nvidia.com, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, stephen@networkplumber.org, edumazet@google.com, pabeni@redhat.com, ast@kernel.org, leon@kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, michael.chan@broadcom.com, andrew.gospodarek@broadcom.com, Vikas Gupta Subject: [PATCH net-next v7 0/2] add framework for selftests in devlink Date: Wed, 27 Jul 2022 12:07:17 +0530 Message-Id: <20220727063719.35125-1-vikas.gupta@broadcom.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Hi, This patchset adds support for selftests in the devlink framework. It adds a callback .selftests_check and .selftests_run in devlink_ops. User can add test(s) suite which is subsequently passed to the driver and driver can opt for running particular tests based on its capabilities. Patchset adds a flash based test for the bnxt_en driver. Suggested commands at user level would be as below: changes from: v6->v7: 1) Changed the macros/enums name as suggested by kuba@kernel.org. 2) Rebase with latest net-next. Dumpit impacted due to recent patches by jiri@nvidia.com. net: devlink: make sure that devlink_try_get() works with valid pointer during xarray iteration net: devlink: move net check into devlinks_xa_for_each_registered_get() v5->v6: Addressed change in .rst file only suggested by jiri@nvidia.com in patch v5. v4->v5: Addressed the changes requested by jiri@nvidia.com in patch v4. v3->v4: Addressed the changes requested by kuba@kernel.org in patch v3. v2->v3: 1) After discussions with jiri@nvidia.com, passing a testmask from user to kernel is removed and a flag based arguments are adopted. This way we can have more than 32/64 selftests defined in the kernel. Below is the format from user to kernel and vice-versa. Kernel to user for show command . Users can know what all tests are supported by the driver. A return from kernel to user if driver supports TEST1, TEST4, and TEST7. ______ |NEST | |_____ |TEST1|TEST4|TEST7|... User to kernel to execute test: If user wants to execute test4, test8, test1... ______ |NEST | |_____ |TEST4|TEST8|TEST1|... After executing the tests kernel return to user. |NEST | |_____ | NEST| |NEST| |NEST| TEST4,RES4 TEST8,RES8 TEST1, RES1 2) Added dumpit in devlink for list/show command. v1->v2: Addressed the changes requested by kuba@kernel.org in patch v1. Fixed the style issues. Thanks, Vikas Vikas Gupta (1): devlink: introduce framework for selftests vikas (1): bnxt_en: implement callbacks for devlink selftests .../networking/devlink/devlink-selftests.rst | 38 +++ .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 61 +++++ .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 +- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 12 + include/net/devlink.h | 21 ++ include/uapi/linux/devlink.h | 29 +++ net/core/devlink.c | 216 ++++++++++++++++++ 7 files changed, 389 insertions(+), 12 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-selftests.rst