@@ -133,6 +133,23 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
133
133
return rule ;
134
134
}
135
135
136
+ static void mlx5e_tc_del_nic_flow (struct mlx5e_priv * priv ,
137
+ struct mlx5e_tc_flow * flow )
138
+ {
139
+ struct mlx5_fc * counter = NULL ;
140
+
141
+ if (!IS_ERR (flow -> rule )) {
142
+ counter = mlx5_flow_rule_counter (flow -> rule );
143
+ mlx5_del_flow_rules (flow -> rule );
144
+ mlx5_fc_destroy (priv -> mdev , counter );
145
+ }
146
+
147
+ if (!mlx5e_tc_num_filters (priv ) && (priv -> fs .tc .t )) {
148
+ mlx5_destroy_flow_table (priv -> fs .tc .t );
149
+ priv -> fs .tc .t = NULL ;
150
+ }
151
+ }
152
+
136
153
static struct mlx5_flow_handle *
137
154
mlx5e_tc_add_fdb_flow (struct mlx5e_priv * priv ,
138
155
struct mlx5_flow_spec * spec ,
@@ -149,7 +166,24 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
149
166
}
150
167
151
168
static void mlx5e_detach_encap (struct mlx5e_priv * priv ,
152
- struct mlx5e_tc_flow * flow ) {
169
+ struct mlx5e_tc_flow * flow );
170
+
171
+ static void mlx5e_tc_del_fdb_flow (struct mlx5e_priv * priv ,
172
+ struct mlx5e_tc_flow * flow )
173
+ {
174
+ struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
175
+
176
+ mlx5_eswitch_del_offloaded_rule (esw , flow -> rule , flow -> attr );
177
+
178
+ mlx5_eswitch_del_vlan_action (esw , flow -> attr );
179
+
180
+ if (flow -> attr -> action & MLX5_FLOW_CONTEXT_ACTION_ENCAP )
181
+ mlx5e_detach_encap (priv , flow );
182
+ }
183
+
184
+ static void mlx5e_detach_encap (struct mlx5e_priv * priv ,
185
+ struct mlx5e_tc_flow * flow )
186
+ {
153
187
struct list_head * next = flow -> encap .next ;
154
188
155
189
list_del (& flow -> encap );
@@ -173,25 +207,10 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
173
207
static void mlx5e_tc_del_flow (struct mlx5e_priv * priv ,
174
208
struct mlx5e_tc_flow * flow )
175
209
{
176
- struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
177
- struct mlx5_fc * counter = NULL ;
178
-
179
- if (!IS_ERR (flow -> rule )) {
180
- counter = mlx5_flow_rule_counter (flow -> rule );
181
- mlx5_del_flow_rules (flow -> rule );
182
- mlx5_fc_destroy (priv -> mdev , counter );
183
- }
184
-
185
- if (flow -> flags & MLX5E_TC_FLOW_ESWITCH ) {
186
- mlx5_eswitch_del_vlan_action (esw , flow -> attr );
187
- if (flow -> attr -> action & MLX5_FLOW_CONTEXT_ACTION_ENCAP )
188
- mlx5e_detach_encap (priv , flow );
189
- }
190
-
191
- if (!mlx5e_tc_num_filters (priv ) && (priv -> fs .tc .t )) {
192
- mlx5_destroy_flow_table (priv -> fs .tc .t );
193
- priv -> fs .tc .t = NULL ;
194
- }
210
+ if (flow -> flags & MLX5E_TC_FLOW_ESWITCH )
211
+ mlx5e_tc_del_fdb_flow (priv , flow );
212
+ else
213
+ mlx5e_tc_del_nic_flow (priv , flow );
195
214
}
196
215
197
216
static void parse_vxlan_attr (struct mlx5_flow_spec * spec ,
@@ -248,12 +267,15 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
248
267
skb_flow_dissector_target (f -> dissector ,
249
268
FLOW_DISSECTOR_KEY_ENC_PORTS ,
250
269
f -> mask );
270
+ struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
271
+ struct net_device * up_dev = mlx5_eswitch_get_uplink_netdev (esw );
272
+ struct mlx5e_priv * up_priv = netdev_priv (up_dev );
251
273
252
274
/* Full udp dst port must be given */
253
275
if (memchr_inv (& mask -> dst , 0xff , sizeof (mask -> dst )))
254
276
goto vxlan_match_offload_err ;
255
277
256
- if (mlx5e_vxlan_lookup_port (priv , be16_to_cpu (key -> dst )) &&
278
+ if (mlx5e_vxlan_lookup_port (up_priv , be16_to_cpu (key -> dst )) &&
257
279
MLX5_CAP_ESW (priv -> mdev , vxlan_encap_decap ))
258
280
parse_vxlan_attr (spec , f );
259
281
else {
@@ -976,6 +998,8 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
976
998
struct mlx5_esw_flow_attr * attr )
977
999
{
978
1000
struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
1001
+ struct net_device * up_dev = mlx5_eswitch_get_uplink_netdev (esw );
1002
+ struct mlx5e_priv * up_priv = netdev_priv (up_dev );
979
1003
unsigned short family = ip_tunnel_info_af (tun_info );
980
1004
struct ip_tunnel_key * key = & tun_info -> key ;
981
1005
struct mlx5_encap_entry * e ;
@@ -996,7 +1020,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
996
1020
return - EOPNOTSUPP ;
997
1021
}
998
1022
999
- if (mlx5e_vxlan_lookup_port (priv , be16_to_cpu (key -> tp_dst )) &&
1023
+ if (mlx5e_vxlan_lookup_port (up_priv , be16_to_cpu (key -> tp_dst )) &&
1000
1024
MLX5_CAP_ESW (priv -> mdev , vxlan_encap_decap )) {
1001
1025
tunnel_type = MLX5_HEADER_TYPE_VXLAN ;
1002
1026
} else {
@@ -1112,14 +1136,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1112
1136
}
1113
1137
1114
1138
if (is_tcf_vlan (a )) {
1115
- if (tcf_vlan_action (a ) == VLAN_F_POP ) {
1139
+ if (tcf_vlan_action (a ) == TCA_VLAN_ACT_POP ) {
1116
1140
attr -> action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP ;
1117
- } else if (tcf_vlan_action (a ) == VLAN_F_PUSH ) {
1141
+ } else if (tcf_vlan_action (a ) == TCA_VLAN_ACT_PUSH ) {
1118
1142
if (tcf_vlan_push_proto (a ) != htons (ETH_P_8021Q ))
1119
1143
return - EOPNOTSUPP ;
1120
1144
1121
1145
attr -> action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH ;
1122
1146
attr -> vlan = tcf_vlan_push_vid (a );
1147
+ } else { /* action is TCA_VLAN_ACT_MODIFY */
1148
+ return - EOPNOTSUPP ;
1123
1149
}
1124
1150
continue ;
1125
1151
}
0 commit comments