summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_cc_functions.c
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2010-08-28 17:59:51 +0000
committertuexen <tuexen@FreeBSD.org>2010-08-28 17:59:51 +0000
commit8d90bd696f6ffe32185cc58c210e1cb2b6b40466 (patch)
tree3c18fb8c6c88a9d89b4532f1a0b0ed84a8db9c07 /sys/netinet/sctp_cc_functions.c
parent9d21e17f07e784c9d5c0c2ed6a0a0c75431f76eb (diff)
downloadFreeBSD-src-8d90bd696f6ffe32185cc58c210e1cb2b6b40466.zip
FreeBSD-src-8d90bd696f6ffe32185cc58c210e1cb2b6b40466.tar.gz
Fix the switching on/off of CMT using sysctl and socket option.
Fix the switching on/off of PF and NR-SACKs using sysctl. Add minor improvement in handling malloc failures. Improve the address checks when sending. MFC after: 4 weeks
Diffstat (limited to 'sys/netinet/sctp_cc_functions.c')
-rw-r--r--sys/netinet/sctp_cc_functions.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index 8beff19..1cba25a 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -71,7 +71,8 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
* (net->fast_retran_loss_recovery == 0)))
*/
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
- if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) {
+ if ((asoc->fast_retran_loss_recovery == 0) ||
+ (asoc->sctp_cmt_on_off == 1)) {
/* out of a RFC2582 Fast recovery window? */
if (net->net_ack > 0) {
/*
@@ -232,11 +233,11 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*
* Should we stop any running T3 timer here?
*/
- if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
- SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
+ if ((asoc->sctp_cmt_on_off == 1) &&
+ (asoc->sctp_cmt_pf > 0) &&
((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) {
net->dest_state &= ~SCTP_ADDR_PF;
- net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf);
+ net->cwnd = net->mtu * asoc->sctp_cmt_pf;
SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n",
net, net->cwnd);
/*
@@ -260,7 +261,9 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
#endif
- if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) {
+ if (asoc->fast_retran_loss_recovery &&
+ (will_exit == 0) &&
+ (asoc->sctp_cmt_on_off == 0)) {
/*
* If we are in loss recovery we skip any cwnd
* update
@@ -271,7 +274,8 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb,
* CMT: CUC algorithm. Update cwnd if pseudo-cumack has
* moved.
*/
- if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) {
+ if (accum_moved ||
+ ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) {
/* If the cumulative ack moved we can proceed */
if (net->cwnd <= net->ssthresh) {
/* We are in slow start */
@@ -697,7 +701,8 @@ sctp_hs_cwnd_update_after_fr(struct sctp_tcb *stcb,
* (net->fast_retran_loss_recovery == 0)))
*/
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
- if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) {
+ if ((asoc->fast_retran_loss_recovery == 0) ||
+ (asoc->sctp_cmt_on_off == 1)) {
/* out of a RFC2582 Fast recovery window? */
if (net->net_ack > 0) {
/*
@@ -850,11 +855,11 @@ sctp_hs_cwnd_update_after_sack(struct sctp_tcb *stcb,
*
* Should we stop any running T3 timer here?
*/
- if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
- SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
+ if ((asoc->sctp_cmt_on_off == 1) &&
+ (asoc->sctp_cmt_pf > 0) &&
((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) {
net->dest_state &= ~SCTP_ADDR_PF;
- net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf);
+ net->cwnd = net->mtu * asoc->sctp_cmt_pf;
SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n",
net, net->cwnd);
/*
@@ -878,7 +883,9 @@ sctp_hs_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
#endif
- if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) {
+ if (asoc->fast_retran_loss_recovery &&
+ (will_exit == 0) &&
+ (asoc->sctp_cmt_on_off == 0)) {
/*
* If we are in loss recovery we skip any cwnd
* update
@@ -889,7 +896,8 @@ sctp_hs_cwnd_update_after_sack(struct sctp_tcb *stcb,
* CMT: CUC algorithm. Update cwnd if pseudo-cumack has
* moved.
*/
- if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) {
+ if (accum_moved ||
+ ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) {
/* If the cumulative ack moved we can proceed */
if (net->cwnd <= net->ssthresh) {
/* We are in slow start */
@@ -1333,11 +1341,11 @@ sctp_htcp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*
* Should we stop any running T3 timer here?
*/
- if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) &&
- SCTP_BASE_SYSCTL(sctp_cmt_pf) &&
+ if ((asoc->sctp_cmt_on_off == 1) &&
+ (asoc->sctp_cmt_pf > 0) &&
((net->dest_state & SCTP_ADDR_PF) == SCTP_ADDR_PF)) {
net->dest_state &= ~SCTP_ADDR_PF;
- net->cwnd = net->mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf);
+ net->cwnd = net->mtu * asoc->sctp_cmt_pf;
SCTPDBG(SCTP_DEBUG_INDATA1, "Destination %p moved from PF to reachable with cwnd %d.\n",
net, net->cwnd);
/*
@@ -1361,7 +1369,9 @@ sctp_htcp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
#endif
- if (asoc->fast_retran_loss_recovery && will_exit == 0 && SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) {
+ if (asoc->fast_retran_loss_recovery &&
+ will_exit == 0 &&
+ (asoc->sctp_cmt_on_off == 0)) {
/*
* If we are in loss recovery we skip any cwnd
* update
@@ -1372,7 +1382,8 @@ sctp_htcp_cwnd_update_after_sack(struct sctp_tcb *stcb,
* CMT: CUC algorithm. Update cwnd if pseudo-cumack has
* moved.
*/
- if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) && net->new_pseudo_cumack)) {
+ if (accum_moved ||
+ ((asoc->sctp_cmt_on_off == 1) && net->new_pseudo_cumack)) {
htcp_cong_avoid(stcb, net);
measure_achieved_throughput(stcb, net);
} else {
@@ -1412,7 +1423,8 @@ sctp_htcp_cwnd_update_after_fr(struct sctp_tcb *stcb,
* (net->fast_retran_loss_recovery == 0)))
*/
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
- if ((asoc->fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) {
+ if ((asoc->fast_retran_loss_recovery == 0) ||
+ (asoc->sctp_cmt_on_off == 1)) {
/* out of a RFC2582 Fast recovery window? */
if (net->net_ack > 0) {
/*
OpenPOWER on IntegriCloud