Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2492146lqp; Sun, 24 Mar 2024 23:25:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXT4NemvNMbgHyjRBOI+I+R0+kyE6Lq+fkTe9rfvVSNlQ/cOYfKxGlcUi/srcaoG3avC+ACRjt70Jgir4Nt1+m4hOMwLNepKtwQoEyIw== X-Google-Smtp-Source: AGHT+IH6CJs/qiR5S6IDqqBEypeD36thBWkCXhhZWwmsx9eaNCwXbnkzGs/Gg+mPWrw+i1T3N4v6 X-Received: by 2002:a05:620a:8d0:b0:78a:429c:bb2c with SMTP id z16-20020a05620a08d000b0078a429cbb2cmr6036812qkz.16.1711347922760; Sun, 24 Mar 2024 23:25:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711347922; cv=pass; d=google.com; s=arc-20160816; b=MQe5xuLGqlHzmOq2frx5PZsr4KmfxrNG6ehqPoLph6KOcc1kN2Qzq4tDQEZ6U7rRy1 y/eNL5EuVLIwx1Z4czV+ohrIWgBVC6P2+ehCilZHgXHUDoW+3tR6hODBCZrrZa5Mbh+J UhXAxjXl7/NTs8wlhLB/cLdPg9jVET76tDD5I9QbZUAjQThkqCE86n5ft+G8IX0Jad0W ff5bQtsUpdnmvUPWJIM5Fr3Rr0OXSj2gkp7kpnhMLuGuJlx2Ev7ap2INA743oaUfwsXz TPlgcKc7xEgTpI9UfGTcv7BMF8JWvwxWNjNMQeE/4S5ZauWK4ClnMhNDF2WO3KCT+gpR tJlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zmuxTh3qndvBguP28ZHrkJsgIGMyhHcOdOQb05kogsM=; fh=QsEZ9HkiAvFlj9Xqzj84bFgaetIq9uTWGXy2rZRRI3Q=; b=qxzltsZM4TdDtxSN6OrjHnvWyZD4ueOKkptGG4MAPzilm41V6dIIK8HRLdcag378Nk 3RTMiRyN6hZva7OrRkkM6UpPjomm/SpVwjtLfjxv9RU/pxeo4W5jNJgQr/B2TgkefbAM K3LvAVF588+N2KM5ZrGCJYJbhy/OBljb6D3V9/lgT1uAH5zVrzOE3Yu0L4TwYcb89RS8 jXH90CDCLbOJ5kk4cwcjcLruxYfeyw4p3Tv7MhZ0pZlLein140cu5zj+SnBuknk+alA1 a8Z5FfF7nVtODkw5g4emmnl90kul6Prmz97+FF6BMiLhgsFWDBlD4ZH7tZxeBpIBG2Us mhPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YA8LKDWN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 23-20020a05620a04d700b0078a1e412169si4864010qks.709.2024.03.24.23.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:25:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YA8LKDWN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114686-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114686-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 670611C2C78B for ; Mon, 25 Mar 2024 06:25:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B9EB23947E; Sun, 24 Mar 2024 23:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YA8LKDWN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97D4D23A764; Sun, 24 Mar 2024 23:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322349; cv=none; b=IL1OZGixAxxXL9eYdjt4BGxDGfjmbaCAnmOIxvZ9XfdBIX1PJqHtG2lxUhIvFIb+Er6BMjkBsSoScy5hBeLqRegbtLYJ4KslPrPFsKxyxcOwMDqQprv4xMGm6uoZESAWmghmprPEtJMxyC83/QYATlpRbpeU9DelHa9WigxH798= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322349; c=relaxed/simple; bh=yL2hvudX4plorCm7akPwfZ0zBhqLhXo5nsRHPp4CSaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UPg61xn+Yc9mZ+GMXH2XgZglSRUGdK2jEzJhwLwEJVZizg0BcibiRLTn9PTssl8pR2BKHcrUQVnAGW0lBDsvpefe6NHf5/Stsp9ZcHm80NStvM/c6cIJg3Z02LLeDiqGprrGEkffLoHwO8iiyUjONo6ikpeRqWYpYou90zVPiiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YA8LKDWN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8510AC43330; Sun, 24 Mar 2024 23:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322348; bh=yL2hvudX4plorCm7akPwfZ0zBhqLhXo5nsRHPp4CSaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YA8LKDWNXITiQwWsKe07a/RdEa/LY2ldbzboPL+bVlIg5EjWmCO+60QcKV7R9P7a5 xjsTi/H16DT2XO8mrioTNfNGFoeTIXc8XCXk84UbPO/MEZX72sUKyj9MQ7hiATpjMj VlqGM1TtD0bbn3GWENSGc4peXd6r9xQ0oJJfIr3aImJyNP+GyTqBi/HVKhs3BzqbGa JthbD9xE64mIACjjLA7RayZWfL6oKGz9Hu8QcVE0qQsucXWQ6+nHN4mlGgdshMDhTN t8hpthiKPHbs1qa1vBpPBfil7+lJxkcWaMiCCGloB4tpKRSB+1I252Dk0pf0RvgvFl rb6rJdpdxNudA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srujana Challa , "David S . Miller" , Sasha Levin Subject: [PATCH 6.1 430/451] octeontx2-af: optimize cpt pf identification Date: Sun, 24 Mar 2024 19:11:46 -0400 Message-ID: <20240324231207.1351418-431-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Srujana Challa [ Upstream commit 9adb04ff62f51265002c2c83e718bcf459e06e48 ] Optimize CPT PF identification in mbox handling for faster mbox response by doing it at AF driver probe instead of every mbox message. Signed-off-by: Srujana Challa Signed-off-by: David S. Miller Stable-dep-of: a88e0f936ba9 ("octeontx2: Detect the mbox up or down message via register") Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 8 ++++++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 ++ drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 13 ++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index d88d86bf07b03..8f5b7d14e3f7c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -1164,8 +1164,16 @@ static int rvu_setup_hw_resources(struct rvu *rvu) goto nix_err; } + err = rvu_cpt_init(rvu); + if (err) { + dev_err(rvu->dev, "%s: Failed to initialize cpt\n", __func__); + goto mcs_err; + } + return 0; +mcs_err: + rvu_mcs_exit(rvu); nix_err: rvu_nix_freemem(rvu); npa_err: diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h index 0b76dfa979d4e..e1760f9298b17 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h @@ -506,6 +506,7 @@ struct rvu { struct ptp *ptp; int mcs_blk_cnt; + int cpt_pf_num; #ifdef CONFIG_DEBUG_FS struct rvu_debugfs rvu_dbg; @@ -872,6 +873,7 @@ void rvu_cpt_unregister_interrupts(struct rvu *rvu); int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int slot); int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc); +int rvu_cpt_init(struct rvu *rvu); #define NDC_AF_BANK_MASK GENMASK_ULL(7, 0) #define NDC_AF_BANK_LINE_MASK GENMASK_ULL(31, 16) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c index 1cd34914cb86b..923af460db296 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c @@ -340,7 +340,7 @@ static int get_cpt_pf_num(struct rvu *rvu) static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc) { - int cpt_pf_num = get_cpt_pf_num(rvu); + int cpt_pf_num = rvu->cpt_pf_num; if (rvu_get_pf(pcifunc) != cpt_pf_num) return false; @@ -352,7 +352,7 @@ static bool is_cpt_pf(struct rvu *rvu, u16 pcifunc) static bool is_cpt_vf(struct rvu *rvu, u16 pcifunc) { - int cpt_pf_num = get_cpt_pf_num(rvu); + int cpt_pf_num = rvu->cpt_pf_num; if (rvu_get_pf(pcifunc) != cpt_pf_num) return false; @@ -1023,7 +1023,7 @@ int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int lf, int s static int cpt_inline_inb_lf_cmd_send(struct rvu *rvu, int blkaddr, int nix_blkaddr) { - int cpt_pf_num = get_cpt_pf_num(rvu); + int cpt_pf_num = rvu->cpt_pf_num; struct cpt_inst_lmtst_req *req; dma_addr_t res_daddr; int timeout = 3000; @@ -1167,3 +1167,10 @@ int rvu_cpt_ctx_flush(struct rvu *rvu, u16 pcifunc) return 0; } + +int rvu_cpt_init(struct rvu *rvu) +{ + /* Retrieve CPT PF number */ + rvu->cpt_pf_num = get_cpt_pf_num(rvu); + return 0; +} -- 2.43.0