Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: flowtable: add function to invoke garbage collection immediately

Expose nf_flow_table_gc_run() to force a garbage collector run from the
offload infrastructure.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

+10 -3
+1
include/net/netfilter/nf_flow_table.h
··· 270 270 271 271 struct flow_offload_tuple_rhash *flow_offload_lookup(struct nf_flowtable *flow_table, 272 272 struct flow_offload_tuple *tuple); 273 + void nf_flow_table_gc_run(struct nf_flowtable *flow_table); 273 274 void nf_flow_table_gc_cleanup(struct nf_flowtable *flowtable, 274 275 struct net_device *dev); 275 276 void nf_flow_table_cleanup(struct net_device *dev);
+9 -3
net/netfilter/nf_flow_table_core.c
··· 437 437 } 438 438 } 439 439 440 + void nf_flow_table_gc_run(struct nf_flowtable *flow_table) 441 + { 442 + nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); 443 + } 444 + 440 445 static void nf_flow_offload_work_gc(struct work_struct *work) 441 446 { 442 447 struct nf_flowtable *flow_table; 443 448 444 449 flow_table = container_of(work, struct nf_flowtable, gc_work.work); 445 - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); 450 + nf_flow_table_gc_run(flow_table); 446 451 queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ); 447 452 } 448 453 ··· 606 601 607 602 cancel_delayed_work_sync(&flow_table->gc_work); 608 603 nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL); 609 - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); 604 + nf_flow_table_gc_run(flow_table); 610 605 nf_flow_table_offload_flush(flow_table); 611 606 if (nf_flowtable_hw_offload(flow_table)) 612 - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); 607 + nf_flow_table_gc_run(flow_table); 608 + 613 609 rhashtable_destroy(&flow_table->rhashtable); 614 610 } 615 611 EXPORT_SYMBOL_GPL(nf_flow_table_free);