Thread (56 messages) flat view 56 messages, 6 authors, 2019-08-27
STALE2565d

[PATCH 30/38] cls_flower: Use XArray list of filters in fl_walk

From: Matthew Wilcox <willy@infradead.org>
Date: 2019-08-20 22:33:23
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Instead of iterating over every filter attached to every mark, just
iterate over each filter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 net/sched/cls_flower.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 54026c9e9b05..2a1999d2b507 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -575,18 +575,15 @@ static void fl_destroy(struct tcf_proto *tp, bool rtnl_held,
 		       struct netlink_ext_ack *extack)
 {
 	struct cls_fl_head *head = fl_head_dereference(tp);
-	struct fl_flow_mask *mask, *next_mask;
-	struct cls_fl_filter *f, *next;
+	struct cls_fl_filter *f;
+	unsigned long handle;
 	bool last;
 
-	list_for_each_entry_safe(mask, next_mask, &head->masks, list) {
-		list_for_each_entry_safe(f, next, &mask->filters, list) {
-			__fl_delete(tp, f, &last, rtnl_held, extack);
-			if (last)
-				break;
-		}
+	xa_for_each(&head->filters, handle, f) {
+		__fl_delete(tp, f, &last, rtnl_held, extack);
+		if (last)
+			break;
 	}
-	xa_destroy(&head->filters);
 
 	__module_get(THIS_MODULE);
 	tcf_queue_work(&head->rwork, fl_destroy_sleepable);
-- 
2.23.0.rc1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help