From patchwork Tue Jan 31 05:25:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 4748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2569536wrn; Mon, 30 Jan 2023 21:26:59 -0800 (PST) X-Google-Smtp-Source: AK7set8PVedbQb7mzrg350iWNfiQ7aqJ4WOH2ltjpA+Y1jXiIQ7O1xQkp7uyaNUTASZv7+2HycdU X-Received: by 2002:a05:6402:40cf:b0:4a2:5603:f05b with SMTP id z15-20020a05640240cf00b004a25603f05bmr2677711edb.23.1675142818983; Mon, 30 Jan 2023 21:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675142818; cv=none; d=google.com; s=arc-20160816; b=fRIojqfAGvftdQ5Ww4FutR80LFvPAl7R4bw8JWQHUsSp14IYMsSvVMXGKhzOx9k9HZ 18eLLbcCwEM1FeupXx3yUOBi7biTjWlV/h5+9XKusaT/rkmGyLejHHvwymzX633fPdWJ GitPkPc8XGgylMDzXMdL09ni0zp8fC743wHIMaXXqWAl7/BApxsJbdiPBB+sNh1tr/fs Sy6IGhWezR5fH+euuWTuBztElYh/CMs+/SsxgDfNC8ohnWHklnsvpTL8BOKdgvOZQVCl PNkJ0pUfHSuD/LWdswmNEm/YPxE3bGRiYR1odeUcZ7bITRhuhM46J2ZsX1ohd90oIjSL C5kg== 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=lHxvfY/9mLckuNaFUI8MqQHR70TdRDF2XTsmF1CVRH8=; b=BxuI4yiG9LoTQsU3irz61+koAxNFrX2NrO58YrzNfzLpJ6/mgAGPG5AUqX4qz4hajz kx+e2I4oxUDN6rVV13rmZJwkgCP8ggLK46IN/+mgImFpL9LJuFbQyvoXy547zVSvF6vv Yvy/F5fPn4hbp1fI5ZRyH66b3nTe0xecwW0ayxvvgVD/nWMkDa6emz+/XYKrRjV+qIVF FvwJTdQurOaQ/5wQwtNHCf8i5le0VqeURtmE1WKFq/KAC68UfKoo2C8evJab0udbGexG Ptc3rHWXHVwzvFwnY/PLbqSciUH9oULrd3caet+gMvCdNzSWk18PGWVedFCmGjzD/u3P u2uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=hn36V4OH; 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 17-20020a508e11000000b004a21579d23esi12411600edw.510.2023.01.30.21.26.34; Mon, 30 Jan 2023 21:26:57 -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=hn36V4OH; 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 S230272AbjAaF0M (ORCPT + 99 others); Tue, 31 Jan 2023 00:26:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbjAaF0I (ORCPT ); Tue, 31 Jan 2023 00:26:08 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55F3CCDF8 for ; Mon, 30 Jan 2023 21:26:07 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id cl23-20020a17090af69700b0022c745bfdc3so6746530pjb.3 for ; Mon, 30 Jan 2023 21:26:07 -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=lHxvfY/9mLckuNaFUI8MqQHR70TdRDF2XTsmF1CVRH8=; b=hn36V4OHze6prx5MOQcsRzPeyl6IMNx7ITX7661ZYoKyK+AGu5nykrHsIBxsWVfus6 87/FqarCSohBvx3X6iDSP96ZgUfdme31e2Qy5MBCvSSy4W4LDHzb3X5g1QSQTYUf1s86 hmoc9xTdw1tkXHW/0kD+Fn+j9mkvydvlQqT5c= 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=lHxvfY/9mLckuNaFUI8MqQHR70TdRDF2XTsmF1CVRH8=; b=p/bv0LybzwqgGBKth0mYn8ubPor6XDPmPkXCthdGMHgYCnIZ8cTdbMoUDxPx76XhxS pi9EpfJrm04zO8ODYk9SJbnQ/DHXRnAmCITYWWqpcbIHmrRsc3ZObhnG+whHrU2m80vc I2qYGoakJ1eOU8V+B/YMjUIPMQqmpZd1//8AgLCpYlvM3TGXvrJnQPnP1bl3QyU8Donv +BeDVBkAFPm3tfKOLNb4zoT/Yhq+XPzUmlN6ejknflwwtL1TBI6H9PQFgighAWA1MOM/ 6/2zoK+V7GFXScesmv/O5T4TWvjovxmUykMovws7fsKppoVkG3zg95ekHJXtn2nut7wr yv4g== X-Gm-Message-State: AO0yUKWFC7bjVq9VSciQClLQG4p7XQau+crYvFy4q0IP/B3WpUcjOCJ/ VN6ugem3QGg9+9wqp9I3PoabkQ== X-Received: by 2002:a17:902:f1ca:b0:198:94cb:82a5 with SMTP id e10-20020a170902f1ca00b0019894cb82a5mr1866239plc.4.1675142766736; Mon, 30 Jan 2023 21:26:06 -0800 (PST) Received: from localhost.localdomain ([2605:a601:a780:1400:a879:b64b:d9bd:3c1]) by smtp.gmail.com with ESMTPSA id jk15-20020a170903330f00b001960cccc318sm2310106plb.121.2023.01.30.21.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 21:26:05 -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 v9 0/8] Add Auxiliary driver support Date: Mon, 30 Jan 2023 21:25:49 -0800 Message-Id: <20230131052557.99119-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?1756514556782437717?= 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. Commit message uses Leon's Reviewed-by from earlier version. Please apply. Thanks. The following are changes since commit 90e8ca0abb05ada6c1e2710eaa21688dafca26f2 Merge branch 'devlink-next' and are available in the git repository at: https://github.com/ajitkhaparde1/net-next/tree/aux-bus-v9 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 | 9 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 8 + .../net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 478 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 51 +- 8 files changed, 464 insertions(+), 735 deletions(-)