From patchwork Wed Feb 1 20:44:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 4837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp502719wrn; Wed, 1 Feb 2023 12:47:00 -0800 (PST) X-Google-Smtp-Source: AK7set+hUfLajwRlIG1qHHo3UP9V+uIsEp95m5l+1ttnUxV5rQo/JKlFHTWIU5KZvZg/jLzFgdnm X-Received: by 2002:a05:6a20:3955:b0:be:df22:96ca with SMTP id r21-20020a056a20395500b000bedf2296camr5066305pzg.25.1675284420529; Wed, 01 Feb 2023 12:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675284420; cv=none; d=google.com; s=arc-20160816; b=iREGCpWC6eL+QWtwN/+eXa1q/k4JeqYCr8nmZEqx1dTQAr3LRmts9etE2NKI+hQYV7 SOSx5wAXEvFZEUx27HBYMvPiTBQcw+RjEPKOvGqmH0bg41cfg5iGUb8MBv+BRHgFDsWe kz7dSYVA2IiG0kv3UUekfXBs0RjcQawwqtS4drbS3liAAh7ldLtlVsYFllil/+uFYTLF iw8LrcSqK+0DtgClTuNFn59yyj+B4bQWzpI//52vu/WsB2ivzXlx7+7ql0GcouhiFHQh xX21//QcJmaApWS1uqKaCY9e2KR/1au7fM5bvitwXVZ5UxLmDm+Xbibe10vBOzA4HOos 8S/Q== 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=LzLozXzCuxE8T4EHCDoJFTwpAcvv6j3p72KaiWQu2nE=; b=YWV47oUukmSi+QG1ELOdGgrw0ovZOTJ9v+6GJz46M3LI9PWDA/1XoKW15kotSD0hYg dFKsu9Zl8bXh0rAM/Y1Ni66malVYsxrMVoMj1NDrtYiy2aNZWNf3TOu1jhLbtUP0DwBJ xSRvxVF4tIGiQP9JBVBx+VMtEhuQeS8biXCKDOjtLdZluiOXMTvuIXi23ach7BReDgKT gA/Tg+JpbeKI1Z1enEmKvHnXESbwqCESvV8OE0HrukRvz0xlcmnYiIH/A/zQhyIzY1Wm 3E7KP9VlU6MPiq+ZGon8pkqPR/+eH3XHCcz410rAjWhOlcpKoPkDG7PDeIwA2of+gvRK zi1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=V17vCFD7; 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 u71-20020a63854a000000b004e407a446adsi16063786pgd.647.2023.02.01.12.46.46; Wed, 01 Feb 2023 12:46:59 -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=V17vCFD7; 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 S231611AbjBAUps (ORCPT + 99 others); Wed, 1 Feb 2023 15:45:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbjBAUp1 (ORCPT ); Wed, 1 Feb 2023 15:45:27 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 908357B42C for ; Wed, 1 Feb 2023 12:45:05 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id e8-20020a17090a9a8800b0022c387f0f93so3481970pjp.3 for ; Wed, 01 Feb 2023 12:45:05 -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=LzLozXzCuxE8T4EHCDoJFTwpAcvv6j3p72KaiWQu2nE=; b=V17vCFD7/HOJGTwK+jUOkQ3CB8HDcCojzNKIbn4tt15NE6oxDz9TQ40lQeYN/ZOHw2 OpLPtrxqgUGBCyIC9nLVc/OMSIepykGiVVtlkD6xYpGKn5sm8Qx/wQbr/qLTdtMfX/Ph cNLUFVx2kSw0Y2/i3yHhWv9RRAuuRMUPa5d+s= 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=LzLozXzCuxE8T4EHCDoJFTwpAcvv6j3p72KaiWQu2nE=; b=XaROo9/hp0JWeWoUb114mQ2FmZyc4C9PxdJDeKFxFHN4yYljwaNVB7N0TJqVuuUHIV b9c8uEQRy5P5dUMgSQE1Tg51sVpZAHJmot5JiudFT0J8bQlRzX0G7o5MBkPAxOCJMvcK GP8c1F1OJiac3n+vRe8nXJdVfGDF1vAPT6dcFFzPwQLJCRzcnd6W/vYNV4kXMMXs8VQf CVA62fovdQ5js9xGQj22LHaFVGxV0okemi53yPt33sCz+rsqt+9JiD3GFm6hww2hmUgf ZYBF8inFxfJaPnplLO2sVzco4u0CIqbiFYO1VW1TRWIqMt84K6X8ltdslsi66upL7J9W 4bog== X-Gm-Message-State: AO0yUKXNL9gnwAU2929UfuLPlAZPElWIkfWJN7WkZpLyYrYwP1gQtiPY jPDB1qd8neKnC8J+Hl4LKZYYRA== X-Received: by 2002:a17:903:214d:b0:196:8292:e879 with SMTP id s13-20020a170903214d00b001968292e879mr3420338ple.1.1675284304967; Wed, 01 Feb 2023 12:45:04 -0800 (PST) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id w9-20020a1709027b8900b0019682e27995sm6485795pll.223.2023.02.01.12.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 12:45:03 -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 v10 0/8] Add Auxiliary driver support Date: Wed, 1 Feb 2023 12:44:52 -0800 Message-Id: <20230201204500.19420-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?1756663036379170513?= 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. Commit message uses Leon's Reviewed-by from earlier version. Please apply. Thanks. The following are changes since commit c0b67534c95c537f7a506a06b98e5e85d72e2b7d: Merge tag 'cgroup-for-6.2-fixes' in Linus's tree and are available in the git repository at: https://github.com/ajitkhaparde1/linux aux-bus-v10 for you to fetch changes upto 2daf6059f4cf2cd3f5f09e6beb4bba3e3a89b977: 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 | 475 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 51 +- 8 files changed, 462 insertions(+), 735 deletions(-)