From eecb0a8aa72ff92a9cc4881892c8fa117737ad7f Mon Sep 17 00:00:00 2001 From: rrs Date: Tue, 20 Mar 2007 10:23:11 +0000 Subject: - window update sacks sent incorrectly after shutdown which caused extra abort from peer. - RTT time calculation was not being done in express sack handling since it refered to an unused variable (rto_pending). Removed variable. - socket buffer high water access macro-ized. --- sys/netinet/sctp_output.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'sys/netinet/sctp_output.c') diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 4c20802..b23edb3 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -3953,7 +3953,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb) /* place in my tag */ initm->msg.init.initiate_tag = htonl(stcb->asoc.my_vtag); /* set up some of the credits. */ - initm->msg.init.a_rwnd = htonl(max(inp->sctp_socket->so_rcv.sb_hiwat, + initm->msg.init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket), SCTP_MINIMAL_RWND)); initm->msg.init.num_outbound_streams = htons(stcb->asoc.pre_open_streams); @@ -4862,7 +4862,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, stc.my_vtag = initackm_out->msg.init.initiate_tag; /* set up some of the credits. */ - initackm_out->msg.init.a_rwnd = htonl(max(inp->sctp_socket->so_rcv.sb_hiwat, SCTP_MINIMAL_RWND)); + initackm_out->msg.init.a_rwnd = htonl(max(SCTP_SB_LIMIT_RCV(inp->sctp_socket), SCTP_MINIMAL_RWND)); /* set what I want */ his_limit = ntohs(init_chk->init.num_inbound_streams); /* choose what I want */ @@ -7314,15 +7314,10 @@ again_one_more_time: *num_out += (ctl_cnt + bundle_at); } if (bundle_at) { - /* if (!net->rto_pending) { */ /* setup for a RTO measurement */ - /* net->rto_pending = 1; */ tsns_sent = data_list[0]->rec.data.TSN_seq; data_list[0]->do_rtt = 1; - /* } else { */ - /* data_list[0]->do_rtt = 0; */ - /* } */ SCTP_STAT_INCR_BY(sctps_senddata, bundle_at); sctp_clean_up_datalist(stcb, asoc, data_list, bundle_at, net); if (sctp_early_fr) { @@ -9625,7 +9620,7 @@ jump_out: chk->rec.chunk_id.can_take_data = 1; drp->ch.chunk_type = SCTP_PACKET_DROPPED; drp->ch.chunk_length = htons(chk->send_size); - spc = stcb->sctp_socket->so_rcv.sb_hiwat; + spc = SCTP_SB_LIMIT_RCV(stcb->sctp_socket); if (spc < 0) { spc = 0; } @@ -10416,7 +10411,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb, *error = 0; /* Unless E_EOR mode is on, we must make a send FIT in one call. */ if (((user_marks_eor == 0) && non_blocking) && - (uio->uio_resid > stcb->sctp_socket->so_snd.sb_hiwat)) { + (uio->uio_resid > SCTP_SB_LIMIT_SND(stcb->sctp_socket))) { /* It will NEVER fit */ *error = EMSGSIZE; goto out_now; @@ -10828,7 +10823,7 @@ sctp_lower_sosend(struct socket *so, asoc = &stcb->asoc; /* would we block? */ if (non_blocking) { - if ((so->so_snd.sb_hiwat < + if ((SCTP_SB_LIMIT_SND(so) < (sndlen + stcb->asoc.total_output_queue_size)) || (stcb->asoc.chunks_on_out_queue > sctp_max_chunks_on_queue)) { @@ -10997,8 +10992,8 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } /* Calculate the maximum we can send */ - if (so->so_snd.sb_hiwat > stcb->asoc.total_output_queue_size) { - max_len = so->so_snd.sb_hiwat - stcb->asoc.total_output_queue_size; + if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) { + max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; } else { max_len = 0; } @@ -11021,7 +11016,7 @@ sctp_lower_sosend(struct socket *so, if (max_len < sctp_add_more_threshold) { /* No room right no ! */ SOCKBUF_LOCK(&so->so_snd); - while (so->so_snd.sb_hiwat < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) { + while (SCTP_SB_LIMIT_SND(so) < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) { #ifdef SCTP_BLK_LOGGING sctp_log_block(SCTP_BLOCK_LOG_INTO_BLKA, so, asoc, uio->uio_resid); @@ -11049,8 +11044,8 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } } - if (so->so_snd.sb_hiwat > stcb->asoc.total_output_queue_size) { - max_len = so->so_snd.sb_hiwat - stcb->asoc.total_output_queue_size; + if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) { + max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; } else { max_len = 0; } @@ -11143,8 +11138,8 @@ sctp_lower_sosend(struct socket *so, /* How much room do we have? */ struct mbuf *new_tail, *mm; - if (so->so_snd.sb_hiwat > stcb->asoc.total_output_queue_size) - max_len = so->so_snd.sb_hiwat - stcb->asoc.total_output_queue_size; + if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) + max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; else max_len = 0; @@ -11213,8 +11208,8 @@ sctp_lower_sosend(struct socket *so, hold_tcblock = 1; } sctp_prune_prsctp(stcb, asoc, srcv, sndlen); - if (so->so_snd.sb_hiwat > stcb->asoc.total_output_queue_size) - max_len = so->so_snd.sb_hiwat - stcb->asoc.total_output_queue_size; + if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size) + max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size; else max_len = 0; if (max_len > 0) { @@ -11338,7 +11333,7 @@ sctp_lower_sosend(struct socket *so, * will get to sleep safely with the wakeup flag in * place. */ - if (so->so_snd.sb_hiwat < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) { + if (SCTP_SB_LIMIT_SND(so) < (stcb->asoc.total_output_queue_size + sctp_add_more_threshold)) { #ifdef SCTP_BLK_LOGGING sctp_log_block(SCTP_BLOCK_LOG_INTO_BLK, so, asoc, uio->uio_resid); -- cgit v1.1