From patchwork Thu Feb 2 03:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 4847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp16017wrn; Wed, 1 Feb 2023 19:39:17 -0800 (PST) X-Google-Smtp-Source: AK7set9ifDQ5pdblBnE7wxZdiZfDycTZV5i0vF8JLDVzsMSXgrpacCsXfjeae0p9mH4OrAsUUMDR X-Received: by 2002:a17:906:7e43:b0:87b:d376:b857 with SMTP id z3-20020a1709067e4300b0087bd376b857mr4678809ejr.29.1675309156957; Wed, 01 Feb 2023 19:39:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675309156; cv=none; d=google.com; s=arc-20160816; b=diTYF2tee3jRiw33AUh/e5L4X6DsNGfm8PRiYCEtsYNIuwU0t4uEPNqiKPcLNR6SN/ dcOw8CtMi0ot7vY77hos9waaggL1WyIDQsNvQsSTL6LLX+FOx/wh8zlF4CvSIKUn8HT0 og73ITbPMyk/4UeXjw/vuV6TxPxHqk4Hn8lilBILHOmfjHASpQ9wDjZtuUFpTf1nW+Hf JtbGnRxm1D5nZnd2QjCgWzmqFnR4on3w4BCkC3gdHlTnIm30MvzUA9IpqvSaoFJL3idF vNDD1PFSTCnDmsUp0uo5Uq0/UvES0f9WsmvT6MklRsWpgNElJ+T7+gPoHym/NWAvduw1 7+8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=S1Z4q4eiu76FrR27U++GDGdcxx0kHPG5mM1THCi2eMw=; b=jvePIf6CVRuHxPa41KRAjRhDQqNpRNBurWijtFD1+5/3/xPj4TAOjXFz3ERMeykaM7 K+IBxSXyM+13Mb6t18SUvBb6Tg5qzVYSjwEBOivSSpzUT4ItduLVRhl08qKTcMgqR1lz bt2lu6zyMdRyYBL5FhP4IS/h+P0CXODAA2rt2vYJWvTmDlr49sOl08SxM100zznh2Y8C koy4L4qQTi8dJtpOlvxy+Ot8KYxHlXK1DFvbR8QuVOC7MsJo3m8XrZkJ5G3Us+z/jAsC KTIw/mmfrM8YH9e6ov8s69y9L5lZigAcc4vV+Xn3Smgd96nl1snKARFlDZIY4WYpPFII ZwmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dRXiH6mr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ew6-20020a170907950600b008786a9dca87si20187437ejc.264.2023.02.01.19.38.50; Wed, 01 Feb 2023 19:39:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dRXiH6mr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231946AbjBBDiV (ORCPT + 99 others); Wed, 1 Feb 2023 22:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbjBBDiT (ORCPT ); Wed, 1 Feb 2023 22:38:19 -0500 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D857A4B3 for ; Wed, 1 Feb 2023 19:38:16 -0800 (PST) Received: by mail-qt1-x832.google.com with SMTP id w3so670311qts.7 for ; Wed, 01 Feb 2023 19:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=S1Z4q4eiu76FrR27U++GDGdcxx0kHPG5mM1THCi2eMw=; b=dRXiH6mrme8wl6SBmKW17vyhmO01IvanHBQwMgQTKQ43NOkIS1pSAZZBSzZigpawVs nZeR9tqFh8mQlen9kQ/AI6RO5WSY9ol8qGyVnQR28AcSomKBx+ZLRdXGNYp7KzUZNysG OpwW8kRUS8vUvXSD7Vmls0emFQlNj3WN3JDq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=S1Z4q4eiu76FrR27U++GDGdcxx0kHPG5mM1THCi2eMw=; b=S5nClUVQl1GNLAH9lkuLGKaU6JBHok+jvQRaColAESSlHnzre0hR8W7PnQfNCLgi6M Wsx+t8QVaYXP1qK8tuUPw+yVWStkm0zqSrD21fSYZZzBUAWpGrM02nFGvU49gv0v6JP1 UxKtt2xmDkmB93sOxLHYsV6o78n0JubIPgeLI/EHS7zC7WAnOKY/SY2rrydnDUuhwCrc n81iUHt+vcTQQaN2HZraPHzPD8E/HVLpGyrFLP3/NVNxa5/QDG/CU1rELUnRcRLjE/nI rvQZydDgiiTX/EcyP3HtFOJjurygOdlMFogdnoyvO20Wx8IeeYYYQbOLPQ8tmZy3RHLu kBnQ== X-Gm-Message-State: AO0yUKV4Qlgo2eKg1UnbpuMDJ81Oj3uFTjiFsvD5RU2igNJjQH/sZM8L 9zvWlZ5Zo27ZXBG+BLRuro/h/g== X-Received: by 2002:ac8:4e94:0:b0:3a8:e9e:e194 with SMTP id 20-20020ac84e94000000b003a80e9ee194mr7979412qtp.40.1675309095806; Wed, 01 Feb 2023 19:38:15 -0800 (PST) Received: from localhost.localdomain ([2605:a601:a780:1400:3d86:d226:5cc5:3432]) by smtp.gmail.com with ESMTPSA id p12-20020ac8408c000000b003b869f71eedsm7244487qtl.66.2023.02.01.19.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 19:38:14 -0800 (PST) From: Ajit Khaparde To: ajit.khaparde@broadcom.com Cc: andrew.gospodarek@broadcom.com, davem@davemloft.net, edumazet@google.com, jgg@ziepe.ca, kuba@kernel.org, leon@kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, michael.chan@broadcom.com, netdev@vger.kernel.org, pabeni@redhat.com, selvin.xavier@broadcom.com, gregkh@linuxfoundation.org Subject: [PATCH net-next v11 0/8] Add Auxiliary driver support Date: Wed, 1 Feb 2023 19:38:01 -0800 Message-Id: <20230202033809.3989-1-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MIME_NO_TEXT, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756514556782437717?= X-GMAIL-MSGID: =?utf-8?q?1756688974575975993?= Add auxiliary device driver for Broadcom devices. The bnxt_en driver will register and initialize an aux device if RDMA is enabled in the underlying device. The bnxt_re driver will then probe and initialize the RoCE interfaces with the infiniband stack. We got rid of the bnxt_en_ops which the bnxt_re driver used to communicate with bnxt_en. Similarly We have tried to clean up most of the bnxt_ulp_ops. In most of the cases we used the functions and entry points provided by the auxiliary bus driver framework. And now these are the minimal functions needed to support the functionality. We will try to work on getting rid of the remaining if we find any other viable option in future. v1->v2: - Incorporated review comments including usage of ulp_id & complex function indirections. - Used function calls provided by the auxiliary bus interface instead of proprietary calls. - Refactor code to remove ROCE driver's access to bnxt structure. v2->v3: - Addressed review comments including cleanup of some unnecessary wrappers - Fixed warnings seen during cross compilation v3->v4: - Cleaned up bnxt_ulp.c and bnxt_ulp.h further - Removed some more dead code - Sending the patchset as a standalone series v4->v5: - Removed the SRIOV config callback which bnxt_en driver was calling into bnxt_re driver. - Removed excessive checks for rdev and other pointers. v5->v6: - Removed excessive checks for dev and other pointers - Remove runtime interrupt vector allocation. bnxt_en preallocates interrupt vectors for bnxt_re to use. v6->v7: - Removed incorrect usage of inline - Updated Kconfig to select AUXILIARY BUS support - Addressed various comments including removal of unnecessary forward declaration, using static functions where possible, unnecessary jump, cleanup logic, etc.. - Added Leon's Reviewed-by, to the commit log in the patches, from previous version. v7->v8: - Addressed various comments to remove unnecessary check for id, removed setting pointer to NULL after free, renamed private pointers to avoid confusing them with the auxiliary device names and refactored some code accordingly. - Auxiliary device will be released through auxiliary_device_uninit(); v8->v9: - Fixed the cleanup code to use the auxiliary driver release function to free allocated memory. This allows the cleanup to be performed once the device reference count drops to 0. - Refactored the code to address the above. v9->v10: - Fixed residual comments like useless NULL assignments and variable initializations. v10->v11: - Addressed unused variable warning in patch 1 reported by kernel test robot. Commit message uses Leon's Reviewed-by from earlier version. Please apply. Thanks. The following are changes since commit 9f266ccaa2f5228bfe67ad58a94ca4e0109b954a: Merge tag 'for_linus' in Linus's tree and are available in the git repository at: https://github.com/ajitkhaparde1/linux aux-bus-v11 for you to fetch changes upto 30343221132430c24b468493c861f71e2bad131f: bnxt_en: Remove runtime interrupt vector allocation ---- Ajit Khaparde (7): bnxt_en: Add auxiliary driver support RDMA/bnxt_re: Use auxiliary driver interface bnxt_en: Remove usage of ulp_id bnxt_en: Use direct API instead of indirection bnxt_en: Use auxiliary bus calls over proprietary calls RDMA/bnxt_re: Remove the sriov config callback bnxt_en: Remove runtime interrupt vector allocation Hongguang Gao (1): bnxt_en: Remove struct bnxt access from RoCE driver drivers/infiniband/hw/bnxt_re/bnxt_re.h | 10 +- drivers/infiniband/hw/bnxt_re/main.c | 635 +++++++----------- drivers/net/ethernet/broadcom/Kconfig | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 8 + .../net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 474 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 51 +- 8 files changed, 461 insertions(+), 735 deletions(-)