Print this page
11553 Want pluggable TCP congestion control algorithms
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com>

@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  * Copyright 2019 Joyent, Inc.
  */
 
 /* This file contains all TCP output processing functions. */
 

@@ -79,10 +79,22 @@
  * speedup is observed for values larger than sixteen.  Zero will
  * disable the optimisation.
  */
 static int tcp_tx_pull_len = 16;
 
+static void
+cc_after_idle(tcp_t *tcp)
+{
+        uint32_t old_cwnd = tcp->tcp_cwnd;
+
+        if (CC_ALGO(tcp)->after_idle != NULL)
+                CC_ALGO(tcp)->after_idle(&tcp->tcp_ccv);
+
+        DTRACE_PROBE3(cwnd__cc__after__idle, tcp_t *, tcp, uint32_t, old_cwnd,
+            uint32_t, tcp->tcp_cwnd);
+}
+
 int
 tcp_wput(queue_t *q, mblk_t *mp)
 {
         conn_t  *connp = Q_TO_CONN(q);
         tcp_t   *tcp;

@@ -217,11 +229,10 @@
         int32_t         mss;
         int32_t         num_sack_blk = 0;
         int32_t         total_hdr_len;
         int32_t         tcp_hdr_len;
         int             rc;
-        tcp_stack_t     *tcps = tcp->tcp_tcps;
         conn_t          *connp = tcp->tcp_connp;
         clock_t         now = LBOLT_FASTPATH;
 
         tcpstate = tcp->tcp_state;
         if (mp == NULL) {

@@ -372,11 +383,11 @@
                 tcp_hdr_len = connp->conn_ht_ulp_len;
         }
 
         if ((tcp->tcp_suna == snxt) && !tcp->tcp_localnet &&
             (TICK_TO_MSEC(now - tcp->tcp_last_recv_time) >= tcp->tcp_rto)) {
-                TCP_SET_INIT_CWND(tcp, mss, tcps->tcps_slow_start_after_idle);
+                cc_after_idle(tcp);
         }
         if (tcpstate == TCPS_SYN_RCVD) {
                 /*
                  * The three-way connection establishment handshake is not
                  * complete yet. We want to queue the data for transmission

@@ -1193,11 +1204,11 @@
          * "Congestion avoidance and control".
          */
         now = LBOLT_FASTPATH;
         if ((tcp->tcp_suna == snxt) && !tcp->tcp_localnet &&
             (TICK_TO_MSEC(now - tcp->tcp_last_recv_time) >= tcp->tcp_rto)) {
-                TCP_SET_INIT_CWND(tcp, mss, tcps->tcps_slow_start_after_idle);
+                cc_after_idle(tcp);
         }
 
         usable = tcp->tcp_swnd;         /* tcp window size */
         if (usable > tcp->tcp_cwnd)
                 usable = tcp->tcp_cwnd; /* congestion window smaller */