This makes flow more obvious in case of short-circuit and removes need for prev double pointer & fc recount per queue switch.
Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]> --- include/net/tcp.h | 54 ++++++++++++++++++---------------------------------- 1 files changed, 19 insertions(+), 35 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 2d9949e..5e6c433 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1467,38 +1467,6 @@ static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *s tcp_rb_insert(skb, &tcp_sk(sk)->write_queue_rb); } -static inline struct sk_buff *__tcp_reset_fack_counts(struct sock *sk, - struct sk_buff *skb, - struct sk_buff **prev, - int queue) -{ - unsigned int fc = 0; - - if (*prev != NULL) - fc = TCP_SKB_CB(*prev)->fack_count + tcp_skb_pcount(*prev); - - BUG_ON((*prev != NULL) && !tcp_skb_adjacent(sk, *prev, skb)); - - tcp_for_write_queue_from(skb, sk, queue) { - if ((*prev != NULL) && !tcp_skb_adjacent(sk, *prev, skb)) - break; - - /* Terminate whole search? */ - if (!before(TCP_SKB_CB(skb)->seq, tcp_sk(sk)->snd_nxt) || - TCP_SKB_CB(skb)->fack_count == fc) { - *prev = NULL; - return NULL; - } - - TCP_SKB_CB(skb)->fack_count = fc; - fc += tcp_skb_pcount(skb); - - *prev = skb; - } - - return skb; -} - /* An insert into the middle of the write queue causes the fack * counts in subsequent packets to become invalid, fix them up. * @@ -1509,6 +1477,7 @@ static inline void tcp_reset_fack_counts(struct sock *sk, struct sk_buff *inskb) struct sk_buff *prev; struct sk_buff *skb[2] = {NULL, NULL}; int queue; + unsigned int fc = 0; if (!before(TCP_SKB_CB(inskb)->seq, tcp_sk(sk)->snd_nxt)) return; @@ -1531,6 +1500,9 @@ static inline void tcp_reset_fack_counts(struct sock *sk, struct sk_buff *inskb) skb[otherq] = prev->next; } + if (prev != NULL) + fc = TCP_SKB_CB(prev)->fack_count + tcp_skb_pcount(prev); + while (skb[queue] != (struct sk_buff *)__tcp_list_select(sk, queue)) { /* Lazy find for the other queue */ if (skb[queue] == NULL) { @@ -1540,9 +1512,21 @@ static inline void tcp_reset_fack_counts(struct sock *sk, struct sk_buff *inskb) break; } - skb[queue] = __tcp_reset_fack_counts(sk, skb[queue], &prev, queue); - if (skb[queue] == NULL) - break; + BUG_ON((prev != NULL) && !tcp_skb_adjacent(sk, prev, skb[queue])); + + tcp_for_write_queue_from(skb[queue], sk, queue) { + if ((prev != NULL) && !tcp_skb_adjacent(sk, prev, skb[queue])) + break; + + if (!before(TCP_SKB_CB(skb[queue])->seq, tcp_sk(sk)->snd_nxt) || + TCP_SKB_CB(skb[queue])->fack_count == fc) + return; + + TCP_SKB_CB(skb[queue])->fack_count = fc; + fc += tcp_skb_pcount(skb[queue]); + + prev = skb[queue]; + } queue ^= TCP_WQ_SACKED; } -- 1.5.0.6 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html