From patchwork Wed Jun 7 21:04:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13271321 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 AB2EFC83003 for ; Wed, 7 Jun 2023 21:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236110AbjFGVFo (ORCPT ); Wed, 7 Jun 2023 17:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236647AbjFGVFG (ORCPT ); Wed, 7 Jun 2023 17:05:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A0C2D6B for ; Wed, 7 Jun 2023 14:04:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60305649F8 for ; Wed, 7 Jun 2023 21:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68DDC43443; Wed, 7 Jun 2023 21:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686171873; bh=TxslIJuegigARBUmcC/zoGAApJ4huayWW1+6cWeHxpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYx5RbsLi1Kzi0ybBEfI1pY1di15TKg7oIC628VTgPV6sdOH7y9vxyrfvnqbGib2X GSuZgTJdl2Ko0xxxlR1f1sJxV0/fRPMTg3wla86eRZL3cb+sKrzH4Qz3HWaQRzQU7E g4EUbr2KwXp2MJ7eEvU8gtlcGjJvsrxGmZOAKFsmYsuVQ0d+GH2sCA7Vzo5TVcnzu7 5qsUvbMVXx0bUEyi4mJ7T2Sg7UbSjS34RPbcz962HmNlNg/e6/s3KkA9wQzOJkqdxI QHH4JUG4/FwhrDJRFs/uwByXEgbT7HYw3f0EW/jsMb8SvYh7Dul3bKHfYr9/NOWlK/ xPSNAHuejGVjA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Leon Romanovsky , linux-rdma@vger.kernel.org, Shay Drory , Mark Bloch Subject: [net-next V2 06/14] net/mlx5: LAG, block multipath LAG in case ldev have more than 2 ports Date: Wed, 7 Jun 2023 14:04:02 -0700 Message-Id: <20230607210410.88209-7-saeed@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607210410.88209-1-saeed@kernel.org> References: <20230607210410.88209-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Shay Drory multipath LAG is not supported over more than two ports. Add a check in order to block multipath LAG over such configurations. Signed-off-by: Shay Drory Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c index d85a8dfc153d..976caa8e6922 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c @@ -14,6 +14,7 @@ static bool __mlx5_lag_is_multipath(struct mlx5_lag *ldev) return ldev->mode == MLX5_LAG_MODE_MULTIPATH; } +#define MLX5_LAG_MULTIPATH_OFFLOADS_SUPPORTED_PORTS 2 static bool mlx5_lag_multipath_check_prereq(struct mlx5_lag *ldev) { if (!mlx5_lag_is_ready(ldev)) @@ -22,6 +23,9 @@ static bool mlx5_lag_multipath_check_prereq(struct mlx5_lag *ldev) if (__mlx5_lag_is_active(ldev) && !__mlx5_lag_is_multipath(ldev)) return false; + if (ldev->ports > MLX5_LAG_MULTIPATH_OFFLOADS_SUPPORTED_PORTS) + return false; + return mlx5_esw_multipath_prereq(ldev->pf[MLX5_LAG_P1].dev, ldev->pf[MLX5_LAG_P2].dev); }