Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1639932pxy; Mon, 2 Aug 2021 06:52:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmjIBm0dZWILmSjQuSFJ0hOvUbYs7kQqBHSBaTufE+nQoU/OX5l7h36/XyPR40HK60uuCR X-Received: by 2002:a92:6605:: with SMTP id a5mr1182043ilc.15.1627912338492; Mon, 02 Aug 2021 06:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912338; cv=none; d=google.com; s=arc-20160816; b=vVTgHA3hAW/ZBSJd0AHLmQCFXDD/hE9rarTdZ6UhVr8CmcoJ8ggVhQnCfgCmavkGFJ GQ713oJGEB5H1Oq+wvD7DdW3EbGA1vQHX38SBIY+mAlnlL+CezQMNACTeAOm21J62JMh HD6bkZ8vYer5FROoWILL56xtLNQ5/eDmOpDmrSxew+bhdCjS5u7N9fiWURQLV5eA2Ilz A3aWwC43jrzh8GCUbkXQewcu8rom4b3t2hNdev0IDX5yzJpugmbTDaMriAxQWuOSkZNL iVxiyZ8bJ7d5+BcUy8ip+38VfDxkyfn9FUWJEe0bi5KhfO8VjeIX32rBJby2KfDVTM3n pHXQ== 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=mCF1GQqZ8DBIDETFlmoI+Eo7aKCMab84GllFE3o0Nek=; b=c/JsJB7Q1IboTZsBiHCntAw5JvIh2x8NY6wE0uu3L8/9RfK2vGYyYHIkPu12nP4DVQ CIz1V0jBoONtetzPMnC1WIPmT86EjJX00cHMTYVY6v/GYr119e7Da0lbfm8Ahg/ukiuU XFedvJ/4dfh6y3nE22LaV1U/F5MUVvjZedgsTF2ZTw2WJex/G4/1O94KK2p4D/4m0OfL /tmXoxagbTLg3JEcYza5qAVbuBkYlcP6YCdehmNNtFjsqls13XoFF9QhJrId3Z8deTp0 3NEVIZoeA4wk5RHRTojkv+rK/BUtodDswhoRMST5FkBbyE+Zg+PS7uzDbrmQrbn67zPy +FkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PhKkN+do; 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 m9si12551679jaj.89.2021.08.02.06.52.04; Mon, 02 Aug 2021 06:52:18 -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=PhKkN+do; 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 S234897AbhHBNu0 (ORCPT + 99 others); Mon, 2 Aug 2021 09:50:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:57866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233981AbhHBNru (ORCPT ); Mon, 2 Aug 2021 09:47:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DD0C60EBB; Mon, 2 Aug 2021 13:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912061; bh=8rQU6Md/G+S09rLoycAvv8ctRbjJG4KppAwij9NlqZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhKkN+doLXO/riycJjzfFM11/0CWBPQU4tDohW7I4soqUFUa974p0mW/ei3eDFDnP jkoQgyH1hxPfl+cww/XLcfkJHU/HA4w4+K0pLYmfSl5YxOFu0NhmxjY0JHzVq9X6U9 wdZzPPv3pU7od+L7yEC0aoueDQBmNxI6oRZIWD+0= 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.9 30/32] net/mlx5: Fix flow table chaining Date: Mon, 2 Aug 2021 15:44:50 +0200 Message-Id: <20210802134333.878761456@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134332.931915241@linuxfoundation.org> References: <20210802134332.931915241@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 13dfc197bdd8..6c092dc41c82 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -701,17 +701,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; @@ -1357,7 +1359,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