From patchwork Thu Jul 21 07:21:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12924811 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 ED517C433EF for ; Thu, 21 Jul 2022 07:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbiGUHVg (ORCPT ); Thu, 21 Jul 2022 03:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbiGUHVf (ORCPT ); Thu, 21 Jul 2022 03:21:35 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA07A3F33E for ; Thu, 21 Jul 2022 00:21:34 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id gn24so793635pjb.3 for ; Thu, 21 Jul 2022 00:21:34 -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=nO/ZTYF5Xh4r4yF0nmycD6Cl2JjkTtWaf0UaCcqRE4M=; b=OPBnsvc3dbCxJbal4ep9rrAU5NvWKwAWhwI3ISNNdHsDn1Wm4DPxkMb7SqWvkaHYhE Jueh9sVrTpGfIdVHRV8EdDfxNCaOP+T3vIJGIfsCjY6njDgV+WmTfQF7aX3VyFIzrjLa Kgu8W8wUc2ODbrrOuLV5+jZ4DYPrPeWH9BFj4= 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=nO/ZTYF5Xh4r4yF0nmycD6Cl2JjkTtWaf0UaCcqRE4M=; b=bJtWnN3yUjEc5LozGchWt1C2hJrqLGcocejUyVUCTYtxwnSuoi0zh2Hs/lIpWZJtuS O5j6DxEIgUPunW8Qz/nwtVa+JNk8unHF+3bV0dKoJIjt0MeE4X9MW1brW4VcIsfXWhcu /8OdYl4QTEZvATAhi5CSceKM1qyNyJ2hSPaTu1wxl6UujJxKc/HyhICgjtebP2HmpfUb 3xpXYTOLj7koeFiij9RhFF1JxBXVXgmpN3rmcZ9dTzPMZ2HBlxO5VbarLDNfrvDIrNQa uHcnpcNzNUbKApUWecG5ZjnXzGI+D4cKJMz3Asipef8FcNlNmnVLX2zehwczJO6qnfxM uY+Q== X-Gm-Message-State: AJIora9EKdFBDgM7RugCHFvnGY/Py0xR3gZPjpLZz9Z5L6TJSwnhdguT 9Lgso7lKDV5YxSTes82gTXZztw== X-Google-Smtp-Source: AGRyM1v/kb5K/4EGvSTqv4P/3kIH878gQ79BtnnEXX0F1VjWiJJjILcQY36TRdh8PbV+tWZW3lE+qw== X-Received: by 2002:a17:90a:e7c4:b0:1f0:78a7:bf37 with SMTP id kb4-20020a17090ae7c400b001f078a7bf37mr10054133pjb.77.1658388094195; Thu, 21 Jul 2022 00:21:34 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t8-20020a170902e84800b0016d2959cf37sm823611plg.279.2022.07.21.00.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 00:21:33 -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 v4 0/3] add framework for selftests in devlink Date: Thu, 21 Jul 2022 12:51:18 +0530 Message-Id: <20220721072121.43648-1-vikas.gupta@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220718062032.22426-1-vikas.gupta@broadcom.com> References: <20220718062032.22426-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: 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 (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 | 225 ++++++++++++++++++ 7 files changed, 396 insertions(+), 12 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-selftests.rst