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
9struct mlx5e_tc_int_port;
10struct mlx5e_tc_int_port_priv;
11
12enum 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)
18bool mlx5e_tc_int_port_supported(const struct mlx5_eswitch *esw);
19
20struct mlx5e_tc_int_port_priv *
21mlx5e_tc_int_port_init(struct mlx5e_priv *priv);
22void
23mlx5e_tc_int_port_cleanup(struct mlx5e_tc_int_port_priv *priv);
24
25void mlx5e_tc_int_port_init_rep_rx(struct mlx5e_priv *priv);
26void mlx5e_tc_int_port_cleanup_rep_rx(struct mlx5e_priv *priv);
27
28bool
29mlx5e_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);
32struct mlx5e_tc_int_port *
33mlx5e_tc_int_port_get(struct mlx5e_tc_int_port_priv *priv,
34 int ifindex,
35 enum mlx5e_tc_int_port_type type);
36void
37mlx5e_tc_int_port_put(struct mlx5e_tc_int_port_priv *priv,
38 struct mlx5e_tc_int_port *int_port);
39
40u32 mlx5e_tc_int_port_get_metadata(struct mlx5e_tc_int_port *int_port);
41u32 mlx5e_tc_int_port_get_metadata_for_match(struct mlx5e_tc_int_port *int_port);
42int mlx5e_tc_int_port_get_flow_source(struct mlx5e_tc_int_port *int_port);
43#else /* CONFIG_MLX5_CLS_ACT */
44static inline u32
45mlx5e_tc_int_port_get_metadata_for_match(struct mlx5e_tc_int_port *int_port)
46{
47 return 0;
48}
49
50static inline int
51mlx5e_tc_int_port_get_flow_source(struct mlx5e_tc_int_port *int_port)
52{
53 return 0;
54}
55
56static inline bool mlx5e_tc_int_port_supported(const struct mlx5_eswitch *esw)
57{
58 return false;
59}
60
61static inline void mlx5e_tc_int_port_init_rep_rx(struct mlx5e_priv *priv) {}
62static 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

source code of linux/drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.h