Skip to content

Commit 583aef7

Browse files
ummakynesabuehaze14
authored andcommitted
netfilter: flowtable: add function to invoke garbage collection immediately
[ Upstream commit 759eebb ] 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> Signed-off-by: Nathan Gao <zcgao@amazon.com>
1 parent bd70de5 commit 583aef7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

include/net/netfilter/nf_flow_table.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void flow_offload_refresh(struct nf_flowtable *flow_table,
215215

216216
struct flow_offload_tuple_rhash *flow_offload_lookup(struct nf_flowtable *flow_table,
217217
struct flow_offload_tuple *tuple);
218+
void nf_flow_table_gc_run(struct nf_flowtable *flow_table);
218219
void nf_flow_table_gc_cleanup(struct nf_flowtable *flowtable,
219220
struct net_device *dev);
220221
void nf_flow_table_cleanup(struct net_device *dev);

net/netfilter/nf_flow_table_core.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,17 @@ static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table,
379379
}
380380
}
381381

382+
void nf_flow_table_gc_run(struct nf_flowtable *flow_table)
383+
{
384+
nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
385+
}
386+
382387
static void nf_flow_offload_work_gc(struct work_struct *work)
383388
{
384389
struct nf_flowtable *flow_table;
385390

386391
flow_table = container_of(work, struct nf_flowtable, gc_work.work);
387-
nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
392+
nf_flow_table_gc_run(flow_table);
388393
queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
389394
}
390395

@@ -568,10 +573,11 @@ void nf_flow_table_free(struct nf_flowtable *flow_table)
568573

569574
cancel_delayed_work_sync(&flow_table->gc_work);
570575
nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL);
571-
nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
576+
nf_flow_table_gc_run(flow_table);
572577
nf_flow_table_offload_flush(flow_table);
573578
if (nf_flowtable_hw_offload(flow_table))
574-
nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
579+
nf_flow_table_gc_run(flow_table);
580+
575581
rhashtable_destroy(&flow_table->rhashtable);
576582
}
577583
EXPORT_SYMBOL_GPL(nf_flow_table_free);

0 commit comments

Comments
 (0)