netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kaber@trash.net
To: davem@davemloft.net
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 01/28] netfilter: nf_conntrack_reasm: add fast path for in-order fragments
Date: Mon,  2 Aug 2010 21:57:18 +0200	[thread overview]
Message-ID: <1280779065-9333-2-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1280779065-9333-1-git-send-email-kaber@trash.net>

From: Changli Gao <xiaosuo@gmail.com>

As the fragments are sent in order in most of OSes, such as Windows, Darwin and
FreeBSD, it is likely the new fragments are at the end of the inet_frag_queue.
In the fast path, we check if the skb at the end of the inet_frag_queue is the
prev we expect.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 9254008..098a050 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -269,6 +269,11 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
 	 * in the chain of fragments so far.  We must know where to put
 	 * this fragment, right?
 	 */
+	prev = fq->q.fragments_tail;
+	if (!prev || NFCT_FRAG6_CB(prev)->offset < offset) {
+		next = NULL;
+		goto found;
+	}
 	prev = NULL;
 	for (next = fq->q.fragments; next != NULL; next = next->next) {
 		if (NFCT_FRAG6_CB(next)->offset >= offset)
@@ -276,6 +281,7 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
 		prev = next;
 	}
 
+found:
 	/* We found where to put this one.  Check for overlap with
 	 * preceding fragment, and, if needed, align things so that
 	 * any overlaps are eliminated.
@@ -341,6 +347,8 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
 
 	/* Insert this fragment in the chain of fragments. */
 	skb->next = next;
+	if (!next)
+		fq->q.fragments_tail = skb;
 	if (prev)
 		prev->next = skb;
 	else
@@ -464,6 +472,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
 					  head->csum);
 
 	fq->q.fragments = NULL;
+	fq->q.fragments_tail = NULL;
 
 	/* all original skbs are linked into the NFCT_FRAG6_CB(head).orig */
 	fp = skb_shinfo(head)->frag_list;
-- 
1.7.1


  reply	other threads:[~2010-08-02 19:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 19:57 [PATCH 00/28] netfilter: netfilter update kaber
2010-08-02 19:57 ` kaber [this message]
2010-08-02 19:57 ` [PATCH 02/28] netfilter: ipt_REJECT: postpone the checksum calculation kaber
2010-08-02 19:57 ` [PATCH 03/28] netfilter: ipt_REJECT: avoid touching dst ref kaber
2010-08-02 19:57 ` [PATCH 04/28] ipvs: Kconfig cleanup kaber
2010-08-02 19:57 ` [PATCH 05/28] ipvs: lvs sctp protocol handler is incorrectly invoked ip_vs_app_pkt_out kaber
2010-08-02 19:57 ` [PATCH 06/28] netfilter: xt_TPROXY: the length of lines should be within 80 kaber
2010-08-02 19:57 ` [PATCH 07/28] nfnetlink_log: do not expose NFULNL_COPY_DISABLED to user-space kaber
2010-08-02 19:57 ` [PATCH 08/28] netfilter: nf_ct_tcp: fix flow recovery with TCP window tracking enabled kaber
2010-08-02 19:57 ` [PATCH 09/28] netfilter: add CHECKSUM target kaber
2010-08-02 19:57 ` [PATCH 10/28] netfilter: correct CHECKSUM header and export it kaber
2010-08-02 19:57 ` [PATCH 11/28] netfilter: xt_ipvs (netfilter matcher for IPVS) kaber
2010-08-02 19:57 ` [PATCH 12/28] IPVS: make friends with nf_conntrack kaber
2010-08-02 19:57 ` [PATCH 13/28] IPVS: make FTP work with full NAT support kaber
2010-08-02 19:57 ` [PATCH 14/28] netfilter: add xt_cpu match kaber
2010-08-02 19:57 ` [PATCH 15/28] netfilter: nf_nat_core: merge the same lines kaber
2010-08-02 19:57 ` [PATCH 16/28] netfilter: arptables: use arp_hdr_len() kaber
2010-08-02 19:57 ` [PATCH 17/28] netfilter: xt_quota: use per-rule spin lock kaber
2010-08-02 19:57 ` [PATCH 18/28] xt_quota: report initial quota value instead of current value to userspace kaber
2010-08-02 19:57 ` [PATCH 19/28] netfilter: ip6tables: use skb->len for accounting kaber
2010-08-02 19:57 ` [PATCH 20/28] netfilter: iptables: " kaber
2010-08-02 19:57 ` [PATCH 21/28] netfilter: {ip,ip6,arp}_tables: dont block bottom half more than necessary kaber
2010-08-02 19:57 ` [PATCH 22/28] netfilter: nf_conntrack_extend: introduce __nf_ct_ext_exist() kaber
2010-08-02 19:57 ` [PATCH 23/28] ipvs: remove EXPERIMENTAL tag kaber
2010-08-02 19:57 ` [PATCH 24/28] ipvs: provide default ip_vs_conn_{in,out}_get_proto kaber
2010-08-02 19:57 ` [PATCH 25/28] netfilter: nf_nat: use local variable hdrlen kaber
2010-08-02 19:57 ` [PATCH 26/28] netfilter: nf_nat: make unique_tuple return void kaber
2010-08-02 19:57 ` [PATCH 27/28] netfilter: nf_nat: don't check if the tuple is unique when there isn't any other choice kaber
2010-08-02 19:57 ` [PATCH 28/28] netfilter: nf_conntrack_acct: use skb->len for accounting kaber
2010-08-02 22:24 ` [PATCH 00/28] netfilter: netfilter update David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280779065-9333-2-git-send-email-kaber@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).