ccid3.c (404c3bc30cb1361e1b3533643326ab472d24a618) ccid3.c (2c53040f018b6c36a46eec75b9b937aaa5f78e6d)
1/*
2 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
3 * Copyright (c) 2005-7 The University of Waikato, Hamilton, New Zealand.
4 * Copyright (c) 2005-7 Ian McDonald <ian.mcdonald@jandi.co.nz>
5 *
6 * An implementation of the DCCP protocol
7 *
8 * This code has been developed by the University of Waikato WAND

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

108 u32 delta = ktime_us_delta(now, hc->tx_t_last_win_count);
109
110 return delta / hc->tx_rtt;
111}
112
113/**
114 * ccid3_hc_tx_update_x - Update allowed sending rate X
115 * @stamp: most recent time if available - can be left NULL.
1/*
2 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
3 * Copyright (c) 2005-7 The University of Waikato, Hamilton, New Zealand.
4 * Copyright (c) 2005-7 Ian McDonald <ian.mcdonald@jandi.co.nz>
5 *
6 * An implementation of the DCCP protocol
7 *
8 * This code has been developed by the University of Waikato WAND

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

108 u32 delta = ktime_us_delta(now, hc->tx_t_last_win_count);
109
110 return delta / hc->tx_rtt;
111}
112
113/**
114 * ccid3_hc_tx_update_x - Update allowed sending rate X
115 * @stamp: most recent time if available - can be left NULL.
116 *
116 * This function tracks draft rfc3448bis, check there for latest details.
117 *
118 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support
119 * fine-grained resolution of sending rates. This requires scaling by 2^6
120 * throughout the code. Only X_calc is unscaled (in bytes/second).
121 *
122 */
123static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)

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

156 "X_recv=%u\n", (unsigned int)(old_x >> 6),
157 (unsigned int)(hc->tx_x >> 6), hc->tx_x_calc,
158 (unsigned int)(hc->tx_x_recv >> 6));
159
160 ccid3_update_send_interval(hc);
161 }
162}
163
117 * This function tracks draft rfc3448bis, check there for latest details.
118 *
119 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support
120 * fine-grained resolution of sending rates. This requires scaling by 2^6
121 * throughout the code. Only X_calc is unscaled (in bytes/second).
122 *
123 */
124static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)

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

157 "X_recv=%u\n", (unsigned int)(old_x >> 6),
158 (unsigned int)(hc->tx_x >> 6), hc->tx_x_calc,
159 (unsigned int)(hc->tx_x_recv >> 6));
160
161 ccid3_update_send_interval(hc);
162 }
163}
164
164/*
165 * Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1)
165/**
166 * ccid3_hc_tx_update_s - Track the mean packet size `s'
166 * @len: DCCP packet payload size in bytes
167 * @len: DCCP packet payload size in bytes
168 *
169 * cf. RFC 4342, 5.3 and RFC 3448, 4.1
167 */
168static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hc, int len)
169{
170 const u16 old_s = hc->tx_s;
171
172 hc->tx_s = tfrc_ewma(hc->tx_s, len, 9);
173
174 if (hc->tx_s != old_s)

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

265out:
266 bh_unlock_sock(sk);
267 sock_put(sk);
268}
269
270/**
271 * ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets
272 * @skb: next packet candidate to send on @sk
170 */
171static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hc, int len)
172{
173 const u16 old_s = hc->tx_s;
174
175 hc->tx_s = tfrc_ewma(hc->tx_s, len, 9);
176
177 if (hc->tx_s != old_s)

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

268out:
269 bh_unlock_sock(sk);
270 sock_put(sk);
271}
272
273/**
274 * ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets
275 * @skb: next packet candidate to send on @sk
276 *
273 * This function uses the convention of ccid_packet_dequeue_eval() and
274 * returns a millisecond-delay value between 0 and t_mbi = 64000 msec.
275 */
276static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
277{
278 struct dccp_sock *dp = dccp_sk(sk);
279 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
280 ktime_t now = ktime_get_real();

--- 585 unchanged lines hidden ---
277 * This function uses the convention of ccid_packet_dequeue_eval() and
278 * returns a millisecond-delay value between 0 and t_mbi = 64000 msec.
279 */
280static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
281{
282 struct dccp_sock *dp = dccp_sk(sk);
283 struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
284 ktime_t now = ktime_get_real();

--- 585 unchanged lines hidden ---