dccp ccid-2: Remove wrappers around sk_{reset,stop}_timer()

This removes the wrappers around the sk timer functions as it makes the code
clearer and not much is gained from using wrappers: the BUG_ON in 
start_rto_timer will never trigger since that function was called only when
 * the RTO timer expired (rto_expire, and then timer_pending() is false);
 * in tx_packet_sent only if !timer_pending() (BUG_ON is redundant here);
 * previously in new_ack, after stopping the timer (timer_pending() false).

One further motive behind this patch is to replace the RTO timer with the
icsk retransmission timer, as it is already part of the DCCP socket.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
This commit is contained in:
Gerrit Renker 2008-09-04 07:30:19 +02:00
parent 1435562d7e
commit 20bbd0f75e
1 changed files with 4 additions and 24 deletions

View File

@ -110,8 +110,6 @@ static void ccid2_change_l_ack_ratio(struct sock *sk, u32 val)
dp->dccps_l_ack_ratio = val; dp->dccps_l_ack_ratio = val;
} }
static void ccid2_start_rto_timer(struct sock *sk);
static void ccid2_hc_tx_rto_expire(unsigned long data) static void ccid2_hc_tx_rto_expire(unsigned long data)
{ {
struct sock *sk = (struct sock *)data; struct sock *sk = (struct sock *)data;
@ -150,23 +148,13 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
/* if we were blocked before, we may now send cwnd=1 packet */ /* if we were blocked before, we may now send cwnd=1 packet */
if (sender_was_blocked) if (sender_was_blocked)
tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet); tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet);
ccid2_start_rto_timer(sk); /* restart backed-off timer */
sk_reset_timer(sk, &hctx->rtotimer, jiffies + hctx->rto);
out: out:
bh_unlock_sock(sk); bh_unlock_sock(sk);
sock_put(sk); sock_put(sk);
} }
static void ccid2_start_rto_timer(struct sock *sk)
{
struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
ccid2_pr_debug("setting RTO timeout=%ld\n", hctx->rto);
BUG_ON(timer_pending(&hctx->rtotimer));
sk_reset_timer(sk, &hctx->rtotimer,
jiffies + hctx->rto);
}
static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len) static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
{ {
struct dccp_sock *dp = dccp_sk(sk); struct dccp_sock *dp = dccp_sk(sk);
@ -245,7 +233,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
/* setup RTO timer */ /* setup RTO timer */
if (!timer_pending(&hctx->rtotimer)) if (!timer_pending(&hctx->rtotimer))
ccid2_start_rto_timer(sk); sk_reset_timer(sk, &hctx->rtotimer, jiffies + hctx->rto);
#ifdef CONFIG_IP_DCCP_CCID2_DEBUG #ifdef CONFIG_IP_DCCP_CCID2_DEBUG
do { do {
@ -262,14 +250,6 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
#endif #endif
} }
static void ccid2_hc_tx_kill_rto_timer(struct sock *sk)
{
struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
sk_stop_timer(sk, &hctx->rtotimer);
ccid2_pr_debug("deleted RTO timer\n");
}
/** /**
* ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm
* This code is almost identical with TCP's tcp_rtt_estimator(), since * This code is almost identical with TCP's tcp_rtt_estimator(), since
@ -645,7 +625,7 @@ static void ccid2_hc_tx_exit(struct sock *sk)
struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
int i; int i;
ccid2_hc_tx_kill_rto_timer(sk); sk_stop_timer(sk, &hctx->rtotimer);
for (i = 0; i < hctx->seqbufc; i++) for (i = 0; i < hctx->seqbufc; i++)
kfree(hctx->seqbuf[i]); kfree(hctx->seqbuf[i]);