inet_frag.h (a43e61842ec55baa486d60eed2a19af67ba78b9f) inet_frag.h (104b4e5139fe384431ac11c3b8a6cf4a529edf4a)
1#ifndef __NET_FRAG_H__
2#define __NET_FRAG_H__
3
4#include <linux/percpu_counter.h>
5
6struct netns_frags {
7 /* The percpu_counter "mem" need to be cacheline aligned.
8 * mem.count must not share cacheline with other writers

--- 78 unchanged lines hidden (view full) ---

87 /* The first call to hashfn is responsible to initialize
88 * rnd. This is best done with net_get_random_once.
89 *
90 * rnd_seqlock is used to let hash insertion detect
91 * when it needs to re-lookup the hash chain to use.
92 */
93 u32 rnd;
94 seqlock_t rnd_seqlock;
1#ifndef __NET_FRAG_H__
2#define __NET_FRAG_H__
3
4#include <linux/percpu_counter.h>
5
6struct netns_frags {
7 /* The percpu_counter "mem" need to be cacheline aligned.
8 * mem.count must not share cacheline with other writers

--- 78 unchanged lines hidden (view full) ---

87 /* The first call to hashfn is responsible to initialize
88 * rnd. This is best done with net_get_random_once.
89 *
90 * rnd_seqlock is used to let hash insertion detect
91 * when it needs to re-lookup the hash chain to use.
92 */
93 u32 rnd;
94 seqlock_t rnd_seqlock;
95 unsigned int qsize;
95 int qsize;
96
97 unsigned int (*hashfn)(const struct inet_frag_queue *);
98 bool (*match)(const struct inet_frag_queue *q,
99 const void *arg);
100 void (*constructor)(struct inet_frag_queue *q,
101 const void *arg);
102 void (*destructor)(struct inet_frag_queue *);
103 void (*frag_expire)(unsigned long data);

--- 45 unchanged lines hidden (view full) ---

149
150static inline int frag_mem_limit(struct netns_frags *nf)
151{
152 return percpu_counter_read(&nf->mem);
153}
154
155static inline void sub_frag_mem_limit(struct netns_frags *nf, int i)
156{
96
97 unsigned int (*hashfn)(const struct inet_frag_queue *);
98 bool (*match)(const struct inet_frag_queue *q,
99 const void *arg);
100 void (*constructor)(struct inet_frag_queue *q,
101 const void *arg);
102 void (*destructor)(struct inet_frag_queue *);
103 void (*frag_expire)(unsigned long data);

--- 45 unchanged lines hidden (view full) ---

149
150static inline int frag_mem_limit(struct netns_frags *nf)
151{
152 return percpu_counter_read(&nf->mem);
153}
154
155static inline void sub_frag_mem_limit(struct netns_frags *nf, int i)
156{
157 __percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
157 percpu_counter_add_batch(&nf->mem, -i, frag_percpu_counter_batch);
158}
159
160static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
161{
158}
159
160static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
161{
162 __percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
162 percpu_counter_add_batch(&nf->mem, i, frag_percpu_counter_batch);
163}
164
165static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
166{
167 return percpu_counter_sum_positive(&nf->mem);
168}
169
170/* RFC 3168 support :
171 * We want to check ECN values of all fragments, do detect invalid combinations.
172 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
173 */
174#define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */
175#define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */
176#define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */
177#define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */
178
179extern const u8 ip_frag_ecn_table[16];
180
181#endif
163}
164
165static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
166{
167 return percpu_counter_sum_positive(&nf->mem);
168}
169
170/* RFC 3168 support :
171 * We want to check ECN values of all fragments, do detect invalid combinations.
172 * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
173 */
174#define IPFRAG_ECN_NOT_ECT 0x01 /* one frag had ECN_NOT_ECT */
175#define IPFRAG_ECN_ECT_1 0x02 /* one frag had ECN_ECT_1 */
176#define IPFRAG_ECN_ECT_0 0x04 /* one frag had ECN_ECT_0 */
177#define IPFRAG_ECN_CE 0x08 /* one frag had ECN_CE */
178
179extern const u8 ip_frag_ecn_table[16];
180
181#endif