From patchwork Thu May 27 04:36:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 449365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0933EC47089 for ; Thu, 27 May 2021 04:37:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0457610A5 for ; Thu, 27 May 2021 04:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234577AbhE0Eie (ORCPT ); Thu, 27 May 2021 00:38:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:40582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbhE0EiL (ORCPT ); Thu, 27 May 2021 00:38:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9147613D4; Thu, 27 May 2021 04:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622090199; bh=q70lOhaKZeARksTYZ1PjL3Lp20SX8Cr6mosHxZISN8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l9OBLtAhwU8LX3yEpJO6OINX8EUi2hNYQ46g6nKpSd6OQS/gEuo+Buwl+atZ7RhYX 1ZMogTlEviw5X1SvNgXqVDSo6gGcwQo5m+evNG5+fNkyE8dhlfJC4CeJDTN6XD9CFV 3kpXyIjTz2MLxIFT3hsT1o7dUORq2CW+BhGIJtsJajaf7XxMWW2jSIIyVy14DGT5Ed vK5ti5mxgR+2QxzcfyYjrFwPgNa0ovUbcVmlW+D9i0sb7rRm0Jhm6BkPajJCzZ5odk v74Lzj8lZQ5iJim5ZJWP4ueNP7XO120UoVs9WotwDu0J+bWWUuRuVOKPAnVjxxC410 G8ql1lwop4Trw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Tariq Toukan , Paul Blakey , Saeed Mahameed Subject: [net-next 12/17] net/mlx5: Cap the maximum flow group size to 16M entries Date: Wed, 26 May 2021 21:36:04 -0700 Message-Id: <20210527043609.654854-13-saeed@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210527043609.654854-1-saeed@kernel.org> References: <20210527043609.654854-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Paul Blakey The maximum number of large flow groups applies to both small and large tables. For very large tables (such as the 2G SW steering tables) this may create a small number of flow groups each with an unrealistic entries domain (> 16M). Set the maximum number of large flow groups to at least what user requested, but with a maximum per group size of 16M entries. For software steering, if user requested less than 128 large flow groups, it will gives us about 128 16M groups in a 2G entries tables. Signed-off-by: Paul Blakey Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 6e20cbb4656a..1b7a1cde097c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -1173,6 +1173,7 @@ mlx5_create_lag_demux_flow_table(struct mlx5_flow_namespace *ns, } EXPORT_SYMBOL(mlx5_create_lag_demux_flow_table); +#define MAX_FLOW_GROUP_SIZE BIT(24) struct mlx5_flow_table* mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, struct mlx5_flow_table_attr *ft_attr) @@ -1192,6 +1193,10 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, if (num_reserved_entries > ft->max_fte) goto err_validate; + /* Align the number of groups according to the largest group size */ + if (autogroups_max_fte / (max_num_groups + 1) > MAX_FLOW_GROUP_SIZE) + max_num_groups = (autogroups_max_fte / MAX_FLOW_GROUP_SIZE) - 1; + ft->autogroup.active = true; ft->autogroup.required_groups = max_num_groups; ft->autogroup.max_fte = autogroups_max_fte;