From: Tom Quetchenbach <virtualphtn@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH 2/2] David Miller's rbtree patches for 2.6.22.6
Date: Wed, 19 Sep 2007 18:44:03 -0700 [thread overview]
Message-ID: <46F1D063.6030005@gmail.com> (raw)
In-Reply-To: <46F1D00B.6030108@gmail.com>
Patch 2: fixes to fack_counts and enhancement of SACK fast path
-Tom
---
diff -ur linux-2.6.22.6-rbtree-davem-fixed/include/net/tcp.h linux-2.6.22.6-rbtree-tomq/include/net/tcp.h
--- linux-2.6.22.6-rbtree-davem-fixed/include/net/tcp.h 2007-09-19 17:36:07.000000000 -0700
+++ linux-2.6.22.6-rbtree-tomq/include/net/tcp.h 2007-09-19 12:22:06.000000000 -0700
@@ -1213,6 +1213,11 @@
sk->sk_send_head = tcp_write_queue_next(sk, skb);
if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
sk->sk_send_head = NULL;
+ else
+ /* update fack_count of send_head. Since we've sent skb already,
+ * its packet count must be set by now. */
+ TCP_SKB_CB(sk->sk_send_head)->fack_count =
+ TCP_SKB_CB(skb)->fack_count + tcp_skb_pcount(skb);
/* Don't override Nagle indefinately with F-RTO */
if (tp->frto_counter == 2)
tp->frto_counter = 3;
@@ -1310,19 +1315,22 @@
/* An insert into the middle of the write queue causes the fack
* counts in subsequent packets to become invalid, fix them up.
*/
-static inline void tcp_reset_fack_counts(struct sock *sk, struct sk_buff *first)
+static inline void tcp_reset_fack_counts(struct sock *sk, struct sk_buff *skb)
{
- struct sk_buff *prev = first->prev;
+ struct sk_buff *prev = skb->prev;
unsigned int fc = 0;
if (prev != (struct sk_buff *) &sk->sk_write_queue)
fc = TCP_SKB_CB(prev)->fack_count + tcp_skb_pcount(prev);
- while (first != (struct sk_buff *)&sk->sk_write_queue) {
- TCP_SKB_CB(first)->fack_count = fc;
+ while (skb != (struct sk_buff *)&sk->sk_write_queue) {
+ if (TCP_SKB_CB(skb)->fack_count == fc || !tcp_skb_pcount(skb))
+ break;
- fc += tcp_skb_pcount(first);
- first = first->next;
+ TCP_SKB_CB(skb)->fack_count = fc;
+
+ fc += tcp_skb_pcount(skb);
+ skb = skb->next;
}
}
diff -ur linux-2.6.22.6-rbtree-davem-fixed/net/ipv4/tcp_input.c linux-2.6.22.6-rbtree-tomq/net/ipv4/tcp_input.c
--- linux-2.6.22.6-rbtree-davem-fixed/net/ipv4/tcp_input.c 2007-09-13 18:23:16.000000000 -0700
+++ linux-2.6.22.6-rbtree-tomq/net/ipv4/tcp_input.c 2007-09-19 12:27:42.000000000 -0700
@@ -956,6 +956,7 @@
int fack_count_base;
int i;
int first_sack_index;
+ u32 prev_end_seq = 0;
if (!tp->sacked_out)
tp->fackets_out = 0;
@@ -1000,6 +1001,7 @@
if (i == 0) {
if (tp->recv_sack_cache[i].start_seq != start_seq)
flag = 0;
+ prev_end_seq = ntohl(tp->recv_sack_cache[i].end_seq);
} else {
if ((tp->recv_sack_cache[i].start_seq != start_seq) ||
(tp->recv_sack_cache[i].end_seq != end_seq))
@@ -1016,9 +1018,16 @@
first_sack_index = 0;
if (flag)
+ /* all that has changed is end of first SACK block. So all we
+ * need to do is tag those skbs that were'nt tagged last time. */
num_sacks = 1;
else {
int j;
+
+ /* more than just end of first SACK block has changed; invalidate
+ * prev_end_seq */
+
+ prev_end_seq = 0;
/* order SACK blocks to allow in order walk of the retrans queue */
for (i = num_sacks-1; i > 0; i--) {
@@ -1051,6 +1060,8 @@
int fack_count;
int dup_sack = (found_dup_sack && (i == first_sack_index));
+ if (prev_end_seq) start_seq = prev_end_seq;
+
skb = tcp_write_queue_find(sk, start_seq);
if (!skb)
continue;
next prev parent reply other threads:[~2007-09-20 1:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 1:39 [PATCH 0/2] David Miller's rbtree patches for 2.6.22.6 Tom Quetchenbach
2007-09-20 1:42 ` [PATCH 1/2] " Tom Quetchenbach
2007-09-20 1:44 ` Tom Quetchenbach [this message]
2007-09-21 13:48 ` [PATCH 2/2] " Ilpo Järvinen
2007-09-20 21:27 ` [PATCH 1/2 revised] " Tom Quetchenbach
2007-09-21 13:37 ` [PATCH 1/2] " Ilpo Järvinen
2007-09-21 14:08 ` [PATCH 0/2] " Ilpo Järvinen
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=46F1D063.6030005@gmail.com \
--to=virtualphtn@gmail.com \
--cc=netdev@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).