Commit 1faf0a1f authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[DCCP]: Convert ccid3hcrx_tstamp_last_ack to ktime_t

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 23f062af
...@@ -876,7 +876,6 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -876,7 +876,6 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
const struct dccp_options_received *opt_recv; const struct dccp_options_received *opt_recv;
struct dccp_rx_hist_entry *packet; struct dccp_rx_hist_entry *packet;
struct timeval now;
u32 p_prev, r_sample, rtt_prev; u32 p_prev, r_sample, rtt_prev;
int loss, payload_size; int loss, payload_size;
...@@ -888,7 +887,9 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -888,7 +887,9 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
case DCCP_PKT_ACK: case DCCP_PKT_ACK:
if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA) if (hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)
return; return;
case DCCP_PKT_DATAACK: case DCCP_PKT_DATAACK: {
struct timeval now;
if (opt_recv->dccpor_timestamp_echo == 0) if (opt_recv->dccpor_timestamp_echo == 0)
break; break;
rtt_prev = hcrx->ccid3hcrx_rtt; rtt_prev = hcrx->ccid3hcrx_rtt;
...@@ -906,6 +907,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -906,6 +907,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
dccp_role(sk), sk, hcrx->ccid3hcrx_rtt, dccp_role(sk), sk, hcrx->ccid3hcrx_rtt,
opt_recv->dccpor_elapsed_time); opt_recv->dccpor_elapsed_time);
break; break;
}
case DCCP_PKT_DATA: case DCCP_PKT_DATA:
break; break;
default: /* We're not interested in other packet types, move along */ default: /* We're not interested in other packet types, move along */
...@@ -936,18 +938,21 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -936,18 +938,21 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
ccid3_hc_rx_send_feedback(sk); ccid3_hc_rx_send_feedback(sk);
ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA); ccid3_hc_rx_set_state(sk, TFRC_RSTATE_DATA);
return; return;
case TFRC_RSTATE_DATA: case TFRC_RSTATE_DATA: {
ktime_t now;
hcrx->ccid3hcrx_bytes_recv += payload_size; hcrx->ccid3hcrx_bytes_recv += payload_size;
if (loss) if (loss)
break; break;
dccp_timestamp(sk, &now); now = ktime_get_real();
if ((timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) - if ((ktime_us_delta(now, hcrx->ccid3hcrx_tstamp_last_ack) -
(suseconds_t)hcrx->ccid3hcrx_rtt) >= 0) { (s64)hcrx->ccid3hcrx_rtt) >= 0) {
hcrx->ccid3hcrx_tstamp_last_ack = now; hcrx->ccid3hcrx_tstamp_last_ack = now;
ccid3_hc_rx_send_feedback(sk); ccid3_hc_rx_send_feedback(sk);
} }
return; return;
}
case TFRC_RSTATE_TERM: case TFRC_RSTATE_TERM:
DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk); DCCP_BUG("%s(%p) - Illegal state TERM", dccp_role(sk), sk);
return; return;
...@@ -984,8 +989,9 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk) ...@@ -984,8 +989,9 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk)
hcrx->ccid3hcrx_state = TFRC_RSTATE_NO_DATA; hcrx->ccid3hcrx_state = TFRC_RSTATE_NO_DATA;
INIT_LIST_HEAD(&hcrx->ccid3hcrx_hist); INIT_LIST_HEAD(&hcrx->ccid3hcrx_hist);
INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist); INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist);
dccp_timestamp(sk, &hcrx->ccid3hcrx_tstamp_last_ack); hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real();
hcrx->ccid3hcrx_tstamp_last_feedback = hcrx->ccid3hcrx_tstamp_last_ack; hcrx->ccid3hcrx_tstamp_last_feedback =
ktime_to_timeval(hcrx->ccid3hcrx_tstamp_last_ack);
hcrx->ccid3hcrx_s = 0; hcrx->ccid3hcrx_s = 0;
hcrx->ccid3hcrx_rtt = 0; hcrx->ccid3hcrx_rtt = 0;
return 0; return 0;
......
...@@ -153,7 +153,7 @@ struct ccid3_hc_rx_sock { ...@@ -153,7 +153,7 @@ struct ccid3_hc_rx_sock {
enum ccid3_hc_rx_states ccid3hcrx_state:8; enum ccid3_hc_rx_states ccid3hcrx_state:8;
u32 ccid3hcrx_bytes_recv; u32 ccid3hcrx_bytes_recv;
struct timeval ccid3hcrx_tstamp_last_feedback; struct timeval ccid3hcrx_tstamp_last_feedback;
struct timeval ccid3hcrx_tstamp_last_ack; ktime_t ccid3hcrx_tstamp_last_ack;
struct list_head ccid3hcrx_hist; struct list_head ccid3hcrx_hist;
struct list_head ccid3hcrx_li_hist; struct list_head ccid3hcrx_li_hist;
u16 ccid3hcrx_s; u16 ccid3hcrx_s;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment