cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

smfs.c (1650B)


      1// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
      2/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
      3
      4#include <linux/kernel.h>
      5#include <linux/mlx5/driver.h>
      6
      7#include "smfs.h"
      8
      9struct mlx5dr_matcher *
     10mlx5_smfs_matcher_create(struct mlx5dr_table *table, u32 priority, struct mlx5_flow_spec *spec)
     11{
     12	struct mlx5dr_match_parameters matcher_mask = {};
     13
     14	matcher_mask.match_buf = (u64 *)&spec->match_criteria;
     15	matcher_mask.match_sz = DR_SZ_MATCH_PARAM;
     16
     17	return mlx5dr_matcher_create(table, priority, spec->match_criteria_enable, &matcher_mask);
     18}
     19
     20void
     21mlx5_smfs_matcher_destroy(struct mlx5dr_matcher *matcher)
     22{
     23	mlx5dr_matcher_destroy(matcher);
     24}
     25
     26struct mlx5dr_table *
     27mlx5_smfs_table_get_from_fs_ft(struct mlx5_flow_table *ft)
     28{
     29	return mlx5dr_table_get_from_fs_ft(ft);
     30}
     31
     32struct mlx5dr_action *
     33mlx5_smfs_action_create_dest_table(struct mlx5dr_table *table)
     34{
     35	return mlx5dr_action_create_dest_table(table);
     36}
     37
     38struct mlx5dr_action *
     39mlx5_smfs_action_create_flow_counter(u32 counter_id)
     40{
     41	return mlx5dr_action_create_flow_counter(counter_id);
     42}
     43
     44void
     45mlx5_smfs_action_destroy(struct mlx5dr_action *action)
     46{
     47	mlx5dr_action_destroy(action);
     48}
     49
     50struct mlx5dr_rule *
     51mlx5_smfs_rule_create(struct mlx5dr_matcher *matcher, struct mlx5_flow_spec *spec,
     52		      size_t num_actions, struct mlx5dr_action *actions[],
     53		      u32 flow_source)
     54{
     55	struct mlx5dr_match_parameters value = {};
     56
     57	value.match_buf = (u64 *)spec->match_value;
     58	value.match_sz = DR_SZ_MATCH_PARAM;
     59
     60	return mlx5dr_rule_create(matcher, &value, num_actions, actions, flow_source);
     61}
     62
     63void
     64mlx5_smfs_rule_destroy(struct mlx5dr_rule *rule)
     65{
     66	mlx5dr_rule_destroy(rule);
     67}
     68