Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp714323pxv; Thu, 15 Jul 2021 14:13:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0qnERYvITe354Z1aIa8XQ7kVhN1dFfMCxIfBm41O7r1YtnEDDKbf0k7lgf0CVhYSSOwM/ X-Received: by 2002:a17:906:d045:: with SMTP id bo5mr7745072ejb.461.1626383633207; Thu, 15 Jul 2021 14:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383633; cv=none; d=google.com; s=arc-20160816; b=Li7Fzk6RjKdofY82wsSSGwLMqD70Yt9n7UazzeisLisHi4J+Iloo7ox9j73+9ksm82 GdvglN69ZB9tnDZjCJx6aurF6+G7bu2RJ+eMxaofp/PpJrL4SF2gbJc8Jsc4Z8fHi/gK OA5zXm6gMBV1qPMDS5bnphhxG1FV9v9cwuApon57R3dzcTxa80e/Z5x4qf3JK7h5pdOx vtQlXkbAdYH3qmY1OIBvTfmwJ5Ep8oOFmhfRntLYPmdvVwUGDJAGzFq/akq/Q76BX6hu /xS2v51bRZ2qQLiF/I4UQf7roav2LRJKdbpDMy4RyrmPpzhEsL/lekiIzwir1h9+JbWa GUUw== 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=XEut1UMhrG6ASOihp4zgXf+IYkJXdzA6bMYQWi2nPwE=; b=ENoX1Ocgk7zgMRch0ISzsh7sPHX04b6p9ei1LH6j2Bnl7CSn0Y8wjq0rv7nvooeOPU 2dpVJcLrNpwaDM4xFX6FaAAoEGKHguyb5a2qjZhSfYRzgAM2BEbCr2ih4sAejKAfv60F 3QLod8eQXKWdRrg24cmLCCQ3tf250FxTCJ6qQg3TQEFH8kOh2TlrbedgP+JSA2HDX81z Iy/30OiOkj/RYd9RYeutB4o/5uB5ok1KRMYaQLxRXMuP5dGOFZuNI5likmknAONQiR+w HmLXRNxfeBdDXOPiEMaqg2hZjy5mEO/H4pNphScpi5CDzHd+IbBuyZIjdWG56JGOMFCH Xp/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UDFTP9gO; 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 cb17si8645885edb.276.2021.07.15.14.13.30; Thu, 15 Jul 2021 14:13:53 -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=UDFTP9gO; 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 S1345279AbhGOTbA (ORCPT + 99 others); Thu, 15 Jul 2021 15:31:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:46400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243223AbhGOTJa (ORCPT ); Thu, 15 Jul 2021 15:09:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96608613CF; Thu, 15 Jul 2021 19:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375914; bh=MWXuWisZncxrhW+Gof0/n2Fystbk7rolGH5RF9Kpt5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UDFTP9gOtImTFtAFxDwDtmenZQR4QDWc2rg83DrkK2R2UEZsuDMaMv8b9uAHGxAD0 Xu30cfjlyovMwbJSfFa3izPf6Pb+31fIkIKZfDDBa/D0JigCpp3DllkIP0tvE3+lKl K5sxxHE3KZmImu2NtAl/lR7CNC4scCPJVNRcMI3I= 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.13 047/266] net/mlx5: Fix lag port remapping logic Date: Thu, 15 Jul 2021 20:36:42 +0200 Message-Id: <20210715182622.557848570@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 b8748390335f..9ce144ef8326 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