dccp: Extend CCID packet dequeueing interface
This extends the packet dequeuing interface of dccp_write_xmit() to allow 1. CCIDs to take care of timing when the next packet may be sent; 2. delayed sending (as before, with an inter-packet gap up to 65.535 seconds). The main purpose is to take CCID-2 out of its polling mode (when it is network- limited, it tries every millisecond to send, without interruption). The mode of operation for (2) is as follows: * new packet is enqueued via dccp_sendmsg() => dccp_write_xmit(), * ccid_hc_tx_send_packet() detects that it may not send (e.g. window full), * it signals this condition via `CCID_PACKET_WILL_DEQUEUE_LATER', * dccp_write_xmit() returns without further action; * after some time the wait-condition for CCID becomes true, * that CCID schedules the tasklet, * tasklet function calls ccid_hc_tx_send_packet() via dccp_write_xmit(), * since the wait-condition is now true, ccid_hc_tx_packet() returns "send now", * packet is sent, and possibly more (since dccp_write_xmit() loops). Code reuse: the taskled function calls dccp_write_xmit(), the timer function reduces to a wrapper around the same code. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
fe84f4140f
commit
dc841e30ea
@@ -237,32 +237,35 @@ out:
|
||||
sock_put(sk);
|
||||
}
|
||||
|
||||
/* Transmit-delay timer: used by the CCIDs to delay actual send time */
|
||||
static void dccp_write_xmit_timer(unsigned long data)
|
||||
/**
|
||||
* dccp_write_xmitlet - Workhorse for CCID packet dequeueing interface
|
||||
* See the comments above %ccid_dequeueing_decision for supported modes.
|
||||
*/
|
||||
static void dccp_write_xmitlet(unsigned long data)
|
||||
{
|
||||
struct sock *sk = (struct sock *)data;
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
|
||||
bh_lock_sock(sk);
|
||||
if (sock_owned_by_user(sk))
|
||||
sk_reset_timer(sk, &dp->dccps_xmit_timer, jiffies+1);
|
||||
sk_reset_timer(sk, &dccp_sk(sk)->dccps_xmit_timer, jiffies + 1);
|
||||
else
|
||||
dccp_write_xmit(sk, 0);
|
||||
bh_unlock_sock(sk);
|
||||
sock_put(sk);
|
||||
}
|
||||
|
||||
static void dccp_init_write_xmit_timer(struct sock *sk)
|
||||
static void dccp_write_xmit_timer(unsigned long data)
|
||||
{
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
|
||||
setup_timer(&dp->dccps_xmit_timer, dccp_write_xmit_timer,
|
||||
(unsigned long)sk);
|
||||
dccp_write_xmitlet(data);
|
||||
sock_put((struct sock *)data);
|
||||
}
|
||||
|
||||
void dccp_init_xmit_timers(struct sock *sk)
|
||||
{
|
||||
dccp_init_write_xmit_timer(sk);
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
|
||||
tasklet_init(&dp->dccps_xmitlet, dccp_write_xmitlet, (unsigned long)sk);
|
||||
setup_timer(&dp->dccps_xmit_timer, dccp_write_xmit_timer,
|
||||
(unsigned long)sk);
|
||||
inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
|
||||
&dccp_keepalive_timer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user