aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/flow.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-04-06 20:30:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-07 06:43:18 -0400
commitfe1a5f031e76bd8761a7803d75b95ee96e84a574 (patch)
treec74392cef02c1529b00df6c5d0b8f4239fe091c3 /include/net/flow.h
parent8020eb82d4c37d21dade0abeb8feed265a01819e (diff)
flow: virtualize flow cache entry methods
This allows to validate the cached object before returning it. It also allows to destruct object properly, if the last reference was held in flow cache. This is also a prepartion for caching bundles in the flow cache. In return for virtualizing the methods, we save on: - not having to regenerate the whole flow cache on policy removal: each flow matching a killed policy gets refreshed as the getter function notices it smartly. - we do not have to call flow_cache_flush from policy gc, since the flow cache now properly deletes the object if it had any references Signed-off-by: Timo Teras <timo.teras@iki.fi> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/flow.h')
-rw-r--r--include/net/flow.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/include/net/flow.h b/include/net/flow.h
index 809970b7dfee..bb08692a20b0 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -86,11 +86,26 @@ struct flowi {
86 86
87struct net; 87struct net;
88struct sock; 88struct sock;
89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, 89struct flow_cache_ops;
90 u8 dir, void **objp, atomic_t **obj_refp); 90
91struct flow_cache_object {
92 const struct flow_cache_ops *ops;
93};
94
95struct flow_cache_ops {
96 struct flow_cache_object *(*get)(struct flow_cache_object *);
97 int (*check)(struct flow_cache_object *);
98 void (*delete)(struct flow_cache_object *);
99};
100
101typedef struct flow_cache_object *(*flow_resolve_t)(
102 struct net *net, struct flowi *key, u16 family,
103 u8 dir, struct flow_cache_object *oldobj, void *ctx);
104
105extern struct flow_cache_object *flow_cache_lookup(
106 struct net *net, struct flowi *key, u16 family,
107 u8 dir, flow_resolve_t resolver, void *ctx);
91 108
92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
93 u8 dir, flow_resolve_t resolver);
94extern void flow_cache_flush(void); 109extern void flow_cache_flush(void);
95extern atomic_t flow_cache_genid; 110extern atomic_t flow_cache_genid;
96 111