ARM64: configs: tizen: Adjust for mipi csi camera of rpi5
[platform/kernel/linux-rpi.git] / include / net / netfilter / nf_conntrack_act_ct.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef _NF_CONNTRACK_ACT_CT_H
4 #define _NF_CONNTRACK_ACT_CT_H
5
6 #include <net/netfilter/nf_conntrack.h>
7 #include <linux/netfilter/nf_conntrack_common.h>
8 #include <net/netfilter/nf_conntrack_extend.h>
9
10 struct nf_conn_act_ct_ext {
11         int ifindex[IP_CT_DIR_MAX];
12 };
13
14 static inline struct nf_conn_act_ct_ext *nf_conn_act_ct_ext_find(const struct nf_conn *ct)
15 {
16 #if IS_ENABLED(CONFIG_NET_ACT_CT)
17         return nf_ct_ext_find(ct, NF_CT_EXT_ACT_CT);
18 #else
19         return NULL;
20 #endif
21 }
22
23 static inline void nf_conn_act_ct_ext_fill(struct sk_buff *skb, struct nf_conn *ct,
24                                            enum ip_conntrack_info ctinfo)
25 {
26 #if IS_ENABLED(CONFIG_NET_ACT_CT)
27         struct nf_conn_act_ct_ext *act_ct_ext;
28
29         act_ct_ext = nf_conn_act_ct_ext_find(ct);
30         if (dev_net(skb->dev) == &init_net && act_ct_ext)
31                 act_ct_ext->ifindex[CTINFO2DIR(ctinfo)] = skb->dev->ifindex;
32 #endif
33 }
34
35 static inline struct
36 nf_conn_act_ct_ext *nf_conn_act_ct_ext_add(struct sk_buff *skb,
37                                            struct nf_conn *ct,
38                                            enum ip_conntrack_info ctinfo)
39 {
40 #if IS_ENABLED(CONFIG_NET_ACT_CT)
41         struct nf_conn_act_ct_ext *act_ct = nf_ct_ext_find(ct, NF_CT_EXT_ACT_CT);
42
43         if (act_ct)
44                 return act_ct;
45
46         act_ct = nf_ct_ext_add(ct, NF_CT_EXT_ACT_CT, GFP_ATOMIC);
47         nf_conn_act_ct_ext_fill(skb, ct, ctinfo);
48         return act_ct;
49 #else
50         return NULL;
51 #endif
52 }
53
54 #endif /* _NF_CONNTRACK_ACT_CT_H */