| 1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
| 2 | /* Copyright (c) 2020 Mellanox Technologies. */ |
| 3 | |
| 4 | #ifndef __MLX5_EN_REP_TC_H__ |
| 5 | #define __MLX5_EN_REP_TC_H__ |
| 6 | |
| 7 | #include <linux/skbuff.h> |
| 8 | #include "en_tc.h" |
| 9 | #include "en_rep.h" |
| 10 | |
| 11 | #if IS_ENABLED(CONFIG_MLX5_CLS_ACT) |
| 12 | |
| 13 | int mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv); |
| 14 | void mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv); |
| 15 | |
| 16 | int mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv); |
| 17 | void mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv); |
| 18 | |
| 19 | void mlx5e_rep_tc_enable(struct mlx5e_priv *priv); |
| 20 | void mlx5e_rep_tc_disable(struct mlx5e_priv *priv); |
| 21 | |
| 22 | int mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv); |
| 23 | |
| 24 | void mlx5e_rep_update_flows(struct mlx5e_priv *priv, |
| 25 | struct mlx5e_encap_entry *e, |
| 26 | bool neigh_connected, |
| 27 | unsigned char ha[ETH_ALEN]); |
| 28 | |
| 29 | int mlx5e_rep_encap_entry_attach(struct mlx5e_priv *priv, |
| 30 | struct mlx5e_encap_entry *e, |
| 31 | struct mlx5e_neigh *m_neigh, |
| 32 | struct net_device *neigh_dev); |
| 33 | void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv, |
| 34 | struct mlx5e_encap_entry *e); |
| 35 | |
| 36 | int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, |
| 37 | void *type_data); |
| 38 | |
| 39 | void mlx5e_rep_tc_receive(struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq, |
| 40 | struct sk_buff *skb); |
| 41 | |
| 42 | #else /* CONFIG_MLX5_CLS_ACT */ |
| 43 | |
| 44 | struct mlx5e_rep_priv; |
| 45 | static inline int |
| 46 | mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv) { return 0; } |
| 47 | static inline void |
| 48 | mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv) {} |
| 49 | |
| 50 | static inline int |
| 51 | mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv) { return 0; } |
| 52 | static inline void |
| 53 | mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv) {} |
| 54 | |
| 55 | static inline void |
| 56 | mlx5e_rep_tc_enable(struct mlx5e_priv *priv) {} |
| 57 | static inline void |
| 58 | mlx5e_rep_tc_disable(struct mlx5e_priv *priv) {} |
| 59 | |
| 60 | static inline int |
| 61 | mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv) { return NOTIFY_DONE; } |
| 62 | |
| 63 | static inline int |
| 64 | mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, |
| 65 | void *type_data) { return -EOPNOTSUPP; } |
| 66 | |
| 67 | static inline void |
| 68 | mlx5e_rep_tc_receive(struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq, |
| 69 | struct sk_buff *skb) { napi_gro_receive(rq->cq.napi, skb); } |
| 70 | |
| 71 | #endif /* CONFIG_MLX5_CLS_ACT */ |
| 72 | |
| 73 | #endif /* __MLX5_EN_REP_TC_H__ */ |
| 74 | |