Blame view

include/net/inet_frag.h 1.97 KB
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
1
2
  #ifndef __NET_FRAG_H__
  #define __NET_FRAG_H__
ac18e7509   Pavel Emelyanov   [NETNS][FRAGS]: M...
3
  struct netns_frags {
e5a2bb842   Pavel Emelyanov   [NETNS][FRAGS]: M...
4
  	int			nqueues;
6ddc08222   Pavel Emelyanov   [NETNS][FRAGS]: M...
5
  	atomic_t		mem;
3140c25c8   Pavel Emelyanov   [NETNS][FRAGS]: M...
6
  	struct list_head	lru_list;
b2fd5321d   Pavel Emelyanov   [NETNS][FRAGS]: M...
7
8
9
  
  	/* sysctls */
  	int			timeout;
e31e0bdc7   Pavel Emelyanov   [NETNS][FRAGS]: M...
10
11
  	int			high_thresh;
  	int			low_thresh;
ac18e7509   Pavel Emelyanov   [NETNS][FRAGS]: M...
12
  };
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
13
14
  struct inet_frag_queue {
  	struct hlist_node	list;
ac18e7509   Pavel Emelyanov   [NETNS][FRAGS]: M...
15
  	struct netns_frags	*net;
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
16
17
18
19
20
  	struct list_head	lru_list;   /* lru list member */
  	spinlock_t		lock;
  	atomic_t		refcnt;
  	struct timer_list	timer;      /* when will this queue expire? */
  	struct sk_buff		*fragments; /* list of received fragments */
d6bebca92   Changli Gao   fragment: add fas...
21
  	struct sk_buff		*fragments_tail;
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
22
23
24
25
  	ktime_t			stamp;
  	int			len;        /* total length of orig datagram */
  	int			meat;
  	__u8			last_in;    /* first/last segment arrived? */
bc578a54f   Joe Perches   [NET]: Rename ine...
26
27
28
  #define INET_FRAG_COMPLETE	4
  #define INET_FRAG_FIRST_IN	2
  #define INET_FRAG_LAST_IN	1
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
29
  };
7eb95156d   Pavel Emelyanov   [INET]: Collect f...
30
31
32
  #define INETFRAGS_HASHSZ		64
  
  struct inet_frags {
7eb95156d   Pavel Emelyanov   [INET]: Collect f...
33
34
35
  	struct hlist_head	hash[INETFRAGS_HASHSZ];
  	rwlock_t		lock;
  	u32			rnd;
1e4b82873   Pavel Emelyanov   [INET]: Consolida...
36
  	int			qsize;
3b4bc4a2b   Pavel Emelyanov   [NETNS][FRAGS]: I...
37
  	int			secret_interval;
7eb95156d   Pavel Emelyanov   [INET]: Collect f...
38
  	struct timer_list	secret_timer;
321a3a99e   Pavel Emelyanov   [INET]: Consolida...
39
40
  
  	unsigned int		(*hashfn)(struct inet_frag_queue *);
c6fda2822   Pavel Emelyanov   [INET]: Consolida...
41
42
  	void			(*constructor)(struct inet_frag_queue *q,
  						void *arg);
1e4b82873   Pavel Emelyanov   [INET]: Consolida...
43
44
  	void			(*destructor)(struct inet_frag_queue *);
  	void			(*skb_free)(struct sk_buff *);
abd6523d1   Pavel Emelyanov   [INET]: Consolida...
45
46
  	int			(*match)(struct inet_frag_queue *q,
  						void *arg);
e521db9d7   Pavel Emelyanov   [INET]: Consolida...
47
  	void			(*frag_expire)(unsigned long data);
7eb95156d   Pavel Emelyanov   [INET]: Collect f...
48
49
50
51
  };
  
  void inet_frags_init(struct inet_frags *);
  void inet_frags_fini(struct inet_frags *);
e5a2bb842   Pavel Emelyanov   [NETNS][FRAGS]: M...
52
  void inet_frags_init_net(struct netns_frags *nf);
81566e832   Pavel Emelyanov   [NETNS][FRAGS]: M...
53
  void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
e5a2bb842   Pavel Emelyanov   [NETNS][FRAGS]: M...
54

277e650dd   Pavel Emelyanov   [INET]: Consolida...
55
  void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
1e4b82873   Pavel Emelyanov   [INET]: Consolida...
56
57
  void inet_frag_destroy(struct inet_frag_queue *q,
  				struct inet_frags *f, int *work);
6ddc08222   Pavel Emelyanov   [NETNS][FRAGS]: M...
58
  int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f);
ac18e7509   Pavel Emelyanov   [NETNS][FRAGS]: M...
59
  struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
56bca31ff   Hannes Eder   inet fragments: f...
60
61
  		struct inet_frags *f, void *key, unsigned int hash)
  	__releases(&f->lock);
277e650dd   Pavel Emelyanov   [INET]: Consolida...
62

762cc4080   Pavel Emelyanov   [INET]: Consolida...
63
64
65
66
67
  static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
  {
  	if (atomic_dec_and_test(&q->refcnt))
  		inet_frag_destroy(q, f, NULL);
  }
5ab11c98d   Pavel Emelyanov   [INET]: Move comm...
68
  #endif