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 bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe, 40 struct sk_buff *skb, 41 struct mlx5e_tc_update_priv *tc_priv); 42 void mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv); 43 44 #else /* CONFIG_MLX5_CLS_ACT */ 45 46 struct mlx5e_rep_priv; 47 static inline int 48 mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv) { return 0; } 49 static inline void 50 mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv) {} 51 52 static inline int 53 mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv) { return 0; } 54 static inline void 55 mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv) {} 56 57 static inline void 58 mlx5e_rep_tc_enable(struct mlx5e_priv *priv) {} 59 static inline void 60 mlx5e_rep_tc_disable(struct mlx5e_priv *priv) {} 61 62 static inline int 63 mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv) { return NOTIFY_DONE; } 64 65 static inline int 66 mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, 67 void *type_data) { return -EOPNOTSUPP; } 68 69 struct mlx5e_tc_update_priv; 70 static inline bool 71 mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe, 72 struct sk_buff *skb, 73 struct mlx5e_tc_update_priv *tc_priv) { return true; } 74 static inline void 75 mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv) {} 76 77 #endif /* CONFIG_MLX5_CLS_ACT */ 78 79 #endif /* __MLX5_EN_REP_TC_H__ */ 80