Skip to content

Commit 48eb74e

Browse files
mosheshemesh2kuba-moo
authored andcommitted
net/mlx5: fs, move steering common function to fs_cmd.h
As preparation for HW steering support in fs core level, move SW steering helper function that can be reused by HW steering to fs_cmd.h. The function mlx5_fs_cmd_is_fw_term_table() checks if a flow table is a flow steering termination table and so should be handled by FW steering. Reviewed-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Moshe Shemesh <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3f4c38d commit 48eb74e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,12 @@ const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void);
124124

125125
int mlx5_fs_cmd_set_l2table_entry_silent(struct mlx5_core_dev *dev, u8 silent_mode);
126126
int mlx5_fs_cmd_set_tx_flow_table_root(struct mlx5_core_dev *dev, u32 ft_id, bool disconnect);
127+
128+
static inline bool mlx5_fs_cmd_is_fw_term_table(struct mlx5_flow_table *ft)
129+
{
130+
if (ft->flags & MLX5_FLOW_TABLE_TERMINATION)
131+
return true;
132+
133+
return false;
134+
}
127135
#endif

drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
#include "fs_dr.h"
1010
#include "dr_types.h"
1111

12-
static bool dr_is_fw_term_table(struct mlx5_flow_table *ft)
13-
{
14-
if (ft->flags & MLX5_FLOW_TABLE_TERMINATION)
15-
return true;
16-
17-
return false;
18-
}
19-
2012
static int mlx5_cmd_dr_update_root_ft(struct mlx5_flow_root_namespace *ns,
2113
struct mlx5_flow_table *ft,
2214
u32 underlay_qpn,
@@ -70,7 +62,7 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns,
7062
u32 flags;
7163
int err;
7264

73-
if (dr_is_fw_term_table(ft))
65+
if (mlx5_fs_cmd_is_fw_term_table(ft))
7466
return mlx5_fs_cmd_get_fw_cmds()->create_flow_table(ns, ft,
7567
ft_attr,
7668
next_ft);
@@ -110,7 +102,7 @@ static int mlx5_cmd_dr_destroy_flow_table(struct mlx5_flow_root_namespace *ns,
110102
struct mlx5dr_action *action = ft->fs_dr_table.miss_action;
111103
int err;
112104

113-
if (dr_is_fw_term_table(ft))
105+
if (mlx5_fs_cmd_is_fw_term_table(ft))
114106
return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_table(ns, ft);
115107

116108
err = mlx5dr_table_destroy(ft->fs_dr_table.dr_table);
@@ -135,7 +127,7 @@ static int mlx5_cmd_dr_modify_flow_table(struct mlx5_flow_root_namespace *ns,
135127
struct mlx5_flow_table *ft,
136128
struct mlx5_flow_table *next_ft)
137129
{
138-
if (dr_is_fw_term_table(ft))
130+
if (mlx5_fs_cmd_is_fw_term_table(ft))
139131
return mlx5_fs_cmd_get_fw_cmds()->modify_flow_table(ns, ft, next_ft);
140132

141133
return set_miss_action(ns, ft, next_ft);
@@ -154,7 +146,7 @@ static int mlx5_cmd_dr_create_flow_group(struct mlx5_flow_root_namespace *ns,
154146
match_criteria_enable);
155147
struct mlx5dr_match_parameters mask;
156148

157-
if (dr_is_fw_term_table(ft))
149+
if (mlx5_fs_cmd_is_fw_term_table(ft))
158150
return mlx5_fs_cmd_get_fw_cmds()->create_flow_group(ns, ft, in,
159151
fg);
160152

@@ -179,7 +171,7 @@ static int mlx5_cmd_dr_destroy_flow_group(struct mlx5_flow_root_namespace *ns,
179171
struct mlx5_flow_table *ft,
180172
struct mlx5_flow_group *fg)
181173
{
182-
if (dr_is_fw_term_table(ft))
174+
if (mlx5_fs_cmd_is_fw_term_table(ft))
183175
return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_group(ns, ft, fg);
184176

185177
return mlx5dr_matcher_destroy(fg->fs_dr_matcher.dr_matcher);
@@ -279,7 +271,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
279271
int err = 0;
280272
int i;
281273

282-
if (dr_is_fw_term_table(ft))
274+
if (mlx5_fs_cmd_is_fw_term_table(ft))
283275
return mlx5_fs_cmd_get_fw_cmds()->create_fte(ns, ft, group, fte);
284276

285277
actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, sizeof(*actions),
@@ -740,7 +732,7 @@ static int mlx5_cmd_dr_delete_fte(struct mlx5_flow_root_namespace *ns,
740732
int err;
741733
int i;
742734

743-
if (dr_is_fw_term_table(ft))
735+
if (mlx5_fs_cmd_is_fw_term_table(ft))
744736
return mlx5_fs_cmd_get_fw_cmds()->delete_fte(ns, ft, fte);
745737

746738
err = mlx5dr_rule_destroy(rule->dr_rule);
@@ -765,7 +757,7 @@ static int mlx5_cmd_dr_update_fte(struct mlx5_flow_root_namespace *ns,
765757
struct fs_fte fte_tmp = {};
766758
int ret;
767759

768-
if (dr_is_fw_term_table(ft))
760+
if (mlx5_fs_cmd_is_fw_term_table(ft))
769761
return mlx5_fs_cmd_get_fw_cmds()->update_fte(ns, ft, group, modify_mask, fte);
770762

771763
/* Backup current dr rule details */

0 commit comments

Comments
 (0)