Skip to content

Commit 59f8f7c

Browse files
Maor GottliebSaeed Mahameed
authored andcommitted
net/mlx5: Fix forward to next namespace
The steering tree is as follow (nic RX as example): --------- |root_ns| --------- | -------------------------------- | | | ---------- ---------- --------- |p(prio)0| | p1 | | pn | ---------- ---------- --------- | | ---------------- --------------- |ns(e.g bypass)| |ns(e.g. lag) | ---------------- --------------- | | | ---- ---- ---- |p0| |p1| |pn| ---- ---- ---- | ---- |FT| ---- find_next_chained_ft(prio) returns the first flow table in the next priority. If prio is a parent of a flow table then it returns the first flow table in the next priority in the same namespace, else if prio is parent of namespace, then it should return the first flow table in the next namespace. Currently if the user requests to forward to next namespace, the code calls to find_next_chained_ft with the prio of the next namespace and not the prio of the namesapce itself. Fixes: 9254f8e ("net/mlx5: Add support in forward to namespace") Signed-off-by: Maor Gottlieb <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 0c2600c commit 59f8f7c

File tree

1 file changed

+5
-23
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+5
-23
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ static struct mlx5_flow_table *find_closest_ft_recursive(struct fs_node *root,
797797
return ft;
798798
}
799799

800-
/* If reverse if false then return the first flow table in next priority of
800+
/* If reverse is false then return the first flow table in next priority of
801801
* prio in the tree, else return the last flow table in the previous priority
802802
* of prio in the tree.
803803
*/
@@ -829,34 +829,16 @@ static struct mlx5_flow_table *find_prev_chained_ft(struct fs_prio *prio)
829829
return find_closest_ft(prio, true);
830830
}
831831

832-
static struct fs_prio *find_fwd_ns_prio(struct mlx5_flow_root_namespace *root,
833-
struct mlx5_flow_namespace *ns)
834-
{
835-
struct mlx5_flow_namespace *root_ns = &root->ns;
836-
struct fs_prio *iter_prio;
837-
struct fs_prio *prio;
838-
839-
fs_get_obj(prio, ns->node.parent);
840-
list_for_each_entry(iter_prio, &root_ns->node.children, node.list) {
841-
if (iter_prio == prio &&
842-
!list_is_last(&prio->node.children, &iter_prio->node.list))
843-
return list_next_entry(iter_prio, node.list);
844-
}
845-
return NULL;
846-
}
847-
848832
static struct mlx5_flow_table *find_next_fwd_ft(struct mlx5_flow_table *ft,
849833
struct mlx5_flow_act *flow_act)
850834
{
851-
struct mlx5_flow_root_namespace *root = find_root(&ft->node);
852835
struct fs_prio *prio;
836+
bool next_ns;
853837

854-
if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS)
855-
prio = find_fwd_ns_prio(root, ft->ns);
856-
else
857-
fs_get_obj(prio, ft->node.parent);
838+
next_ns = flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS;
839+
fs_get_obj(prio, next_ns ? ft->ns->node.parent : ft->node.parent);
858840

859-
return (prio) ? find_next_chained_ft(prio) : NULL;
841+
return find_next_chained_ft(prio);
860842
}
861843

862844
static int connect_fts_in_prio(struct mlx5_core_dev *dev,

0 commit comments

Comments
 (0)