inet: frag: remove lru list
[deliverable/linux.git] / include / net / inet_frag.h
index 6f59de98dabde3be0daa202f8be4528d49676f7f..90d21ea62c593bcca5c5b115c6ef600847e7ff2d 100644 (file)
@@ -4,10 +4,6 @@
 #include <linux/percpu_counter.h>
 
 struct netns_frags {
-       int                     nqueues;
-       struct list_head        lru_list;
-       spinlock_t              lru_lock;
-
        /* The percpu_counter "mem" need to be cacheline aligned.
         *  mem.count must not share cacheline with other writers
         */
@@ -22,7 +18,6 @@ struct netns_frags {
 struct inet_frag_queue {
        spinlock_t              lock;
        struct timer_list       timer;      /* when will this queue expire? */
-       struct list_head        lru_list;   /* lru list member */
        struct hlist_node       list;
        atomic_t                refcnt;
        struct sk_buff          *fragments; /* list of received fragments */
@@ -32,6 +27,7 @@ struct inet_frag_queue {
        int                     meat;
        __u8                    last_in;    /* first/last segment arrived? */
 
+#define INET_FRAG_EVICTED      8
 #define INET_FRAG_COMPLETE     4
 #define INET_FRAG_FIRST_IN     2
 #define INET_FRAG_LAST_IN      1
@@ -48,7 +44,7 @@ struct inet_frag_queue {
  *            rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or
  *            struct frag_queue))
  */
-#define INETFRAGS_MAXDEPTH             128
+#define INETFRAGS_MAXDEPTH     128
 
 struct inet_frag_bucket {
        struct hlist_head       chain;
@@ -65,16 +61,20 @@ struct inet_frags {
        int                     secret_interval;
        struct timer_list       secret_timer;
 
+       struct work_struct      frags_work;
+       unsigned int next_bucket;
+
        /* The first call to hashfn is responsible to initialize
         * rnd. This is best done with net_get_random_once.
         */
        u32                     rnd;
        int                     qsize;
 
-       unsigned int            (*hashfn)(struct inet_frag_queue *);
-       bool                    (*match)(struct inet_frag_queue *q, void *arg);
+       unsigned int            (*hashfn)(const struct inet_frag_queue *);
+       bool                    (*match)(const struct inet_frag_queue *q,
+                                        const void *arg);
        void                    (*constructor)(struct inet_frag_queue *q,
-                                               void *arg);
+                                              const void *arg);
        void                    (*destructor)(struct inet_frag_queue *);
        void                    (*skb_free)(struct sk_buff *);
        void                    (*frag_expire)(unsigned long data);
@@ -87,9 +87,7 @@ void inet_frags_init_net(struct netns_frags *nf);
 void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
 
 void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
-void inet_frag_destroy(struct inet_frag_queue *q,
-                               struct inet_frags *f, int *work);
-int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force);
+void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f);
 struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
                struct inet_frags *f, void *key, unsigned int hash)
        __releases(&f->lock);
@@ -99,7 +97,7 @@ void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
 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);
+               inet_frag_destroy(q, f);
 }
 
 /* Memory Tracking Functions. */
@@ -131,9 +129,9 @@ static inline void init_frag_mem_limit(struct netns_frags *nf)
        percpu_counter_init(&nf->mem, 0);
 }
 
-static inline int sum_frag_mem_limit(struct netns_frags *nf)
+static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
 {
-       int res;
+       unsigned int res;
 
        local_bh_disable();
        res = percpu_counter_sum_positive(&nf->mem);
@@ -142,31 +140,6 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf)
        return res;
 }
 
-static inline void inet_frag_lru_move(struct inet_frag_queue *q)
-{
-       spin_lock(&q->net->lru_lock);
-       if (!list_empty(&q->lru_list))
-               list_move_tail(&q->lru_list, &q->net->lru_list);
-       spin_unlock(&q->net->lru_lock);
-}
-
-static inline void inet_frag_lru_del(struct inet_frag_queue *q)
-{
-       spin_lock(&q->net->lru_lock);
-       list_del_init(&q->lru_list);
-       q->net->nqueues--;
-       spin_unlock(&q->net->lru_lock);
-}
-
-static inline void inet_frag_lru_add(struct netns_frags *nf,
-                                    struct inet_frag_queue *q)
-{
-       spin_lock(&nf->lru_lock);
-       list_add_tail(&q->lru_list, &nf->lru_list);
-       q->net->nqueues++;
-       spin_unlock(&nf->lru_lock);
-}
-
 /* RFC 3168 support :
  * We want to check ECN values of all fragments, do detect invalid combinations.
  * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.
This page took 0.029877 seconds and 5 git commands to generate.