• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2017-2018 Mellanox Technologies. All rights reserved */
3 
4 #ifndef _MLXSW_CORE_ACL_FLEX_ACTIONS_H
5 #define _MLXSW_CORE_ACL_FLEX_ACTIONS_H
6 
7 #include <linux/types.h>
8 #include <linux/netdevice.h>
9 
10 struct mlxsw_afa;
11 struct mlxsw_afa_block;
12 
13 struct mlxsw_afa_ops {
14 	int (*kvdl_set_add)(void *priv, u32 *p_kvdl_index,
15 			    char *enc_actions, bool is_first);
16 	void (*kvdl_set_del)(void *priv, u32 kvdl_index, bool is_first);
17 	int (*kvdl_set_activity_get)(void *priv, u32 kvdl_index,
18 				     bool *activity);
19 	int (*kvdl_fwd_entry_add)(void *priv, u32 *p_kvdl_index, u8 local_port);
20 	void (*kvdl_fwd_entry_del)(void *priv, u32 kvdl_index);
21 	int (*counter_index_get)(void *priv, unsigned int *p_counter_index);
22 	void (*counter_index_put)(void *priv, unsigned int counter_index);
23 	int (*mirror_add)(void *priv, u8 local_in_port,
24 			  const struct net_device *out_dev,
25 			  bool ingress, int *p_span_id);
26 	void (*mirror_del)(void *priv, u8 local_in_port, int span_id,
27 			   bool ingress);
28 	bool dummy_first_set;
29 };
30 
31 struct mlxsw_afa *mlxsw_afa_create(unsigned int max_acts_per_set,
32 				   const struct mlxsw_afa_ops *ops,
33 				   void *ops_priv);
34 void mlxsw_afa_destroy(struct mlxsw_afa *mlxsw_afa);
35 struct mlxsw_afa_block *mlxsw_afa_block_create(struct mlxsw_afa *mlxsw_afa);
36 void mlxsw_afa_block_destroy(struct mlxsw_afa_block *block);
37 int mlxsw_afa_block_commit(struct mlxsw_afa_block *block);
38 char *mlxsw_afa_block_first_set(struct mlxsw_afa_block *block);
39 char *mlxsw_afa_block_cur_set(struct mlxsw_afa_block *block);
40 u32 mlxsw_afa_block_first_kvdl_index(struct mlxsw_afa_block *block);
41 int mlxsw_afa_block_activity_get(struct mlxsw_afa_block *block, bool *activity);
42 int mlxsw_afa_block_continue(struct mlxsw_afa_block *block);
43 int mlxsw_afa_block_jump(struct mlxsw_afa_block *block, u16 group_id);
44 int mlxsw_afa_block_terminate(struct mlxsw_afa_block *block);
45 int mlxsw_afa_block_append_drop(struct mlxsw_afa_block *block);
46 int mlxsw_afa_block_append_trap(struct mlxsw_afa_block *block, u16 trap_id);
47 int mlxsw_afa_block_append_trap_and_forward(struct mlxsw_afa_block *block,
48 					    u16 trap_id);
49 int mlxsw_afa_block_append_mirror(struct mlxsw_afa_block *block,
50 				  u8 local_in_port,
51 				  const struct net_device *out_dev,
52 				  bool ingress,
53 				  struct netlink_ext_ack *extack);
54 int mlxsw_afa_block_append_fwd(struct mlxsw_afa_block *block,
55 			       u8 local_port, bool in_port,
56 			       struct netlink_ext_ack *extack);
57 int mlxsw_afa_block_append_vlan_modify(struct mlxsw_afa_block *block,
58 				       u16 vid, u8 pcp, u8 et,
59 				       struct netlink_ext_ack *extack);
60 int mlxsw_afa_block_append_allocated_counter(struct mlxsw_afa_block *block,
61 					     u32 counter_index);
62 int mlxsw_afa_block_append_counter(struct mlxsw_afa_block *block,
63 				   u32 *p_counter_index,
64 				   struct netlink_ext_ack *extack);
65 int mlxsw_afa_block_append_fid_set(struct mlxsw_afa_block *block, u16 fid,
66 				   struct netlink_ext_ack *extack);
67 int mlxsw_afa_block_append_mcrouter(struct mlxsw_afa_block *block,
68 				    u16 expected_irif, u16 min_mtu,
69 				    bool rmid_valid, u32 kvdl_index);
70 
71 #endif
72