From patchwork Mon Jan 9 13:31:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Aptel X-Patchwork-Id: 13093578 X-Patchwork-Delegate: kuba@kernel.org 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 E1E0EC54EBD for ; Mon, 9 Jan 2023 13:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236892AbjAINdt (ORCPT ); Mon, 9 Jan 2023 08:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236303AbjAINc6 (ORCPT ); Mon, 9 Jan 2023 08:32:58 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3564727180 for ; Mon, 9 Jan 2023 05:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X/LJaGRRQEeI9skvXOSKD7HeiCtJuZXuWFSiStAFnEWpOTHG0kRYN713gTPJXOzvQUGUdmpbh+Em1WzwBmIwr03TWv7ZVXBtm+EZIx7jRxtb5yqZ09ccHZRIKIhcjbFRQVEt5yzgWOH3tYcYSbSp/o8YAyHY419ON68j+9/jiiCFmz71RxPIZUfLUNC/wuobgws10fZ0bgL00lqqQZAT4KAzS2+GiHP3NxorzDUC+SxAvKaWlmclT5DmK2mLbIgEYCXi76vnsjN2a1hq8GEk/oIb2ySyMlTH0yE7KbCMNrQY6AQUQ2CzPAZ/XwvZYBfQs5XK6sqhuArdUMKQgzOgpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W0PXvlx7XDWdFv2p/lC26w2sChP9Q33lvxW84tc6t4Y=; b=hfgbN/A+X+Fco+GiDRnWHlAKRjO7KWxY/0aIde0Ez++FXqQG8MoblXcBMjc9fAk71l+taeLnTlJIImomR3RHKEX8awEM3hf2Um8tVA7PPUbbE22qrx3TScvynqLeIUn2/pUxv8oAmmsaNwTv+CBPdnP14jP4yD+1dzz/2h3Degj/RDDFHxkGF9b9rAPcNxxTTMlYbcJVczyGOjbnK7kDdr38oLPFgjwltACNjI4rzRMCkhvk41BsDNvP5UqwGnym+ZMt+ANdMvUFIJjo9OnG9gm6mvIUeQuwBEFN8LlQZqYO/fWTYZgRU7nBddwhJWA7FsF9gJJw/GA9Lz+0gRAIGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W0PXvlx7XDWdFv2p/lC26w2sChP9Q33lvxW84tc6t4Y=; b=eLj3Okdwenah0/92kc0RewnvRk0wRdGNCPliQHaJ4vmdAXKn0mEuhYbwJF6h2/9oNXDyUCx/enMTpUuXdlJO/wKiKsjprmq6TwuNH2GXrdNPLP/dVwkftzIssI2o7kKGMls3Dnfish520d1QkzCmothqRDJWAOdKv9/y8nlkrwWeVFpQjXORDEtkWOHtNKAM+hQ9R2U98em/6YARI9GuOCG+9jElk5qo0WHHqa9qsFAN5ha+MnlcXcp/fgQYc41W65jCSU3mcQLUH+q+4Rk2b7tnwn6DtB+IDEnoj1mH3+txEoauO3cHga3xpuIoK2BvK7ffJHtvzqqCw0vnXqSkow== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SJ1PR12MB6075.namprd12.prod.outlook.com (2603:10b6:a03:45e::8) by DM4PR12MB5056.namprd12.prod.outlook.com (2603:10b6:5:38b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:32:55 +0000 Received: from SJ1PR12MB6075.namprd12.prod.outlook.com ([fe80::6d66:a4bb:4018:3c70]) by SJ1PR12MB6075.namprd12.prod.outlook.com ([fe80::6d66:a4bb:4018:3c70%6]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:32:54 +0000 From: Aurelien Aptel To: linux-nvme@lists.infradead.org, netdev@vger.kernel.org, sagi@grimberg.me, hch@lst.de, kbusch@kernel.org, axboe@fb.com, chaitanyak@nvidia.com, davem@davemloft.net, kuba@kernel.org Cc: Or Gerlitz , Aurelien Aptel , aurelien.aptel@gmail.com, smalin@nvidia.com, malin1024@gmail.com, yorayz@nvidia.com, borisp@nvidia.com Subject: [PATCH v8 14/25] net/mlx5e: Refactor ico sq polling to get budget Date: Mon, 9 Jan 2023 15:31:05 +0200 Message-Id: <20230109133116.20801-15-aaptel@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230109133116.20801-1-aaptel@nvidia.com> References: <20230109133116.20801-1-aaptel@nvidia.com> X-ClientProxiedBy: FR2P281CA0087.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9b::6) To SJ1PR12MB6075.namprd12.prod.outlook.com (2603:10b6:a03:45e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PR12MB6075:EE_|DM4PR12MB5056:EE_ X-MS-Office365-Filtering-Correlation-Id: afec3707-8060-42fe-ff4d-08daf246039d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RWcJ0fI+iGIdaC+/TK4PhTtezQn20GDcd0IdQ+R60oV7S3IK8o9deJaksHth4oBi6O5EYYs9awiIUn4P9kD+gC6xF9EFbfG/92LkjLqFQXyMK141a8OlhKinWYYRnZsaaLJo/GKDaHlN5MwlzSd4vRY/vVZXIm4laAR+pS/tL9ZisByTPyqv+ZRO0ypKHWl/sFsEF9RlTm5iE+i1Frw4qN00aPhO4bNfWzr28+xKOuw4wocKCG+pOMsUM6D59bVtQrDPSUszOT8HAycJgp7popNAlDOZT0d2euyocoT/+uqfoaL8XDwVAD7bSVTuDfwRmtAiqjkhLpFkyTxfv1nINHqptt96NsaRT07XtzwXDF0sBnx+W9GHOfqd24R2hXvkuuGbQQwRTgxgF4iS447IT/TepKx2W7tZsWV/cq88Q/OUpuLmg2xGalZIE3uGg2glNgwXtadzPgIogaBBmlBkIUwJPMBMmPHnJHS6KbLrnsFdfR1ORftaVcafgjzWuoch41GBO8C4Vku5G7UBFiu3EHM75UuUxtmdNJ3wQ/cPkiEt1PDFLBBNFhXGM4QG6koh1Z0jQZ9p9QvJW4vk6fKYVWpkfL5RIDJqBUuR8ouOf8QSe7FAeVrJY21lbX15MxXgX4H/3Sh2/0F7GooTju+f3w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ1PR12MB6075.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(39860400002)(136003)(346002)(366004)(451199015)(2906002)(83380400001)(54906003)(1076003)(2616005)(66476007)(7416002)(66556008)(5660300002)(66946007)(6666004)(107886003)(26005)(186003)(36756003)(8936002)(6506007)(6512007)(478600001)(38100700002)(8676002)(41300700001)(6486002)(86362001)(4326008)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chun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i0NFb9f7Ad4P7fqpDizzgegGBx6ihWNop/QS1Qj+29Nokc1XpChMBDv8S63ccZTKkAnVRve75V6BSzEqs9XeSNxTY8X3hVRHqEJumxvmv1ONpbzE6+QwdUa3U0ziO/w9hDXGCvC8v62q6DdD8PPBeoXWnSdX8/WNpfK/8LzzZ6SXU6BytQkXjEKyZgYqmCFCdt7dMItQQs0eaU/KRI8e/eDhQT/SvZFUiPfoGdnFg9IP0YWNoRC7JTzlvEIVz0sKeXfQOmF9HZ40xtr9Vp6KFAEPqXwAEAaSITzw/Eh8pK5VD4EyuYjkKCueEVClzGTz1ZQRMOPyiapfTJQ34EKy8hgb2nc3LGkEgX3jD9lyJb+DCHEQi8oOq0Zct5Ya8qs00EKZMJCVUgrWFbQ6NcCfPKL4YH6wJf2no8vJ8KX3S4oJFYI+kTkLYdyd5bD9B1+3I5o16yZzak8zylTrHhQISIf1XGNva1Xb/y+OK1byRZ8Kqt5Y79ZiKI6/zhx/5VBvEoRC3urV1/x+9FbieWy67Gc0Ap4nQ1P X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: afec3707-8060-42fe-ff4d-08daf246039d X-MS-Exchange-CrossTenant-AuthSource: SJ1PR12MB6075.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:32:54.9290 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JiIDUG8EcK8o6Ytqh59CkslFrQ2Bqx1mMz8DLTWu0DlwOm8ozNFMJbHa9ygftlZpMEeaD2IrwfV65wGJDqrzcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5056 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Or Gerlitz The mlx5e driver uses ICO SQs for internal control operations which are not visible to the network stack, such as UMR mapping for striding RQ (MPWQ) and etc more cases. The upcoming nvmeotcp offload uses ico sq for umr mapping as part of the offload. As a pre-step for nvmeotcp ico sqs which have their own napi and need to comply with budget, add the budget as parameter to the polling of cqs related to ico sqs. The polling already stops after a limit is reached, so just have the caller to provide this limit as the budget. No functional change here. Signed-off-by: Or Gerlitz Signed-off-by: Aurelien Aptel Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h index 853f312cd757..a7799cee9918 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h @@ -62,7 +62,7 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq); void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe); void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event); int mlx5e_napi_poll(struct napi_struct *napi, int budget); -int mlx5e_poll_ico_cq(struct mlx5e_cq *cq); +int mlx5e_poll_ico_cq(struct mlx5e_cq *cq, int budget); /* RX */ void mlx5e_page_dma_unmap(struct mlx5e_rq *rq, struct page *page); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index c8820ab22169..7bf69e35af18 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -916,7 +916,7 @@ static void mlx5e_handle_shampo_hd_umr(struct mlx5e_shampo_umr umr, shampo->ci = (shampo->ci + umr.len) & (shampo->hd_per_wq - 1); } -int mlx5e_poll_ico_cq(struct mlx5e_cq *cq) +int mlx5e_poll_ico_cq(struct mlx5e_cq *cq, int budget) { struct mlx5e_icosq *sq = container_of(cq, struct mlx5e_icosq, cq); struct mlx5_cqe64 *cqe; @@ -991,7 +991,7 @@ int mlx5e_poll_ico_cq(struct mlx5e_cq *cq) wi->wqe_type); } } while (!last_wqe); - } while ((++i < MLX5E_TX_CQ_POLL_BUDGET) && (cqe = mlx5_cqwq_get_cqe(&cq->wq))); + } while ((++i < budget) && (cqe = mlx5_cqwq_get_cqe(&cq->wq))); sq->cc = sqcc; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c index 9a458a5d9853..9ddacb5e1bf4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c @@ -176,8 +176,8 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) busy |= work_done == budget; } - mlx5e_poll_ico_cq(&c->icosq.cq); - if (mlx5e_poll_ico_cq(&c->async_icosq.cq)) + mlx5e_poll_ico_cq(&c->icosq.cq, MLX5E_TX_CQ_POLL_BUDGET); + if (mlx5e_poll_ico_cq(&c->async_icosq.cq, MLX5E_TX_CQ_POLL_BUDGET)) /* Don't clear the flag if nothing was polled to prevent * queueing more WQEs and overflowing the async ICOSQ. */