File Index
Files and directories
Sign in
FILE

act.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h C
  1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
  3
  4#ifndef __MLX5_EN_TC_ACT_H__
  5#define __MLX5_EN_TC_ACT_H__
  6
  7#include <net/tc_act/tc_pedit.h>
  8#include <net/flow_offload.h>
  9#include <linux/netlink.h>
 10#include "eswitch.h"
 11#include "pedit.h"
 12
 13struct mlx5_flow_attr;
 14
 15struct mlx5e_tc_act_parse_state {
 16	struct flow_action *flow_action;
 17	struct mlx5e_tc_flow *flow;
 18	struct netlink_ext_ack *extack;
 19	u32 actions;
 20	bool encap;
 21	bool decap;
 22	bool mpls_push;
 23	bool eth_push;
 24	bool eth_pop;
 25	bool ptype_host;
 26	const struct ip_tunnel_info *tun_info;
 27	struct mlx5e_mpls_info mpls_info;
 28	int ifindexes[MLX5_MAX_FLOW_FWD_VPORTS];
 29	int if_count;
 30	struct mlx5_tc_ct_priv *ct_priv;
 31};
 32
 33struct mlx5e_tc_act_branch_ctrl {
 34	enum flow_action_id act_id;
 35	u32 extval;
 36};
 37
 38struct mlx5e_tc_act {
 39	bool (*can_offload)(struct mlx5e_tc_act_parse_state *parse_state,
 40			    const struct flow_action_entry *act,
 41			    int act_index,
 42			    struct mlx5_flow_attr *attr);
 43
 44	int (*parse_action)(struct mlx5e_tc_act_parse_state *parse_state,
 45			    const struct flow_action_entry *act,
 46			    struct mlx5e_priv *priv,
 47			    struct mlx5_flow_attr *attr);
 48
 49	int (*post_parse)(struct mlx5e_tc_act_parse_state *parse_state,
 50			  struct mlx5e_priv *priv,
 51			  struct mlx5_flow_attr *attr);
 52
 53	bool (*is_multi_table_act)(struct mlx5e_priv *priv,
 54				   const struct flow_action_entry *act,
 55				   struct mlx5_flow_attr *attr);
 56
 57	bool (*is_missable)(const struct flow_action_entry *act);
 58
 59	int (*offload_action)(struct mlx5e_priv *priv,
 60			      struct flow_offload_action *fl_act,
 61			      struct flow_action_entry *act);
 62
 63	int (*destroy_action)(struct mlx5e_priv *priv,
 64			      struct flow_offload_action *fl_act);
 65
 66	int (*stats_action)(struct mlx5e_priv *priv,
 67			    struct flow_offload_action *fl_act);
 68
 69	bool (*get_branch_ctrl)(const struct flow_action_entry *act,
 70				struct mlx5e_tc_act_branch_ctrl *cond_true,
 71				struct mlx5e_tc_act_branch_ctrl *cond_false);
 72
 73	bool is_terminating_action;
 74};
 75
 76extern struct mlx5e_tc_act mlx5e_tc_act_drop;
 77extern struct mlx5e_tc_act mlx5e_tc_act_trap;
 78extern struct mlx5e_tc_act mlx5e_tc_act_accept;
 79extern struct mlx5e_tc_act mlx5e_tc_act_mark;
 80extern struct mlx5e_tc_act mlx5e_tc_act_goto;
 81extern struct mlx5e_tc_act mlx5e_tc_act_tun_encap;
 82extern struct mlx5e_tc_act mlx5e_tc_act_tun_decap;
 83extern struct mlx5e_tc_act mlx5e_tc_act_csum;
 84extern struct mlx5e_tc_act mlx5e_tc_act_pedit;
 85extern struct mlx5e_tc_act mlx5e_tc_act_vlan;
 86extern struct mlx5e_tc_act mlx5e_tc_act_vlan_mangle;
 87extern struct mlx5e_tc_act mlx5e_tc_act_mpls_push;
 88extern struct mlx5e_tc_act mlx5e_tc_act_mpls_pop;
 89extern struct mlx5e_tc_act mlx5e_tc_act_mirred;
 90extern struct mlx5e_tc_act mlx5e_tc_act_redirect;
 91extern struct mlx5e_tc_act mlx5e_tc_act_mirred_nic;
 92extern struct mlx5e_tc_act mlx5e_tc_act_ct;
 93extern struct mlx5e_tc_act mlx5e_tc_act_sample;
 94extern struct mlx5e_tc_act mlx5e_tc_act_ptype;
 95extern struct mlx5e_tc_act mlx5e_tc_act_redirect_ingress;
 96extern struct mlx5e_tc_act mlx5e_tc_act_police;
 97
 98struct mlx5e_tc_act *
 99mlx5e_tc_act_get(enum flow_action_id act_id,
100		 enum mlx5_flow_namespace_type ns_type);
101
102void
103mlx5e_tc_act_init_parse_state(struct mlx5e_tc_act_parse_state *parse_state,
104			      struct mlx5e_tc_flow *flow,
105			      struct flow_action *flow_action,
106			      struct netlink_ext_ack *extack);
107
108int
109mlx5e_tc_act_post_parse(struct mlx5e_tc_act_parse_state *parse_state,
110			struct flow_action *flow_action, int from, int to,
111			struct mlx5_flow_attr *attr,
112			enum mlx5_flow_namespace_type ns_type);
113
114int
115mlx5e_tc_act_set_next_post_act(struct mlx5e_tc_flow *flow,
116			       struct mlx5_flow_attr *attr,
117			       struct mlx5_flow_attr *next_attr);
118
119#endif /* __MLX5_EN_TC_ACT_H__ */
~/ Read-only file preview.