]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
sctp: Update SWS avaoidance receiver side algorithm
authorVlad Yasevich <vladislav.yasevich@hp.com>
Mon, 23 Nov 2009 20:53:57 +0000 (15:53 -0500)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Mon, 23 Nov 2009 20:53:57 +0000 (15:53 -0500)
We currently send window update SACKs every time we free up 1 PMTU
worth of data.  That a lot more SACKs then necessary.  Instead, we'll
now send back the actuall window every time we send a sack, and do
window-update SACKs when a fraction of the receive buffer has been
opened.  The fraction is controlled with a sysctl.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
include/net/sctp/constants.h
include/net/sctp/structs.h
net/sctp/associola.c
net/sctp/protocol.c
net/sctp/sm_sideeffect.c
net/sctp/sysctl.c

index 58f714a3b670965a38888a3c594f5455f4de68df..63908840eef0c9b8ad3c10828247fc206ddcd5cd 100644 (file)
@@ -308,6 +308,10 @@ enum { SCTP_MAX_GABS = 16 };
 
 #define SCTP_DEFAULT_MINWINDOW 1500    /* default minimum rwnd size */
 #define SCTP_DEFAULT_MAXWINDOW 65535   /* default rwnd size */
+#define SCTP_DEFAULT_RWND_SHIFT  4     /* by default, update on 1/16 of
+                                        * rcvbuf, which is 1/8 of initial
+                                        * window
+                                        */
 #define SCTP_DEFAULT_MAXSEGMENT 1500   /* MTU size, this is the limit
                                          * to which we will raise the P-MTU.
                                         */
index cd2e18778f8190569f98450842bd16458d76f0b0..90876b657775e20ed0f42ebcc241d542df2520e2 100644 (file)
@@ -231,6 +231,11 @@ extern struct sctp_globals {
        /* Flag to indicate whether computing and verifying checksum
         * is disabled. */
         int checksum_disable;
+
+       /* Threshold for rwnd update SACKS.  Receive buffer shifted this many
+        * bits is an indicator of when to send and window update SACK.
+        */
+       int rwnd_update_shift;
 } sctp_globals;
 
 #define sctp_rto_initial               (sctp_globals.rto_initial)
@@ -267,6 +272,7 @@ extern struct sctp_globals {
 #define sctp_prsctp_enable             (sctp_globals.prsctp_enable)
 #define sctp_auth_enable               (sctp_globals.auth_enable)
 #define sctp_checksum_disable          (sctp_globals.checksum_disable)
+#define sctp_rwnd_upd_shift            (sctp_globals.rwnd_update_shift)
 
 /* SCTP Socket type: UDP or TCP style. */
 typedef enum {
index 8e755ebff3b836f060296132cb2a6b850cab403d..37e982510beabaec356902b75d8d3521477a9bf2 100644 (file)
@@ -1383,8 +1383,9 @@ static inline int sctp_peer_needs_update(struct sctp_association *asoc)
        case SCTP_STATE_SHUTDOWN_RECEIVED:
        case SCTP_STATE_SHUTDOWN_SENT:
                if ((asoc->rwnd > asoc->a_rwnd) &&
-                   ((asoc->rwnd - asoc->a_rwnd) >=
-                    min_t(__u32, (asoc->base.sk->sk_rcvbuf >> 1), asoc->pathmtu)))
+                   ((asoc->rwnd - asoc->a_rwnd) >= max_t(__u32,
+                          (asoc->base.sk->sk_rcvbuf >> sctp_rwnd_upd_shift),
+                          asoc->pathmtu)))
                        return 1;
                break;
        default:
index 08ef203d36ac77a16a0b161e38a146131fb7b835..a3c8988758b1bf35204b3043c247859a8e8d77b2 100644 (file)
@@ -1258,6 +1258,9 @@ SCTP_STATIC __init int sctp_init(void)
        /* Set SCOPE policy to enabled */
        sctp_scope_policy = SCTP_SCOPE_POLICY_ENABLE;
 
+       /* Set the default rwnd update threshold */
+       sctp_rwnd_upd_shift             = SCTP_DEFAULT_RWND_SHIFT;
+
        sctp_sysctl_register();
 
        INIT_LIST_HEAD(&sctp_address_families);
index eda4fe783be5a9d04f5531ce3de0421e75aad3bd..8ae67098e094bd639df49ddab503fa160b983e67 100644 (file)
@@ -217,8 +217,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force,
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_SACK));
        } else {
-               if (asoc->a_rwnd > asoc->rwnd)
-                       asoc->a_rwnd = asoc->rwnd;
+               asoc->a_rwnd = asoc->rwnd;
                sack = sctp_make_sack(asoc);
                if (!sack)
                        goto nomem;
index ab7151da120fb08818666495a25803e90a658087..ae03ded2bf1a4a2a10342a2e1bd5ae2c8210eff8 100644 (file)
@@ -52,6 +52,7 @@ static int int_max = INT_MAX;
 static int sack_timer_min = 1;
 static int sack_timer_max = 500;
 static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
+static int rwnd_scale_max = 16;
 
 extern int sysctl_sctp_mem[3];
 extern int sysctl_sctp_rmem[3];
@@ -284,6 +285,18 @@ static ctl_table sctp_table[] = {
                .extra1         = &zero,
                .extra2         = &addr_scope_max,
        },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "rwnd_update_shift",
+               .data           = &sctp_rwnd_upd_shift,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &one,
+               .extra2         = &rwnd_scale_max,
+       },
+
        { .ctl_name = 0 }
 };