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_INT_PORT_H__ |
5 | #define __MLX5_EN_TC_INT_PORT_H__ |
6 | |
7 | #include "en.h" |
8 | |
9 | struct mlx5e_tc_int_port; |
10 | struct mlx5e_tc_int_port_priv; |
11 | |
12 | enum mlx5e_tc_int_port_type { |
13 | MLX5E_TC_INT_PORT_INGRESS, |
14 | MLX5E_TC_INT_PORT_EGRESS, |
15 | }; |
16 | |
17 | #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) |
18 | bool mlx5e_tc_int_port_supported(const struct mlx5_eswitch *esw); |
19 | |
20 | struct mlx5e_tc_int_port_priv * |
21 | mlx5e_tc_int_port_init(struct mlx5e_priv *priv); |
22 | void |
23 | mlx5e_tc_int_port_cleanup(struct mlx5e_tc_int_port_priv *priv); |
24 | |
25 | void mlx5e_tc_int_port_init_rep_rx(struct mlx5e_priv *priv); |
26 | void mlx5e_tc_int_port_cleanup_rep_rx(struct mlx5e_priv *priv); |
27 | |
28 | bool |
29 | mlx5e_tc_int_port_dev_fwd(struct mlx5e_tc_int_port_priv *priv, |
30 | struct sk_buff *skb, u32 int_vport_metadata, |
31 | bool *forward_tx); |
32 | struct mlx5e_tc_int_port * |
33 | mlx5e_tc_int_port_get(struct mlx5e_tc_int_port_priv *priv, |
34 | int ifindex, |
35 | enum mlx5e_tc_int_port_type type); |
36 | void |
37 | mlx5e_tc_int_port_put(struct mlx5e_tc_int_port_priv *priv, |
38 | struct mlx5e_tc_int_port *int_port); |
39 | |
40 | u32 mlx5e_tc_int_port_get_metadata(struct mlx5e_tc_int_port *int_port); |
41 | u32 mlx5e_tc_int_port_get_metadata_for_match(struct mlx5e_tc_int_port *int_port); |
42 | int mlx5e_tc_int_port_get_flow_source(struct mlx5e_tc_int_port *int_port); |
43 | #else /* CONFIG_MLX5_CLS_ACT */ |
44 | static inline u32 |
45 | mlx5e_tc_int_port_get_metadata_for_match(struct mlx5e_tc_int_port *int_port) |
46 | { |
47 | return 0; |
48 | } |
49 | |
50 | static inline int |
51 | mlx5e_tc_int_port_get_flow_source(struct mlx5e_tc_int_port *int_port) |
52 | { |
53 | return 0; |
54 | } |
55 | |
56 | static inline bool mlx5e_tc_int_port_supported(const struct mlx5_eswitch *esw) |
57 | { |
58 | return false; |
59 | } |
60 | |
61 | static inline void mlx5e_tc_int_port_init_rep_rx(struct mlx5e_priv *priv) {} |
62 | static inline void mlx5e_tc_int_port_cleanup_rep_rx(struct mlx5e_priv *priv) {} |
63 | |
64 | #endif /* CONFIG_MLX5_CLS_ACT */ |
65 | #endif /* __MLX5_EN_TC_INT_PORT_H__ */ |
66 | |