Skip to content

Commit 13fa876

Browse files
roidayandavem330
authored andcommitted
net/sched: cls_flower: merge filter delete/destroy common code
Move common code from fl_delete and fl_detroy to __fl_delete. Signed-off-by: Roi Dayan <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a1a8f7f commit 13fa876

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

net/sched/cls_flower.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
269269
dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
270270
}
271271

272+
static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)
273+
{
274+
list_del_rcu(&f->list);
275+
fl_hw_destroy_filter(tp, (unsigned long)f);
276+
tcf_unbind_filter(tp, &f->res);
277+
call_rcu(&f->rcu, fl_destroy_filter);
278+
}
279+
272280
static bool fl_destroy(struct tcf_proto *tp, bool force)
273281
{
274282
struct cls_fl_head *head = rtnl_dereference(tp->root);
@@ -277,12 +285,8 @@ static bool fl_destroy(struct tcf_proto *tp, bool force)
277285
if (!force && !list_empty(&head->filters))
278286
return false;
279287

280-
list_for_each_entry_safe(f, next, &head->filters, list) {
281-
fl_hw_destroy_filter(tp, (unsigned long)f);
282-
list_del_rcu(&f->list);
283-
tcf_unbind_filter(tp, &f->res);
284-
call_rcu(&f->rcu, fl_destroy_filter);
285-
}
288+
list_for_each_entry_safe(f, next, &head->filters, list)
289+
__fl_delete(tp, f);
286290
RCU_INIT_POINTER(tp->root, NULL);
287291
if (head->mask_assigned)
288292
rhashtable_destroy(&head->ht);
@@ -742,10 +746,7 @@ static int fl_delete(struct tcf_proto *tp, unsigned long arg)
742746

743747
rhashtable_remove_fast(&head->ht, &f->ht_node,
744748
head->ht_params);
745-
list_del_rcu(&f->list);
746-
fl_hw_destroy_filter(tp, (unsigned long)f);
747-
tcf_unbind_filter(tp, &f->res);
748-
call_rcu(&f->rcu, fl_destroy_filter);
749+
__fl_delete(tp, f);
749750
return 0;
750751
}
751752

0 commit comments

Comments
 (0)