@@ -384,7 +384,6 @@ static void del_flow_table(struct fs_node *node)
384
384
err = mlx5_cmd_destroy_flow_table (dev , ft );
385
385
if (err )
386
386
mlx5_core_warn (dev , "flow steering can't destroy ft\n" );
387
- ida_destroy (& ft -> fte_allocator );
388
387
rhltable_destroy (& ft -> fgs_hash );
389
388
fs_get_obj (prio , ft -> node .parent );
390
389
prio -> num_ft -- ;
@@ -445,7 +444,7 @@ static void destroy_fte(struct fs_fte *fte, struct mlx5_flow_group *fg)
445
444
WARN_ON (ret );
446
445
fte -> status = 0 ;
447
446
fs_get_obj (ft , fg -> node .parent );
448
- ida_simple_remove (& ft -> fte_allocator , fte -> index );
447
+ ida_simple_remove (& fg -> fte_allocator , fte -> index - fg -> start_index );
449
448
}
450
449
451
450
static void del_fte (struct fs_node * node )
@@ -488,6 +487,7 @@ static void del_flow_group(struct fs_node *node)
488
487
ft -> autogroup .num_groups -- ;
489
488
490
489
rhashtable_destroy (& fg -> ftes_hash );
490
+ ida_destroy (& fg -> fte_allocator );
491
491
err = rhltable_remove (& ft -> fgs_hash ,
492
492
& fg -> hash ,
493
493
rhash_fg );
@@ -537,6 +537,7 @@ static struct mlx5_flow_group *alloc_flow_group(u32 *create_fg_in)
537
537
kfree (fg );
538
538
return ERR_PTR (ret );
539
539
}
540
+ ida_init (& fg -> fte_allocator );
540
541
fg -> mask .match_criteria_enable = match_criteria_enable ;
541
542
memcpy (& fg -> mask .match_criteria , match_criteria ,
542
543
sizeof (fg -> mask .match_criteria ));
@@ -575,7 +576,6 @@ static struct mlx5_flow_table *alloc_flow_table(int level, u16 vport, int max_ft
575
576
ft -> flags = flags ;
576
577
INIT_LIST_HEAD (& ft -> fwd_rules );
577
578
mutex_init (& ft -> lock );
578
- ida_init (& ft -> fte_allocator );
579
579
580
580
return ft ;
581
581
}
@@ -892,7 +892,6 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
892
892
destroy_ft :
893
893
mlx5_cmd_destroy_flow_table (root -> dev , ft );
894
894
free_ft :
895
- ida_destroy (& ft -> fte_allocator );
896
895
kfree (ft );
897
896
unlock_root :
898
897
mutex_unlock (& root -> chain_lock );
@@ -1003,6 +1002,7 @@ static struct mlx5_flow_group *create_flow_group_common(struct mlx5_flow_table *
1003
1002
rhash_fg ));
1004
1003
err_free_fg :
1005
1004
rhashtable_destroy (& fg -> ftes_hash );
1005
+ ida_destroy (& fg -> fte_allocator );
1006
1006
kfree (fg );
1007
1007
1008
1008
return ERR_PTR (err );
@@ -1181,18 +1181,18 @@ static struct fs_fte *create_fte(struct mlx5_flow_group *fg,
1181
1181
u32 * match_value ,
1182
1182
struct mlx5_flow_act * flow_act )
1183
1183
{
1184
- struct mlx5_flow_table * ft ;
1185
1184
struct fs_fte * fte ;
1186
1185
int index ;
1187
1186
int ret ;
1188
1187
1189
- fs_get_obj (ft , fg -> node .parent );
1190
- index = ida_simple_get (& ft -> fte_allocator , fg -> start_index ,
1191
- fg -> start_index + fg -> max_ftes ,
1188
+ index = ida_simple_get (& fg -> fte_allocator , 0 ,
1189
+ fg -> max_ftes ,
1192
1190
GFP_KERNEL );
1193
1191
if (index < 0 )
1194
1192
return ERR_PTR (index );
1195
1193
1194
+ index += fg -> start_index ;
1195
+
1196
1196
fte = alloc_fte (flow_act , match_value , index );
1197
1197
if (IS_ERR (fte )) {
1198
1198
ret = PTR_ERR (fte );
@@ -1207,7 +1207,7 @@ static struct fs_fte *create_fte(struct mlx5_flow_group *fg,
1207
1207
err_hash :
1208
1208
kfree (fte );
1209
1209
err_alloc :
1210
- ida_simple_remove (& ft -> fte_allocator , index );
1210
+ ida_simple_remove (& fg -> fte_allocator , index - fg -> start_index );
1211
1211
return ERR_PTR (ret );
1212
1212
}
1213
1213
0 commit comments