[DCCP]: Remove timeo from output.c
It simplifies waiting for the CCID module to signal that a packet is ready to be sent. Other simplifications flow on from this such as removing constants. As a result of this EAGAIN is not returned any more by dccp_wait_for_ccid (which would otherwise lead to unnecessarily discarding the packet in dccp_write_xmit). Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
committed by
David S. Miller
parent
e37b8d9319
commit
5cc3741d6c
@@ -80,8 +80,6 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo);
|
|||||||
|
|
||||||
#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */
|
#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */
|
||||||
|
|
||||||
#define DCCP_XMIT_TIMEO 30000 /* Time/msecs for blocking transmit per packet */
|
|
||||||
|
|
||||||
/* sysctl variables for DCCP */
|
/* sysctl variables for DCCP */
|
||||||
extern int sysctl_dccp_request_retries;
|
extern int sysctl_dccp_request_retries;
|
||||||
extern int sysctl_dccp_retries1;
|
extern int sysctl_dccp_retries1;
|
||||||
|
@@ -175,14 +175,12 @@ void dccp_write_space(struct sock *sk)
|
|||||||
/**
|
/**
|
||||||
* dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet
|
* dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet
|
||||||
* @sk: socket to wait for
|
* @sk: socket to wait for
|
||||||
* @timeo: for how long
|
|
||||||
*/
|
*/
|
||||||
static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
|
static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb)
|
||||||
long *timeo)
|
|
||||||
{
|
{
|
||||||
struct dccp_sock *dp = dccp_sk(sk);
|
struct dccp_sock *dp = dccp_sk(sk);
|
||||||
DEFINE_WAIT(wait);
|
DEFINE_WAIT(wait);
|
||||||
long delay;
|
unsigned long delay;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -190,8 +188,6 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
|
|||||||
|
|
||||||
if (sk->sk_err)
|
if (sk->sk_err)
|
||||||
goto do_error;
|
goto do_error;
|
||||||
if (!*timeo)
|
|
||||||
goto do_nonblock;
|
|
||||||
if (signal_pending(current))
|
if (signal_pending(current))
|
||||||
goto do_interrupted;
|
goto do_interrupted;
|
||||||
|
|
||||||
@@ -199,12 +195,9 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
|
|||||||
if (rc <= 0)
|
if (rc <= 0)
|
||||||
break;
|
break;
|
||||||
delay = msecs_to_jiffies(rc);
|
delay = msecs_to_jiffies(rc);
|
||||||
if (delay > *timeo || delay < 0)
|
|
||||||
goto do_nonblock;
|
|
||||||
|
|
||||||
sk->sk_write_pending++;
|
sk->sk_write_pending++;
|
||||||
release_sock(sk);
|
release_sock(sk);
|
||||||
*timeo -= schedule_timeout(delay);
|
schedule_timeout(delay);
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
sk->sk_write_pending--;
|
sk->sk_write_pending--;
|
||||||
}
|
}
|
||||||
@@ -215,11 +208,8 @@ out:
|
|||||||
do_error:
|
do_error:
|
||||||
rc = -EPIPE;
|
rc = -EPIPE;
|
||||||
goto out;
|
goto out;
|
||||||
do_nonblock:
|
|
||||||
rc = -EAGAIN;
|
|
||||||
goto out;
|
|
||||||
do_interrupted:
|
do_interrupted:
|
||||||
rc = sock_intr_errno(*timeo);
|
rc = -EINTR;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,8 +230,6 @@ void dccp_write_xmit(struct sock *sk, int block)
|
|||||||
{
|
{
|
||||||
struct dccp_sock *dp = dccp_sk(sk);
|
struct dccp_sock *dp = dccp_sk(sk);
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
long timeo = DCCP_XMIT_TIMEO; /* If a packet is taking longer than
|
|
||||||
this we have other issues */
|
|
||||||
|
|
||||||
while ((skb = skb_peek(&sk->sk_write_queue))) {
|
while ((skb = skb_peek(&sk->sk_write_queue))) {
|
||||||
int err = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
|
int err = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
|
||||||
@@ -251,10 +239,8 @@ void dccp_write_xmit(struct sock *sk, int block)
|
|||||||
sk_reset_timer(sk, &dp->dccps_xmit_timer,
|
sk_reset_timer(sk, &dp->dccps_xmit_timer,
|
||||||
msecs_to_jiffies(err)+jiffies);
|
msecs_to_jiffies(err)+jiffies);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else
|
||||||
err = dccp_wait_for_ccid(sk, skb, &timeo);
|
err = dccp_wait_for_ccid(sk, skb);
|
||||||
timeo = DCCP_XMIT_TIMEO;
|
|
||||||
}
|
|
||||||
if (err)
|
if (err)
|
||||||
DCCP_BUG("err=%d after dccp_wait_for_ccid", err);
|
DCCP_BUG("err=%d after dccp_wait_for_ccid", err);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user