summaryrefslogtreecommitdiffstats
path: root/sys/netinet/cc
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2010-12-02 02:32:46 +0000
committerlstewart <lstewart@FreeBSD.org>2010-12-02 02:32:46 +0000
commit6d18efb46ac07ce85d61e51af3e92e375778457b (patch)
treecb35b27ab9b0963b260ad484e997c8b916205c84 /sys/netinet/cc
parent66143c6cf9b9b11b84389c6dde8f6a7b11370370 (diff)
downloadFreeBSD-src-6d18efb46ac07ce85d61e51af3e92e375778457b.zip
FreeBSD-src-6d18efb46ac07ce85d61e51af3e92e375778457b.tar.gz
General cleanup of the NewReno CC module (no functional changes):
- Remove superfluous includes and unhelpful comments. - Alphabetically order functions. - Make functions static. Sponsored by: FreeBSD Foundation MFC after: 9 weeks X-MFC with: r215166
Diffstat (limited to 'sys/netinet/cc')
-rw-r--r--sys/netinet/cc/cc_newreno.c92
1 files changed, 40 insertions, 52 deletions
diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c
index 511186a..c095540 100644
--- a/sys/netinet/cc/cc_newreno.c
+++ b/sys/netinet/cc/cc_newreno.c
@@ -52,41 +52,35 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sysctl.h>
+#include <sys/systm.h>
-#include <net/if.h>
-#include <net/if_var.h>
+#include <net/vnet.h>
#include <netinet/cc.h>
-#include <netinet/in.h>
-#include <netinet/in_pcb.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_var.h>
#include <netinet/cc/cc_module.h>
-void newreno_ack_received(struct cc_var *ccv, uint16_t type);
-void newreno_cong_signal(struct cc_var *ccv, uint32_t type);
-void newreno_post_recovery(struct cc_var *ccv);
-void newreno_after_idle(struct cc_var *ccv);
+static void newreno_ack_received(struct cc_var *ccv, uint16_t type);
+static void newreno_after_idle(struct cc_var *ccv);
+static void newreno_cong_signal(struct cc_var *ccv, uint32_t type);
+static void newreno_post_recovery(struct cc_var *ccv);
struct cc_algo newreno_cc_algo = {
.name = "newreno",
.ack_received = newreno_ack_received,
+ .after_idle = newreno_after_idle,
.cong_signal = newreno_cong_signal,
.post_recovery = newreno_post_recovery,
- .after_idle = newreno_after_idle
};
-/*
- * Increase cwnd on receipt of a successful ACK:
- * if cwnd <= ssthresh, increases by 1 MSS per ACK
- * if cwnd > ssthresh, increase by ~1 MSS per RTT
- */
-void
+static void
newreno_ack_received(struct cc_var *ccv, uint16_t type)
{
if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
@@ -153,10 +147,37 @@ newreno_ack_received(struct cc_var *ccv, uint16_t type)
}
}
+static void
+newreno_after_idle(struct cc_var *ccv)
+{
+ int rw;
+
+ /*
+ * If we've been idle for more than one retransmit timeout the old
+ * congestion window is no longer current and we have to reduce it to
+ * the restart window before we can transmit again.
+ *
+ * The restart window is the initial window or the last CWND, whichever
+ * is smaller.
+ *
+ * This is done to prevent us from flooding the path with a full CWND at
+ * wirespeed, overloading router and switch buffers along the way.
+ *
+ * See RFC5681 Section 4.1. "Restarting Idle Connections".
+ */
+ if (V_tcp_do_rfc3390)
+ rw = min(4 * CCV(ccv, t_maxseg),
+ max(2 * CCV(ccv, t_maxseg), 4380));
+ else
+ rw = CCV(ccv, t_maxseg) * 2;
+
+ CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd));
+}
+
/*
- * manage congestion signals
+ * Perform any necessary tasks before we enter congestion recovery.
*/
-void
+static void
newreno_cong_signal(struct cc_var *ccv, uint32_t type)
{
u_int win;
@@ -183,11 +204,9 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
}
/*
- * decrease the cwnd in response to packet loss or a transmit timeout.
- * th can be null, in which case cwnd will be set according to reno instead
- * of new reno.
+ * Perform any necessary tasks before we exit congestion recovery.
*/
-void
+static void
newreno_post_recovery(struct cc_var *ccv)
{
if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
@@ -209,36 +228,5 @@ newreno_post_recovery(struct cc_var *ccv)
}
}
-/*
- * if a connection has been idle for a while and more data is ready to be sent,
- * reset cwnd
- */
-void
-newreno_after_idle(struct cc_var *ccv)
-{
- int rw;
-
- /*
- * If we've been idle for more than one retransmit timeout the old
- * congestion window is no longer current and we have to reduce it to
- * the restart window before we can transmit again.
- *
- * The restart window is the initial window or the last CWND, whichever
- * is smaller.
- *
- * This is done to prevent us from flooding the path with a full CWND at
- * wirespeed, overloading router and switch buffers along the way.
- *
- * See RFC5681 Section 4.1. "Restarting Idle Connections".
- */
- if (V_tcp_do_rfc3390)
- rw = min(4 * CCV(ccv, t_maxseg),
- max(2 * CCV(ccv, t_maxseg), 4380));
- else
- rw = CCV(ccv, t_maxseg) * 2;
-
- CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd));
-}
-
DECLARE_CC_MODULE(newreno, &newreno_cc_algo);
OpenPOWER on IntegriCloud