Commit | Line | Data |
---|---|---|
5ab11c98 PE |
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 | ||
7eb95156 PE |
21 | #define INETFRAGS_HASHSZ 64 |
22 | ||
04128f23 PE |
23 | struct inet_frags_ctl { |
24 | int high_thresh; | |
25 | int low_thresh; | |
26 | int timeout; | |
27 | int secret_interval; | |
28 | }; | |
29 | ||
7eb95156 PE |
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; | |
1e4b8287 | 36 | int qsize; |
7eb95156 PE |
37 | atomic_t mem; |
38 | struct timer_list secret_timer; | |
04128f23 | 39 | struct inet_frags_ctl *ctl; |
321a3a99 PE |
40 | |
41 | unsigned int (*hashfn)(struct inet_frag_queue *); | |
1e4b8287 PE |
42 | void (*destructor)(struct inet_frag_queue *); |
43 | void (*skb_free)(struct sk_buff *); | |
2588fe1d PE |
44 | int (*equal)(struct inet_frag_queue *q1, |
45 | struct inet_frag_queue *q2); | |
7eb95156 PE |
46 | }; |
47 | ||
48 | void inet_frags_init(struct inet_frags *); | |
49 | void inet_frags_fini(struct inet_frags *); | |
50 | ||
277e650d | 51 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); |
1e4b8287 PE |
52 | void inet_frag_destroy(struct inet_frag_queue *q, |
53 | struct inet_frags *f, int *work); | |
8e7999c4 | 54 | int inet_frag_evictor(struct inet_frags *f); |
2588fe1d PE |
55 | struct inet_frag_queue *inet_frag_intern(struct inet_frag_queue *q, |
56 | struct inet_frags *f, unsigned int hash); | |
277e650d | 57 | |
762cc408 PE |
58 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
59 | { | |
60 | if (atomic_dec_and_test(&q->refcnt)) | |
61 | inet_frag_destroy(q, f, NULL); | |
62 | } | |
63 | ||
5ab11c98 | 64 | #endif |