diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2009-06-12 22:13:26 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-02-15 10:56:51 -0500 |
commit | 2249065f4b22b493bae2caf549b86f175f33188e (patch) | |
tree | f8e754437592f0c3ac5a7d3e9782a43b0d359615 | |
parent | 23f3733d440b918ccb7746718f77256334cf6176 (diff) |
netfilter: get rid of the grossness in netfilter.h
GCC is now smart enough to follow the inline trail correctly.
vmlinux size remain the same.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
-rw-r--r-- | include/linux/netfilter.h | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 2f22816a5514..70079454ffd0 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -196,25 +196,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
196 | coders :) | 196 | coders :) |
197 | */ | 197 | */ |
198 | 198 | ||
199 | /* This is gross, but inline doesn't cut it for avoiding the function | 199 | static inline int |
200 | call in fast path: gcc doesn't inline (needs value tracking?). --RR */ | 200 | NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
201 | 201 | struct net_device *in, struct net_device *out, | |
202 | /* HX: It's slightly less gross now. */ | 202 | int (*okfn)(struct sk_buff *), int thresh) |
203 | 203 | { | |
204 | #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ | 204 | int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); |
205 | ({int __ret; \ | 205 | if (ret == 1) |
206 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh)) == 1)\ | 206 | ret = okfn(skb); |
207 | __ret = (okfn)(skb); \ | 207 | return ret; |
208 | __ret;}) | 208 | } |
209 | 209 | ||
210 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ | 210 | static inline int |
211 | ({int __ret; \ | 211 | NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
212 | if ((cond) || (__ret = nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN)) == 1)\ | 212 | struct net_device *in, struct net_device *out, |
213 | __ret = (okfn)(skb); \ | 213 | int (*okfn)(struct sk_buff *), bool cond) |
214 | __ret;}) | 214 | { |
215 | int ret = 1; | ||
216 | if (cond || | ||
217 | (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) | ||
218 | ret = okfn(skb); | ||
219 | return ret; | ||
220 | } | ||
215 | 221 | ||
216 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ | 222 | static inline int |
217 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 223 | NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
224 | struct net_device *in, struct net_device *out, | ||
225 | int (*okfn)(struct sk_buff *)) | ||
226 | { | ||
227 | return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); | ||
228 | } | ||
218 | 229 | ||
219 | /* Call setsockopt() */ | 230 | /* Call setsockopt() */ |
220 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 231 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |