diff options
author | Patrick McHardy <kaber@trash.net> | 2007-12-05 04:26:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:14 -0500 |
commit | 02f014d88831f73b895c1fe09badb66c88e932d3 (patch) | |
tree | 09aa75b8edeb240e62c4269f20630f8206c0e6d4 /include | |
parent | 7a6c6653b3a977087ec64d76817c7ee6e1df5b60 (diff) |
[NETFILTER]: nf_queue: move list_head/skb/id to struct nf_info
Move common fields for queue management to struct nf_info and rename it
to struct nf_queue_entry. The avoids one allocation/free per packet and
simplifies the code a bit.
Alternatively we could add some private room at the tail, but since
all current users use identical structs this seems easier.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/nf_queue.h | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 5fe4ef401cc8..f25eec595807 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -270,7 +270,7 @@ extern void nf_invalidate_cache(int pf); | |||
270 | extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); | 270 | extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); |
271 | 271 | ||
272 | struct flowi; | 272 | struct flowi; |
273 | struct nf_info; | 273 | struct nf_queue_entry; |
274 | 274 | ||
275 | struct nf_afinfo { | 275 | struct nf_afinfo { |
276 | unsigned short family; | 276 | unsigned short family; |
@@ -278,9 +278,9 @@ struct nf_afinfo { | |||
278 | unsigned int dataoff, u_int8_t protocol); | 278 | unsigned int dataoff, u_int8_t protocol); |
279 | int (*route)(struct dst_entry **dst, struct flowi *fl); | 279 | int (*route)(struct dst_entry **dst, struct flowi *fl); |
280 | void (*saveroute)(const struct sk_buff *skb, | 280 | void (*saveroute)(const struct sk_buff *skb, |
281 | struct nf_info *info); | 281 | struct nf_queue_entry *entry); |
282 | int (*reroute)(struct sk_buff *skb, | 282 | int (*reroute)(struct sk_buff *skb, |
283 | const struct nf_info *info); | 283 | const struct nf_queue_entry *entry); |
284 | int route_key_size; | 284 | int route_key_size; |
285 | }; | 285 | }; |
286 | 286 | ||
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index 8c6b382fd865..d030044e9235 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h | |||
@@ -2,7 +2,11 @@ | |||
2 | #define _NF_QUEUE_H | 2 | #define _NF_QUEUE_H |
3 | 3 | ||
4 | /* Each queued (to userspace) skbuff has one of these. */ | 4 | /* Each queued (to userspace) skbuff has one of these. */ |
5 | struct nf_info { | 5 | struct nf_queue_entry { |
6 | struct list_head list; | ||
7 | struct sk_buff *skb; | ||
8 | unsigned int id; | ||
9 | |||
6 | struct nf_hook_ops *elem; | 10 | struct nf_hook_ops *elem; |
7 | int pf; | 11 | int pf; |
8 | unsigned int hook; | 12 | unsigned int hook; |
@@ -11,12 +15,11 @@ struct nf_info { | |||
11 | int (*okfn)(struct sk_buff *); | 15 | int (*okfn)(struct sk_buff *); |
12 | }; | 16 | }; |
13 | 17 | ||
14 | #define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info)) | 18 | #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) |
15 | 19 | ||
16 | /* Packet queuing */ | 20 | /* Packet queuing */ |
17 | struct nf_queue_handler { | 21 | struct nf_queue_handler { |
18 | int (*outfn)(struct sk_buff *skb, | 22 | int (*outfn)(struct nf_queue_entry *entry, |
19 | struct nf_info *info, | ||
20 | unsigned int queuenum); | 23 | unsigned int queuenum); |
21 | char *name; | 24 | char *name; |
22 | }; | 25 | }; |
@@ -26,7 +29,6 @@ extern int nf_register_queue_handler(int pf, | |||
26 | extern int nf_unregister_queue_handler(int pf, | 29 | extern int nf_unregister_queue_handler(int pf, |
27 | const struct nf_queue_handler *qh); | 30 | const struct nf_queue_handler *qh); |
28 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); | 31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); |
29 | extern void nf_reinject(struct sk_buff *skb, struct nf_info *info, | 32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); |
30 | unsigned int verdict); | ||
31 | 33 | ||
32 | #endif /* _NF_QUEUE_H */ | 34 | #endif /* _NF_QUEUE_H */ |