From patchwork Mon Jul 18 06:20:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12920748 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 675BEC433EF for ; Mon, 18 Jul 2022 06:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233339AbiGRGV0 (ORCPT ); Mon, 18 Jul 2022 02:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbiGRGVA (ORCPT ); Mon, 18 Jul 2022 02:21:00 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E89B813F06 for ; Sun, 17 Jul 2022 23:20:59 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id q16so6611679pgq.6 for ; Sun, 17 Jul 2022 23:20:59 -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:in-reply-to:references; bh=iFqLFR3Yn6XwZzgvZrtLuP2bd8i9r1PcKMQvEm1Gv+8=; b=BOl67qQG7UcST3cJWrtUWXkoAlOs0PAAK/OGJR64aiwzpdr0eiFk4IHFX/MnreHas5 t6DcV6+qK8ijemRIztXRodxWKvwXvqi7EBxWYKU4b2jJgR8yPQv5Q4pEkEkfxLvEezb7 vQM9INm2t4/oLKzUqwCCzATOwpRrXyYXozq1E= 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:in-reply-to :references; bh=iFqLFR3Yn6XwZzgvZrtLuP2bd8i9r1PcKMQvEm1Gv+8=; b=C80txsb7usYITMd0/26w06wLqXtoizwsqghE614zXnN6AeusqcMNvbv8Uo3T9n7tCB UmVD79WxLkqyUw73mgA7ymuKmZkNdbBP1aRjEC89Ar3PiWKuc1pDY3V+OugKGGkbDBDs S2jfbqYdmcyerhjw+ljUc1yfxtgvVyEXeNj5Tepd1/mzg/cHMaL3BuJ9pAN0J2gpZpib 7kDkCYulTDY5pW2lDzFODGWDecbPS/Fr6OuLheZfp+41X5NCdqrVFFSTR5YNHoyAmS69 CZSWqwysmP7Mk6elTwaadlvkkKu8AXuhSBjNu0y4Rv4dQZ9MFGXV+4uo6V3fUD0c08q8 pW4Q== X-Gm-Message-State: AJIora+OKglMcjKnW0kmiWV/UCkQOiV89W7wMQbvDiijHTKgCn6fcgeT bRSbd1oMAp+Kp2WnaQWkhDXcnA== X-Google-Smtp-Source: AGRyM1u9E9HE/ZEG+6fanEkVEfuhk6Gk55edx60+CXwsMukQTIgCyd+xE2Exq6iGuUcZEl/dTkb52A== X-Received: by 2002:a63:5d09:0:b0:416:18b:5846 with SMTP id r9-20020a635d09000000b00416018b5846mr23790482pgb.574.1658125259144; Sun, 17 Jul 2022 23:20:59 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h22-20020a170902f7d600b0016c4fe627eesm8360164plw.241.2022.07.17.23.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 23:20:58 -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 v3 0/3] add framework for selftests in devlink Date: Mon, 18 Jul 2022 11:50:29 +0530 Message-Id: <20220718062032.22426-1-vikas.gupta@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <0220707182950.29348-1-vikas.gupta@broadcom.com> References: <0220707182950.29348-1-vikas.gupta@broadcom.com> 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: 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 (3): devlink: introduce framework for selftests bnxt_en: refactor NVM APIs bnxt_en: implement callbacks for devlink selftests .../networking/devlink/devlink-selftests.rst | 38 +++ .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 60 +++++ .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 +- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 12 + include/net/devlink.h | 20 ++ include/uapi/linux/devlink.h | 29 +++ net/core/devlink.c | 216 ++++++++++++++++++ 7 files changed, 387 insertions(+), 12 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-selftests.rst