diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-08-23 08:11:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-23 08:11:41 -0400 |
commit | 2cf46637b501794d7fe9e365f0a3046f5d1f5dfb (patch) | |
tree | 085f846e6cd31de856af53f861eda250d7721e83 /net/ipv4/tcp_input.c | |
parent | cbe2d128a01315fb4bd55b96cf8b963f5df28ea2 (diff) |
tcp: Add tcp_collapse_one to eliminate duplicated code
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e1b15d4e6171..580f9547ddfe 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4161,6 +4161,18 @@ add_sack: | |||
4161 | } | 4161 | } |
4162 | } | 4162 | } |
4163 | 4163 | ||
4164 | static struct sk_buff *tcp_collapse_one(struct sock *sk, struct sk_buff *skb, | ||
4165 | struct sk_buff_head *list) | ||
4166 | { | ||
4167 | struct sk_buff *next = skb->next; | ||
4168 | |||
4169 | __skb_unlink(skb, list); | ||
4170 | __kfree_skb(skb); | ||
4171 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOLLAPSED); | ||
4172 | |||
4173 | return next; | ||
4174 | } | ||
4175 | |||
4164 | /* Collapse contiguous sequence of skbs head..tail with | 4176 | /* Collapse contiguous sequence of skbs head..tail with |
4165 | * sequence numbers start..end. | 4177 | * sequence numbers start..end. |
4166 | * Segments with FIN/SYN are not collapsed (only because this | 4178 | * Segments with FIN/SYN are not collapsed (only because this |
@@ -4178,11 +4190,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
4178 | for (skb = head; skb != tail;) { | 4190 | for (skb = head; skb != tail;) { |
4179 | /* No new bits? It is possible on ofo queue. */ | 4191 | /* No new bits? It is possible on ofo queue. */ |
4180 | if (!before(start, TCP_SKB_CB(skb)->end_seq)) { | 4192 | if (!before(start, TCP_SKB_CB(skb)->end_seq)) { |
4181 | struct sk_buff *next = skb->next; | 4193 | skb = tcp_collapse_one(sk, skb, list); |
4182 | __skb_unlink(skb, list); | ||
4183 | __kfree_skb(skb); | ||
4184 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOLLAPSED); | ||
4185 | skb = next; | ||
4186 | continue; | 4194 | continue; |
4187 | } | 4195 | } |
4188 | 4196 | ||
@@ -4246,11 +4254,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
4246 | start += size; | 4254 | start += size; |
4247 | } | 4255 | } |
4248 | if (!before(start, TCP_SKB_CB(skb)->end_seq)) { | 4256 | if (!before(start, TCP_SKB_CB(skb)->end_seq)) { |
4249 | struct sk_buff *next = skb->next; | 4257 | skb = tcp_collapse_one(sk, skb, list); |
4250 | __skb_unlink(skb, list); | ||
4251 | __kfree_skb(skb); | ||
4252 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOLLAPSED); | ||
4253 | skb = next; | ||
4254 | if (skb == tail || | 4258 | if (skb == tail || |
4255 | tcp_hdr(skb)->syn || | 4259 | tcp_hdr(skb)->syn || |
4256 | tcp_hdr(skb)->fin) | 4260 | tcp_hdr(skb)->fin) |