From patchwork Fri Jul 22 09:11:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12926193 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 C584FC43334 for ; Fri, 22 Jul 2022 09:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235359AbiGVJQ3 (ORCPT ); Fri, 22 Jul 2022 05:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235677AbiGVJPx (ORCPT ); Fri, 22 Jul 2022 05:15:53 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE463AFB77 for ; Fri, 22 Jul 2022 02:11:46 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id k16so4064546pls.8 for ; Fri, 22 Jul 2022 02:11:46 -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=bVVRhSXlhNB1Fprkdwqb2Lm/qvTgymOkbqhC8ZX5R10=; b=BvrX6JhvqNBTU3sqLV0kVEqYsOVeNJcdir0s+Tp/WHfqYWzmkTDMjKKvnVk76F8W3n +K71zFrDERvz8BgvV6Vpv0gok45UtBzh6hf7tPGOTmcPi4oU2f0JXyD7R96/i6Dq0Bns esHe05KAGgaQBJq6xJMdleQhAfL3AbMAxZnXM= 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=bVVRhSXlhNB1Fprkdwqb2Lm/qvTgymOkbqhC8ZX5R10=; b=BB+/mWS/YDt4XbUWDk6PTh0ECUvUV2hTtfnLEBKqe2/WeHRUwvlOeIvwUsiVIT7FM7 3aw9sj3z9CCQ9iZV5AAIGcHhwWrLUdt9YbiNhJZdkCeY6xCB8H+sM0+cs3XmEmChBN7j xeUMemPGO8YML85L0DlHR5GHewpjDGx8cL41SIJrq8P38UMHLSKj04sAV14yIhZxemWW PyrgZbkW15MRqeXKIIhyKxmg8DYUxDIe2XyHP4YhN5xCl/Su6BKlgS1HDJYoHPY844kA WN47mlnuXI8plsEMF9LlzeNIG9wntD3oyYlH0UoD/7GoLcDqZxJKiblmIwgIBFOBapZk KZQw== X-Gm-Message-State: AJIora+GafHlYLm1KlL3buk2khTqWM2vjmi78u2EyVuGJytjQaJaLTGZ K0ZCD7SfLqEfhhTy8aCbTNYqPw== X-Google-Smtp-Source: AGRyM1s9t0lIdAHwLipZ/G0QflWJA5sDWeOGB7ww1Lc76acKEzVEom/XnmGbnUpdOm1Br3rgURe9sw== X-Received: by 2002:a17:90a:4e87:b0:1f2:1c52:4082 with SMTP id o7-20020a17090a4e8700b001f21c524082mr3030293pjh.237.1658481105994; Fri, 22 Jul 2022 02:11:45 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id p64-20020a622943000000b0052b9351737fsm3429978pfp.92.2022.07.22.02.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 02:11:45 -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 v5 0/2] add framework for selftests in devlink Date: Fri, 22 Jul 2022 14:41:27 +0530 Message-Id: <20220722091129.2271-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: 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 (2): devlink: introduce framework for selftests 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 | 32 +++ net/core/devlink.c | 223 ++++++++++++++++++ 7 files changed, 399 insertions(+), 12 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-selftests.rst