转:http://blog.csdn.net/nerdx/article/details/12656699
-
-
-
-
-
1.1 static void ip_evictor(void)
-
{
-
struct ipq *qp;
-
struct list_head *tmp;
-
int work;
-
-
work = atomic_read(&ip_frag_mem) - sysctl_ipfrag_low_thresh;
-
if (work <= 0)
-
return;
-
-
while (work > 0) {
-
read_lock(&ipfrag_lock);
-
if (list_empty(&ipq_lru_list)) {
-
read_unlock(&ipfrag_lock);
-
return;
-
}
-
-
tmp = ipq_lru_list.next;
-
qp = list_entry(tmp, struct ipq, lru_list);
-
atomic_inc(&qp->refcnt);
-
read_unlock(&ipfrag_lock);
-
-
spin_lock(&qp->lock);
-
if (!(qp->last_in&COMPLETE))
-
ipq_kill(qp);
-
spin_unlock(&qp->lock);
-
-
ipq_put(qp, &work);
-
IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
-
}
-
}
-
-
1.2 static void ipq_kill(struct ipq *ipq)
-
{
-
if (del_timer(&ipq->timer))
-
atomic_dec(&ipq->refcnt);
-
-
if (!(ipq->last_in & COMPLETE)) {
-
ipq_unlink(ipq);
-
atomic_dec(&ipq->refcnt);
-
ipq->last_in |= COMPLETE;
-
}
-
}
-
-
1.3 static __inline__ void ipq_put(struct ipq *ipq, int *work)
-
{
-
if (atomic_dec_and_test(&ipq->refcnt))
-
ip_frag_destroy(ipq, work);
-
}
-
-
1.4 static void ip_frag_destroy(struct ipq *qp, int *work)
-
{
-
struct sk_buff *fp;
-
-
fp = qp->fragments;
-
while (fp) {
-
struct sk_buff *xp = fp->next;
-
-
frag_kfree_skb(fp, work);
-
fp = xp;
-
}
-
-
frag_free_queue(qp, work);
-
}
-
阅读(776) | 评论(0) | 转发(0) |