Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/topcliff-pch' into...
[sfrench/cifs-2.6.git] / include / linux / netfilter / ipset / ip_set_skbinfo.h
1 #ifndef _IP_SET_SKBINFO_H
2 #define _IP_SET_SKBINFO_H
3
4 /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #ifdef __KERNEL__
12
13 static inline void
14 ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
15                    const struct ip_set_ext *ext,
16                    struct ip_set_ext *mext, u32 flags)
17 {
18         mext->skbinfo = *skbinfo;
19 }
20
21 static inline bool
22 ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo)
23 {
24         /* Send nonzero parameters only */
25         return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
26                 nla_put_net64(skb, IPSET_ATTR_SKBMARK,
27                               cpu_to_be64((u64)skbinfo->skbmark << 32 |
28                                           skbinfo->skbmarkmask),
29                               IPSET_ATTR_PAD)) ||
30                (skbinfo->skbprio &&
31                 nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
32                               cpu_to_be32(skbinfo->skbprio))) ||
33                (skbinfo->skbqueue &&
34                 nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
35                               cpu_to_be16(skbinfo->skbqueue)));
36 }
37
38 static inline void
39 ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
40                     const struct ip_set_ext *ext)
41 {
42         *skbinfo = ext->skbinfo;
43 }
44
45 #endif /* __KERNEL__ */
46 #endif /* _IP_SET_SKBINFO_H */