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 13int mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv); 14void mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv); 15 16int mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv); 17void mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv); 18 19void mlx5e_rep_tc_enable(struct mlx5e_priv *priv); 20void mlx5e_rep_tc_disable(struct mlx5e_priv *priv); 21 22int mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv); 23 24void 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 29int 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); 33void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv, 34 struct mlx5e_encap_entry *e); 35 36int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, 37 void *type_data); 38 39void 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 44struct mlx5e_rep_priv; 45static inline int 46mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv) { return 0; } 47static inline void 48mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv) {} 49 50static inline int 51mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv) { return 0; } 52static inline void 53mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv) {} 54 55static inline void 56mlx5e_rep_tc_enable(struct mlx5e_priv *priv) {} 57static inline void 58mlx5e_rep_tc_disable(struct mlx5e_priv *priv) {} 59 60static inline int 61mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv) { return NOTIFY_DONE; } 62 63static inline int 64mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type, 65 void *type_data) { return -EOPNOTSUPP; } 66 67static inline void 68mlx5e_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