提交 8a63fc8c 编写于 作者: M Maor Gottlieb 提交者: Yang Yingliang

net/mlx5: Fix flow table chaining

stable inclusion
from linux-4.19.201
commit 2a7b6a5203b6f80c35fcd66c995201cb54f4178f

--------------------------------

[ Upstream commit 8b54874e ]

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: f90edfd2 ("net/mlx5_core: Connect flow tables")
Signed-off-by: NMaor Gottlieb <maorg@nvidia.com>
Reviewed-by: NMark Bloch <mbloch@nvidia.com>
Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 461534a9
...@@ -904,17 +904,19 @@ static int connect_fwd_rules(struct mlx5_core_dev *dev, ...@@ -904,17 +904,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, static int connect_flow_table(struct mlx5_core_dev *dev, struct mlx5_flow_table *ft,
struct fs_prio *prio) struct fs_prio *prio)
{ {
struct mlx5_flow_table *next_ft; struct mlx5_flow_table *next_ft, *first_ft;
int err = 0; int err = 0;
/* Connect_prev_fts and update_root_ft_create are mutually exclusive */ /* 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); err = connect_prev_fts(dev, ft, prio);
if (err) if (err)
return 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); err = connect_fwd_rules(dev, ft, next_ft);
if (err) if (err)
return err; return err;
...@@ -1945,7 +1947,7 @@ static int disconnect_flow_table(struct mlx5_flow_table *ft) ...@@ -1945,7 +1947,7 @@ static int disconnect_flow_table(struct mlx5_flow_table *ft)
node.list) == ft)) node.list) == ft))
return 0; return 0;
next_ft = find_next_chained_ft(prio); next_ft = find_next_ft(ft);
err = connect_fwd_rules(dev, next_ft, ft); err = connect_fwd_rules(dev, next_ft, ft);
if (err) if (err)
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册