From patchwork Sat Jul 23 04:22:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12927086 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 2876DC433EF for ; Sat, 23 Jul 2022 04:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235879AbiGWEWZ (ORCPT ); Sat, 23 Jul 2022 00:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiGWEWX (ORCPT ); Sat, 23 Jul 2022 00:22:23 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E6E381B11 for ; Fri, 22 Jul 2022 21:22:22 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id g17so6091715plh.2 for ; Fri, 22 Jul 2022 21:22:22 -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=5KK/U08eHSwcHOZe+o4XpAi92r760lBIHvSbQg9Cbqw=; b=XhCNvz4ZOmZv3j64kRvDrOkyMZNEEk7peMTAqip+sKcSCgbUjmaE9LrkBG5K1jU1kh U8R4nkbK3+QVxFzkgo6pOJLil6KPZ/LDJPAN+/A+tUD1EKDgsKGIXPEJqf9rVX5pN13B Q5dN3V2f6skmu3Fslro9bzBYibj4j78Ke0/NI= 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=5KK/U08eHSwcHOZe+o4XpAi92r760lBIHvSbQg9Cbqw=; b=vcqHsrUZQI+xnFt8M3IwDnqPiElWhD89F6wVXvenECLKJUDgB/qQUIWOQ4S2KB4uDQ oK2zJwDgmie9SgWmoE9SfpaKhOOs0X/ka7j999uC9N1kjykXhwID4Irr/Z9wnKWMEoaB ZDHdfuQ5TyahyG+ORvsp0tGV4NEcoTHQDH9X2fOPYKL3KBSKd/yuLGW/9zuAnSATlzqB hN54qO3LJPDTc3xfE3antJskV52hOiAoo+kgqQuA7iAWCpMMujre1gFAb3fEHumrt/xG 49R8H9Mt/O0obVqaKMqeuxF5gpNKORwEin2IyuMsUNAmU3A++Czgo7aEepxZEnpQoxAC 3g5A== X-Gm-Message-State: AJIora+zobcERqIqKeh6w4jmq1adaj4T8C8WYcivLwGmgrZ8vprbAQC/ 7t0JUBq3Ygs8d8GGSFct26vLKw== X-Google-Smtp-Source: AGRyM1tS742xQkNtctauUbZFgze2ToyUFTIAtCyshsOJUN6gpN8cZUlfb4XT6/6LdwLgpbgPcs5qOA== X-Received: by 2002:a17:902:cf11:b0:16b:e1a5:aee with SMTP id i17-20020a170902cf1100b0016be1a50aeemr2974863plg.132.1658550141756; Fri, 22 Jul 2022 21:22:21 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h184-20020a6283c1000000b0052531985e3esm4807287pfe.22.2022.07.22.21.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 21:22:20 -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 v6 0/2] add framework for selftests in devlink Date: Sat, 23 Jul 2022 09:52:04 +0530 Message-Id: <20220723042206.8104-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: 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 (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