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