Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1641749pxy; Mon, 2 Aug 2021 06:55:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsP8vxeDwQa3OSdu4vGYkGN53n76UdiJgZb1aMoUEwOkb6q6jCydWh92uqBTAlDJJrc+7W X-Received: by 2002:a05:6602:3423:: with SMTP id n35mr911149ioz.188.1627912516880; Mon, 02 Aug 2021 06:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912516; cv=none; d=google.com; s=arc-20160816; b=Uvmh0TP0BiROoFQhMPh9bsk2IsmIanJ0Io1lvHEgTZP+Q92MvRJ4olZNZPBzqxg35J r8FbVt/UO2m74E7OcsV0yAws5QGDkPQsU+W1VKLBYSSsUZwO3tCPkPx76JH/V3dKlIka +RGCI7E4Fi1JXLcOfWvSeud2vmszCwYkZ/dUIsVt9OJClWq4ryge87rEu5Uqg29x730m h1FL64s+CfbtEOGbtgZoNM5KfL42DS8spWuRVjHC8KToAgOKBQEKuHBsKylttpwx6wtt 2Hf21XQcWk/Nb79OK001VafhGjwVoPxx2c+WSDA5/eLDDdFaSHuNQ27TXTAr7aFYYg17 ml1Q== 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=Nhj7xcnT58RG3Pcr+9jZAiJn/DDIEaO0ed5pdGX8c6E=; b=X2Kgq+nGbwuIgUQ7MD3JufQq8c3bvLnOqSiPnLVBevMY7QuS9U6XX9lCRnVbgzR9WY rEtMh8Um8YAeoJg1AGf8haPVh4bbcbO5kQqouY0u8wUTe0u7yNLW4mHhZNZMut9hmKmr QaHIggNtFAOyzKyvRiM7WlcHPBvwG6bpOrux6dCwBBzzQmnUD8whSRmLh81wjue/D5Xe rJWNyoOPVU7sk7+qREUX+R6Illuo0JOxw1YWN/O3USn+8QwPbhRxpLvo95VINsIJAuYc aYOTcL++EFD9g0Zz1TdcaXRkGch5Z23HbSePtnHy88ItyT6A9is1Azs/+Cb55L635nfI 8NsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=krt4wj2V; 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 t15si11958349ilg.47.2021.08.02.06.55.05; Mon, 02 Aug 2021 06:55:16 -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=krt4wj2V; 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 S234832AbhHBNxt (ORCPT + 99 others); Mon, 2 Aug 2021 09:53:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:60588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234876AbhHBNtY (ORCPT ); Mon, 2 Aug 2021 09:49:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E4A6460555; Mon, 2 Aug 2021 13:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912154; bh=cF4fEoWq1Nz4oVHakRcKWLKvGGd2+TX3ZMZARCe9jkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krt4wj2VZ97AYeHGzRlF6qjzISOlbmciVZINLR1/yGVARDYJMatwrb1zLONyLTOmj /I1gUbbAVRCWq99vl51B61sbFxu49KeWp0N5VsZM7bZc7ykxuC091PTtYsDhR3/QP9 vg8jdgHdOKDYpvPbghrYjsFGlcq22qKVkycjihr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maor Gottlieb , Mark Bloch , Saeed Mahameed , Sasha Levin Subject: [PATCH 4.14 33/38] net/mlx5: Fix flow table chaining Date: Mon, 2 Aug 2021 15:44:55 +0200 Message-Id: <20210802134335.873445918@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134334.835358048@linuxfoundation.org> References: <20210802134334.835358048@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: Maor Gottlieb [ Upstream commit 8b54874ef1617185048029a3083d510569e93751 ] Fix a bug when flow table is created in priority that already has other flow tables as shown in the below diagram. If the new flow table (FT-B) has the lowest level in the priority, we need to connect the flow tables from the previous priority (p0) to this new table. In addition when this flow table is destroyed (FT-B), we need to connect the flow tables from the previous priority (p0) to the next level flow table (FT-C) in the same priority of the destroyed table (if exists). --------- |root_ns| --------- | -------------------------------- | | | ---------- ---------- --------- |p(prio)-x| | p-y | | p-n | ---------- ---------- --------- | | ---------------- ------------------ |ns(e.g bypass)| |ns(e.g. kernel) | ---------------- ------------------ | | | ------- ------ ---- | p0 | | p1 | |p2| ------- ------ ---- | | \ -------- ------- ------ | FT-A | |FT-B | |FT-C| -------- ------- ------ Fixes: f90edfd279f3 ("net/mlx5_core: Connect flow tables") Signed-off-by: Maor Gottlieb Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 24d1b0be5a68..24f70c337d8f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -795,17 +795,19 @@ static int connect_fwd_rules(struct mlx5_core_dev *dev, static int connect_flow_table(struct mlx5_core_dev *dev, struct mlx5_flow_table *ft, struct fs_prio *prio) { - struct mlx5_flow_table *next_ft; + struct mlx5_flow_table *next_ft, *first_ft; int err = 0; /* Connect_prev_fts and update_root_ft_create are mutually exclusive */ - if (list_empty(&prio->node.children)) { + first_ft = list_first_entry_or_null(&prio->node.children, + struct mlx5_flow_table, node.list); + if (!first_ft || first_ft->level > ft->level) { err = connect_prev_fts(dev, ft, prio); if (err) return err; - next_ft = find_next_chained_ft(prio); + next_ft = first_ft ? first_ft : find_next_chained_ft(prio); err = connect_fwd_rules(dev, ft, next_ft); if (err) return err; @@ -1703,7 +1705,7 @@ static int disconnect_flow_table(struct mlx5_flow_table *ft) node.list) == ft)) return 0; - next_ft = find_next_chained_ft(prio); + next_ft = find_next_ft(ft); err = connect_fwd_rules(dev, next_ft, ft); if (err) return err; -- 2.30.2