RTO Logic - First Draft
In order for the RTO logic to work, we need a way to store the time when each packet was forwarded. Here the time would be stored in jiffies. We would also need to know the time at which we recieved the last ACK from the forward flow. Hence we would need to add two variables
1. time_send: indicates when the packet was forwarded. Will be stored in struct skbuff_list.
2. last_ack_rcv: indicates the time at which the last ACK was recieved by the helper box.
For last_ack_rcv I had to give a moment of thought. Would I need to introduce a spin_lock for it ? What happens when a function is using this variable and a new ACK comes in. If that happens, the ack_seq variable will also change value and hence the comparison will hold and so will the RTT measurement. However, think again and confirm the theory.
In addition to these variables, the srtt, mdev etc variable required for the RTO calculation will be added in struct tcp_state.
These variable will be initialized to the value specified by the RFC after sending the SYN for the forward flow. The reception of the corresponding SYN-ACK will be our first RTT measurement. Do what the RFC says for the first RTT. The function that will implement this functionality will be called before or after the call to dequeue the SYN from the forward queue.
Now we will start sending data packets. When we recieve a good ACK, the RTO calcualtion will be done during the dequeue logic in prepare_fwd_data(). However, inorder to accomodate delayed ACKs, we will have to compare the ack_seq to the seq number of the packet in the forward queue i.e.
if(ack_seq == seq)
call rto_calcualte()
reinitialize the rto_timer
This rto_timer will also be reinitialized when the SYN packet will be dequeued. The rto_timer will be of type struct timer_list. The members of concern for this timer will have the following values
1. expire time: jiffies + rto
2. function to be called: prepare_fwd_retrans_data
3. input parameter: sfi
When this rto_timer expires, it means we have not recieved an ACK for the packet having snd_una as seq. Hence we can just call prepare_fwd_retrans_data() which will send the first packet from the forward queue. At this time we will have to call the function that will do the rto backoff calculation. The rto backoff calculation function should be called if the helper box recieves more than 3 dup acks.
TO DO:
------
1. The entire logic of a host being in congestion avoidance has to be implemented. (Fast recovery and Fast retransmit)
1. time_send: indicates when the packet was forwarded. Will be stored in struct skbuff_list.
2. last_ack_rcv: indicates the time at which the last ACK was recieved by the helper box.
For last_ack_rcv I had to give a moment of thought. Would I need to introduce a spin_lock for it ? What happens when a function is using this variable and a new ACK comes in. If that happens, the ack_seq variable will also change value and hence the comparison will hold and so will the RTT measurement. However, think again and confirm the theory.
In addition to these variables, the srtt, mdev etc variable required for the RTO calculation will be added in struct tcp_state.
These variable will be initialized to the value specified by the RFC after sending the SYN for the forward flow. The reception of the corresponding SYN-ACK will be our first RTT measurement. Do what the RFC says for the first RTT. The function that will implement this functionality will be called before or after the call to dequeue the SYN from the forward queue.
Now we will start sending data packets. When we recieve a good ACK, the RTO calcualtion will be done during the dequeue logic in prepare_fwd_data(). However, inorder to accomodate delayed ACKs, we will have to compare the ack_seq to the seq number of the packet in the forward queue i.e.
if(ack_seq == seq)
call rto_calcualte()
reinitialize the rto_timer
This rto_timer will also be reinitialized when the SYN packet will be dequeued. The rto_timer will be of type struct timer_list. The members of concern for this timer will have the following values
1. expire time: jiffies + rto
2. function to be called: prepare_fwd_retrans_data
3. input parameter: sfi
When this rto_timer expires, it means we have not recieved an ACK for the packet having snd_una as seq. Hence we can just call prepare_fwd_retrans_data() which will send the first packet from the forward queue. At this time we will have to call the function that will do the rto backoff calculation. The rto backoff calculation function should be called if the helper box recieves more than 3 dup acks.
TO DO:
------
1. The entire logic of a host being in congestion avoidance has to be implemented. (Fast recovery and Fast retransmit)