diff options
Diffstat (limited to 'include/net/inet_frag.h')
-rw-r--r-- | include/net/inet_frag.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h new file mode 100644 index 000000000000..911c2cd02941 --- /dev/null +++ b/include/net/inet_frag.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __NET_FRAG_H__ | ||
2 | #define __NET_FRAG_H__ | ||
3 | |||
4 | struct inet_frag_queue { | ||
5 | struct hlist_node list; | ||
6 | struct list_head lru_list; /* lru list member */ | ||
7 | spinlock_t lock; | ||
8 | atomic_t refcnt; | ||
9 | struct timer_list timer; /* when will this queue expire? */ | ||
10 | struct sk_buff *fragments; /* list of received fragments */ | ||
11 | ktime_t stamp; | ||
12 | int len; /* total length of orig datagram */ | ||
13 | int meat; | ||
14 | __u8 last_in; /* first/last segment arrived? */ | ||
15 | |||
16 | #define COMPLETE 4 | ||
17 | #define FIRST_IN 2 | ||
18 | #define LAST_IN 1 | ||
19 | }; | ||
20 | |||
21 | #define INETFRAGS_HASHSZ 64 | ||
22 | |||
23 | struct inet_frags_ctl { | ||
24 | int high_thresh; | ||
25 | int low_thresh; | ||
26 | int timeout; | ||
27 | int secret_interval; | ||
28 | }; | ||
29 | |||
30 | struct inet_frags { | ||
31 | struct list_head lru_list; | ||
32 | struct hlist_head hash[INETFRAGS_HASHSZ]; | ||
33 | rwlock_t lock; | ||
34 | u32 rnd; | ||
35 | int nqueues; | ||
36 | int qsize; | ||
37 | atomic_t mem; | ||
38 | struct timer_list secret_timer; | ||
39 | struct inet_frags_ctl *ctl; | ||
40 | |||
41 | unsigned int (*hashfn)(struct inet_frag_queue *); | ||
42 | void (*destructor)(struct inet_frag_queue *); | ||
43 | void (*skb_free)(struct sk_buff *); | ||
44 | }; | ||
45 | |||
46 | void inet_frags_init(struct inet_frags *); | ||
47 | void inet_frags_fini(struct inet_frags *); | ||
48 | |||
49 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); | ||
50 | void inet_frag_destroy(struct inet_frag_queue *q, | ||
51 | struct inet_frags *f, int *work); | ||
52 | int inet_frag_evictor(struct inet_frags *f); | ||
53 | |||
54 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) | ||
55 | { | ||
56 | if (atomic_dec_and_test(&q->refcnt)) | ||
57 | inet_frag_destroy(q, f, NULL); | ||
58 | } | ||
59 | |||
60 | #endif | ||