@@ -27,6 +27,7 @@ struct nf_flowtable_type {
const struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule);
+ int (*cleanup)(struct nf_flowtable *ft);
void (*free)(struct nf_flowtable *ft);
nf_hookfn *hook;
struct module *owner;
@@ -367,9 +367,15 @@ static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table,
static void nf_flow_offload_work_gc(struct work_struct *work)
{
struct nf_flowtable *flow_table;
+ int err, cnt;
flow_table = container_of(work, struct nf_flowtable, gc_work.work);
- nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
+ cnt = nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL);
+ if (cnt == 0 && flow_table->type->cleanup) {
+ err = flow_table->type->cleanup(flow_table);
+ if (!err)
+ return;
+ }
queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
}