0001
0002
0003
0004 #include <linux/kernel.h>
0005 #include <linux/mlx5/driver.h>
0006
0007 #include "smfs.h"
0008
0009 struct mlx5dr_matcher *
0010 mlx5_smfs_matcher_create(struct mlx5dr_table *table, u32 priority, struct mlx5_flow_spec *spec)
0011 {
0012 struct mlx5dr_match_parameters matcher_mask = {};
0013
0014 matcher_mask.match_buf = (u64 *)&spec->match_criteria;
0015 matcher_mask.match_sz = DR_SZ_MATCH_PARAM;
0016
0017 return mlx5dr_matcher_create(table, priority, spec->match_criteria_enable, &matcher_mask);
0018 }
0019
0020 void
0021 mlx5_smfs_matcher_destroy(struct mlx5dr_matcher *matcher)
0022 {
0023 mlx5dr_matcher_destroy(matcher);
0024 }
0025
0026 struct mlx5dr_table *
0027 mlx5_smfs_table_get_from_fs_ft(struct mlx5_flow_table *ft)
0028 {
0029 return mlx5dr_table_get_from_fs_ft(ft);
0030 }
0031
0032 struct mlx5dr_action *
0033 mlx5_smfs_action_create_dest_table(struct mlx5dr_table *table)
0034 {
0035 return mlx5dr_action_create_dest_table(table);
0036 }
0037
0038 struct mlx5dr_action *
0039 mlx5_smfs_action_create_flow_counter(u32 counter_id)
0040 {
0041 return mlx5dr_action_create_flow_counter(counter_id);
0042 }
0043
0044 void
0045 mlx5_smfs_action_destroy(struct mlx5dr_action *action)
0046 {
0047 mlx5dr_action_destroy(action);
0048 }
0049
0050 struct mlx5dr_rule *
0051 mlx5_smfs_rule_create(struct mlx5dr_matcher *matcher, struct mlx5_flow_spec *spec,
0052 size_t num_actions, struct mlx5dr_action *actions[],
0053 u32 flow_source)
0054 {
0055 struct mlx5dr_match_parameters value = {};
0056
0057 value.match_buf = (u64 *)spec->match_value;
0058 value.match_sz = DR_SZ_MATCH_PARAM;
0059
0060 return mlx5dr_rule_create(matcher, &value, num_actions, actions, flow_source);
0061 }
0062
0063 void
0064 mlx5_smfs_rule_destroy(struct mlx5dr_rule *rule)
0065 {
0066 mlx5dr_rule_destroy(rule);
0067 }
0068