ALSA: hda - Fix mute control with some ALC262 models
[linux-2.6/mini2440.git] / include / net / netfilter / nf_conntrack_ecache.h
blob0ff0dc69ca4a53b9b3827122e715f1a15c1fa0cc
1 /*
2 * connection tracking event cache.
3 */
5 #ifndef _NF_CONNTRACK_ECACHE_H
6 #define _NF_CONNTRACK_ECACHE_H
7 #include <net/netfilter/nf_conntrack.h>
9 #include <linux/notifier.h>
10 #include <linux/interrupt.h>
11 #include <net/net_namespace.h>
12 #include <net/netfilter/nf_conntrack_expect.h>
14 #ifdef CONFIG_NF_CONNTRACK_EVENTS
15 struct nf_conntrack_ecache {
16 struct nf_conn *ct;
17 unsigned int events;
20 /* This structure is passed to event handler */
21 struct nf_ct_event {
22 struct nf_conn *ct;
23 u32 pid;
24 int report;
27 extern struct atomic_notifier_head nf_conntrack_chain;
28 extern int nf_conntrack_register_notifier(struct notifier_block *nb);
29 extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
31 extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
32 extern void __nf_ct_event_cache_init(struct nf_conn *ct);
33 extern void nf_ct_event_cache_flush(struct net *net);
35 static inline void
36 nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
38 struct net *net = nf_ct_net(ct);
39 struct nf_conntrack_ecache *ecache;
41 local_bh_disable();
42 ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id());
43 if (ct != ecache->ct)
44 __nf_ct_event_cache_init(ct);
45 ecache->events |= event;
46 local_bh_enable();
49 static inline void
50 nf_conntrack_event_report(enum ip_conntrack_events event,
51 struct nf_conn *ct,
52 u32 pid,
53 int report)
55 struct nf_ct_event item = {
56 .ct = ct,
57 .pid = pid,
58 .report = report
60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
64 static inline void
65 nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
67 nf_conntrack_event_report(event, ct, 0, 0);
70 struct nf_exp_event {
71 struct nf_conntrack_expect *exp;
72 u32 pid;
73 int report;
76 extern struct atomic_notifier_head nf_ct_expect_chain;
77 extern int nf_ct_expect_register_notifier(struct notifier_block *nb);
78 extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb);
80 static inline void
81 nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
82 struct nf_conntrack_expect *exp,
83 u32 pid,
84 int report)
86 struct nf_exp_event item = {
87 .exp = exp,
88 .pid = pid,
89 .report = report
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item);
94 static inline void
95 nf_ct_expect_event(enum ip_conntrack_expect_events event,
96 struct nf_conntrack_expect *exp)
98 nf_ct_expect_event_report(event, exp, 0, 0);
101 extern int nf_conntrack_ecache_init(struct net *net);
102 extern void nf_conntrack_ecache_fini(struct net *net);
104 #else /* CONFIG_NF_CONNTRACK_EVENTS */
106 static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
107 struct nf_conn *ct) {}
108 static inline void nf_conntrack_event(enum ip_conntrack_events event,
109 struct nf_conn *ct) {}
110 static inline void nf_conntrack_event_report(enum ip_conntrack_events event,
111 struct nf_conn *ct,
112 u32 pid,
113 int report) {}
114 static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
115 static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
116 struct nf_conntrack_expect *exp) {}
117 static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp,
119 u32 pid,
120 int report) {}
121 static inline void nf_ct_event_cache_flush(struct net *net) {}
123 static inline int nf_conntrack_ecache_init(struct net *net)
125 return 0;
128 static inline void nf_conntrack_ecache_fini(struct net *net)
131 #endif /* CONFIG_NF_CONNTRACK_EVENTS */
133 #endif /*_NF_CONNTRACK_ECACHE_H*/