@@ -98,7 +98,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
98
98
.action = attr -> action ,
99
99
.flow_tag = attr -> flow_tag ,
100
100
.encap_id = 0 ,
101
- .modify_id = attr -> mod_hdr_id ,
102
101
};
103
102
struct mlx5_fc * counter = NULL ;
104
103
struct mlx5_flow_handle * rule ;
@@ -122,6 +121,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
122
121
parse_attr -> num_mod_hdr_actions ,
123
122
parse_attr -> mod_hdr_actions ,
124
123
& attr -> mod_hdr_id );
124
+ flow_act .modify_id = attr -> mod_hdr_id ;
125
125
kfree (parse_attr -> mod_hdr_actions );
126
126
if (err ) {
127
127
rule = ERR_PTR (err );
@@ -208,32 +208,52 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
208
208
goto err_add_vlan ;
209
209
}
210
210
211
+ if (attr -> action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ) {
212
+ err = mlx5_modify_header_alloc (priv -> mdev , MLX5_FLOW_NAMESPACE_FDB ,
213
+ parse_attr -> num_mod_hdr_actions ,
214
+ parse_attr -> mod_hdr_actions ,
215
+ & attr -> mod_hdr_id );
216
+ kfree (parse_attr -> mod_hdr_actions );
217
+ if (err ) {
218
+ rule = ERR_PTR (err );
219
+ goto err_mod_hdr ;
220
+ }
221
+ }
222
+
211
223
rule = mlx5_eswitch_add_offloaded_rule (esw , & parse_attr -> spec , attr );
212
224
if (IS_ERR (rule ))
213
225
goto err_add_rule ;
214
226
215
227
return rule ;
216
228
217
229
err_add_rule :
230
+ if (flow -> esw_attr -> action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR )
231
+ mlx5_modify_header_dealloc (priv -> mdev ,
232
+ attr -> mod_hdr_id );
233
+ err_mod_hdr :
218
234
mlx5_eswitch_del_vlan_action (esw , attr );
219
235
err_add_vlan :
220
236
if (attr -> action & MLX5_FLOW_CONTEXT_ACTION_ENCAP )
221
237
mlx5e_detach_encap (priv , flow );
222
-
223
238
return rule ;
224
239
}
225
240
226
241
static void mlx5e_tc_del_fdb_flow (struct mlx5e_priv * priv ,
227
242
struct mlx5e_tc_flow * flow )
228
243
{
229
244
struct mlx5_eswitch * esw = priv -> mdev -> priv .eswitch ;
245
+ struct mlx5_esw_flow_attr * attr = flow -> esw_attr ;
230
246
231
247
mlx5_eswitch_del_offloaded_rule (esw , flow -> rule , flow -> esw_attr );
232
248
233
249
mlx5_eswitch_del_vlan_action (esw , flow -> esw_attr );
234
250
235
251
if (flow -> esw_attr -> action & MLX5_FLOW_CONTEXT_ACTION_ENCAP )
236
252
mlx5e_detach_encap (priv , flow );
253
+
254
+ if (flow -> esw_attr -> action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR )
255
+ mlx5_modify_header_dealloc (priv -> mdev ,
256
+ attr -> mod_hdr_id );
237
257
}
238
258
239
259
static void mlx5e_detach_encap (struct mlx5e_priv * priv ,
@@ -1406,6 +1426,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
1406
1426
}
1407
1427
1408
1428
static int parse_tc_fdb_actions (struct mlx5e_priv * priv , struct tcf_exts * exts ,
1429
+ struct mlx5e_tc_flow_parse_attr * parse_attr ,
1409
1430
struct mlx5e_tc_flow * flow )
1410
1431
{
1411
1432
struct mlx5_esw_flow_attr * attr = flow -> esw_attr ;
@@ -1429,6 +1450,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1429
1450
continue ;
1430
1451
}
1431
1452
1453
+ if (is_tcf_pedit (a )) {
1454
+ err = parse_tc_pedit_action (priv , a , MLX5_FLOW_NAMESPACE_FDB ,
1455
+ parse_attr );
1456
+ if (err )
1457
+ return err ;
1458
+
1459
+ attr -> action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ;
1460
+ continue ;
1461
+ }
1462
+
1432
1463
if (is_tcf_mirred_egress_redirect (a )) {
1433
1464
int ifindex = tcf_mirred_ifindex (a );
1434
1465
struct net_device * out_dev ;
@@ -1528,7 +1559,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
1528
1559
goto err_free ;
1529
1560
1530
1561
if (flow -> flags & MLX5E_TC_FLOW_ESWITCH ) {
1531
- err = parse_tc_fdb_actions (priv , f -> exts , flow );
1562
+ err = parse_tc_fdb_actions (priv , f -> exts , parse_attr , flow );
1532
1563
if (err < 0 )
1533
1564
goto err_free ;
1534
1565
flow -> rule = mlx5e_tc_add_fdb_flow (priv , parse_attr , flow );
0 commit comments