From patchwork Wed Jul 27 16:57:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12930644 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 B42F0C19F2B for ; Wed, 27 Jul 2022 17:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243155AbiG0RxN (ORCPT ); Wed, 27 Jul 2022 13:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243130AbiG0Rw5 (ORCPT ); Wed, 27 Jul 2022 13:52:57 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1C2972E4 for ; Wed, 27 Jul 2022 09:57:37 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id y15so16573495plp.10 for ; Wed, 27 Jul 2022 09:57:37 -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=EM+tGW7KTnRXD7vAwlZ3i7ZJ4sUSVZlJndij/mOIbA4=; b=aLb+PItoczwUYsuF87ksEhfhNSaX1HMMpWRPXAMmYm+QAztNFQtZYQENIh5+oasEk3 I/6YXMaa+nKww4I03lN0cAvTrcFPjKkGJcVg5zQV5hUVUTBRQAH1DmBXG4qShoLYfxW4 4UM0M36nL798NK77A+2zQdjCSJ/ZggklMmCbA= 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=EM+tGW7KTnRXD7vAwlZ3i7ZJ4sUSVZlJndij/mOIbA4=; b=sWTz5qfh1ccFPA2fPnVx4sJiqGCY286YzYIoEjJ6/+08xFwabKYIPaoIQaESTgtoeC +eEuZYSh/MD3drsfUeyNqj8EhIrXMoNce+BEgPMDF4SV23O5Dux7y6VKPy7kxXHPW+Jn JuTLSohVp8okc2v8PvzYhXO+IoWngyDk8hButWb2Owl68g84KPoDCqiDsTnD/3ueB2kE Gr343TK5RY64IBLVDQbQN0vo523hl9ykzJNaS9UDyEmqD0WK1wQ1daIcjbPicGsjY1P1 6sL7liYNMb+b0TxCUuRjPYR/2uyzx7+jWU6tdvJRt2GXHr0wyMBqr8uSJ63mtCSTCaWd CTLQ== X-Gm-Message-State: AJIora9n4CnjkXijwiBiTgKVIndph4+C2FeBqmBdb7IL3eI+B0fW2ps6 OwgraNqOXaJrPVW1UKYyB0Vo+w== X-Google-Smtp-Source: AGRyM1tUiaARDV3hQl3qNDDzrOb0RGQkknp/ZxFNmpE6t5sNab/1XOs3ff91Si/DjFQxBgZGyfOKew== X-Received: by 2002:a17:902:d582:b0:16d:612c:2d6a with SMTP id k2-20020a170902d58200b0016d612c2d6amr18827036plh.168.1658941056907; Wed, 27 Jul 2022 09:57:36 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c15-20020a631c0f000000b0040c74f0cdb5sm12280280pgc.6.2022.07.27.09.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 09:57:35 -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 v9 0/2] add framework for selftests in devlink Date: Wed, 27 Jul 2022 22:27:19 +0530 Message-Id: <20220727165721.37959-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: v8->v9: Only SOB line fixed in 2/2. v7->v8: Some nits requested by jiri@nvidia.com in v7. 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 *** BLURB HERE *** 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