Commit eb279b79 authored by Gerrit Renker's avatar Gerrit Renker Committed by David S. Miller

[CCID3]: Ignore trivial amounts of elapsed time

This patch fixes a previously undiscovered bug; the problem is in computing
the elapsed time as the time between `receiving' the packet (i.e. skb enters
CCID module) and sending feedback:

     - there is no layer-processing, queueing, or delay involved,
     - hence the elapsed time is in the order of 1 function call
     - this is in the dimension of maximally 50..100usec
     - which renders the use of elapsed time almost entirely useless.

The fix is simply to ignore such trivial amounts of elapsed time.

As a further advantage, the now useless elapsed_time field can be removed from
the socket, which reduces the socket structure by another four bytes.
Signed-off-by: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: default avatarIan McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c08b2cf
...@@ -744,11 +744,6 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) ...@@ -744,11 +744,6 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk)
hcrx->ccid3hcrx_ccval_last_counter = packet->dccphrx_ccval; hcrx->ccid3hcrx_ccval_last_counter = packet->dccphrx_ccval;
hcrx->ccid3hcrx_bytes_recv = 0; hcrx->ccid3hcrx_bytes_recv = 0;
/* Elapsed time information [RFC 4340, 13.2] in units of 10 * usecs */
delta = ktime_us_delta(now, packet->dccphrx_tstamp);
DCCP_BUG_ON(delta < 0);
hcrx->ccid3hcrx_elapsed_time = delta / 10;
if (hcrx->ccid3hcrx_p == 0) if (hcrx->ccid3hcrx_p == 0)
hcrx->ccid3hcrx_pinv = ~0U; /* see RFC 4342, 8.5 */ hcrx->ccid3hcrx_pinv = ~0U; /* see RFC 4342, 8.5 */
else if (hcrx->ccid3hcrx_p > 1000000) { else if (hcrx->ccid3hcrx_p > 1000000) {
...@@ -778,10 +773,7 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) ...@@ -778,10 +773,7 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
x_recv = htonl(hcrx->ccid3hcrx_x_recv); x_recv = htonl(hcrx->ccid3hcrx_x_recv);
pinv = htonl(hcrx->ccid3hcrx_pinv); pinv = htonl(hcrx->ccid3hcrx_pinv);
if ((hcrx->ccid3hcrx_elapsed_time != 0 && if (dccp_insert_option_timestamp(sk, skb) ||
dccp_insert_option_elapsed_time(sk, skb,
hcrx->ccid3hcrx_elapsed_time)) ||
dccp_insert_option_timestamp(sk, skb) ||
dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE, dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE,
&pinv, sizeof(pinv)) || &pinv, sizeof(pinv)) ||
dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE, dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE,
......
...@@ -147,7 +147,6 @@ enum ccid3_hc_rx_states { ...@@ -147,7 +147,6 @@ enum ccid3_hc_rx_states {
* @ccid3hcrx_li_hist - Loss Interval History * @ccid3hcrx_li_hist - Loss Interval History
* @ccid3hcrx_s - Received packet size in bytes * @ccid3hcrx_s - Received packet size in bytes
* @ccid3hcrx_pinv - Inverse of Loss Event Rate (RFC 4342, sec. 8.5) * @ccid3hcrx_pinv - Inverse of Loss Event Rate (RFC 4342, sec. 8.5)
* @ccid3hcrx_elapsed_time - Time since packet reception
*/ */
struct ccid3_hc_rx_sock { struct ccid3_hc_rx_sock {
struct tfrc_rx_info ccid3hcrx_tfrc; struct tfrc_rx_info ccid3hcrx_tfrc;
...@@ -165,7 +164,6 @@ struct ccid3_hc_rx_sock { ...@@ -165,7 +164,6 @@ struct ccid3_hc_rx_sock {
struct list_head ccid3hcrx_li_hist; struct list_head ccid3hcrx_li_hist;
u16 ccid3hcrx_s; u16 ccid3hcrx_s;
u32 ccid3hcrx_pinv; u32 ccid3hcrx_pinv;
u32 ccid3hcrx_elapsed_time;
}; };
static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk) static inline struct ccid3_hc_rx_sock *ccid3_hc_rx_sk(const struct sock *sk)
......
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