Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp638567pxv; Thu, 15 Jul 2021 12:09:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4GmgCvjPFPGZEy2YZW94a3iEmeIi5Ci1LsW+7TpqZBsZC50wS4SgCQRW60MihTwyGPckK X-Received: by 2002:a02:94af:: with SMTP id x44mr5378934jah.79.1626376197243; Thu, 15 Jul 2021 12:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376197; cv=none; d=google.com; s=arc-20160816; b=gkACUjR750oyeDJV3kALwWOYbQMAql2erOhjhFI2cf48maziNUBlcWsHelbKanTcgb 7CagOaCG4rHnPufWQ8rBkn/b7cK+zW/MA9brSi3hRm3jBbqURgIw3nKYqwt53rgncgDh xZFfzv0kuVmCWF5JgJrQxinq7s6JZuqrpVGhI4L559pLwmsGH74XbV+NABPTtM9+M+OK roQkdZBOXYx5itG8uIUNPMZNNjDrMg7foddTZ9m/dbDGLlgTiboz1fR1jyaM//7gOBVI vWFdPoeZB1mIJRzs8tW7kaSgQ79WO9515Lfc3a3iF/wJdh/fvgEOqaGd+Uz4yb+IiAUe dxdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Yeq0IOonpQzSVBa0quJvDbmek26ktibXx/y7wmm0D0=; b=S/Iv/33+HtfcAmHx9vh20de4Y7MKeI1g7AqErHsYT0t3IzRMnQq/Hz3rH4OOo0VPNq Mfrfd56cYTID71p1WxbuRzrMvBJYSQaNlKkva8+9MFLK9vrn1mf8K4qwOj6z3FZH5KoV GNXdEzXcR9qOjpbMbPaWj8VFIu29ITOSD/2he0CusN6vRAsJlO3femXdqqrRjwCNYaOh UnmebVleoCF40W5Gtcg+gde5GQbuaCWmqano/cY/PF4sGfYAG8br9esz7FBmymiApEH6 svRyA6n6m0lPXUhFMXPnHIdDP5ToL0XS0stIxU5mv04yewwMxAUshEGfUHbbEFfqy5hl vE5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S0ZQSMy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si8296132iog.79.2021.07.15.12.09.44; Thu, 15 Jul 2021 12:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S0ZQSMy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243174AbhGOTJ2 (ORCPT + 99 others); Thu, 15 Jul 2021 15:09:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:35614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239668AbhGOS6Q (ORCPT ); Thu, 15 Jul 2021 14:58:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1FBA613D3; Thu, 15 Jul 2021 18:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375322; bh=MnWRg8O598uw45XJPMdWCTc8gdgBnSuLbsps9RCIGoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S0ZQSMy49nusB1BCD449Gz4LQcAw028XHrdL4TqhsY5OsEzeNq1tgDencUst6VAy3 eXFARJAPug6CpnBeEzNWColrsaMcf3NzyVMfNKc6hUDzxADhBj0BeOGSTbXz0zSw+o KJfvARvRogEAfBBrspCrnQCWxeeG85Wz4qX7NLDw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.12 038/242] net/mlx5: Fix lag port remapping logic Date: Thu, 15 Jul 2021 20:36:40 +0200 Message-Id: <20210715182558.730604723@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eli Cohen [ Upstream commit 8613641063617c1dfc731b403b3ee4935ef15f87 ] Fix the logic so that if both ports netdevices are enabled or disabled, use the trivial mapping without swapping. If only one of the netdevice's tx is enabled, use it to remap traffic to that port. Signed-off-by: Eli Cohen Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/lag.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index 83a05371e2aa..8d029401ca6c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c @@ -118,17 +118,24 @@ static bool __mlx5_lag_is_sriov(struct mlx5_lag *ldev) static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker, u8 *port1, u8 *port2) { + bool p1en; + bool p2en; + + p1en = tracker->netdev_state[MLX5_LAG_P1].tx_enabled && + tracker->netdev_state[MLX5_LAG_P1].link_up; + + p2en = tracker->netdev_state[MLX5_LAG_P2].tx_enabled && + tracker->netdev_state[MLX5_LAG_P2].link_up; + *port1 = 1; *port2 = 2; - if (!tracker->netdev_state[MLX5_LAG_P1].tx_enabled || - !tracker->netdev_state[MLX5_LAG_P1].link_up) { - *port1 = 2; + if ((!p1en && !p2en) || (p1en && p2en)) return; - } - if (!tracker->netdev_state[MLX5_LAG_P2].tx_enabled || - !tracker->netdev_state[MLX5_LAG_P2].link_up) + if (p1en) *port2 = 1; + else + *port1 = 2; } void mlx5_modify_lag(struct mlx5_lag *ldev, -- 2.30.2