This source file includes following definitions.
- mlx5e_rep_to_rep_priv
- mlx5e_is_uplink_rep
- mlx5e_add_sqs_fwd_rules
- mlx5e_remove_sqs_fwd_rules
- mlx5e_is_vport_rep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #ifndef __MLX5E_REP_H__
34 #define __MLX5E_REP_H__
35
36 #include <net/ip_tunnels.h>
37 #include <linux/rhashtable.h>
38 #include <linux/mutex.h>
39 #include "eswitch.h"
40 #include "en.h"
41 #include "lib/port_tun.h"
42
43 #ifdef CONFIG_MLX5_ESWITCH
44 struct mlx5e_neigh_update_table {
45 struct rhashtable neigh_ht;
46
47
48
49
50 struct list_head neigh_list;
51
52 struct mutex encap_lock;
53 struct notifier_block netevent_nb;
54 struct delayed_work neigh_stats_work;
55 unsigned long min_interval;
56 };
57
58 struct mlx5_rep_uplink_priv {
59
60
61
62 struct rhashtable tc_ht;
63
64
65
66
67
68
69
70
71
72
73
74 struct list_head tc_indr_block_priv_list;
75 struct notifier_block netdevice_nb;
76
77 struct mlx5_tun_entropy tun_entropy;
78
79
80 struct mutex unready_flows_lock;
81 struct list_head unready_flows;
82 struct work_struct reoffload_flows_work;
83 };
84
85 struct mlx5e_rep_priv {
86 struct mlx5_eswitch_rep *rep;
87 struct mlx5e_neigh_update_table neigh_update;
88 struct net_device *netdev;
89 struct mlx5_flow_handle *vport_rx_rule;
90 struct list_head vport_sqs_list;
91 struct mlx5_rep_uplink_priv uplink_priv;
92 struct rtnl_link_stats64 prev_vf_vport_stats;
93 struct devlink_port dl_port;
94 };
95
96 static inline
97 struct mlx5e_rep_priv *mlx5e_rep_to_rep_priv(struct mlx5_eswitch_rep *rep)
98 {
99 return rep->rep_data[REP_ETH].priv;
100 }
101
102 struct mlx5e_neigh {
103 struct net_device *dev;
104 union {
105 __be32 v4;
106 struct in6_addr v6;
107 } dst_ip;
108 int family;
109 };
110
111 struct mlx5e_neigh_hash_entry {
112 struct rhash_head rhash_node;
113 struct mlx5e_neigh m_neigh;
114 struct mlx5e_priv *priv;
115
116
117
118
119
120 struct list_head neigh_list;
121
122
123 spinlock_t encap_list_lock;
124
125 struct list_head encap_list;
126
127
128
129
130 struct neighbour *n;
131 struct work_struct neigh_update_work;
132
133
134
135
136
137 refcount_t refcnt;
138
139
140
141
142
143 unsigned long reported_lastuse;
144
145 struct rcu_head rcu;
146 };
147
148 enum {
149
150 MLX5_ENCAP_ENTRY_VALID = BIT(0),
151 };
152
153 struct mlx5e_encap_entry {
154
155 struct mlx5e_neigh_hash_entry *nhe;
156
157 struct list_head encap_list;
158 struct mlx5e_neigh m_neigh;
159
160
161
162 struct hlist_node encap_hlist;
163 struct list_head flows;
164 struct mlx5_pkt_reformat *pkt_reformat;
165 const struct ip_tunnel_info *tun_info;
166 unsigned char h_dest[ETH_ALEN];
167
168 struct net_device *out_dev;
169 struct net_device *route_dev;
170 struct mlx5e_tc_tunnel *tunnel;
171 int reformat_type;
172 u8 flags;
173 char *encap_header;
174 int encap_size;
175 refcount_t refcnt;
176 struct completion res_ready;
177 int compl_result;
178 struct rcu_head rcu;
179 };
180
181 struct mlx5e_rep_sq {
182 struct mlx5_flow_handle *send_to_vport_rule;
183 struct list_head list;
184 };
185
186 void mlx5e_rep_register_vport_reps(struct mlx5_core_dev *mdev);
187 void mlx5e_rep_unregister_vport_reps(struct mlx5_core_dev *mdev);
188 bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv);
189 int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv);
190 void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv);
191
192 void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
193
194 int mlx5e_rep_encap_entry_attach(struct mlx5e_priv *priv,
195 struct mlx5e_encap_entry *e);
196 void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv,
197 struct mlx5e_encap_entry *e);
198
199 void mlx5e_rep_queue_neigh_stats_work(struct mlx5e_priv *priv);
200
201 bool mlx5e_eswitch_rep(struct net_device *netdev);
202
203 #else
204 static inline bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv) { return false; }
205 static inline int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv) { return 0; }
206 static inline void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv) {}
207 #endif
208
209 static inline bool mlx5e_is_vport_rep(struct mlx5e_priv *priv)
210 {
211 return (MLX5_ESWITCH_MANAGER(priv->mdev) && priv->ppriv);
212 }
213 #endif