aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2007-08-19 20:17:51 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:14 -0400
commite7c2335794b949292ecfd01902c429e2ac3937e1 (patch)
tree1e10116e6635e1b4c1da7890817fd89d6eab285d /net
parentb8bda9d70842dab7902f0681e1297dcf0460fc94 (diff)
[DCCP] packet_history: convert dccphrx_tstamp to ktime_t
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dccp/ccids/ccid3.c11
-rw-r--r--net/dccp/ccids/lib/loss_interval.c11
-rw-r--r--net/dccp/ccids/lib/loss_interval.h4
-rw-r--r--net/dccp/ccids/lib/packet_history.h6
4 files changed, 14 insertions, 18 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 6b12e9faef30..b21d8110298c 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -727,7 +727,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
727 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); 727 struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
728 struct dccp_sock *dp = dccp_sk(sk); 728 struct dccp_sock *dp = dccp_sk(sk);
729 struct dccp_rx_hist_entry *packet; 729 struct dccp_rx_hist_entry *packet;
730 ktime_t now, t_hist; 730 ktime_t now;
731 suseconds_t delta; 731 suseconds_t delta;
732 732
733 ccid3_pr_debug("%s(%p) - entry \n", dccp_role(sk), sk); 733 ccid3_pr_debug("%s(%p) - entry \n", dccp_role(sk), sk);
@@ -762,8 +762,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
762 hcrx->ccid3hcrx_bytes_recv = 0; 762 hcrx->ccid3hcrx_bytes_recv = 0;
763 763
764 /* Elapsed time information [RFC 4340, 13.2] in units of 10 * usecs */ 764 /* Elapsed time information [RFC 4340, 13.2] in units of 10 * usecs */
765 t_hist = timeval_to_ktime(packet->dccphrx_tstamp); 765 delta = ktime_us_delta(now, packet->dccphrx_tstamp);
766 delta = ktime_us_delta(now, t_hist);
767 DCCP_BUG_ON(delta < 0); 766 DCCP_BUG_ON(delta < 0);
768 hcrx->ccid3hcrx_elapsed_time = delta / 10; 767 hcrx->ccid3hcrx_elapsed_time = delta / 10;
769 768
@@ -834,13 +833,11 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
834 833
835 while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno) 834 while (dccp_delta_seqno(hcrx->ccid3hcrx_seqno_nonloss, seqno)
836 > TFRC_RECV_NUM_LATE_LOSS) { 835 > TFRC_RECV_NUM_LATE_LOSS) {
837 struct timeval tstamp =
838 ktime_to_timeval(hcrx->ccid3hcrx_tstamp_last_feedback);
839 loss = 1; 836 loss = 1;
840 dccp_li_update_li(sk, 837 dccp_li_update_li(sk,
841 &hcrx->ccid3hcrx_li_hist, 838 &hcrx->ccid3hcrx_li_hist,
842 &hcrx->ccid3hcrx_hist, 839 &hcrx->ccid3hcrx_hist,
843 &tstamp, 840 hcrx->ccid3hcrx_tstamp_last_feedback,
844 hcrx->ccid3hcrx_s, 841 hcrx->ccid3hcrx_s,
845 hcrx->ccid3hcrx_bytes_recv, 842 hcrx->ccid3hcrx_bytes_recv,
846 hcrx->ccid3hcrx_x_recv, 843 hcrx->ccid3hcrx_x_recv,
@@ -913,7 +910,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
913 return; 910 return;
914 } 911 }
915 912
916 packet = dccp_rx_hist_entry_new(ccid3_rx_hist, sk, opt_recv->dccpor_ndp, 913 packet = dccp_rx_hist_entry_new(ccid3_rx_hist, opt_recv->dccpor_ndp,
917 skb, GFP_ATOMIC); 914 skb, GFP_ATOMIC);
918 if (unlikely(packet == NULL)) { 915 if (unlikely(packet == NULL)) {
919 DCCP_WARN("%s(%p), Not enough mem to add rx packet " 916 DCCP_WARN("%s(%p), Not enough mem to add rx packet "
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 174d3f13d93f..40ad428a27f5 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -125,14 +125,14 @@ static int dccp_li_hist_interval_new(struct list_head *list,
125 * returns estimated loss interval in usecs */ 125 * returns estimated loss interval in usecs */
126static u32 dccp_li_calc_first_li(struct sock *sk, 126static u32 dccp_li_calc_first_li(struct sock *sk,
127 struct list_head *hist_list, 127 struct list_head *hist_list,
128 struct timeval *last_feedback, 128 ktime_t last_feedback,
129 u16 s, u32 bytes_recv, 129 u16 s, u32 bytes_recv,
130 u32 previous_x_recv) 130 u32 previous_x_recv)
131{ 131{
132 struct dccp_rx_hist_entry *entry, *next, *tail = NULL; 132 struct dccp_rx_hist_entry *entry, *next, *tail = NULL;
133 u32 x_recv, p; 133 u32 x_recv, p;
134 suseconds_t rtt, delta; 134 suseconds_t rtt, delta;
135 struct timeval tstamp = { 0, 0 }; 135 ktime_t tstamp = ktime_set(0, 0);
136 int interval = 0; 136 int interval = 0;
137 int win_count = 0; 137 int win_count = 0;
138 int step = 0; 138 int step = 0;
@@ -176,7 +176,7 @@ found:
176 return ~0; 176 return ~0;
177 } 177 }
178 178
179 delta = timeval_delta(&tstamp, &tail->dccphrx_tstamp); 179 delta = ktime_us_delta(tstamp, tail->dccphrx_tstamp);
180 DCCP_BUG_ON(delta < 0); 180 DCCP_BUG_ON(delta < 0);
181 181
182 rtt = delta * 4 / interval; 182 rtt = delta * 4 / interval;
@@ -196,8 +196,7 @@ found:
196 return ~0; 196 return ~0;
197 } 197 }
198 198
199 dccp_timestamp(sk, &tstamp); 199 delta = ktime_us_delta(ktime_get_real(), last_feedback);
200 delta = timeval_delta(&tstamp, last_feedback);
201 DCCP_BUG_ON(delta <= 0); 200 DCCP_BUG_ON(delta <= 0);
202 201
203 x_recv = scaled_div32(bytes_recv, delta); 202 x_recv = scaled_div32(bytes_recv, delta);
@@ -226,7 +225,7 @@ found:
226void dccp_li_update_li(struct sock *sk, 225void dccp_li_update_li(struct sock *sk,
227 struct list_head *li_hist_list, 226 struct list_head *li_hist_list,
228 struct list_head *hist_list, 227 struct list_head *hist_list,
229 struct timeval *last_feedback, u16 s, u32 bytes_recv, 228 ktime_t last_feedback, u16 s, u32 bytes_recv,
230 u32 previous_x_recv, u64 seq_loss, u8 win_loss) 229 u32 previous_x_recv, u64 seq_loss, u8 win_loss)
231{ 230{
232 struct dccp_li_hist_entry *head; 231 struct dccp_li_hist_entry *head;
diff --git a/net/dccp/ccids/lib/loss_interval.h b/net/dccp/ccids/lib/loss_interval.h
index 906c806d6d9d..27bee92dae13 100644
--- a/net/dccp/ccids/lib/loss_interval.h
+++ b/net/dccp/ccids/lib/loss_interval.h
@@ -13,8 +13,8 @@
13 * any later version. 13 * any later version.
14 */ 14 */
15 15
16#include <linux/ktime.h>
16#include <linux/list.h> 17#include <linux/list.h>
17#include <linux/time.h>
18 18
19extern void dccp_li_hist_purge(struct list_head *list); 19extern void dccp_li_hist_purge(struct list_head *list);
20 20
@@ -23,7 +23,7 @@ extern u32 dccp_li_hist_calc_i_mean(struct list_head *list);
23extern void dccp_li_update_li(struct sock *sk, 23extern void dccp_li_update_li(struct sock *sk,
24 struct list_head *li_hist_list, 24 struct list_head *li_hist_list,
25 struct list_head *hist_list, 25 struct list_head *hist_list,
26 struct timeval *last_feedback, u16 s, 26 ktime_t last_feedback, u16 s,
27 u32 bytes_recv, u32 previous_x_recv, 27 u32 bytes_recv, u32 previous_x_recv,
28 u64 seq_loss, u8 win_loss); 28 u64 seq_loss, u8 win_loss);
29#endif /* _DCCP_LI_HIST_ */ 29#endif /* _DCCP_LI_HIST_ */
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h
index 60d00f015390..d9d68964d952 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -37,6 +37,7 @@
37#ifndef _DCCP_PKT_HIST_ 37#ifndef _DCCP_PKT_HIST_
38#define _DCCP_PKT_HIST_ 38#define _DCCP_PKT_HIST_
39 39
40#include <linux/ktime.h>
40#include <linux/list.h> 41#include <linux/list.h>
41#include <linux/slab.h> 42#include <linux/slab.h>
42#include <linux/time.h> 43#include <linux/time.h>
@@ -124,7 +125,7 @@ struct dccp_rx_hist_entry {
124 dccphrx_ccval:4, 125 dccphrx_ccval:4,
125 dccphrx_type:4; 126 dccphrx_type:4;
126 u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */ 127 u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */
127 struct timeval dccphrx_tstamp; 128 ktime_t dccphrx_tstamp;
128}; 129};
129 130
130struct dccp_rx_hist { 131struct dccp_rx_hist {
@@ -136,7 +137,6 @@ extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist);
136 137
137static inline struct dccp_rx_hist_entry * 138static inline struct dccp_rx_hist_entry *
138 dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, 139 dccp_rx_hist_entry_new(struct dccp_rx_hist *hist,
139 const struct sock *sk,
140 const u32 ndp, 140 const u32 ndp,
141 const struct sk_buff *skb, 141 const struct sk_buff *skb,
142 const gfp_t prio) 142 const gfp_t prio)
@@ -151,7 +151,7 @@ static inline struct dccp_rx_hist_entry *
151 entry->dccphrx_ccval = dh->dccph_ccval; 151 entry->dccphrx_ccval = dh->dccph_ccval;
152 entry->dccphrx_type = dh->dccph_type; 152 entry->dccphrx_type = dh->dccph_type;
153 entry->dccphrx_ndp = ndp; 153 entry->dccphrx_ndp = ndp;
154 dccp_timestamp(sk, &entry->dccphrx_tstamp); 154 entry->dccphrx_tstamp = ktime_get_real();
155 } 155 }
156 156
157 return entry; 157 return entry;