summaryrefslogtreecommitdiffstats
path: root/src/vnet/sctp/sctp.c
diff options
context:
space:
mode:
authorMarco Varlese <marco.varlese@suse.com>2018-03-13 15:44:56 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-03-13 23:01:52 +0000
commit3e9b4656a264066f572dc73f091b3583153b05e2 (patch)
treebaed5eb9d65409d295fec76f031794fcb18a27fc /src/vnet/sctp/sctp.c
parent8145842bf273823192140c57fc773bb92d9db64f (diff)
SCTP: data retransmission & snd_space fix
This patch addresses two things: 1) The data retransmission which needs to be taken care of when the SCTP_TIMER_T3_RXTX; 2) The correct calculation of the amount of data transmittable considered: the local window, the peer window and any data inflight. Change-Id: I2d03a6cb43e4e7770c4910f8547c66e1026aeace Signed-off-by: Marco Varlese <marco.varlese@suse.com>
Diffstat (limited to 'src/vnet/sctp/sctp.c')
-rw-r--r--src/vnet/sctp/sctp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c
index 76a1bf41eeb..6e2dccc552e 100644
--- a/src/vnet/sctp/sctp.c
+++ b/src/vnet/sctp/sctp.c
@@ -628,8 +628,17 @@ sctp_snd_space (sctp_connection_t * sctp_conn)
return 0;
u8 idx = sctp_data_subconn_select (sctp_conn);
+
+ u32 available_wnd =
+ clib_min (sctp_conn->peer_rwnd, sctp_conn->sub_conn[idx].cwnd);
+ int flight_size = (int) (sctp_conn->next_tsn - sctp_conn->last_unacked_tsn);
+
+ if (available_wnd <= flight_size)
+ return 0;
+
/* Finally, let's subtract the DATA chunk headers overhead */
- return sctp_conn->sub_conn[idx].cwnd -
+ return available_wnd -
+ flight_size -
sizeof (sctp_payload_data_chunk_t) - sizeof (sctp_full_hdr_t);
}
@@ -747,6 +756,7 @@ sctp_expired_timers_cb (u32 conn_index, u32 timer_id)
break;
case SCTP_TIMER_T3_RXTX:
sctp_timer_reset (sctp_conn, conn_index, timer_id);
+ sctp_conn->flags |= SCTP_CONN_RECOVERY;
sctp_data_retransmit (sctp_conn);
break;
case SCTP_TIMER_T4_HEARTBEAT: