From patchwork Wed Jul 27 09:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas Gupta X-Patchwork-Id: 12930255 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 DDF21C19F21 for ; Wed, 27 Jul 2022 09:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231752AbiG0JWI (ORCPT ); Wed, 27 Jul 2022 05:22:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbiG0JWG (ORCPT ); Wed, 27 Jul 2022 05:22:06 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F37E286D0 for ; Wed, 27 Jul 2022 02:22:03 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id e132so15425496pgc.5 for ; Wed, 27 Jul 2022 02:22:03 -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=nmaBr8xMtAGsu2WZS9mPvLMdzjSuCjz6F0DfA//tq2s=; b=Ajr706Ph0MUkkpeMpyqnPExMN9p4cZ11COuxHcODJ7ba5QU/kdHH3RjNHqPVtilguP R2LZhuGDo4UCZ6JHxlVNcr+EV9kpUhheaZB+S5pEVbQF/JKF40oZN8F0S23TsCW5QKLg P1GJwhXLAQVndHZxr/l2+7a2Tv6tCJPFclvAY= 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=nmaBr8xMtAGsu2WZS9mPvLMdzjSuCjz6F0DfA//tq2s=; b=lg/uqCP0L5FSYNisRsBGqZoTuoQiodYIuE3+5k/JW60zsKTFyRkh3SvxY05VAVavmL lOvfMxne5jUhmTV/wWRkvvRf9tPZqga18jNbT1psOST5/cC4DYFiJGeGCbOsfiBx21mh wAtbSh9JFc/kBgRv2NPL2EEOKOWT7S/VLmp6m1ERhTZV2YUqPRe7FE77ha8plblwtQ2l cE278/dUhWcI3dDAd0HPNeTGHbSIwdoCyZilrOJ8wRJoFOGEwBNpFAnLMVPGUtlct48D Hr2iZp9hjoOCA4XjpSpeoaSAMuxPIMkt/3VqlWyKopGulcL9Ns7HudwO2qeCDMZSlzi4 FhYw== X-Gm-Message-State: AJIora+XbEdApNnQgJSBNuSb2znlqdr6Ei/HIDmysBqlW/ARmbPnOBH1 YJX13w5BHdg7WWg++a8o/RrJkQ== X-Google-Smtp-Source: AGRyM1udX1ZS/xCYQYGMzLoGGTgp3ZXAc05Js+SRQyiAammYbwNHYutpvGsUaLMKcSchlWmShUnGRQ== X-Received: by 2002:a05:6a00:793:b0:52a:b261:f8e7 with SMTP id g19-20020a056a00079300b0052ab261f8e7mr21060093pfu.20.1658913722901; Wed, 27 Jul 2022 02:22:02 -0700 (PDT) Received: from rahul_yocto_ubuntu18.ibn.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w15-20020a17090a380f00b001efa332d365sm1159189pjb.33.2022.07.27.02.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 02:21:50 -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 v8 0/2] add framework for selftests in devlink Date: Wed, 27 Jul 2022 14:50:33 +0530 Message-Id: <20220727092035.35938-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: 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 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