Patchwork [2.6.27] tcp_htcp: last_cong bug fix

login
register
mail settings
Submitter Douglas Leith
Date Nov. 9, 2008, 7:09 p.m.
Message ID <0E5A87BC-8FA8-40A5-8032-9FA18D07D7CE@nuim.ie>
Download mbox | patch
Permalink /patch/7945/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Douglas Leith - Nov. 9, 2008, 7:09 p.m.
This patch fixes a minor bug in tcp_htcp.c which has been highlighted  
by Lachlan Andrew and Lawrence Stewart.   Currently, the time since  
the last congestion event, which is stored in variable last_cong, is  
reset whenever there is a state change into TCP_CA_Open.  This  
includes transitions of the type TCP_CA_Open->TCP_CA_Disorder- 
 >TCP_CA_Open which are not associated with backoff of cwnd.  The  
patch changes last_cong to be updated only on transitions into  
TCP_CA_Open that occur after experiencing the congestion-related  
states TCP_CA_Loss, TCP_CA_Recovery, TCP_CA_CWR.

Doug

  }
@@ -265,12 +268,15 @@
  static void htcp_state(struct sock *sk, u8 new_state)
  {
         switch (new_state) {
-       case TCP_CA_Open:
+       case TCP_CA_Open:
                 {
                         struct htcp *ca = inet_csk_ca(sk);
-                       ca->last_cong = jiffies;
+                       if (ca->undo_last_cong) {
+                               ca->last_cong=jiffies;
+                               ca->undo_last_cong=0;
+                       }
                 }
-               break;
+               break;
         case TCP_CA_CWR:
         case TCP_CA_Recovery:
         case TCP_CA_Loss:



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Nov. 11, 2008, 5:50 a.m.
From: Douglas Leith <Doug.Leith@nuim.ie>
Date: Sun, 09 Nov 2008 19:09:24 +0000

> This patch fixes a minor bug in tcp_htcp.c which has been
> highlighted by Lachlan Andrew and Lawrence Stewart.  Currently, the
> time since the last congestion event, which is stored in variable
> last_cong, is reset whenever there is a state change into
> TCP_CA_Open.  This includes transitions of the type
> TCP_CA_Open->TCP_CA_Disorder->TCP_CA_Open which are not associated
> with backoff of cwnd.  The patch changes last_cong to be updated
> only on transitions into TCP_CA_Open that occur after experiencing
> the congestion-related states TCP_CA_Loss, TCP_CA_Recovery,
> TCP_CA_CWR.

Thank you for this fix.  Could you fix a few things up for
me and resubmit this?

1) Please provide a proper Signed-off-by: line as per
   linux/Documentation/SubmittingPatches

2) Please -p1 root your patches at the top level of
   the kernel source tree, again the SubmittingPatches
   document helps explain ways to do this

3) Please fix up a few coding style errors, such as:

> +               ca->undo_last_cong=0; // flag that ca->last_cong is not to be reset when enter TCP_CA_Open state

   Please don't use C++ style comments, use normal C ones,
   and please don't let the line exceed much more than 80
   columns.

   Also, please put one space on each side of the equal sign in the
   assignment.

> +                       if (ca->undo_last_cong) {
> +                               ca->last_cong=jiffies;
> +                               ca->undo_last_cong=0;
> +                       }

   Again, please put spaces around the assignment equal sign.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- tcp_htcp.c   2008-11-05 15:50:18.000000000 +0000
+++ tcp_htcp.c.new       2008-11-08 07:11:18.000000000 +0000
@@ -69,9 +69,12 @@ 
         const struct tcp_sock *tp = tcp_sk(sk);
         struct htcp *ca = inet_csk_ca(sk);

-       ca->last_cong = ca->undo_last_cong;
-       ca->maxRTT = ca->undo_maxRTT;
-       ca->old_maxB = ca->undo_old_maxB;
+       if (ca->undo_last_cong) {
+               ca->last_cong = ca->undo_last_cong;
+               ca->maxRTT = ca->undo_maxRTT;
+               ca->old_maxB = ca->undo_old_maxB;
+               ca->undo_last_cong=0; // flag that ca->last_cong is  
not to be reset when enter TCP_CA_Open state
+       }

         return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta);