Deleted Added
full compact
sctp_indata.c (172091) sctp_indata.c (172156)
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 172091 2007-09-08 17:48:46Z rrs $");
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_indata.c 172156 2007-09-13 10:36:43Z rrs $");
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

--- 3901 unchanged lines hidden (view full) ---

3944 if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
3945 sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA,
3946 tp1->whoTo->flight_size,
3947 tp1->book_size,
3948 (uintptr_t) tp1->whoTo,
3949 tp1->rec.data.TSN_seq);
3950 }
3951 sctp_flight_size_decrease(tp1);
35
36#include <netinet/sctp_os.h>
37#include <netinet/sctp_var.h>
38#include <netinet/sctp_sysctl.h>
39#include <netinet/sctp_pcb.h>
40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>

--- 3901 unchanged lines hidden (view full) ---

3944 if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
3945 sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_CA,
3946 tp1->whoTo->flight_size,
3947 tp1->book_size,
3948 (uintptr_t) tp1->whoTo,
3949 tp1->rec.data.TSN_seq);
3950 }
3951 sctp_flight_size_decrease(tp1);
3952 /* sa_ignore NO_NULL_CHK */
3952 sctp_total_flight_decrease(stcb, tp1);
3953 }
3954 tp1->whoTo->net_ack += tp1->send_size;
3955 if (tp1->snd_count < 2) {
3956 /*
3957 * True non-retransmited
3958 * chunk
3959 */
3960 tp1->whoTo->net_ack2 +=
3961 tp1->send_size;
3962
3963 /* update RTO too? */
3964 if (tp1->do_rtt) {
3965 tp1->whoTo->RTO =
3953 sctp_total_flight_decrease(stcb, tp1);
3954 }
3955 tp1->whoTo->net_ack += tp1->send_size;
3956 if (tp1->snd_count < 2) {
3957 /*
3958 * True non-retransmited
3959 * chunk
3960 */
3961 tp1->whoTo->net_ack2 +=
3962 tp1->send_size;
3963
3964 /* update RTO too? */
3965 if (tp1->do_rtt) {
3966 tp1->whoTo->RTO =
3967 /*
3968 * sa_ignore
3969 * NO_NULL_CHK
3970 */
3966 sctp_calculate_rto(stcb,
3967 asoc, tp1->whoTo,
3968 &tp1->sent_rcv_time,
3969 sctp_align_safe_nocopy);
3970 tp1->do_rtt = 0;
3971 }
3972 }
3973 /*

--- 8 unchanged lines hidden (view full) ---

3982 * trigger search for the next
3983 * expected (rtx-)pseudo-cumack.
3984 */
3985 tp1->whoTo->new_pseudo_cumack = 1;
3986 tp1->whoTo->find_pseudo_cumack = 1;
3987 tp1->whoTo->find_rtx_pseudo_cumack = 1;
3988
3989 if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
3971 sctp_calculate_rto(stcb,
3972 asoc, tp1->whoTo,
3973 &tp1->sent_rcv_time,
3974 sctp_align_safe_nocopy);
3975 tp1->do_rtt = 0;
3976 }
3977 }
3978 /*

--- 8 unchanged lines hidden (view full) ---

3987 * trigger search for the next
3988 * expected (rtx-)pseudo-cumack.
3989 */
3990 tp1->whoTo->new_pseudo_cumack = 1;
3991 tp1->whoTo->find_pseudo_cumack = 1;
3992 tp1->whoTo->find_rtx_pseudo_cumack = 1;
3993
3994 if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
3995 /* sa_ignore NO_NULL_CHK */
3990 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK);
3991 }
3992 }
3993 if (tp1->sent == SCTP_DATAGRAM_RESEND) {
3994 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
3995 }
3996 if (tp1->rec.data.chunk_was_revoked) {
3997 /* deflate the cwnd */
3998 tp1->whoTo->cwnd -= tp1->book_size;
3999 tp1->rec.data.chunk_was_revoked = 0;
4000 }
4001 tp1->sent = SCTP_DATAGRAM_ACKED;
4002 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
4003 if (tp1->data) {
3996 sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK);
3997 }
3998 }
3999 if (tp1->sent == SCTP_DATAGRAM_RESEND) {
4000 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
4001 }
4002 if (tp1->rec.data.chunk_was_revoked) {
4003 /* deflate the cwnd */
4004 tp1->whoTo->cwnd -= tp1->book_size;
4005 tp1->rec.data.chunk_was_revoked = 0;
4006 }
4007 tp1->sent = SCTP_DATAGRAM_ACKED;
4008 TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next);
4009 if (tp1->data) {
4010 /* sa_ignore NO_NULL_CHK */
4004 sctp_free_bufspace(stcb, asoc, tp1, 1);
4005 sctp_m_freem(tp1->data);
4006 }
4007 if (sctp_logging_level & SCTP_SACK_LOGGING_ENABLE) {
4008 sctp_log_sack(asoc->last_acked_seq,
4009 cumack,
4010 tp1->rec.data.TSN_seq,
4011 0,

--- 5 unchanged lines hidden (view full) ---

4017 sctp_free_a_chunk(stcb, tp1);
4018 tp1 = tp2;
4019 } else {
4020 break;
4021 }
4022 }
4023
4024 }
4011 sctp_free_bufspace(stcb, asoc, tp1, 1);
4012 sctp_m_freem(tp1->data);
4013 }
4014 if (sctp_logging_level & SCTP_SACK_LOGGING_ENABLE) {
4015 sctp_log_sack(asoc->last_acked_seq,
4016 cumack,
4017 tp1->rec.data.TSN_seq,
4018 0,

--- 5 unchanged lines hidden (view full) ---

4024 sctp_free_a_chunk(stcb, tp1);
4025 tp1 = tp2;
4026 } else {
4027 break;
4028 }
4029 }
4030
4031 }
4032 /* sa_ignore NO_NULL_CHK */
4025 if (stcb->sctp_socket) {
4026#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4027 struct socket *so;
4028
4029#endif
4030
4031 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd);
4032 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) {
4033 if (stcb->sctp_socket) {
4034#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4035 struct socket *so;
4036
4037#endif
4038
4039 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd);
4040 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) {
4041 /* sa_ignore NO_NULL_CHK */
4033 sctp_wakeup_log(stcb, cumack, 1, SCTP_WAKESND_FROM_SACK);
4034 }
4035#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4036 so = SCTP_INP_SO(stcb->sctp_ep);
4037 atomic_add_int(&stcb->asoc.refcnt, 1);
4038 SCTP_TCB_UNLOCK(stcb);
4039 SCTP_SOCKET_LOCK(so, 1);
4040 SCTP_TCB_LOCK(stcb);

--- 699 unchanged lines hidden (view full) ---

4740 panic("Warning flight size is postive and should be 0");
4741#else
4742 SCTP_PRINTF("Warning flight size incorrect should be 0 is %d\n",
4743 asoc->total_flight);
4744#endif
4745 asoc->total_flight = 0;
4746 }
4747 if (tp1->data) {
4042 sctp_wakeup_log(stcb, cumack, 1, SCTP_WAKESND_FROM_SACK);
4043 }
4044#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4045 so = SCTP_INP_SO(stcb->sctp_ep);
4046 atomic_add_int(&stcb->asoc.refcnt, 1);
4047 SCTP_TCB_UNLOCK(stcb);
4048 SCTP_SOCKET_LOCK(so, 1);
4049 SCTP_TCB_LOCK(stcb);

--- 699 unchanged lines hidden (view full) ---

4749 panic("Warning flight size is postive and should be 0");
4750#else
4751 SCTP_PRINTF("Warning flight size incorrect should be 0 is %d\n",
4752 asoc->total_flight);
4753#endif
4754 asoc->total_flight = 0;
4755 }
4756 if (tp1->data) {
4757 /* sa_ignore NO_NULL_CHK */
4748 sctp_free_bufspace(stcb, asoc, tp1, 1);
4749 sctp_m_freem(tp1->data);
4750 if (PR_SCTP_BUF_ENABLED(tp1->flags)) {
4751 asoc->sent_queue_cnt_removeable--;
4752 }
4753 }
4754 if (sctp_logging_level & SCTP_SACK_LOGGING_ENABLE) {
4755 sctp_log_sack(asoc->last_acked_seq,

--- 6 unchanged lines hidden (view full) ---

4762 tp1->data = NULL;
4763 asoc->sent_queue_cnt--;
4764 sctp_free_a_chunk(stcb, tp1);
4765 wake_him++;
4766 tp1 = tp2;
4767 } while (tp1 != NULL);
4768
4769done_with_it:
4758 sctp_free_bufspace(stcb, asoc, tp1, 1);
4759 sctp_m_freem(tp1->data);
4760 if (PR_SCTP_BUF_ENABLED(tp1->flags)) {
4761 asoc->sent_queue_cnt_removeable--;
4762 }
4763 }
4764 if (sctp_logging_level & SCTP_SACK_LOGGING_ENABLE) {
4765 sctp_log_sack(asoc->last_acked_seq,

--- 6 unchanged lines hidden (view full) ---

4772 tp1->data = NULL;
4773 asoc->sent_queue_cnt--;
4774 sctp_free_a_chunk(stcb, tp1);
4775 wake_him++;
4776 tp1 = tp2;
4777 } while (tp1 != NULL);
4778
4779done_with_it:
4780 /* sa_ignore NO_NULL_CHK */
4770 if ((wake_him) && (stcb->sctp_socket)) {
4771#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4772 struct socket *so;
4773
4774#endif
4775 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd);
4776 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) {
4777 sctp_wakeup_log(stcb, cum_ack, wake_him, SCTP_WAKESND_FROM_SACK);

--- 791 unchanged lines hidden (view full) ---

5569 strm = &asoc->strmin[stseq->stream];
5570 if (compare_with_wrap(stseq->sequence,
5571 strm->last_sequence_delivered, MAX_SEQ)) {
5572 /* Update the sequence number */
5573 strm->last_sequence_delivered =
5574 stseq->sequence;
5575 }
5576 /* now kick the stream the new way */
4781 if ((wake_him) && (stcb->sctp_socket)) {
4782#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
4783 struct socket *so;
4784
4785#endif
4786 SOCKBUF_LOCK(&stcb->sctp_socket->so_snd);
4787 if (sctp_logging_level & SCTP_WAKE_LOGGING_ENABLE) {
4788 sctp_wakeup_log(stcb, cum_ack, wake_him, SCTP_WAKESND_FROM_SACK);

--- 791 unchanged lines hidden (view full) ---

5580 strm = &asoc->strmin[stseq->stream];
5581 if (compare_with_wrap(stseq->sequence,
5582 strm->last_sequence_delivered, MAX_SEQ)) {
5583 /* Update the sequence number */
5584 strm->last_sequence_delivered =
5585 stseq->sequence;
5586 }
5587 /* now kick the stream the new way */
5588 /* sa_ignore NO_NULL_CHK */
5577 sctp_kick_prsctp_reorder_queue(stcb, strm);
5578 }
5579 }
5580 if (TAILQ_FIRST(&asoc->reasmqueue)) {
5581 /* now lets kick out and check for more fragmented delivery */
5589 sctp_kick_prsctp_reorder_queue(stcb, strm);
5590 }
5591 }
5592 if (TAILQ_FIRST(&asoc->reasmqueue)) {
5593 /* now lets kick out and check for more fragmented delivery */
5594 /* sa_ignore NO_NULL_CHK */
5582 sctp_deliver_reasm_check(stcb, &stcb->asoc);
5583 }
5584}
5595 sctp_deliver_reasm_check(stcb, &stcb->asoc);
5596 }
5597}