Commit 2249065f authored by Jan Engelhardt's avatar Jan Engelhardt

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: default avatarJan Engelhardt <jengelh@medozas.de>
parent 23f3733d
...@@ -196,25 +196,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, ...@@ -196,25 +196,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
coders :) coders :)
*/ */
/* This is gross, but inline doesn't cut it for avoiding the function static inline int
call in fast path: gcc doesn't inline (needs value tracking?). --RR */ NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb,
struct net_device *in, struct net_device *out,
/* HX: It's slightly less gross now. */ int (*okfn)(struct sk_buff *), int thresh)
{
#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh);
({int __ret; \ if (ret == 1)
if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh)) == 1)\ ret = okfn(skb);
__ret = (okfn)(skb); \ return ret;
__ret;}) }
#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ static inline int
({int __ret; \ NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb,
if ((cond) || (__ret = nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN)) == 1)\ struct net_device *in, struct net_device *out,
__ret = (okfn)(skb); \ int (*okfn)(struct sk_buff *), bool cond)
__ret;}) {
int ret = 1;
if (cond ||
(ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1))
ret = okfn(skb);
return ret;
}
#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ static inline int
NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
struct net_device *in, struct net_device *out,
int (*okfn)(struct sk_buff *))
{
return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN);
}
/* Call setsockopt() */ /* Call setsockopt() */
int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment