On Sun, Jul 5, 2020 at 7:34 AM <wenxu@xxxxxxxxx> wrote: > +static int nf_ct_frag_reinit(struct ipq *qp) > +{ > + unsigned int sum_truesize = 0; > + > + if (!mod_timer(&qp->q.timer, jiffies + qp->q.fqdir->timeout)) { > + refcount_inc(&qp->q.refcnt); > + return -ETIMEDOUT; > + } > + > + sum_truesize = inet_frag_rbtree_purge(&qp->q.rb_fragments); > + sub_frag_mem_limit(qp->q.fqdir, sum_truesize); > + > + qp->q.flags = 0; > + qp->q.len = 0; > + qp->q.meat = 0; > + qp->q.rb_fragments = RB_ROOT; > + qp->q.fragments_tail = NULL; > + qp->q.last_run_head = NULL; > + qp->iif = 0; > + qp->ecn = 0; > + > + return 0; > +} > + > +static struct ipq *ip_find(struct net *net, struct iphdr *iph, > + u32 user, int vif) > +{ > + struct frag_v4_compare_key key = { > + .saddr = iph->saddr, > + .daddr = iph->daddr, > + .user = user, > + .vif = vif, > + .id = iph->id, > + .protocol = iph->protocol, > + }; > + struct inet_frag_queue *q; > + > + q = inet_frag_find(net->ipv4.fqdir, &key); > + if (!q) > + return NULL; > + > + return container_of(q, struct ipq, q); > +} Please avoid copy-n-paste code by finding a proper way to reuse them. Thanks.